sending nick name to openfire server - xmpp

I have built a chat application using strophe.js library with openfire sever. The problem I face is that ,I'm sending nickname from my application but i don't know whether openfire is picking this name and sending it to the other end. Is there a way to check nicknames of all the clients connected to openfire in admin console ?
This is the code for sending nickname,on each msg i push nickname.
code:
var rep = $msg({
to: JANE,
from: connection.jid
}).c("nick",{xmlns:'http://jabber.org/protocol/nick'}).t("anil");
connection.send(rep.tree());
in application logs i can see xml format lik this,
<body rid='630150802' xmlns='http://jabber.org/protocol/httpbind' sid='3045bed3'>
<message to='xyz.yyy.com' from='3045bed3#domaiin.com/3045bed3' xmlns='jabber:client'>
<nick xmlns='http://jabber.org/protocol/nick'>anil</nick>
</message>
</body>
if i send the nick name along with msg with body,
logs looks like this,
<body rid='862711207' xmlns='http://jabber.org/protocol/httpbind' sid='9f5d7b67'>
<message to='xyz.yyy.com' from='9f5d7b67#domain.com/9f5d7b67' type='chat' xmlns='jabber:client'>
<nick xmlns='http://jabber.org/protocol/nick'>anil<body>hello</body></nick>
</message>
</body>
nick name header ends after message body ends, but I want it to be like this:
<body>
<message>
<nick>anil</nick>
<body>"chat text"</body>
</message>
</body>
How do I close this nick name field before the body starts?

Related

XMPP: Client Receives Notifications Only From Resource Bound

I'm building an XMPP client in Python. The client needs to get notifications from multiple pubsubs. During session initialization, the client must bind to a resource.
For example, the client could bind to pubsub.sales.
<body rid="34314915"
sid="fe63566533334135bb2edf70b80a62743416b584"
xmlns="http://jabber.org/protocol/httpbind">
<iq id="KVwaFGvr+M53"
type="set"
xmlns="jabber:client">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>pubsub.sales</resource>
</bind>
</iq>
</body>
When I do that, the client only gets messages from the resource to which it is bound. How can I get notifications from other pubsubs?
The problem was related to presence. Here is what the client was sending:
<body rid="34314917"
sid="fe63566533334135bb2edf70b80a62743416b584"
xmlns="http://jabber.org/protocol/httpbind">
<presence xmlns="jabber:client">
<priority>-1</priority>
</presence>
</body>"""
When priority is negative, the client only receives notifications sent to the full JID. I set the priority to 7 and now the client gets notifications from the all pubsubs that are subscribed.

Notify facebook chat server that a thread has been seen

This is similar to Know when Facebook chats have been seen via API? but more or less the reverse.
I am using the fql "thread" object in combination with an XMPP chat to add some messaging/inbox functionality to a client side app. I notice if the user adds a message to a thread via XMPP, the "unseen" field in the fql "thread" is switched off. My question: Is there a way to send some form of message/element to chat.facebook.com that will switch the "unseen" field to off short of sending an actual message. Thanks!
I have tried;
<message type="chat" to="-fbid#chat.facebook.com">
<active xmlns="http://jabber.org/protocol/chatstates"></active>
</message>
Also tried to trick the service with;
<message type="chat" to="-fbid#chat.facebook.com">
<composing xmlns="http://jabber.org/protocol/chatstates"/>
</message>
Even tried to send a dummy message with empty body;
<message type="chat" to="-100004885119811#chat.facebook.com">
<body></body>
</message>

FIle downloading using HTTP

I am having trouble finding the correct XEP to use for this specific use case:
Initiator (e.g. iOS or Android device) uploads a file to a server and needs to notify the responder (in this case this would be a browser based client) to download the file from the location he just uploaded to using HTTP.
All the XEP's I have come across talk about streams or IBB/SOCKS5. I did found the following which could be useful but no updates since 2007:
http://xmpp.org/extensions/inbox/jingle-httpft.html
Am I overlooking something on an XEP which is in draft or final?
Either use XEP-0066: Out of Band Data, or just encode the link in a XEP-0071: XHTML-IM a element.
The first:
<message from='stpeter#jabber.org/work'
to='MaineBoy#jabber.org/home'>
<body>Yeah, but do you have a license to Jabber?</body>
<x xmlns='jabber:x:oob'>
<url>http://www.jabber.org/images/psa-license.jpg</url>
</x>
</message>
The second:
<message>
<body>here is a file [http://www.jabber.org/images/psa-license.jpg]</body>
<html xmlns='http://jabber.org/protocol/xhtml-im'>
<body xmlns='http://www.w3.org/1999/xhtml'>
<p>Here is a <a href='http://www.jabber.org/images/psa-license.jpg'>file</a></p>
</body>
</html>
</message>

Does Google Talk accept HTML formatted chats?

I have sent Google Talk chats that are HTML in the way described by this question: How do you send HTML formatted messages over XMPP with Node.JS?
However, Gtalk seems to just interpret it as text. Does Gtalk accept HTML formatted messages?
To respond to the comment below: it could be either the client or the server that Google runs which is interpreting it incorrectly.
Yes, Google Talk accepts HTML formatted messages. However, as you observed, it disregards the formatted text and only shows the plain text. According to the XHTML-IM XEP, every HTML message must be accompanied by a plain text message for compatibility with clients that do not support HTML formatted messages.
When I send this example message to the Google Talk client on my Windows machine (using Psi's XML input console)...
<message to="test#gmail.com/Talk.v10445D0E8B1">
<body>Wow, I&apos;m green with envy!</body>
<html xmlns='http://jabber.org/protocol/xhtml-im'>
<body xmlns='http://www.w3.org/1999/xhtml'>
<p style='font-size:large'>
<em>Wow</em>, I&apos;m <span style='color:green'>green</span>
with <strong>envy</strong>!
</p>
</body>
</html>
</message>
... I just see the text Wow, I'm green with envy!.
When I send the same message to my Psi client logged in to Google Talk, I receive...
<message from="test#jabber.org/Ben-PC" to="test#gmail.com">
<body>Wow, I'm green with envy!</body>
<html xmlns="http://jabber.org/protocol/xhtml-im">
<body xmlns="http://www.w3.org/1999/xhtml">
<p style="font-size:large">
<em>Wow</em>, I'm <span style="color:green">green</span>
with <strong>envy</strong>!
</p>
</body>
</html>
</message>
It was not stripped from the HTML, exactly as I expected (servers should not change the contents of messages). It shows as , so it looks like Psi does support formatted text.
The way to test for capabilities is using Service Discovery. If I send...
<iq to='test#gmail.com/Talk.v10445D0E8B1' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
... I receive...
<iq from="test#gmail.com/Talk.v10445D0E8B1" type="error" to="test#jabber.org/Ben-PC">
<query xmlns="http://jabber.org/protocol/disco#info"/>
<error type="cancel" code="501">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
... which means the Google Talk client does not support Service Discovery. We have to rely on the observation that HTML message text is ignored by the Google Talk client and server.

Ejabberd Stanza Execution Order (Grouped together)

I am trying to find out the execution order of XMPP stanzas, I am using Strophe + Ejabberd and if I send a request like this.
<body rid='someRID' xmlns='http://jabber.org/protocol/httpbind' sid='someSID'>
<message to='someUser#someDomain' type='chat' xmlns='jabber:client'>
<body>123</body>
</message>
<presence type='unavailable' xmlns='jabber:client' />
</body>
Presence stanzas is always executed first and message stanza later. Is there a way to specify order or something like that so that Message stanza is executed first and Presence later.
Thanks
It's a bug in the server. RFC 6120, Section 10.1 says:
An XMPP server MUST ensure in-order processing of the stanzas and
other XML elements it receives over a given input stream from a
connected client or remote server.