[ejabberd] how to pass custom messages to one of the clients in a chat

Badlop badlop at gmail.com
Fri May 26 13:31:35 MSK 2017


Do you mean, how a client can add to the Message stanza additional
information for the destination client?

<message id='15:593671' type='chat' to='user2 at localhost/tka'>
  <body>new move</body>
  <tic xmlns='urn:xmpp:tictatoe' current='J8'/>
</message>

In your case, maybe you want to use subelements of Tic, instead of an attribute.

<message id='15:593671' type='chat' to='user2 at localhost/tka'>
  <body>new move</body>
  <tic xmlns='urn:xmpp:tictatoe'>
    <move order='1' player='1' position='J8'/>
    <move order='2' player='2' position='A3'/>
    <move order='3' player='1' position='C1'/>
 </tic>
</message>

---
Badlop
ProcessOne

On 25 May 2017 at 10:13, Abhishek Ranjan <abhishek at blacklightsw.com> wrote:
> Hi,
>
> I have placed the erlang code of a simple tic-tac-toe game inside ejabberd,
> and
>
> I have made a set up using ejabberd and Pidgin where when user sends a
> message to the the other user in an xmpp chat I can see the game running in
> ejabberd live. But under this scenario the other user is just getting the
> message sent by the first user and nothing else. I wanted to send the
> receiving user with game state like a list or tuple also along with the
> message on Pidgin.
>
> what I have found till now is that the xmpp message stanza has a body
> attribute and a text attribute where the simple message sent by any user is
> present.
>
> But how can I inject a custom list or a tuple there to send it to the other
> user so that he can also see the game's state.
>
>
> Regards,
>
> Abhishek
>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>


More information about the ejabberd mailing list