use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.
the class GetConversationTask method run.
public void run() {
MonitoringPlugin plugin = (MonitoringPlugin) XMPPServer.getInstance().getPluginManager().getPlugin(MonitoringConstants.NAME);
ConversationManager conversationManager = (ConversationManager) plugin.getModule(ConversationManager.class);
try {
conversation = conversationManager.getConversation(conversationID);
} catch (NotFoundException e) {
// Ignore. The requester of this task will throw this exception in his JVM
}
}
use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.
the class TransportBuddy method addVCardPhoto.
/**
* Adds the PHOTO vcard element (representing an avatar) to an existing vcard.
*
* This will add the avatar to a vcard if there's one to add. Otherwise will not add anything.
* If added, a properly formatted PHOTO element with base64 encoded data in it will be added.
*
* param vcard vcard to add PHOTO element to
*/
public void addVCardPhoto(Element vcard) {
if (!avatarSet) {
Log.debug("TransportBuddy: I've got nothing! (no avatar set)");
return;
}
Element photo = vcard.addElement("PHOTO");
if (avatar != null) {
try {
photo.addElement("TYPE").addCDATA(avatar.getMimeType());
photo.addElement("BINVAL").addCDATA(avatar.getImageData());
} catch (NotFoundException e) {
// No problem, leave it empty then.
}
}
}
use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.
the class TransportBuddyManager method activate.
/**
* Activates the full functionality of the buddy manager and sends available presences to client.
*/
public synchronized void activate() {
for (JID jid : pendingPresences.keySet()) {
if (pendingVerboseStatuses.containsKey(jid)) {
try {
B buddy = getBuddy(jid);
buddy.setPresenceAndStatus(pendingPresences.get(jid), pendingVerboseStatuses.get(jid));
} catch (NotFoundException e) {
// Alrighty then....
}
pendingVerboseStatuses.remove(jid);
} else {
try {
B buddy = getBuddy(jid);
buddy.setPresence(pendingPresences.get(jid));
} catch (NotFoundException e) {
// Alrighty then....
}
}
}
for (JID jid : pendingVerboseStatuses.keySet()) {
try {
B buddy = getBuddy(jid);
buddy.setVerboseStatus(pendingVerboseStatuses.get(jid));
} catch (NotFoundException e) {
// Alrighty then....
}
}
pendingPresences.clear();
pendingVerboseStatuses.clear();
isActive = true;
sendAllAvailablePresences(getSession().getJID());
}
use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.
the class ConfigManager method logoutSession.
/**
* Logs out session via the web interface.
*
*
* @param registrationID ID number associated with registration to log off.
* @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
*/
public Integer logoutSession(Integer registrationID) {
try {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin) pluginManager.getPlugin("kraken");
Registration registration = new Registration(registrationID);
if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
return -1;
}
JID jid = registration.getJID();
TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
return registrationID;
} catch (NotFoundException e) {
return -1;
}
}
use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.
the class ConfigManager method updateRegistration.
/**
* Updates a registration via the web interface.
*
*
* @param registrationID ID number associated with registration to modify.
* @param legacyUsername User's updated username on the legacy service.
* @param legacyPassword User's updated password on the legacy service, null if no change.
* @param legacyNickname User's updated nickname on the legacy service.
* @return Error message or null on success.
*/
public String updateRegistration(Integer registrationID, String legacyUsername, String legacyPassword, String legacyNickname) {
PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
KrakenPlugin plugin = (KrakenPlugin) pluginManager.getPlugin("kraken");
try {
Registration reg = new Registration(registrationID);
if (!plugin.getTransportInstance(reg.getTransportType().toString()).isEnabled()) {
return LocaleUtils.getLocalizedString("gateway.web.registrations.notenabled", "kraken");
}
reg.setUsername(legacyUsername);
if (legacyPassword != null) {
reg.setPassword(legacyPassword);
}
reg.setNickname(legacyNickname);
return null;
} catch (NotFoundException e) {
// Ok, nevermind.
Log.error("Not found while editing id " + registrationID, e);
return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
}
}
Aggregations