Reputation: 9288
I don't understand how to determine the sender of a message sent via jabber protocol. If I get message then xml looks like that:
<message from="[email protected]/QIP" to="[email protected]/Talk.v10576F328E0" stime="1291746351249" xml:lang="ru" type="chat" id="qip_45">
<body>Hi. I'm fine.</body>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
There are from and to attributes.
If I send message then xml looks like that:
<message to="[email protected]" type="chat" id="42">
<body>Hello. How are you?</body>
<active xmlns="http://jabber.org/protocol/chatstates"/>
</message>
There is no attribute from. How does a client know of who sent him a message?
Sorry for my English. Thanks.
Upvotes: 0
Views: 451
Reputation: 15302
The XMPP server is required to either validate the 'from' attribute if one is specified (to verify that the sender is not attempting to impersonate another client) or to add a 'from' attribute if one was not specified. In general, you can omit the 'from' and assume that the server will attach one based on the JID of the client connection.
See RFC 3920 (link is to the "XML Stanzas" section) for the precise rules.
Upvotes: 5