Java 类org.jivesoftware.smackx.workgroup.settings.ChatSettings 实例源码

项目:Smack    文件:Workgroup.java   
/**
 * 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;
}
项目:Fastpath-webchat    文件:SettingsManager.java   
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;
    }
}
项目:Smack    文件:Workgroup.java   
/**
 * 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();
}
项目:Smack    文件:Workgroup.java   
/**
 * 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);
}
项目:Smack    文件:Workgroup.java   
/**
 * 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);
}