Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Avatar
prakash.tandukar #1
Member since Feb 2015 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to retrieve conversation history of users
Hi

I want to develop an application in .net and my requirement is to retrieve the conversations (Message) history of all users and store them in some Database.

In my case, the users can use different Jabber clients and different Jabber server. As far as I know (ref: http://xmpp.org/extensions/xep-0136.html#manage section: 7.2 Retrieving a Collection), it would be possible to get the message history by requesting from the Server.
As per the discussion on http://forum.ag-software.net/thread/1568-Retrieve-chat-his…, protocol classes for XEP-0136 are not implemented in MatriX.
Is it now implemented in MatriX? If yes, could you please share some  code example?

 
Another requirement is: while retrieving the message history of a user, should I need to supply the password of the user in my application? Because, it will not be possible to ask the password of each users.

Please let me know if you need any further information.

Thanks
Prakash
This post was edited on 2015-02-17, 08:19 by prakash.tandukar.
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by prakash.tandukar:
I want to develop an application in .net and my requirement is to retrieve the conversations (Message) history of all users and store them in some Database.

In my case, the users can use different Jabber clients and different Jabber server. As far as I know (ref: http://xmpp.org/extensions/xep-0136.html#manage section: 7.2 Retrieving a Collection), it would be possible to get the message history by requesting from the Server.

This is only possible when all servers and clients you use support the Message archiving extensions. Message archiving is not a core functionality. Its not supproted by all software and its not enabled by default when supported.

Quote by prakash.tandukar:
As per the discussion on http://forum.ag-software.net/thread/1568-Retrieve-chat-his…, protocol classes for XEP-0136 are not implemented in MatriX.
Is it now implemented in MatriX?
yes its fully implemented now in the Matrix.Xmpp.MessageArchiving namespace. You can download teh latest builds from here:
http://www.ag-software.net/download-directory/

Quote by prakash.tandukar:
If yes, could you please share some  code example?
Please ask more detailed questions, then we can provide you sample snippets.

Quote by prakash.tandukar:
Another requirement is: while retrieving the message history of a user, should I need to supply the password of the user in my application? Because, it will not be possible to ask the password of each users.
With message archiving you can retrieve only your own history. The hirstory of the logged in user. Of course the hirstory is stored somewhere on teh server in a database. A server admin whcih has access to it could read teh database directly, assuming no encryption is used for the archiving.

Alex
Avatar
prakash.tandukar #3
Member since Feb 2015 · 2 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

Thank you very much for your response and time.
I will check the new library and come back to you if any help is needed.

Thanks,
Prakash
Avatar
LarsKJ #4
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

I am evaluating Matrix, and stumbled on this feature. How am I supposed to use this MessaginArchive api?


Regrads
Lars
Avatar
Alex #5
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this depends on many factors. This extensions is huge.
Also not all servers support all the included functionality, and there are many different use cases for it.
Can you please ask your question more specific?

Alex
Avatar
LarsKJ #6
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
OK,
the scenario that I am looking at is reopening an one-to-one conversation, and I would like to pick up the recent messages exchanged, let say the last 100.

Lars
Avatar
Alex #7
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The easiest would be to store them on the client in a local database.

archiving is not supported by all servers, and if its supported there are many different ways how this is handled on the server.
You either have to put every message to the storage on your own, or the server is configured to archive any message by default.

When the messages are on the server then you could retrieve the last 100 like described here:
http://xmpp.org/extensions/xep-0136.html#manage
Avatar
LarsKJ #8
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Using a local database is really only a good solution if the user would use the same computer/device at all times, but that is not the case here. The user should be able to use any computer/mobile device and should be able to pick up the conversation where he/she left it and that is why I am looking for this feature.

I have enabled and configured the archive plugin in openfire.

I have looked at the XEP-0136, but my question is really how the to use the Matrix API to send such request, it is not obvious to me as a new user of Matrix.
Would it be possible to post a short snippet on how to send a request and process the response, it would help a lot.

Thanks in advance

Lars
Avatar
Alex #9
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is a snippet for example which should retrieve the collections with the user jack@server1.

As I said before message archiving is a very complex extension. We had users before which had problems with Openfire. I think it does not follow exactly the standard. I am happy to help you and provide you code snippets for anything you need.

It would really help when you let us know what openfire exactly supports and which Xmp it expects. Right now I have no openfire installation here. Is there an existing client which work fine with Openfire archiving?

  1. private void RetrieveArchivedMessages()
  2. {
  3.     var list = new Matrix.Xmpp.MessageArchiving.List
  4.     {
  5.         With = "jack@server1"
  6.     };                     
  7.  
  8.     var iq = new Matrix.Xmpp.Client.Iq
  9.     {
  10.         Type = Matrix.Xmpp.IqType.get,     
  11.         Query = list
  12.     };
  13.     iq.GenerateId();
  14.     xmppClient.IqFilter.SendIq(iq, RetrieveArchivedMessagesCallback);
  15. }
  16.  
  17. private void RetrieveArchivedMessagesCallback(object sender, IqEventArgs args)
  18. {
  19. }
This post was edited on 2015-03-13, 15:54 by Alex.
Avatar
LarsKJ #10
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Thanks that was what I was hoping for, unfortunate it throws an Exception:
 
System.ArgumentNullException was unhandled
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: key
  Source=mscorlib
  ParamName=key
  StackTrace:
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
       at Matrix.IqFilter.SendIq(Iq iq, EventHandler`1 callback, Object state)
       at Matrix.IqFilter.SendIq(Iq iq, EventHandler`1 cb)
       at MatrixTest.ChatUserControl.RetrieveArchivedMessages() in c:\Users\lakr1.SIX\Documents\Visual Studio
This post was edited on 2015-03-13, 15:55 by Alex.
Avatar
Alex #11
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
  1. iq.GenerateId()

is missing on my snippet, I will update it.

Alex
Avatar
LarsKJ #12
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Thanks alot, now I get a response from OpenFire, though empty chat messages but I guess that is OpenFire configuration.

Lars
Avatar
LarsKJ #13
Member since Mar 2015 · 12 posts
Group memberships: Members
Show profile · Link to this post
Changed List to Retrieve and I now get the history, bu how do I map a IQ response to an object structure, or do I need to do the Xml parsing.

Lars
Avatar
Alex #14
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please post the Xml of your request and your response.
I can provide you the c# codes then.

Alex
Avatar
Alex #15
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Lars, still waiting for your Xml log to provide the code.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next
Forum: MatriX RSS