Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
DiWorm #1
Member since Jan 2015 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: How to get Jabber ID of sender with admin privilegies in jabber-conference?
Hello!

I try to write simple jabber-bot to my jabber-conference and I cant get JabberID of sender (bot have admin privilegies on chanel)

How can I get it?

My simple trash code (C#) :)
http://pastebin.com/tT6GNB8H

P.S. I trying like this

  1. string test = msg.From.User;

but getting "gamecoma", but this is JID of bot and conference name.


Code like this:

  1. string test = msg.ToString();
  2. xmpp.Send(new Message(Room, MessageType.groupchat, SenderNickname + ": " + test));

Show me
  1. <message xmlns="jabber:client" to="gamecoma@jabber.ru/456643064" xml:lang="ru" type="groupchat" from="gamecoma@conference.jabber.ru/DiWorm" stime="1421735225349"><body>?????: </body></message>

But JID of DiWorm like wormerrr@qip.ru
This post was edited 3 times, last on 2015-01-20, 09:47 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this real Jid comes with the presence.
But only when the room is configured to send it to anybody or users with a given role, eg owners and admins.

When the room is configured correct then the packet looks like the following:
  1. <presence
  2.     from='coven@chat.shakespeare.lit/thirdwitch'
  3.     id='17232D15-134F-43C8-9A29-61C20A64B236'
  4.     to='crone1@shakespeare.lit/desktop'>
  5.  <x xmlns='http://jabber.org/protocol/muc#user'>
  6.     <item affiliation='none'
  7.           jid='hag66@shakespeare.lit/pda'
  8.           role='participant'/>
  9.  </x>
  10. </presence>

there you have the X-Tag in the presence which includes an item with the Jid attribute.

When the tag, item and Jid is there then the following code retrieves it:

  1. pres.MucUser.Item.Jid

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:
Forum: agsXMPP RSS