8

Please can anyone show me the exact code for retrieving a chat history from openfire server to android client application using asmack library and XMPP protocol? In my openfire server I was enable merged Monitoring service/Open archive service and all messages successfully stored into database. But I don't know how those messages (chat history) retrieve to my client application which is building in ANDROID. What type of chat I need is one-to-one user chat (not group chat).

I am success ed to getting group chat history with help of this but i want to retrieve one to one chat history

Please if anyone can write me a code, I'd be very grateful.

Thanks!

Mahi
  • 1,754
  • 2
  • 16
  • 37
  • Why do you think server keeps such history? – Okas Nov 25 '14 at 12:34
  • @OKas Currently i have installed monitory plugin which is storing chat conversation at sever side but i don't know how to retrieving – Mahi Nov 25 '14 at 12:37
  • I'm afraid standard xmpp protocol does not provide what you want. You have to implement some custom solution for accessing monitoring plugin data. – Okas Nov 25 '14 at 12:38
  • @Okas So we need to create custom API's for retrieve user's chat history ?? – Mahi Nov 25 '14 at 14:25
  • I found specification XEP-0136: Message Archiving http://xmpp.org/extensions/xep-0136.html . This specification is able to send message history to client and in openfire it is already implemented as Monitoring plugin. – Mahi Nov 26 '14 at 05:46
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65665/discussion-between-mahi-singh-and-okas). – Mahi Nov 26 '14 at 06:01
  • @Montu you got any solution for this? – Yog Guru Apr 07 '15 at 10:36
  • @Yog Guru open fire don't provide one to one chat history – Mahi Apr 08 '15 at 06:14
  • @Montu Didn't you think this is partiality ;) ? it provides history for iPhone but not for android. :( – Yog Guru Apr 09 '15 at 05:46

1 Answers1

0
public class XMPPManager implements PacketListener {
........

   void connect(){
   //Init connection configuration
       ......
   XMPPTCPConnection xmppTCPConnection = new XMPPTCPConnection(connectionBuilder.build());
   xmppTCPConnection .connect();
   xmppTCPConnection.addSyncStanzaListener(this, null);
 }

 @Override
 public void processStanza(Stanza packet) {
   //Log.d("Log","Body - " + message.getBody());
 }
}
Anup
  • 21
  • 1
  • 3