当前位置: 首页>>代码示例>>Java>>正文


Java NoSuchMessageException类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.database.NoSuchMessageException的典型用法代码示例。如果您正苦于以下问题:Java NoSuchMessageException类的具体用法?Java NoSuchMessageException怎么用?Java NoSuchMessageException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NoSuchMessageException类属于org.thoughtcrime.securesms.database包,在下文中一共展示了NoSuchMessageException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleSentResult

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
  try {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

    switch (result) {
      case Activity.RESULT_OK:
        database.markAsSent(messageId, false);
        break;
      case SmsManager.RESULT_ERROR_NO_SERVICE:
      case SmsManager.RESULT_ERROR_RADIO_OFF:
        Log.w(TAG, "Service connectivity problem, requeuing...");
        ApplicationContext.getInstance(context)
            .getJobManager()
            .add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));
        break;
      default:
        database.markAsSentFailed(messageId);
        MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
    }
  } catch (NoSuchMessageException e) {
    Log.w(TAG, e);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:25,代码来源:SmsSentJob.java

示例2: onRun

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onRun() throws NoSuchMessageException {

  if (!IdentityKeyUtil.hasIdentityKey(context)) {
    Log.w(TAG, "Skipping job, waiting for migration...");
    MessageNotifier.updateNotification(context, null, true, -2);
    return;
  }

  MasterSecret          masterSecret         = KeyCachingService.getMasterSecret(context);
  PushDatabase          database             = DatabaseFactory.getPushDatabase(context);
  SignalServiceEnvelope envelope             = database.get(messageId);
  Optional<Long>        optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) :
                                                               Optional.<Long>absent();

  MasterSecretUnion masterSecretUnion;

  if (masterSecret == null) masterSecretUnion = new MasterSecretUnion(MasterSecretUtil.getAsymmetricMasterSecret(context, null));
  else                      masterSecretUnion = new MasterSecretUnion(masterSecret);

  handleMessage(masterSecretUnion, envelope, optionalSmsMessageId);
  database.delete(messageId);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:PushDecryptJob.java

示例3: onRun

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onRun() throws NoSuchMessageException {

  if (!IdentityKeyUtil.hasIdentityKey(context)) {
    Log.w(TAG, "Skipping job, waiting for migration...");
    return;
  }

  MasterSecret          masterSecret         = KeyCachingService.getMasterSecret(context);
  PushDatabase          database             = DatabaseFactory.getPushDatabase(context);
  SignalServiceEnvelope envelope             = database.get(messageId);
  Optional<Long>        optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) :
                                                               Optional.<Long>absent();

  MasterSecretUnion masterSecretUnion;

  if (masterSecret == null) masterSecretUnion = new MasterSecretUnion(MasterSecretUtil.getAsymmetricMasterSecret(context, null));
  else                      masterSecretUnion = new MasterSecretUnion(masterSecret);

  handleMessage(masterSecretUnion, envelope, optionalSmsMessageId);
  database.delete(messageId);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:23,代码来源:PushDecryptJob.java

示例4: onRun

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret) throws NoSuchMessageException {
  EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
  SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

  try {
    Log.w(TAG, "Sending message: " + messageId);

    deliver(masterSecret, record);
  } catch (UndeliverableMessageException ude) {
    Log.w(TAG, ude);
    DatabaseFactory.getSmsDatabase(context).markAsSentFailed(record.getId());
    MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
  } catch (InsecureFallbackApprovalException ifae) {
    Log.w(TAG, ifae);
    DatabaseFactory.getSmsDatabase(context).markAsPendingInsecureSmsFallback(record.getId());
    MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:20,代码来源:SmsSendJob.java

示例5: onPushSend

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onPushSend(MasterSecret masterSecret)
    throws RetryLaterException, MmsException, NoSuchMessageException,
           UndeliverableMessageException
{
  ExpiringMessageManager expirationManager = ApplicationContext.getInstance(context).getExpiringMessageManager();
  MmsDatabase            database          = DatabaseFactory.getMmsDatabase(context);
  OutgoingMediaMessage   message           = database.getOutgoingMessage(masterSecret, messageId);

  try {
    deliver(masterSecret, message);
    database.markAsSent(messageId, true);
    markAttachmentsUploaded(messageId, message.getAttachments());

    if (message.getExpiresIn() > 0 && !message.isExpirationUpdate()) {
      database.markExpireStarted(messageId);
      expirationManager.scheduleDeletion(messageId, true, message.getExpiresIn());
    }

  } catch (InsecureFallbackApprovalException ifae) {
    Log.w(TAG, ifae);
    database.markAsPendingInsecureSmsFallback(messageId);
    notifyMediaMessageDeliveryFailed(context, messageId);
    ApplicationContext.getInstance(context).getJobManager().add(new DirectoryRefreshJob(context));
  } catch (UntrustedIdentityException uie) {
    Log.w(TAG, uie);
    Recipients recipients  = RecipientFactory.getRecipientsFromString(context, uie.getE164Number(), false);
    long       recipientId = recipients.getPrimaryRecipient().getRecipientId();

    database.addMismatchedIdentity(messageId, recipientId, uie.getIdentityKey());
    database.markAsSentFailed(messageId);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:34,代码来源:PushMediaSendJob.java

示例6: onSend

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onSend(MasterSecret masterSecret) throws NoSuchMessageException {
  EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
  SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

  try {
    Log.w(TAG, "Sending message: " + messageId);

    deliver(record);
  } catch (UndeliverableMessageException ude) {
    Log.w(TAG, ude);
    DatabaseFactory.getSmsDatabase(context).markAsSentFailed(record.getId());
    MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:SmsSendJob.java

示例7: onRun

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret) throws NoSuchMessageException {
  PushDatabase       database = DatabaseFactory.getPushDatabase(context);
  TextSecureEnvelope envelope = database.get(messageId);

  handleMessage(masterSecret, envelope);
  database.delete(messageId);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:9,代码来源:PushDecryptJob.java

示例8: handleSentResult

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
  try {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

    switch (result) {
      case Activity.RESULT_OK:
        database.markAsSent(messageId);

        if (record != null && record.isEndSession()) {
          Log.w(TAG, "Ending session...");
          SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret);
          sessionStore.deleteAllSessions(record.getIndividualRecipient().getRecipientId());
          SecurityEvent.broadcastSecurityUpdateEvent(context, record.getThreadId());
        }

        break;
      case SmsManager.RESULT_ERROR_NO_SERVICE:
      case SmsManager.RESULT_ERROR_RADIO_OFF:
        Log.w(TAG, "Service connectivity problem, requeuing...");
        ApplicationContext.getInstance(context)
            .getJobManager()
            .add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));

        break;
      default:
        database.markAsSentFailed(messageId);
        MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
    }
  } catch (NoSuchMessageException e) {
    Log.w(TAG, e);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:34,代码来源:SmsSentJob.java

示例9: onRun

import org.thoughtcrime.securesms.database.NoSuchMessageException; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret)
    throws RetryLaterException, MmsException, NoSuchMessageException
{
  MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
  SendReq     message  = database.getOutgoingMessage(masterSecret, messageId);

  try {
    if (deliver(masterSecret, message)) {
      database.markAsPush(messageId);
      database.markAsSecure(messageId);
      database.markAsSent(messageId, "push".getBytes(), 0);
    }
  } catch (InsecureFallbackApprovalException ifae) {
    Log.w(TAG, ifae);
    database.markAsPendingInsecureSmsFallback(messageId);
    notifyMediaMessageDeliveryFailed(context, messageId);
  } catch (SecureFallbackApprovalException sfae) {
    Log.w(TAG, sfae);
    database.markAsPendingSecureSmsFallback(messageId);
    notifyMediaMessageDeliveryFailed(context, messageId);
  } catch (UntrustedIdentityException uie) {
    IncomingIdentityUpdateMessage identityUpdateMessage = IncomingIdentityUpdateMessage.createFor(message.getTo()[0].getString(), uie.getIdentityKey());
    DatabaseFactory.getEncryptingSmsDatabase(context).insertMessageInbox(masterSecret, identityUpdateMessage);
    database.markAsSentFailed(messageId);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:28,代码来源:PushMediaSendJob.java


注:本文中的org.thoughtcrime.securesms.database.NoSuchMessageException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。