use of org.jivesoftware.openfire.user.UserNotFoundException 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);
}
use of org.jivesoftware.openfire.user.UserNotFoundException in project Openfire by igniterealtime.
the class DeleteWorkgroup method execute.
@Override
public void execute(SessionData data, Element command) {
Element note = command.addElement("note");
// Get requested group
WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
// Load the workgroup
try {
Workgroup workgroup = workgroupManager.getWorkgroup(new JID(data.getData().get("workgroup").get(0)));
workgroupManager.deleteWorkgroup(workgroup);
} catch (UserNotFoundException e) {
// Group not found
note.addAttribute("type", "error");
note.setText("Workgroup not found");
return;
} catch (Exception e) {
// Group not found
note.addAttribute("type", "error");
note.setText("Error executing the command");
return;
}
note.addAttribute("type", "info");
note.setText("Operation finished successfully");
}
use of org.jivesoftware.openfire.user.UserNotFoundException in project Openfire by igniterealtime.
the class MSNBuddy method setMsnContact.
public void setMsnContact(MsnContact msnContact) {
if (JiveGlobals.getBooleanProperty("plugin.gateway.msn.autonickname", false)) {
if (!getNickname().equals(msnContact.getDisplayName())) {
setNickname(msnContact.getDisplayName());
try {
final JID owner = getManager().getSession().getJID();
getManager().getSession().getTransport().addOrUpdateRosterItem(owner, getJID(), getNickname(), getGroups());
} catch (UserNotFoundException e) {
// Can't update something that's not really in our list.
}
}
}
this.msnContact = msnContact;
}
use of org.jivesoftware.openfire.user.UserNotFoundException in project Openfire by igniterealtime.
the class MSNSession method completedPendingContactAdd.
/**
* Completes the addition of groups to a new contact after the contact has been created.
*
* @param msnContact Contact that was added.
*/
public void completedPendingContactAdd(MsnContact msnContact) {
try {
Roster roster = getTransport().getRosterManager().getRoster(getJID().getNode());
Email contact = msnContact.getEmail();
JID contactJID = getTransport().convertIDToJID(contact.toString());
RosterItem item = roster.getRosterItem(contactJID);
getBuddyManager().storeBuddy(new MSNBuddy(getBuddyManager(), msnContact));
syncContactGroups(contact, item.getGroups());
} catch (UserNotFoundException e) {
Log.debug("MSN: Unable to find roster when adding pendingcontact for " + getJID());
}
}
use of org.jivesoftware.openfire.user.UserNotFoundException in project Openfire by igniterealtime.
the class MSNSession method completedPendingGroupAdd.
/**
* Completes the addition of a contact to a new group after the group has been created.
*
* @param msnGroup Group that was added.
*/
public void completedPendingGroupAdd(MsnGroup msnGroup) {
if (!msnPendingGroups.containsKey(msnGroup.getGroupName())) {
// Nothing to do, no pending.
return;
}
try {
Roster roster = getTransport().getRosterManager().getRoster(getJID().getNode());
for (Email contact : msnPendingGroups.get(msnGroup.getGroupName())) {
JID contactJID = getTransport().convertIDToJID(contact.toString());
RosterItem item = roster.getRosterItem(contactJID);
syncContactGroups(contact, item.getGroups());
}
} catch (UserNotFoundException e) {
Log.debug("MSN: Unable to find roster when adding pending group contacts for " + getJID());
}
}
Aggregations