Search in sources :

Example 1 with ProbePacket

use of net.sf.kraken.protocols.xmpp.packet.ProbePacket in project Openfire by igniterealtime.

the class XMPPListener method entriesAdded.

public void entriesAdded(Collection<String> addresses) {
    for (String addr : addresses) {
        RosterEntry entry = getSession().conn.getRoster().getEntry(addr);
        getSession().getBuddyManager().storeBuddy(new XMPPBuddy(getSession().getBuddyManager(), entry.getUser(), entry.getName(), entry.getGroups(), entry));
        // Facebook does not support presence probes in their XMPP implementation. See http://developers.facebook.com/docs/chat#features
        if (!TransportType.facebook.equals(getSession().getTransport().getType())) {
            //ProbePacket probe = new ProbePacket(getSession().getJID()+"/"+getSession().xmppResource, entry.getUser());
            ProbePacket probe = new ProbePacket(null, entry.getUser());
            Log.debug("XMPP: Sending the following probe packet: " + probe.toXML());
            try {
                getSession().conn.sendPacket(probe);
            } catch (IllegalStateException e) {
                Log.debug("XMPP: Not connected while trying to send probe.");
            }
        }
    }
}
Also used : ProbePacket(net.sf.kraken.protocols.xmpp.packet.ProbePacket) RosterEntry(org.jivesoftware.smack.RosterEntry)

Example 2 with ProbePacket

use of net.sf.kraken.protocols.xmpp.packet.ProbePacket in project Openfire by igniterealtime.

the class XMPPSession method syncUsers.

private void syncUsers() {
    for (RosterEntry entry : conn.getRoster().getEntries()) {
        getBuddyManager().storeBuddy(new XMPPBuddy(getBuddyManager(), entry.getUser(), entry.getName(), entry.getGroups(), entry));
        // Facebook does not support presence probes in their XMPP implementation. See http://developers.facebook.com/docs/chat#features
        if (!TransportType.facebook.equals(getTransport().getType())) {
            //ProbePacket probe = new ProbePacket(this.getJID()+"/"+xmppResource, entry.getUser());
            ProbePacket probe = new ProbePacket(null, entry.getUser());
            Log.debug("XMPP: Sending the following probe packet: " + probe.toXML());
            try {
                conn.sendPacket(probe);
            } catch (IllegalStateException e) {
                Log.debug("XMPP: Not connected while trying to send probe.");
            }
        }
    }
    try {
        getTransport().syncLegacyRoster(getJID(), getBuddyManager().getBuddies());
    } catch (UserNotFoundException ex) {
        Log.error("XMPP: User not found while syncing legacy roster: ", ex);
    }
    getBuddyManager().activate();
    // lets repoll the roster since smack seems to get out of sync...
    // we'll let the roster listener take care of this though.
    conn.getRoster().reload();
}
Also used : UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) ProbePacket(net.sf.kraken.protocols.xmpp.packet.ProbePacket)

Aggregations

ProbePacket (net.sf.kraken.protocols.xmpp.packet.ProbePacket)2 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)1 RosterEntry (org.jivesoftware.smack.RosterEntry)1