Does Facebook XMPP Chat server implement message archiving? (XEP-0136) - facebook

I'm working with Facebook's XMPP chat service, and I need to fetch older messages from the server. Can I use XEP-0136 on the client to do that or is there another more used way?

Just figured out myself Facebook does not implement that feature. I got this reply sending an IQ:
<iq xmlns='jabber:client' from='chat.facebook.com' to='my.facebook.username#chat.facebook.com/Mac-Pro-di-Michele_65563c5f_4D689E59FB8A5' type='error' id='pref1'>
<pref xmlns='urn:xmpp:archive'/>
<error code='501' type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>

there's no way of knowing and most likely it does not support because facebook is not xmpp compliant. majority of xmpp servers do not support this feature.

Related

How can I tell the difference between the JID of a user and a JID of MUC?

Suppose I have two JIDs:
JID 1: bob#example.com
JID 2 room#chat.example.com
JID 2 clearly refers to the chat server, but the chat server isn't always going to have the word chat or conference in it.
Is there a way, using the Smack libraries, to tell which one is which?
You cannot tell by looking at the JID. You have to keep enough context in a given protocol exchange to know what you are talking to.
Typically on startup, a client will send a disco#items query to the server:
<iq type='get'
to='shakespeare.lit'
id='items1'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
to find all of the local services, then send a disco#info query to each of those services to find out more about the service. Once you find a MUC server:
<iq from='chat.shakespeare.lit'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity
category='conference'
name='Shakespearean Chat Service'
type='text'/>
<feature var='http://jabber.org/protocol/muc'/>
</query>
</iq>
you know that all of the JIDs that include this domain name (chat.shakespeare.lit in the above example) are associated with MUC rooms.
A user JID in a MUC will (should) have the username at the end and will look like:
roomname#conference.example.com/username

Does Facebook Chat XMPP support XEP-0184 Extension?

From last two days, I have been trying to find out why the hell, Facebook is not sending the message receipts. (same like "Seen" feature in Web Interface).
This is XMPPMessage I am sending to Facebook Chat XMPP Server. But Facebook is in no mood to return the receipt or acknowledgement of the message. If you can guys can guide me, it will be really helpful.
<message type="chat" to="-XXXXXXXXX#chat.facebook.com" id="E32DB9A2-8D0F-4BEC-87DF-299102CC4ABF"><body>Helll</body><active xmlns="http://jabber.org/protocol/chatstates"/><request xmlns="urn:xmpp:receipts"/></message>

Whats the best way to extend XMPP Presence stanza

We were using openfire 3.7.1 as our XMPP server, and we wanted to extend the Presence stanza to include some extra information like:
<presence from="you#MyServer.com">
<body>...</body>
<custom_element>
<custom_data/>
</custom_element>
</presence>
Could you please show me some pointers as what would be a better approach to do so? E.g., should I modify or extend some XMPP schema so that openfire will process the above presence packet as usual (currently if I send message like above, openfire seems not taking it as a Presence packet)? And should I create a plugin to intercept all packets so as to process our custom elements?
Thanks in Advance!
This is how it is normally done:
<presence from="you#MyServer.com">
<x xmlms="http://mycompany.com/mycustomnamespace1>
<custom_data/>
</x>
</presence>
Openfire will route such a packet without any problems.
You only need a server plugin when the server has to process any action on this custom elements. When the server should route the presence only to your contacts then nothing is required on the server.

Google chat server archive (XEP-0136)

I am looking for a way how to retrieve archive of chat messages from google server via using XEP-0136 standard, but I got these results just trying to ask for the feature.
Request:
<iq type="get"><pref xmlns="urn:xmpp:archive"/></iq>
Response:
<iq xmlns="jabber:client" type="error" to="myEmail#gmail.com/9FF72CA7">
<pref xmlns="urn:xmpp:archive"/>
<error code="501" type="cancel">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
So it looks like google does not implement this feature, but is it true? I don't think so.
The same happened with trying to set invisibility which is definitely supported by Google server.
Request:
<iq type="set" id="invisible1" from="myEmail#gmail.com/00230F07">
<query xmlns="jabber:iq:privacy">
<active name="invisible"/>
</query>
</iq>
Response:
<iq xmlns="jabber:client" type="error" id="invisible1" to="myEmail#gmail.com/00230F07">
<query xmlns="jabber:iq:privacy">
<active name="invisible"/>
</query>
<error code="501" type="cancel">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
So probably I am doing something wrong. Any help will be appreciated.
I've also been looking into this for quite some time now. It appears, as JoSo already pointed out, that there is no way to access the chat history through any XMPP standard. The only interaction with the chat history that is possible via XMPP is enabling or disabling Off-the-Record through a non-standard XMPP extension.
That being said, the official Google Chat clients such as the Chrome extension, their kind of abandoned Windows client and the Android application are able to sync chats. Thus, there must be at least some way to access the chat history from the outside. However, there is no documentation on this feature anywhere and all questions in the Google forums go unanswered. Quite a few people guess that it might be implemented through XEP-0136 as it would make sense, but without any official word it might also be a completely proprietary XMPP extension.
For invisibility, it is supported but Google again goes their own way instead of using the XEP-0016 extension. At least their way is documented here in this case. Thus, just use their google:shared-status namespace to set yourself invisible.
That all being said, trying out any XMPP extensions with Google's chat servers is a real pain as many features are proprietary, use their own awkward extensions instead of the standard or simply are not implemented. At least the documentation for the hand-full of public extensions is quite good.
In case you're looking for official answers from Google, you're also quite of luck. Most of the Google Talk features of third party clients such as Pidgin have been reverse engineered by the developers. Before you ask, their audio/video and filetransfer extensions are also quite some miles off the current standard.
Google does safe your chat history. But it is stored in your Google Mail account and not on the XMPP Server, thus XEP-0136 is not available.
As for the status. You are trying to set privacy which is different from presence status as defined in rfc3921 (See http://xmpp.org/rfcs/rfc3921.html). Google does not implement privacy as defined in XEP-0126.
Invisibility is actually set through Google-specific "shared status" extension.
Message retrieval is not exposed through XMPP.

Problem creating a chat room with XMPP in an iOS app

I have an iphone app where I want to use chat rooms. I've installed an XMPP server (ejabberd) and downloaded the XMPP framework for iOS from google code (http://code.google.com/p/xmppframework/). The server and client work as expected, since I'm able to log in and send chat messages between two users.
However, when I try to create a chat room using the createOrJoinRoom method of the XMPPRoom class (in XEP-0045), I don't get any reply from the server and the chat room is not created.
I've debugged to see what kind of package is sent to the server and it looks like this:
<presence from="test2#beta.bogus.net/mynick" to="muumit15#conference.beta.bogus.net">
<x xmlns="http://jabber.org/protocol/muc"/>
</presence>
I get no error message back but the chat room (muumit15) is not created. At the same time I can use e.g. Adium client to create a chat room and it succeeds. The server has been configured so that every user has a right to create chat rooms.
Any ideas? I even tried sniffing the TCP/IP traffic sent by the Adium client but that was encrypted/compressed/binary so I couldn't see what kind of packages it is sending.
See section 7.2.2 of XEP-0045, particularly Example 18:
<presence
from='hag66#shakespeare.lit/pda'
to='coven#chat.shakespeare.lit/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
Note that the to address MUST contain a resource, and yours doesn't. The resource is the string after the /, which is used as your nickname in the room. For more information on the XMPP address format, see RFC 6122.