Пример #1
0
  /**
   * Asks the workgroup for it's Chat Settings.
   *
   * @return key specify a key to retrieve only that settings. Otherwise for all settings, key
   *     should be null.
   * @throws XMPPException if an error occurs while getting information from the server.
   */
  private ChatSettings getChatSettings(String key, int type) throws XMPPException {
    ChatSettings request = new ChatSettings();
    if (key != null) {
      request.setKey(key);
    }
    if (type != -1) {
      request.setType(type);
    }
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);

    ChatSettings response =
        (ChatSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();

    return response;
  }
Пример #2
0
 /**
  * Returns a single chat setting based on it's identified key.
  *
  * @param key the key to find.
  * @return the ChatSetting if found, otherwise false.
  * @throws XMPPException if an error occurs while getting information from the server.
  */
 public ChatSetting getChatSetting(String key) throws XMPPException {
   ChatSettings chatSettings = getChatSettings(key, -1);
   return chatSettings.getFirstEntry();
 }