Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
I need get the group of the loged user
Avatar
Marco33 #1
Member since Jan 2011 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Geting Group of an user
Hello i am trying to get the loged person group, but i failed.

Exist an way to get that information on the moment of the login?

Thanks
This post was edited on 2011-01-26, 00:31 by Marco33.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
sorry, but I don't understand your question, can you please elaborate?
Avatar
Marco33 #3
Member since Jan 2011 · 6 posts
Group memberships: Members
Show profile · Link to this post
When i connect with the server using acc/pass of an user i get back the conection  and the Jid of the user, my problem is, i need the list group of that user to. How i get that information?
There´s a way?

Thanks for the attention

Sorry for the bad english
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get all your contacts in the OnRosterItem event.

here is a code example which gets the group of a contact.
  1. private void xmppClient_OnRosterItem(object sender, Matrix.Xmpp.Roster.RosterEventArgs e)
  2. {
  3.     DisplayEvent(string.Format( "OnRosterItem\t{0}\t{1}", e.RosterItem.Jid, e.RosterItem.Name ));
  4.  
  5.     if (e.RosterItem.Subscription != Subscription.remove)
  6.     {
  7.         // set a default group name
  8.         string groupname = "Contacts";
  9.  
  10.         // id the contact has groups get the 1st group. In this example we don't support multiple or nested groups
  11.         // for contacts, but XMPP has support for this.
  12.         if (e.RosterItem.HasGroups)
  13.             groupname = e.RosterItem.GetGroups()[0];
  14.     }
  15. }

Alex
Avatar
Marco33 #5
Member since Jan 2011 · 6 posts
Group memberships: Members
Show profile · Link to this post
Well thath i made, but on the contat group i can´t get the group of the person loged.
I need the group of the person who is now entering

Thanks for the attention
and fast support = )
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
sorry but I don't understand what you are looking for.
Avatar
Marco33 #7
Member since Jan 2011 · 6 posts
Group memberships: Members
Show profile · Link to this post
When I connect to the server, I need to get the user group that is connecting.
At the moment I can only get the group of users who are contacts of the user who is entering.

Got to be clear?

Thank you for your support.
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the user who is connecting has no group.

Because this user can be a contact of n other users. And it up to every user to organize the contact groups. So this user can be in group A at user1, group B at user2 and group C at user3....
Avatar
Marco33 #9
Member since Jan 2011 · 6 posts
Group memberships: Members
Show profile · Link to this post
Is there a way to request this list of groups of that user?
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no, you can only get all your own contact groups.
You could write an own extensions and ask your contacts to which group you belong. But only when the contacts are online.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: