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


Java SentTranscriptMessage类代码示例

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


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

示例1: handleSynchronizeSentExpirationUpdate

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private long handleSynchronizeSentExpirationUpdate(@NonNull MasterSecretUnion masterSecret,
                                                   @NonNull SentTranscriptMessage message,
                                                   @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  MmsDatabase database   = DatabaseFactory.getMmsDatabase(context);
  Recipients  recipients = getSyncMessageDestination(message);

  OutgoingExpirationUpdateMessage expirationUpdateMessage = new OutgoingExpirationUpdateMessage(recipients,
                                                                                                message.getTimestamp(),
                                                                                                message.getMessage().getExpiresInSeconds() * 1000);

  long threadId  = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
  long messageId = database.insertMessageOutbox(masterSecret, expirationUpdateMessage, threadId, false);

  database.markAsSent(messageId, true);

  DatabaseFactory.getRecipientPreferenceDatabase(context).setExpireMessages(recipients, message.getMessage().getExpiresInSeconds());

  if (smsMessageId.isPresent()) {
    DatabaseFactory.getSmsDatabase(context).deleteMessage(smsMessageId.get());
  }

  return threadId;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:26,代码来源:PushDecryptJob.java

示例2: createSynchronizeMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private SignalServiceSyncMessage createSynchronizeMessage(SignalServiceEnvelope envelope, SyncMessage content) {
  if (content.hasSent()) {
    SyncMessage.Sent sentContent = content.getSent();
    return SignalServiceSyncMessage.forSentTranscript(new SentTranscriptMessage(sentContent.getDestination(),
                                                                                sentContent.getTimestamp(),
                                                                                createSignalServiceMessage(envelope, sentContent.getMessage()),
                                                                                sentContent.getExpirationStartTimestamp()));
  }

  if (content.hasRequest()) {
    return SignalServiceSyncMessage.forRequest(new RequestMessage(content.getRequest()));
  }

  if (content.getReadList().size() > 0) {
    List<ReadMessage> readMessages = new LinkedList<>();

    for (SyncMessage.Read read : content.getReadList()) {
      readMessages.add(new ReadMessage(read.getSender(), read.getTimestamp()));
    }

    return SignalServiceSyncMessage.forRead(readMessages);
  }

  return SignalServiceSyncMessage.empty();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:26,代码来源:SignalServiceCipher.java

示例3: handleSynchronizeSentExpirationUpdate

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private long handleSynchronizeSentExpirationUpdate(@NonNull MasterSecretUnion masterSecret,
                                                   @NonNull SentTranscriptMessage message,
                                                   @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  MmsDatabase database   = DatabaseFactory.getMmsDatabase(context);
  Recipients  recipients = getSyncMessageDestination(message);

  OutgoingExpirationUpdateMessage expirationUpdateMessage = new OutgoingExpirationUpdateMessage(recipients,
                                                                                                message.getTimestamp(),
                                                                                                message.getMessage().getExpiresInSeconds() * 1000);

  long threadId  = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
  long messageId = database.insertMessageOutbox(masterSecret, expirationUpdateMessage, threadId, false, null);

  database.markAsSent(messageId, true);

  DatabaseFactory.getRecipientPreferenceDatabase(context).setExpireMessages(recipients, message.getMessage().getExpiresInSeconds());

  if (smsMessageId.isPresent()) {
    DatabaseFactory.getSmsDatabase(context).deleteMessage(smsMessageId.get());
  }

  return threadId;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:26,代码来源:PushDecryptJob.java

示例4: handleSynchronizeSentMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private void handleSynchronizeSentMessage(@NonNull MasterSecretUnion masterSecret,
                                          @NonNull SignalServiceEnvelope envelope,
                                          @NonNull SentTranscriptMessage message,
                                          @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);

  Long threadId;

  if (message.getMessage().isGroupUpdate()) {
    threadId = GroupMessageProcessor.process(context, masterSecret, envelope, message.getMessage(), true);
  } else if (message.getMessage().isExpirationUpdate()) {
    threadId = handleSynchronizeSentExpirationUpdate(masterSecret, message, smsMessageId);
  } else if (message.getMessage().getAttachments().isPresent()) {
    threadId = handleSynchronizeSentMediaMessage(masterSecret, message, smsMessageId);
  } else {
    threadId = handleSynchronizeSentTextMessage(masterSecret, message, smsMessageId);
  }

  if (message.getMessage().getGroupInfo().isPresent() && groupDatabase.isUnknownGroup(message.getMessage().getGroupInfo().get().getGroupId())) {
    handleUnknownGroupMessage(envelope, message.getMessage().getGroupInfo().get());
  }

  if (threadId != null) {
    DatabaseFactory.getThreadDatabase(getContext()).setRead(threadId, true);
    MessageNotifier.updateNotification(getContext(), masterSecret.getMasterSecret().orNull());
  }

  MessageNotifier.setLastDesktopActivityTimestamp(message.getTimestamp());
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:32,代码来源:PushDecryptJob.java

示例5: handleSynchronizeSentTextMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private long handleSynchronizeSentTextMessage(@NonNull MasterSecretUnion masterSecret,
                                              @NonNull SentTranscriptMessage message,
                                              @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  EncryptingSmsDatabase database            = DatabaseFactory.getEncryptingSmsDatabase(context);
  Recipients            recipients          = getSyncMessageDestination(message);
  String                body                = message.getMessage().getBody().or("");
  long                  expiresInMillis     = message.getMessage().getExpiresInSeconds() * 1000;
  OutgoingTextMessage   outgoingTextMessage = new OutgoingTextMessage(recipients, body, expiresInMillis, -1);

  if (recipients.getExpireMessages() != message.getMessage().getExpiresInSeconds()) {
    handleSynchronizeSentExpirationUpdate(masterSecret, message, Optional.<Long>absent());
  }

  long threadId  = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
  long messageId = database.insertMessageOutbox(masterSecret, threadId, outgoingTextMessage, false, message.getTimestamp());

  database.markAsSent(messageId, true);

  if (smsMessageId.isPresent()) {
    database.deleteMessage(smsMessageId.get());
  }

  if (expiresInMillis > 0) {
    database.markExpireStarted(messageId, message.getExpirationStartTimestamp());
    ApplicationContext.getInstance(context)
                      .getExpiringMessageManager()
                      .scheduleDeletion(messageId, false, message.getExpirationStartTimestamp(), expiresInMillis);
  }

  return threadId;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:34,代码来源:PushDecryptJob.java

示例6: getSyncMessageDestination

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private Recipients getSyncMessageDestination(SentTranscriptMessage message) {
  if (message.getMessage().getGroupInfo().isPresent()) {
    return RecipientFactory.getRecipientsFromString(context, GroupUtil.getEncodedId(message.getMessage().getGroupInfo().get().getGroupId()), false);
  } else {
    return RecipientFactory.getRecipientsFromString(context, message.getDestination().get(), false);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:8,代码来源:PushDecryptJob.java

示例7: handleSynchronizeSentEndSessionMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private long handleSynchronizeSentEndSessionMessage(@NonNull MasterSecretUnion     masterSecret,
                                                    @NonNull SentTranscriptMessage message,
                                                    @NonNull Optional<Long>        smsMessageId)
{
  EncryptingSmsDatabase     database                  = DatabaseFactory.getEncryptingSmsDatabase(context);
  Recipients                recipients                = getSyncMessageDestination(message);
  OutgoingTextMessage       outgoingTextMessage       = new OutgoingTextMessage(recipients, "", -1);
  OutgoingEndSessionMessage outgoingEndSessionMessage = new OutgoingEndSessionMessage(outgoingTextMessage);

  long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);

  if (recipients.isSingleRecipient() && !recipients.isGroupRecipient()) {
    SessionStore sessionStore = new TextSecureSessionStore(context);
    sessionStore.deleteAllSessions(recipients.getPrimaryRecipient().getNumber());

    SecurityEvent.broadcastSecurityUpdateEvent(context);

    long messageId = database.insertMessageOutbox(masterSecret, threadId, outgoingEndSessionMessage,
                                                  false, message.getTimestamp(), null);
    database.markAsSent(messageId, true);
  }

  if (smsMessageId.isPresent()) {
    database.deleteMessage(smsMessageId.get());
  }

  return threadId;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:29,代码来源:PushDecryptJob.java

示例8: handleSynchronizeSentMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private void handleSynchronizeSentMessage(@NonNull MasterSecretUnion masterSecret,
                                          @NonNull SignalServiceEnvelope envelope,
                                          @NonNull SentTranscriptMessage message,
                                          @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);

  Long threadId;

  if (message.getMessage().isEndSession()) {
    threadId = handleSynchronizeSentEndSessionMessage(masterSecret, message, smsMessageId);
  } else if (message.getMessage().isGroupUpdate()) {
    threadId = GroupMessageProcessor.process(context, masterSecret, envelope, message.getMessage(), true);
  } else if (message.getMessage().isExpirationUpdate()) {
    threadId = handleSynchronizeSentExpirationUpdate(masterSecret, message, smsMessageId);
  } else if (message.getMessage().getAttachments().isPresent()) {
    threadId = handleSynchronizeSentMediaMessage(masterSecret, message, smsMessageId);
  } else {
    threadId = handleSynchronizeSentTextMessage(masterSecret, message, smsMessageId);
  }

  if (message.getMessage().getGroupInfo().isPresent() && groupDatabase.isUnknownGroup(message.getMessage().getGroupInfo().get().getGroupId())) {
    handleUnknownGroupMessage(envelope, message.getMessage().getGroupInfo().get());
  }

  if (threadId != null) {
    DatabaseFactory.getThreadDatabase(getContext()).setRead(threadId, true);
    MessageNotifier.updateNotification(getContext(), masterSecret.getMasterSecret().orNull());
  }

  MessageNotifier.setLastDesktopActivityTimestamp(message.getTimestamp());
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:34,代码来源:PushDecryptJob.java

示例9: handleSynchronizeSentTextMessage

import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; //导入依赖的package包/类
private long handleSynchronizeSentTextMessage(@NonNull MasterSecretUnion masterSecret,
                                              @NonNull SentTranscriptMessage message,
                                              @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  EncryptingSmsDatabase database            = DatabaseFactory.getEncryptingSmsDatabase(context);
  Recipients            recipients          = getSyncMessageDestination(message);
  String                body                = message.getMessage().getBody().or("");
  long                  expiresInMillis     = message.getMessage().getExpiresInSeconds() * 1000;
  OutgoingTextMessage   outgoingTextMessage = new OutgoingTextMessage(recipients, body, expiresInMillis, -1);

  if (recipients.getExpireMessages() != message.getMessage().getExpiresInSeconds()) {
    handleSynchronizeSentExpirationUpdate(masterSecret, message, Optional.<Long>absent());
  }

  long threadId  = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
  long messageId = database.insertMessageOutbox(masterSecret, threadId, outgoingTextMessage, false, message.getTimestamp(), null);

  database.markAsSent(messageId, true);

  if (smsMessageId.isPresent()) {
    database.deleteMessage(smsMessageId.get());
  }

  if (expiresInMillis > 0) {
    database.markExpireStarted(messageId, message.getExpirationStartTimestamp());
    ApplicationContext.getInstance(context)
                      .getExpiringMessageManager()
                      .scheduleDeletion(messageId, false, message.getExpirationStartTimestamp(), expiresInMillis);
  }

  return threadId;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:34,代码来源:PushDecryptJob.java


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