powered by Jive Software

How to get the jabberID of a person in the contact list

I’m writing a plugin which opens a browser window which will interact with a php script. Basically you will right click on a person in the contacts list and click a menu item, which calls a browser function i’ve made. This part works fine accept I cannot figure out how to get that person’s jabberID to pass it to my php script. I will also need to get the jabberID of the client. So in other words, Right click on a contact, click menu item, small browser window pops up and loads page.php?me=myjabberID&you=their_jabberID

Thanks in advance!

Hi Jon,

Below is a snippet of code from the V2 Spark Whiteboard:

final ContactList contactList = workspace.getContactList();       final Action whiteboardAction = new AbstractAction() {
         public void actionPerformed(ActionEvent actionEvent) {
            Iterator contactListIter = contactList.getSelectedUsers().iterator();
            if (contactListIter.hasNext()) {
               ContactItem contactItem = (ContactItem) contactListIter.next();
               //we need to get the contact's jid that includes their resource so we can send them the invitation iq packet
               showWhiteboardInvite(PresenceManager.getPresence(contactItem.getJID()).getFrom());
            }
         }
      };

Hope that helps,

Ryan

I’ve modified the code in to my plugin, yet I’m getting the following in the error.log

xception in thread “AWT-EventQueue-0” java.lang.NoSuchMethodError: org.jivesoftware.spark.ui.ContactItem.getFullJID()Ljava/lang/String;

at org.jivesoftware.spark.examples.ExamplePlugin$2.actionPerformed(ExamplePlugin.j ava:107)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.AbstractButton.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Hi Jon,

The getFullJID method was replaced with the getJID method with the 2.5.0 release of Spark. I would suggest you update your development environment to the latest if you are planning to use your plugin with Spark 2.5.x.

Hope that helps,

Ryan

My spark source is 2.5.8 that I’ve modified for our internal company client, and I’m using the latest Sparkplug that was on the download page

The Spark related libraries that are included with the sparkplug kit are very old (version 2.0.7). You’ll want to update the Spark/Smack libraries in your build environment to use the latest version.

Cheers,

Ryan

Thanks, got it!!