Search in sources :

Example 6 with ContactGroup

use of org.jivesoftware.spark.ui.ContactGroup in project Spark by igniterealtime.

the class NotificationPlugin method registerListener.

private void registerListener() {
    preferences = SettingsManager.getLocalPreferences();
    // Iterate through all online users and add them to the list.
    ContactList contactList = SparkManager.getWorkspace().getContactList();
    for (ContactGroup contactGroup : contactList.getContactGroups()) {
        for (ContactItem item : contactGroup.getContactItems()) {
            if (item != null && item.getJID() != null && item.getPresence().isAvailable()) {
                String bareJID = XmppStringUtils.parseBareJid(item.getJID());
                onlineUsers.add(bareJID);
            }
        }
    }
    // Add Presence Listener
    SparkManager.getConnection().addAsyncStanzaListener(this, new StanzaTypeFilter(Presence.class));
}
Also used : StanzaTypeFilter(org.jivesoftware.smack.filter.StanzaTypeFilter) ContactItem(org.jivesoftware.spark.ui.ContactItem) Presence(org.jivesoftware.smack.packet.Presence) ContactList(org.jivesoftware.spark.ui.ContactList) ContactGroup(org.jivesoftware.spark.ui.ContactGroup)

Aggregations

ContactGroup (org.jivesoftware.spark.ui.ContactGroup)6 ContactItem (org.jivesoftware.spark.ui.ContactItem)5 ContactList (org.jivesoftware.spark.ui.ContactList)4 MouseEvent (java.awt.event.MouseEvent)3 ActionEvent (java.awt.event.ActionEvent)2 AbstractAction (javax.swing.AbstractAction)2 Action (javax.swing.Action)2 JMenu (javax.swing.JMenu)2 JMenuItem (javax.swing.JMenuItem)2 JPopupMenu (javax.swing.JPopupMenu)2 StanzaTypeFilter (org.jivesoftware.smack.filter.StanzaTypeFilter)2 ContextMenuListener (org.jivesoftware.spark.plugin.ContextMenuListener)2 BorderLayout (java.awt.BorderLayout)1 Component (java.awt.Component)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1