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


Java UnregisteredUserException类代码示例

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


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

示例1: sendMessage

import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; //导入依赖的package包/类
public SendMessageResponse sendMessage(OutgoingPushMessageList bundle)
    throws IOException
{
  try {
    String responseText = makeRequest(String.format(MESSAGE_PATH, bundle.getDestination()), "PUT", JsonUtil.toJson(bundle));

    if (responseText == null) return new SendMessageResponse(false);
    else                      return JsonUtil.fromJson(responseText, SendMessageResponse.class);
  } catch (NotFoundException nfe) {
    throw new UnregisteredUserException(bundle.getDestination(), nfe);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:13,代码来源:PushServiceSocket.java

示例2: getPreKey

import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; //导入依赖的package包/类
public PreKeyBundle getPreKey(SignalServiceAddress destination, int deviceId) throws IOException {
  try {
    String path = String.format(PREKEY_DEVICE_PATH, destination.getNumber(),
                                String.valueOf(deviceId));

    if (destination.getRelay().isPresent()) {
      path = path + "?relay=" + destination.getRelay().get();
    }

    String         responseText = makeRequest(path, "GET", null);
    PreKeyResponse response     = JsonUtil.fromJson(responseText, PreKeyResponse.class);

    if (response.getDevices() == null || response.getDevices().size() < 1)
      throw new IOException("Empty prekey list");

    PreKeyResponseItem device                = response.getDevices().get(0);
    ECPublicKey        preKey                = null;
    ECPublicKey        signedPreKey          = null;
    byte[]             signedPreKeySignature = null;
    int                preKeyId              = -1;
    int                signedPreKeyId        = -1;

    if (device.getPreKey() != null) {
      preKeyId = device.getPreKey().getKeyId();
      preKey   = device.getPreKey().getPublicKey();
    }

    if (device.getSignedPreKey() != null) {
      signedPreKeyId        = device.getSignedPreKey().getKeyId();
      signedPreKey          = device.getSignedPreKey().getPublicKey();
      signedPreKeySignature = device.getSignedPreKey().getSignature();
    }

    return new PreKeyBundle(device.getRegistrationId(), device.getDeviceId(), preKeyId, preKey,
                            signedPreKeyId, signedPreKey, signedPreKeySignature, response.getIdentityKey());
  } catch (NotFoundException nfe) {
    throw new UnregisteredUserException(destination.getNumber(), nfe);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:40,代码来源:PushServiceSocket.java

示例3: getPreKeys

import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; //导入依赖的package包/类
public List<PreKeyBundle> getPreKeys(SignalServiceAddress destination, int deviceIdInteger) throws IOException {
  try {
    String deviceId = String.valueOf(deviceIdInteger);

    if (deviceId.equals("1"))
      deviceId = "*";

    String path = String.format(PREKEY_DEVICE_PATH, destination.getNumber(), deviceId);

    if (destination.getRelay().isPresent()) {
      path = path + "?relay=" + destination.getRelay().get();
    }

    String             responseText = makeRequest(path, "GET", null);
    PreKeyResponse     response     = JsonUtil.fromJson(responseText, PreKeyResponse.class);
    List<PreKeyBundle> bundles      = new LinkedList<>();

    for (PreKeyResponseItem device : response.getDevices()) {
      ECPublicKey preKey                = null;
      ECPublicKey signedPreKey          = null;
      byte[]      signedPreKeySignature = null;
      int         preKeyId              = -1;
      int         signedPreKeyId        = -1;

      if (device.getSignedPreKey() != null) {
        signedPreKey          = device.getSignedPreKey().getPublicKey();
        signedPreKeyId        = device.getSignedPreKey().getKeyId();
        signedPreKeySignature = device.getSignedPreKey().getSignature();
      }

      if (device.getPreKey() != null) {
        preKeyId = device.getPreKey().getKeyId();
        preKey   = device.getPreKey().getPublicKey();
      }

      bundles.add(new PreKeyBundle(device.getRegistrationId(), device.getDeviceId(), preKeyId,
                                   preKey, signedPreKeyId, signedPreKey, signedPreKeySignature,
                                   response.getIdentityKey()));
    }

    return bundles;
  } catch (NotFoundException nfe) {
    throw new UnregisteredUserException(destination.getNumber(), nfe);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:46,代码来源:PushServiceSocket.java

示例4: addException

import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; //导入依赖的package包/类
public void addException(UnregisteredUserException exception) {
  unregisteredUsers.add(exception);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:4,代码来源:SendMessageResponseList.java

示例5: getUnregisteredUsers

import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; //导入依赖的package包/类
public List<UnregisteredUserException> getUnregisteredUsers() {
  return unregisteredUsers;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:4,代码来源:SendMessageResponseList.java


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