Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Openfire chat history on Android device with aSmack?

I am developing a chatting application, where user will chats with one of the domain expert's group member. user uses my android app and domain expert uses spark web for chatting. I made Openfire setup and Spark web setup and developed Android chatting app with aSmack library. My app users are able to chat with domain expert. So far it is fine. Now I would like show chat history of user with any or specific expert on Android device. After surfing web, I am able to install Monitoring Service plugin for my open fire server, which is showing chat history of user on Admin side as shown below.enter image description here

Now I would like to show this history in my Android app, How can I achieve this. Any suggestions, most welcome. Am I moving in the right direction? or there any simple ways to do my job? Any info on where this chat history will be stored in Open fire Database, so that I can make SQL queries and get data using webservices is most appreciated.

like image 309
Ganesh K Avatar asked Jan 27 '13 06:01

Ganesh K


3 Answers

You can get groupchat history by using following code:

DiscussionHistory history = new DiscussionHistory();
history.setMaxStanzas(0);


multiUserChat.join("username", "password", history, SmackConfiguration.getPacketReplyTimeout());
like image 86
BMM Avatar answered Sep 28 '22 18:09

BMM


If you are using MUC (XEP-45) then you can request the discussion history when entering a MUC. See XEP-45 7.2.14 Discussion History. When using (a)Smack, this mean that you have to use MultiUserChat.join(String nickname, String password, DiscussionHistory history, long timeout) to get the History.

like image 37
Flow Avatar answered Sep 28 '22 16:09

Flow


I added Monitoring service Plugin to openfire, which created some additional tables to store chat conversation details between any 2 accounts. Monitoring service also gives you data base query statics. From admin panel data base statics, I am able to get in which tables, which columns this chat details got stored. Also required queries. using the above info, My back end team has written web services to get required info. This is the way I implemented.

like image 38
Ganesh K Avatar answered Sep 28 '22 18:09

Ganesh K