本文整理匯總了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);
}
示例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);
}
}
示例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;
}