Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
sofakng #1
Member since Jan 2007 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: How can I send a message to a conference?
I've successfully joined a conference and can read messages from the conference room, but I can't seem to send any messages to the conference room.

Here's how I'm joining the room:   (and this works)
  muc.JoinRoom(new Jid("groupchat@test.hcvlb21"), "TheyCallHimJimbo");

...but when I try to send a message like this it doesn't work:
  xmpp.Send(new agsXMPP.protocol.client.Message("groupchat@test.hcvlb21l", "Hello!"));

Also, when I join the conference room (eg. muc.JoinRoom), the server sends me about 50 lines of chat log regardless of their date.  Since I'm creating a bot that will respond to certain commands, this chat log is causing me problems.

How can I detect this initial chat log being sent as opposed to "new" messages being sent?

Thanks for your help!
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

you send groupchat messages like normal or chant messages. You send them to the Jid of the conference room. The message type must be groupchat.

  1. agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message("groupchat@test.hcvlb21l", "Hello!");
  2. msg.Type = MessageType.groupchat;
  3. xmpp.Send(msg);

The messages you get after you joined the room is the room history. Administrators of a room can configure this setting. You can also disable this history when joining a room, or only request a maximum of history items. Of course the server must support this feature.
See http://www.xmpp.org/extensions/xep-0045.html#enter-manageh…

Alex
Alexander Gnauck
AG-Software
Avatar
sofakng #3
Member since Jan 2007 · 3 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the reply!

How would I setup agsXMPP to request that no history lines are sent upon joining?

Thanks!
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You have to join the room with XML like this:

  1. <presence from='hag66@shakespeare.lit/pda' to='darkcave@macbeth.shakespeare.lit/thirdwitch'>
  2.  <x xmlns='http://jabber.org/protocol/muc'>
  3.     <history maxchars='0'/>
  4.  </x>
  5. </presence>

the MUC Manager doesn't support this currently. So you have to build this packet in your code or extend the MucManager.

Alex
Alexander Gnauck
AG-Software
Avatar
sofakng #5
Member since Jan 2007 · 3 posts
Group memberships: Members
Show profile · Link to this post
I'm sorry, but I'm still not sure how I would do this...

Would I just need to do this: (?)

xmpp.Send("<presence from='hag66@shakespeare.lit/pda' to='darkcave@macbeth.shakespeare.lit/thirdwitch'><x xmlns='http://jabber.org/protocol/muc'><history maxchars='0'/></x></presence> ");

...and that is all?   ...or do I need to do something else?

Thanks again for your help!

- John
Avatar
Alex #6
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you could do that (at least if you replace the from and to jids), but this is no good idea.

You should take a look at the JoinRoom function in the source code. This shows you how you can create and send such packets.

Alex
Alexander Gnauck
AG-Software
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 SDK Support RSS