How To get Chat History from XMPP for ejabberd - xmpp

I am new to XMPP and ejabberd.
and I need to get chat history from ejabberd with XMPP.
I did Googling but didn't got satisfactory Answer.
Any link or idea will be great help.

You need to enable mod_mam module in ejabberd and implement XEP-0313: Message Archive Management.

According to the documentation here, you need to enable mod_mam in your configuration by adding mod_mam to the list of modules. You also need to specify some of the options as given in the documentation. For eg:
mod_mam:
default: roster
request_activates_archiving: true
assume_mam_usage: if_enabled
The default option is never, so you need to set the configuration accordingly.

Related

Smack 4.2 does not include jabber:client in outgoing stanzas

I am using Smack 4.2 to implement a fairly basic XMPP chat client. I am using Prosody XMPP server. Prosody is fairly strict about requiring "xmlns=jabber:client" in all incoming stanzas. Smack 4.2 does not include this attribute in its outgoing stanzas. I have tried extending Bind and Session stanzas, and I can make the connection work that way. But, now I am getting into joining rooms, and I really dont want to modify Smack's MUC code so that it can accept a modified Presence message.
Please help!!
I do not know why Prosody server requires it, there is nothing about it in official XEP-0045 standard https://xmpp.org/extensions/xep-0045.html#enter
Maybe there is a way to disable it at Prosody side somehow
Smack 4.3 does add xmlns to every outgoing IQ: https://github.com/igniterealtime/Smack/blob/master/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java#L518
So that at least solves the xmlns problem.

which one is required to fetch openfire messages MAM XEP-0313 or XEP-0136

I am new to OpenFire. I am working on a task to fetch openfire chat messages for date range. While googling i read in some post that it can be done using xep-0136 while other posts suggested MAM XEP-0313.
Can somebody please help me on this.Which plugin i need to install for this.
Thanks
Openfire has XEP-0136 support for a long time, while XEP-0363 support was added recently. So now you can use both protocols

Openfire MUC Through HTTP Requests

I've been searching high and low for a plugin that handles MUC administration through HTTP requests for Openfire. I've looked in the plugins and even in the community pages but I've had no luck so far.
Is there a plugin for this? Where can I find it?
If there are none, what are my alternatives aside from creating my own? Kinda like how ejabberd has mod_rest or even ejabberdctl.
If anyone can point me to the right direction, that would be really great!
I ended up creating a service for http requests and linking it to Openfire's MySQL back end. Easier and gives me more control.
Openfire have cache mechanism, Directly operate Mysql table have some issue, User information will delay before openfire cash flush.
I do it by xmpphp, and a new method to add muc room and room member by xmpp protocol, but i need user's password every operation.
If you check again the Plugin site from Openfire you will find out that there is a Plugin for that named "MUC Service". That do exactly what you need.
Here is the documentation: http://www.igniterealtime.org/projects/openfire/plugins/mucservice/readme.html

Can the xmpp pubsub service(XEP-0060) create a node when it receives a subscribe request?

We use XMPP XEP-0060 pub/sub feature to build a notification system.
According to XEP-0060, node can be created automatically when publishing.
My question is can it be created when subscribing?
If not, is there any alternative solution to implement this? (create node after subscribed)
Thanks
There's no inherent reason this can't be done transparently on the server-side. Prosody has a service-wide autocreate_on_subscribe option, for example.
Not via the XEP, as it doesn't specifically have that use case. You will have to either use a server that supports this natively, (as mentioned by #MattJ) or extend one to do so yourself, as most XMPP servers have some form of plugin/extension mechanism built in.
The caveat though, is that this is no longer to spec and you will be tied to a specific implementation so your application will not be portable.

Does JavaMail support server-push?

Does JavaMail support notification of new emails through server-push?
If yes, where is the documentation for that?
If no, is there a library that can do it?
You should be using IMAPFolder's idle function to issue the idle command to the server. That will then listen for events, such as a new mail or deleted mail. (See the IMAP spec to see what the messages look like). And you should be using a MessageCountListener to execute code when a number of emails in the mailbox change.
IMAP's idle function is exactly meant to imitate "push" functionality.
http://java.sun.com/products/javamail/javadocs/javax/mail/event/MessageCountListener.html
http://java.sun.com/products/javamail/javadocs/com/sun/mail/imap/IMAPFolder.html
Sorry I didn't post any code that shows how this is used. I didn't want to waste my time since there are many readily available examples on the internet if you search for this stuff.
But be forewarned, this method won't work for more than one IMAP account since the idle command blocks. Unless you want them all on different threads (bad idea).
A Store event listens for notifications issued by your backend store:
http://java.sun.com/products/javamail/javadocs/javax/mail/event/StoreEvent.html
But in my experience the java mail docs are so thin in places, that the best way of finding out what is going on, is to debug through the process yourself.
This is a great allround resource as well; the JavaMail FAQ :
http://www.oracle.com/technetwork/java/faq-135477.html