Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] How could I obtain the hostname ?

Hi Cristiano,

On 7/28/2011 5:54 AM, Cristiano Gavião wrote:
Hi,

I'm digging a little bit on the presence api...

Now I could get the list of all contacts of my user using Adapter... very interesting...:

XMPPContainer containerXMPP = (XMPPContainer) client.getContainer().getAdapter(XMPPContainer.class);
        IRoster roster = containerXMPP.getRosterManager().getRoster();
        Collection rosterList = roster.getItems();
for (Iterator iterator = rosterList.iterator(); iterator.hasNext();) {
            RosterItem roster_item = (RosterItem) iterator.next();
System.out.println(roster_item.getRoster().getUser().getID());
        }


Actually, it's preferred that you use the presence API to use the roster...e.g.

IPresenceContainerAdapter containerAdapter = (IPresenceContainerAdapter) client.getContainer().getAdapter(IPresenceContainerAdapter.class);

IRosterManager rosterManager = containerAdapter.getRosterManager();
IRoster roster = rosterManager.getRoster();
etc.

The reason this is preferable is that the presence API is separate from XMPP...and can/is implemented by other presence protocols. So clients can use this presence API without regard to the underlying protocol that implements it.

But I couldn't find the hostname of the contacts.

How could I obtain the hostname of a contact user ?

For any contact user's ID (contactUserID), you can do this:

IFQID fullyQualifiedID = (IFQID) contactUserID.getAdapter(IFQID.class);

String fullyQualifiedName = fullyQualifiedID.getFQName();

I'm going out of reach of the Internet for a couple of days, so I may not respond as fast as I typically do.

Thanks,

Scott




cheers

Cristiano
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top