Search in sources :

Example 1 with RosterEntry

use of org.jivesoftware.smack.RosterEntry 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 RosterEntry

use of org.jivesoftware.smack.RosterEntry in project intellij-plugins by JetBrains.

the class JabberSyncUserMessage method send.

public boolean send(User user) {
    final JabberTransport jabberTransport = JabberTransport.getInstance();
    if (jabberTransport != null && jabberTransport.isOnline()) {
        final Roster roster = jabberTransport.getFacade().getConnection().getRoster();
        final RosterEntry userEntry = roster.getEntry(myEvent.getUser().getName());
        if (userEntry != null) {
            jabberTransport.runIngnoringUserEvents(() -> processEvent(jabberTransport.getFacade(), userEntry));
        }
        return true;
    }
    return false;
}
Also used : Roster(org.jivesoftware.smack.Roster) RosterEntry(org.jivesoftware.smack.RosterEntry)

Aggregations

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