Search in sources :

Example 11 with NotFoundException

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
    }
}
Also used : MonitoringPlugin(org.jivesoftware.openfire.plugin.MonitoringPlugin) ConversationManager(org.jivesoftware.openfire.archive.ConversationManager) NotFoundException(org.jivesoftware.util.NotFoundException)

Example 12 with NotFoundException

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.
        }
    }
}
Also used : Element(org.dom4j.Element) NotFoundException(org.jivesoftware.util.NotFoundException)

Example 13 with NotFoundException

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());
}
Also used : JID(org.xmpp.packet.JID) NotFoundException(org.jivesoftware.util.NotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException)

Example 14 with NotFoundException

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;
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) JID(org.xmpp.packet.JID) Registration(net.sf.kraken.registration.Registration) NotFoundException(org.jivesoftware.util.NotFoundException) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) TransportSession(net.sf.kraken.session.TransportSession) KrakenPlugin(net.sf.kraken.KrakenPlugin)

Example 15 with NotFoundException

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");
    }
}
Also used : PluginManager(org.jivesoftware.openfire.container.PluginManager) Registration(net.sf.kraken.registration.Registration) NotFoundException(org.jivesoftware.util.NotFoundException) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) KrakenPlugin(net.sf.kraken.KrakenPlugin)

Aggregations

NotFoundException (org.jivesoftware.util.NotFoundException)67 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)29 Element (org.dom4j.Element)17 JID (org.xmpp.packet.JID)15 ArrayList (java.util.ArrayList)10 Connection (java.sql.Connection)8 PreparedStatement (java.sql.PreparedStatement)8 SQLException (java.sql.SQLException)8 ResultSet (java.sql.ResultSet)7 TransportSession (net.sf.kraken.session.TransportSession)7 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)6 Avatar (net.sf.kraken.avatars.Avatar)5 TransportBuddy (net.sf.kraken.roster.TransportBuddy)5 Packet (org.xmpp.packet.Packet)5 Date (java.util.Date)4 MultiUserChatServiceImpl (org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl)4 UserRequest (org.jivesoftware.xmpp.workgroup.request.UserRequest)4 KrakenPlugin (net.sf.kraken.KrakenPlugin)3 Registration (net.sf.kraken.registration.Registration)3 UnauthorizedException (org.jivesoftware.openfire.auth.UnauthorizedException)3