當前位置: 首頁>>代碼示例>>Java>>正文


Java IncomingEndSessionMessage類代碼示例

本文整理匯總了Java中org.thoughtcrime.securesms.sms.IncomingEndSessionMessage的典型用法代碼示例。如果您正苦於以下問題:Java IncomingEndSessionMessage類的具體用法?Java IncomingEndSessionMessage怎麽用?Java IncomingEndSessionMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IncomingEndSessionMessage類屬於org.thoughtcrime.securesms.sms包,在下文中一共展示了IncomingEndSessionMessage類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleEndSessionMessage

import org.thoughtcrime.securesms.sms.IncomingEndSessionMessage; //導入依賴的package包/類
private void handleEndSessionMessage(MasterSecret masterSecret, long recipientId,
                                     TextSecureEnvelope envelope, TextSecureMessage message)
{
  IncomingTextMessage incomingTextMessage = new IncomingTextMessage(envelope.getSource(),
                                                                    envelope.getSourceDevice(),
                                                                    message.getTimestamp(),
                                                                    "", Optional.<TextSecureGroup>absent());

  IncomingEndSessionMessage incomingEndSessionMessage = new IncomingEndSessionMessage(incomingTextMessage);
  EncryptingSmsDatabase     database                  = DatabaseFactory.getEncryptingSmsDatabase(context);
  Pair<Long, Long>          messageAndThreadId        = database.insertMessageInbox(masterSecret, incomingEndSessionMessage);

  SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret);
  sessionStore.deleteAllSessions(recipientId);

  SecurityEvent.broadcastSecurityUpdateEvent(context, messageAndThreadId.second);
  MessageNotifier.updateNotification(context, masterSecret, messageAndThreadId.second);
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:19,代碼來源:PushDecryptJob.java

示例2: handleEndSessionMessage

import org.thoughtcrime.securesms.sms.IncomingEndSessionMessage; //導入依賴的package包/類
private void handleEndSessionMessage(@NonNull MasterSecretUnion        masterSecret,
                                     @NonNull SignalServiceEnvelope    envelope,
                                     @NonNull SignalServiceDataMessage message,
                                     @NonNull Optional<Long>           smsMessageId)
{
  EncryptingSmsDatabase smsDatabase         = DatabaseFactory.getEncryptingSmsDatabase(context);
  IncomingTextMessage   incomingTextMessage = new IncomingTextMessage(envelope.getSource(),
                                                                      envelope.getSourceDevice(),
                                                                      message.getTimestamp(),
                                                                      "", Optional.<SignalServiceGroup>absent(), 0);

  Long threadId;

  if (!smsMessageId.isPresent()) {
    IncomingEndSessionMessage incomingEndSessionMessage = new IncomingEndSessionMessage(incomingTextMessage);
    Optional<InsertResult>    insertResult              = smsDatabase.insertMessageInbox(masterSecret, incomingEndSessionMessage);

    if (insertResult.isPresent()) threadId = insertResult.get().getThreadId();
    else                          threadId = null;
  } else {
    smsDatabase.markAsEndSession(smsMessageId.get());
    threadId = smsDatabase.getThreadIdForMessage(smsMessageId.get());
  }

  if (threadId != null) {
    SessionStore sessionStore = new TextSecureSessionStore(context);
    sessionStore.deleteAllSessions(envelope.getSource());

    SecurityEvent.broadcastSecurityUpdateEvent(context);
    MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), threadId);
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:33,代碼來源:PushDecryptJob.java

示例3: createIncomingTextMessage

import org.thoughtcrime.securesms.sms.IncomingEndSessionMessage; //導入依賴的package包/類
private IncomingTextMessage createIncomingTextMessage(MasterSecret masterSecret, SmsMessageRecord record)
    throws InvalidMessageException
{
  String plaintextBody = record.getBody().getBody();

  if (record.isAsymmetricEncryption()) {
    plaintextBody = getAsymmetricDecryptedBody(masterSecret, record.getBody().getBody());
  }

  IncomingTextMessage message = new IncomingTextMessage(record.getRecipients().getPrimaryRecipient().getNumber(),
                                                        record.getRecipientDeviceId(),
                                                        record.getDateSent(),
                                                        plaintextBody,
                                                        Optional.<TextSecureGroup>absent());

  if (record.isEndSession()) {
    return new IncomingEndSessionMessage(message);
  } else if (record.isBundleKeyExchange()) {
    return new IncomingPreKeyBundleMessage(message, message.getMessageBody());
  } else if (record.isKeyExchange()) {
    return new IncomingKeyExchangeMessage(message, message.getMessageBody());
  } else if (record.isSecure()) {
    return new IncomingEncryptedMessage(message, message.getMessageBody());
  }

  return message;
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:28,代碼來源:SmsDecryptJob.java


注:本文中的org.thoughtcrime.securesms.sms.IncomingEndSessionMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。