/** * 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 NoResponseException * @throws XMPPErrorException if an error occurs while getting information from the server. * @throws NotConnectedException */ private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException { 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; }
public byte[] getImageFromMap(String imageName, String workgroupName) { ChatSettings chatSettings = (ChatSettings)this.chatSettings.get(workgroupName); ChatSetting imageSetting = chatSettings.getChatSetting(imageName); if (imageSetting == null || imageSetting.getValue() == null) { return null; } else { byte[] bytes = Base64.decode(imageSetting.getValue()); return bytes; } }
/** * 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. * @throws SmackException */ public ChatSetting getChatSetting(String key) throws XMPPException, SmackException { ChatSettings chatSettings = getChatSettings(key, -1); return chatSettings.getFirstEntry(); }
/** * Returns ChatSettings based on type. * * @param type the type of ChatSettings to return. * @return the ChatSettings of given type, otherwise null. * @throws XMPPException if an error occurs while getting information from the server. * @throws SmackException */ public ChatSettings getChatSettings(int type) throws XMPPException, SmackException { return getChatSettings(null, type); }
/** * Returns all ChatSettings. * * @return all ChatSettings of a given workgroup. * @throws XMPPException if an error occurs while getting information from the server. * @throws SmackException */ public ChatSettings getChatSettings() throws XMPPException, SmackException { return getChatSettings(null, -1); }