1

I'm new to openfire. I have a chat application running nodejs. I have a separate Chat server with openfire installed.

  1. I wanted to know how chat history for a chat group is handled?
  2. How to progressively load chat history in the client from openfire server? Should I write a custom routine for the same ? Does Monitoring plugin provide any for the same
  3. What is format is which chats are archived ? Is there a way to retrieve them in any given format ?
  4. Are there any APIs that can be used to access the database ?(I doubt it tho)

I have installed Monitoring Plugin for the same. However I'm not able to find any documentation for openfire or monitoring plugin regarding chat history. Any help would be much appreciated.

pravin
  • 1,106
  • 1
  • 18
  • 27

4 Answers4

4

If you have installed the monitoring plugin, you can read in its readme file under the configuration paragraph the following content:

Chat archiving is enabled by default. However, only information about who is communicating and at what time is stored unless chat transcript archiving is enabled. To enable chat transcript archiving or group chat archiving, you will need to log into the admin console and go to:

Server --> Archiving --> Archiving Settings

Sagar Panda
  • 561
  • 3
  • 17
  • Thanks for the reply.. this helps solve point 1 I guess.. I have updated the question.. can you please check and let me know – pravin Sep 14 '16 at 09:31
  • @priya: We have a client-server architecture application, where in openfire db is managed from server side. So when client needs chat history(be it one to one or group chat history) an api is called from client to server. Thereby server side services connected to openfires db fetch the data from the ofmessagearchive table and send it back to client side. – Sagar Panda Sep 16 '16 at 16:09
  • 1
    @pravin and priya: Although there is a way to fetch chat history directly from client side, whereby you need to implement the xep-0136. Here you have to send an xml stanza request to fetch history. You can see the stanza in http://xmpp.org/extensions/xep-0136.html#manage-list under section 7.Archive Management. – Sagar Panda Sep 16 '16 at 16:11
  • 1
    Following links could help you: http://stackoverflow.com/questions/21657530/how-to-retrieve-chat-history-from-open-fire-in-android/22300454#22300454 http://stackoverflow.com/questions/21657530/how-to-retrieve-chat-history-from-open-fire-in-android http://stackoverflow.com/questions/39163681/retrieve-history-chat-openfire-xmpp-framework – Sagar Panda Sep 16 '16 at 16:12
2
  • To enable group chat archiving, you will need to log into the admin console and go to: Server --> Archiving --> Archiving Settings and 'Message Archiving' is enabled for either 'Archive one-to-one chats' and/or 'Archive group chats'.
  • Then the messages get stored in the external database table 'ofMessageArchive'.
  • The history can be further loaded from the database.

This might help you!

Manasi
  • 765
  • 6
  • 17
  • how to access the table 'ofMessagingArchive' from openfire in my application..? – Priya Sep 12 '16 at 07:10
  • @Manasi Thanks for the reply. I have expanded the question(included priya's query too).. can you please check and let me know ? – pravin Sep 14 '16 at 09:35
  • 1
    openfireDb will be created in your SQL you can access table from there. you have to connect to that db and hit query. Please check if db is created. – Manasi Sep 15 '16 at 06:26
1

Answering to #3: Chats are archived in following format in ofmessage archive table:

conversationID | fromJID | fromJIDResource | toJID | toJIDResource | sentDate | body | 
Sagar Panda
  • 561
  • 3
  • 17
  • can you share the code for connect to db from android application to openfire and retrive data? – Rajat May 31 '17 at 08:18
1
  1. Please login to your server

  2. Go to Plugins, find plugin "Monitoring Service" install/enable it if you have not enabled

  3. Now go to the "Server" menu, go to "Archiving" then "Archiving Settings"

  4. Check "Archive one-to-one chats" Check "Archive group chats"

  5. Now click on "Update Setting"

And then after most important is you need to click on "Rebuild Index" (last button in this setting screen). Then send a messsage from your app, and check your database table "ofMessageArchive"

You will have magic :)

It's working for me, let's see it is working for you or not!

m00am
  • 5,910
  • 11
  • 53
  • 69
Vishal P Gothi
  • 987
  • 5
  • 15
  • seems to be working for me.. thanks.. please edit the answer though and make the content style normal text rather than code style.. – pravin Dec 02 '17 at 10:18
  • Thank You @pravin – Vishal P Gothi Jan 16 '18 at 07:43
  • I installed Monitoring Service plugin and set settings described above. When I hit "Rebuild Index" it shows an error. Error log has the following, "org.jivesoftware.openfire.reporting.stats.RrdSqlBackend - Error while accessing information in database: java.sql.SQLException: Invalid object name 'ofRRDs'." No "ofMessageArchive" table was created. Please help. – vkelman Dec 07 '18 at 19:21
  • I added dbOwner role to a SQL user used by OpenFire. Uninstalled and reinstalled Monitoring Service plugin. Restarted OpenFire. Still - no ofRRDs table and no ofMessageArchive table and errors in a log: java.sql.SQLException: Invalid object name 'ofRRDs'. ava.io.FileNotFoundException: Could not open muc_traffic [non existent] – vkelman Dec 07 '18 at 20:27