use of org.jivesoftware.openfire.fastpath.settings.chat.ChatSettings in project Openfire by igniterealtime.
the class ImageServlet method getImage.
/**
* Returns the image bytes of the encoded image.
*
* @param imageName the name of the image.
* @param workgroupName the name of the workgroup.
* @return the image bytes found, otherwise null.
*/
public byte[] getImage(String imageName, String workgroupName) {
WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
JID workgroupJID = new JID(workgroupName);
Workgroup workgroup;
try {
workgroup = workgroupManager.getWorkgroup(workgroupJID);
} catch (UserNotFoundException e) {
Log.error(e.getMessage(), e);
return null;
}
ChatSettings chatSettings = chatSettingsManager.getChatSettings(workgroup);
ChatSetting setting = chatSettings.getChatSetting(imageName);
String encodedValue = setting.getValue();
if (encodedValue == null) {
return null;
}
return StringUtils.decodeBase64(encodedValue);
}
Aggregations