Receiving own user information

43 views
Skip to first unread message

wpeters1981

unread,
Dec 21, 2009, 11:36:49 AM12/21/09
to jabber-net
I am trying to find out my own Name and roster group that i belong to.
Just need the same information i receive true the Presencemanager for
all of the roster users but i need to get this information for myself
as wel. (nickname on server: openfire server Name field and roster
group i am a member of.

Anyone know how to ?

madkoala

unread,
Jan 3, 2010, 6:32:44 AM1/3/10
to jabber-net
You can use vcard to get user's information generally.
See code snippet below:

// Query vcard
private void QueryVCard(jabber.protocol.iq.Item ri)
{
jabber.protocol.iq.VCardIQ vcard = new jabber.protocol.iq.VCardIQ
(jClient.Document);
vcard.To = ri.JID; // You can set this JID to your own JID.
vcard.Type = IQType.get;

jClient.Write(vcard);
}

// IQ Handler - handle vcard IQ.
private void jClient_OnIQ(object sender, IQ iq)
{
XmlElement query = iq.Query;

if (query is VCard)
{
iq = iq.GetResponse(jClient.Document);
VCard vcard = iq.Query as VCard;

// Now you get vcard information of your own.
}
return;

Joe Hildebrand

unread,
Jan 4, 2010, 3:03:28 AM1/4/10
to jabbe...@googlegroups.com
Even better would be to use the IQTracker.

jClient.Tracker.BeginIQ(vcard, new IqCB(OnVcard));

This will call back OnVcard exactly once. Check the iq object that is passed in for null -- that can happen on timeout.

> --
>
> You received this message because you are subscribed to the Google Groups "jabber-net" group.
> To post to this group, send email to jabbe...@googlegroups.com.
> To unsubscribe from this group, send email to jabber-net+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jabber-net?hl=en.
>
>

madkoala

unread,
Jan 5, 2010, 2:28:20 AM1/5/10
to jabber-net
I didn't know that. It would be much better.
Thank you for announcing.

wpeters1981

unread,
Jan 5, 2010, 7:46:13 PM1/5/10
to jabber-net
i already used this but this will only work if the user has Vcard
information stored on the server.
By default the Openfire users do not have Vcard information until they
use a client and edit there profile.
So just for normal roster users i receive their JID UserName and
groupname from the server, i want to receive the same information for
myself.
So without using vcard how can i query for my own information Other
users receive on their roster about myself?

Also how can i receive roster information about someone that is not in
my roster? I hafve situations like this:
User A has in their roster user B and C
User B has in their roster user A
User C has in their roster user A
User A creates chat room and invites user B and C to the room
when these users join the room they miss the nicknames of the users
they normally dont have in their roster.
Where normaly these users will be found in their RosterTree , in
combination with their UserName setting, they now only have the JID
user and therefore do not have the correct names showing in the chat
room.

Which is the same problem as with my own nickname. how can i find the
usernames defined on the server (outside vcard) for people not in your
roster?

Reply all
Reply to author
Forward
0 new messages