• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SignalServiceEnvelope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: appendPushNotificationState

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private static void appendPushNotificationState(@NonNull Context context,
                                                @NonNull NotificationState notificationState,
                                                @NonNull Cursor cursor)
{
  PushDatabase.Reader reader = null;
  SignalServiceEnvelope envelope;

  try {
    reader = DatabaseFactory.getPushDatabase(context).readerFor(cursor);

    while ((envelope = reader.getNext()) != null) {
      Recipients      recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
      Recipient       recipient  = recipients.getPrimaryRecipient();
      long            threadId   = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients);
      SpannableString body       = new SpannableString(context.getString(R.string.MessageNotifier_locked_message));
      body.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

      if (!recipients.isMuted()) {
        notificationState.addNotification(new NotificationItem(recipient, recipients, null, threadId, body, 0, null));
      }
    }
  } finally {
    if (reader != null)
      reader.close();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:27,代码来源:MessageNotifier.java


示例2: handleGroupCreate

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private static @Nullable Long handleGroupCreate(@NonNull Context context,
                                                @NonNull MasterSecretUnion masterSecret,
                                                @NonNull SignalServiceEnvelope envelope,
                                                @NonNull SignalServiceGroup group,
                                                boolean outgoing)
{
  GroupDatabase        database = DatabaseFactory.getGroupDatabase(context);
  byte[]               id       = group.getGroupId();
  GroupContext.Builder builder  = createGroupContext(group);
  builder.setType(GroupContext.Type.UPDATE);

  SignalServiceAttachment avatar = group.getAvatar().orNull();

  database.create(id, group.getName().orNull(), group.getMembers().orNull(), group.getOwner().orNull(),
                  group.getAdmins().or(Collections.<String>emptyList()),
                  avatar != null && avatar.isPointer() ? avatar.asPointer() : null,
                  envelope.getRelay());

  return storeMessage(context, masterSecret, envelope, group, builder.build(), outgoing);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:21,代码来源:GroupMessageProcessor.java


示例3: handleGroupLeave

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private static Long handleGroupLeave(@NonNull Context               context,
                                     @NonNull MasterSecretUnion     masterSecret,
                                     @NonNull SignalServiceEnvelope envelope,
                                     @NonNull SignalServiceGroup    group,
                                     @NonNull GroupRecord           record,
                                     boolean  outgoing)
{
  GroupDatabase database = DatabaseFactory.getGroupDatabase(context);
  byte[]        id       = group.getGroupId();
  List<String>  members  = record.getMembers();

  GroupContext.Builder builder = createGroupContext(group);
  builder.setType(GroupContext.Type.QUIT);

  if (members.contains(envelope.getSource())) {
    database.remove(id, envelope.getSource());
    if (outgoing) database.setActive(id, false);

    return storeMessage(context, masterSecret, envelope, group, builder.build(), outgoing);
  }

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


示例4: insert

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
public long insert(@NonNull SignalServiceEnvelope envelope) {
  Optional<Long> messageId = find(envelope);

  if (messageId.isPresent()) {
    return messageId.get();
  } else {
    ContentValues values = new ContentValues();
    values.put(TYPE, envelope.getType());
    values.put(SOURCE, envelope.getSource());
    values.put(DEVICE_ID, envelope.getSourceDevice());
    values.put(LEGACY_MSG, envelope.hasLegacyMessage() ? Base64.encodeBytes(envelope.getLegacyMessage()) : "");
    values.put(CONTENT, envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "");
    values.put(TIMESTAMP, envelope.getTimestamp());

    return databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, values);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushDatabase.java


示例5: find

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private Optional<Long> find(SignalServiceEnvelope envelope) {
  SQLiteDatabase database = databaseHelper.getReadableDatabase();
  Cursor         cursor   = null;

  try {
    cursor = database.query(TABLE_NAME, null, TYPE + " = ? AND " + SOURCE + " = ? AND " +
                                              DEVICE_ID + " = ? AND " + LEGACY_MSG + " = ? AND " +
                                              CONTENT + " = ? AND " + TIMESTAMP + " = ?" ,
                            new String[] {String.valueOf(envelope.getType()),
                                          envelope.getSource(),
                                          String.valueOf(envelope.getSourceDevice()),
                                          envelope.hasLegacyMessage() ? Base64.encodeBytes(envelope.getLegacyMessage()) : "",
                                          envelope.hasContent() ? Base64.encodeBytes(envelope.getContent()) : "",
                                          String.valueOf(envelope.getTimestamp())},
                            null, null, null);

    if (cursor != null && cursor.moveToFirst()) {
      return Optional.of(cursor.getLong(cursor.getColumnIndexOrThrow(ID)));
    } else {
      return Optional.absent();
    }
  } finally {
    if (cursor != null) cursor.close();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:26,代码来源:PushDatabase.java


示例6: getNext

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
public SignalServiceEnvelope getNext() {
  try {
    if (cursor == null || !cursor.moveToNext())
      return null;

    int    type          = cursor.getInt(cursor.getColumnIndexOrThrow(TYPE));
    String source        = cursor.getString(cursor.getColumnIndexOrThrow(SOURCE));
    int    deviceId      = cursor.getInt(cursor.getColumnIndexOrThrow(DEVICE_ID));
    String legacyMessage = cursor.getString(cursor.getColumnIndexOrThrow(LEGACY_MSG));
    String content       = cursor.getString(cursor.getColumnIndexOrThrow(CONTENT));
    long   timestamp     = cursor.getLong(cursor.getColumnIndexOrThrow(TIMESTAMP));

    return new SignalServiceEnvelope(type, source, deviceId, "", timestamp,
                                     legacyMessage != null ? Base64.decode(legacyMessage) : null,
                                     content != null ? Base64.decode(content) : null);
  } catch (IOException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:PushDatabase.java


示例7: onRun

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的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


示例8: handleCallOfferMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleCallOfferMessage(@NonNull SignalServiceEnvelope envelope,
                                    @NonNull OfferMessage message,
                                    @NonNull Optional<Long> smsMessageId)
{
  Log.w(TAG, "handleCallOfferMessage...");

  if (smsMessageId.isPresent()) {
    SmsDatabase database = DatabaseFactory.getSmsDatabase(context);
    database.markAsMissedCall(smsMessageId.get());
  } else {
    Intent intent = new Intent(context, WebRtcCallService.class);
    intent.setAction(WebRtcCallService.ACTION_INCOMING_CALL);
    intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
    intent.putExtra(WebRtcCallService.EXTRA_REMOTE_NUMBER, envelope.getSource());
    intent.putExtra(WebRtcCallService.EXTRA_REMOTE_DESCRIPTION, message.getDescription());
    intent.putExtra(WebRtcCallService.EXTRA_TIMESTAMP, envelope.getTimestamp());
    context.startService(intent);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:PushDecryptJob.java


示例9: handleExpirationUpdate

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleExpirationUpdate(@NonNull MasterSecretUnion masterSecret,
                                    @NonNull SignalServiceEnvelope envelope,
                                    @NonNull SignalServiceDataMessage message,
                                    @NonNull Optional<Long> smsMessageId)
    throws MmsException
{
  MmsDatabase          database     = DatabaseFactory.getMmsDatabase(context);
  String               localNumber  = TextSecurePreferences.getLocalNumber(context);
  Recipients           recipients   = getMessageDestination(envelope, message);
  IncomingMediaMessage mediaMessage = new IncomingMediaMessage(masterSecret, envelope.getSource(),
                                                               localNumber, message.getTimestamp(), -1,
                                                               message.getExpiresInSeconds() * 1000, true,
                                                               Optional.fromNullable(envelope.getRelay()),
                                                               Optional.<String>absent(), message.getGroupInfo(),
                                                               Optional.<List<SignalServiceAttachment>>absent());



  database.insertSecureDecryptedMessageInbox(masterSecret, mediaMessage, -1);

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

  if (smsMessageId.isPresent()) {
    DatabaseFactory.getSmsDatabase(context).deleteMessage(smsMessageId.get());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:27,代码来源:PushDecryptJob.java


示例10: handleInvalidVersionMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleInvalidVersionMessage(@NonNull MasterSecretUnion masterSecret,
                                         @NonNull SignalServiceEnvelope envelope,
                                         @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsInvalidVersionKeyExchange(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsInvalidVersionKeyExchange(smsMessageId.get());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushDecryptJob.java


示例11: handleCorruptMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleCorruptMessage(@NonNull MasterSecretUnion masterSecret,
                                  @NonNull SignalServiceEnvelope envelope,
                                  @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsDecryptFailed(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsDecryptFailed(smsMessageId.get());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushDecryptJob.java


示例12: handleNoSessionMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleNoSessionMessage(@NonNull MasterSecretUnion masterSecret,
                                    @NonNull SignalServiceEnvelope envelope,
                                    @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsNoSession(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsNoSession(smsMessageId.get());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushDecryptJob.java


示例13: handleLegacyMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleLegacyMessage(@NonNull MasterSecretUnion masterSecret,
                                 @NonNull SignalServiceEnvelope envelope,
                                 @NonNull Optional<Long> smsMessageId)
{
  EncryptingSmsDatabase smsDatabase = DatabaseFactory.getEncryptingSmsDatabase(context);

  if (!smsMessageId.isPresent()) {
    Optional<InsertResult> insertResult = insertPlaceholder(envelope);

    if (insertResult.isPresent()) {
      smsDatabase.markAsLegacyVersion(insertResult.get().getMessageId());
      MessageNotifier.updateNotification(context, masterSecret.getMasterSecret().orNull(), insertResult.get().getThreadId());
    }
  } else {
    smsDatabase.markAsLegacyVersion(smsMessageId.get());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushDecryptJob.java


示例14: handle

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
public void handle(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
  if (!isActiveNumber(context, envelope.getSource())) {
    TextSecureDirectory directory           = TextSecureDirectory.getInstance(context);
    ContactTokenDetails contactTokenDetails = new ContactTokenDetails();
    contactTokenDetails.setNumber(envelope.getSource());

    directory.setNumber(contactTokenDetails, true);

    Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
    ApplicationContext.getInstance(context).getJobManager().add(new DirectoryRefreshJob(context, KeyCachingService.getMasterSecret(context), recipients));
  }

  if (envelope.isReceipt()) {
    handleReceipt(envelope);
  } else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage()) {
    handleMessage(envelope, sendExplicitReceipt);
  } else {
    Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:21,代码来源:PushReceivedJob.java


示例15: handleMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private void handleMessage(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
  Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
  JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();

  if (!recipients.isBlocked()) {
    long messageId = DatabaseFactory.getPushDatabase(context).insert(envelope);
    jobManager.add(new PushDecryptJob(context, messageId, envelope.getSource()));
  } else {
    Log.w(TAG, "*** Received blocked push message, ignoring...");
  }

  if (sendExplicitReceipt) {
    jobManager.add(new DeliveryReceiptJob(context, envelope.getSource(),
                                          envelope.getTimestamp(),
                                          envelope.getRelay()));
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:18,代码来源:PushReceivedJob.java


示例16: retrieveMessages

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
public List<SignalServiceEnvelope> retrieveMessages(MessageReceivedCallback callback)
    throws IOException
{
  List<SignalServiceEnvelope>       results  = new LinkedList<>();
  List<SignalServiceEnvelopeEntity> entities = socket.getMessages();

  for (SignalServiceEnvelopeEntity entity : entities) {
    SignalServiceEnvelope envelope =  new SignalServiceEnvelope(entity.getType(), entity.getSource(),
                                                                entity.getSourceDevice(), entity.getRelay(),
                                                                entity.getTimestamp(), entity.getMessage(),
                                                                entity.getContent());

    callback.onMessage(envelope);
    results.add(envelope);

    socket.acknowledgeMessage(entity.getSource(), entity.getTimestamp());
  }

  return results;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:21,代码来源:SignalServiceMessageReceiver.java


示例17: decrypt

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private byte[] decrypt(SignalServiceEnvelope envelope, byte[] ciphertext)
    throws InvalidVersionException, InvalidMessageException, InvalidKeyException,
           DuplicateMessageException, InvalidKeyIdException, UntrustedIdentityException,
           LegacyMessageException, NoSessionException
{
  SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSource(), envelope.getSourceDevice());
  SessionCipher         sessionCipher = new SessionCipher(signalProtocolStore, sourceAddress);

  byte[] paddedMessage;

  if (envelope.isPreKeySignalMessage()) {
    paddedMessage = sessionCipher.decrypt(new PreKeySignalMessage(ciphertext));
  } else if (envelope.isSignalMessage()) {
    paddedMessage = sessionCipher.decrypt(new SignalMessage(ciphertext));
  } else {
    throw new InvalidMessageException("Unknown type: " + envelope.getType());
  }

  PushTransportDetails transportDetails = new PushTransportDetails(sessionCipher.getSessionVersion());
  return transportDetails.getStrippedPaddingMessageBody(paddedMessage);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:22,代码来源:SignalServiceCipher.java


示例18: createSignalServiceMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
private SignalServiceDataMessage createSignalServiceMessage(SignalServiceEnvelope envelope, DataMessage content) {
  SignalServiceGroup            groupInfo        = createGroupInfo(envelope, content);
  List<SignalServiceAttachment> attachments      = new LinkedList<>();
  boolean                       endSession       = ((content.getFlags() & DataMessage.Flags.END_SESSION_VALUE) != 0);
  boolean                       expirationUpdate = ((content.getFlags() & DataMessage.Flags.EXPIRATION_TIMER_UPDATE_VALUE) != 0);

  for (AttachmentPointer pointer : content.getAttachmentsList()) {
    attachments.add(new SignalServiceAttachmentPointer(pointer.getId(),
                                                       pointer.getContentType(),
                                                       pointer.getFilename(),
                                                       pointer.getKey().toByteArray(),
                                                       envelope.getRelay(),
                                                       pointer.hasSize() ? Optional.of(pointer.getSize()) : Optional.<Integer>absent(),
                                                       pointer.hasThumbnail() ? Optional.of(pointer.getThumbnail().toByteArray()): Optional.<byte[]>absent(),
                                                       pointer.hasDigest() ? Optional.of(pointer.getDigest().toByteArray()) : Optional.<byte[]>absent()));
  }

  return new SignalServiceDataMessage(envelope.getTimestamp(), groupInfo, attachments,
                                      content.getBody(), endSession, content.getExpireTimer(),
                                      expirationUpdate);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:22,代码来源:SignalServiceCipher.java


示例19: createSynchronizeMessage

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的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


示例20: read

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入依赖的package包/类
/**
 * A blocking call that reads a message off the pipe (see {@link #read(long, java.util.concurrent.TimeUnit)}
 *
 * Unlike {@link #read(long, java.util.concurrent.TimeUnit)}, this method allows you
 * to specify a callback that will be called before the received message is acknowledged.
 * This allows you to write the received message to durable storage before acknowledging
 * receipt of it to the server.
 *
 * @param timeout The timeout to wait for.
 * @param unit The timeout time unit.
 * @param callback A callback that will be called before the message receipt is
 *                 acknowledged to the server.
 * @return The message read (same as the message sent through the callback).
 * @throws TimeoutException
 * @throws IOException
 * @throws InvalidVersionException
 */
public SignalServiceEnvelope read(long timeout, TimeUnit unit, MessagePipeCallback callback)
    throws TimeoutException, IOException, InvalidVersionException
{
  while (true) {
    WebSocketRequestMessage  request  = websocket.readRequest(unit.toMillis(timeout));
    WebSocketResponseMessage response = createWebSocketResponse(request);

    try {
      if (isSignalServiceEnvelope(request)) {
        SignalServiceEnvelope envelope = new SignalServiceEnvelope(request.getBody().toByteArray(),
                                                                   credentialsProvider.getSignalingKey());

        callback.onMessage(envelope);
        return envelope;
      }
    } finally {
      websocket.sendResponse(response);
    }
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:38,代码来源:SignalServiceMessagePipe.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MarkerAnnotation类代码示例发布时间:2022-05-22
下一篇:
Java SerializedSubscriber类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap