Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
SteveV #1
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: YAMAQ: (Yet another message archiving question)
I'm using OpenFire 4.2.3 with the Monitoring Service plugin installed which provides XEP-0313 and XEP-0316 support.  From the read me:
Overview

The monitoring plugin adds support for chat archiving and server statistics to Openfire. It provides support for generating various reports on the server statistics, as well as managing, viewing, and reporting on chat logs.

As of version 1.3 this plugin combines Stefan Reuter's Open Archive plugin to provide XEP-0136 automated archiving and message retrieval for one-to-one and MUC chat. Starting with 1.4.6 version it also supports newer XEP-0313: Message Archive Management protocol.


I have created a C# chat client and am trying to retrieve the message archive as follows:

  1.             var list = new Matrix.Xmpp.MessageArchiving.List( )
  2.             {
  3.                 With = "nulladministrator3@NLGServer"
  4.             };
  5.  
  6.             var iq = new Matrix.Xmpp.Client.Iq
  7.             {
  8.                 Type = Matrix.Xmpp.IqType.Get,
  9.                 Query = list
  10.             };
  11.  
  12.             iq.GenerateId( );
  13.             var iqResult = await ChatClient.SendIqAsync( iq );

I'm getting the following results:

  1. <iq type="error" id="shxZsHs9MUKg+M0CdfKROw" to="sbldapclient@nlgserver.corp.nashobalearninggroup.local/MatriX" xmlns="jabber:client">
  2.   <error code="501" type="cancel">
  3.     <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  4.   </error>
  5. </iq>

Any idea what I might be doing wrong?

Thanks -- Steve
This post was edited on 2018-10-31, 22:39 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
can you please also post the XML of the query which was sent to the server? I see only the error reply.

Akex
Avatar
SteveV #3
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the quick reply.  I assumed that the MatriX framework was creating the query automatically from the C# code I included on my previous post.  Is that not the case?  Regardless, how would I capture the XML being sent to the server?

Steve
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
it does, but I need to see what Xml MatriX produced and sent to the server for this query.
You posted only the response, which is not enough for me to diagnose.

In order to help you I have to see request Xml and response Xml. Te response (error) always refers to a request with a matching id attribute.

Alex
Avatar
SteveV #5
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
Is this what you're looking for:

  1. <iq type="set" id="5fDhnuMTzE+j1/qU/gTArw" xmlns="jabber:client">
  2.  <list with="nulladministrator3@NLGServer.corp.nashobalearninggroup.local" xmlns="urn:xmpp:archive" />
  3. </iq>

Response:
  1. <iq type="error" id="5fDhnuMTzE+j1/qU/gTArw" to="sbldapclient@nlgserver.corp.nashobalearninggroup.local/MatriX" xmlns="jabber:client">
  2.  <error code="501" type="cancel">
  3.     <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  4.  </error>
  5. </iq>

Steve
This post was edited on 2018-11-01, 12:52 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes this is what I was looking for.
The jid in your request (with attribute) is not normalized. For ASCII chars Jids are all lower case.
The server may find no data for this jid.

Its also suggested to use result set management to request the data in pages.
See sample 38 from here:
https://xmpp.org/extensions/xep-0136.html#manage-list

But the error message from the server indicates to me that the message archiving plugin may not be installed, configured or enabled correctly. Because it sais feature-not-implemented

Even if there are no messages saved yet I would expect a different error message or an empty result.

Alex
Avatar
SteveV #7
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
Changing the jid to all lower case result was the same.  The OpenFire message archive plugin is definitely installed:

[Image: http://nashobalearninggroup.org/images/default-source/temp/xmpp-archive-settings.jpg?sfvrsn=2]

This is a dev server with only 23 archived messages:

Archived Message Count - The total number of archived messages. 23 
Archived Conversation Count - The total number of archived conversations.  2

Looking at the XEP 0136 docs shouldn't the query type be "get" (<iq type="get"...) rather than "set" as below?

  1. <iq type="set" id="MCXnlp4+8kO6/l/Aon/YYA" xmlns="jabber:client">
  2.  <list with="sbldapclient@nlgserver.corp.nashobalearninggroup.local" xmlns="urn:xmpp:archive" />
  3. </iq>

Steve


EDIT:

Changed to:

  1. <iq type="get" id="mcCrx32C9k6Ue/+w5BtBvA" xmlns="jabber:client">
  2.  <list with="sbldapclient@nlgserver.corp.nashobalearninggroup.local" xmlns="urn:xmpp:archive" />
  3. </iq>

Result is the same:
  1. <iq type="error" id="mcCrx32C9k6Ue/+w5BtBvA" to="sbldapclient@nlgserver.corp.nashobalearninggroup.local/MatriX" xmlns="jabber:client">
  2.  <error code="501" type="cancel">
  3.     <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  4.  </error>
  5. </iq>
This post was edited 3 times, last on 2018-11-01, 14:14 by Alex.
Avatar
SteveV #8
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
It working now!  The fix?  Restart the XMPP Server after changing the archive settings.  Thanks for the help.

Steve
Avatar
Alex #9
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #7
Quote by SteveV:
Looking at the XEP 0136 docs shouldn't the query type be "get" (<iq type="get"...) rather than "set" as below?

  1. <iq type="set" id="MCXnlp4+8kO6/l/Aon/YYA" xmlns="jabber:client">
  2.  <list with="sbldapclient@nlgserver.corp.nashobalearninggroup.local" xmlns="urn:xmpp:archive" />
  3. </iq>

yes, for retrieving messages it has to be get. Did miss this in your Xml. But your code snippet showed Type=Get correctly.

Great to hear its working now.

Alex
This post was edited on 2018-11-01, 14:16 by Alex.
Avatar
SteveV #10
Member for a month · 6 posts
Group memberships: Members
Show profile · Link to this post
I'm including the following code with hope that it's helpful to someone trying to muddle their way through getting archived messages from their XMPP server.

  1. var archiveList = new Matrix.Xmpp.MessageArchiving.List( )
  2. {
  3.     With = "SBLDAPClient@NLGServer.corp.nashobalearninggroup.local".ToLower( ),
  4.     Start = DateTime.UtcNow.AddYears( -1 ),
  5.     End = DateTime.UtcNow
  6. };
  7.  
  8. var archiveIq = new Matrix.Xmpp.Client.Iq
  9. {
  10.     Type = Matrix.Xmpp.IqType.Get,
  11.     Query = archiveList,
  12. };
  13.  
  14. archiveIq.GenerateId( );
  15. var archiveResult = await ChatClient.SendIqAsync( archiveIq );
  16.  
  17. Matrix.Xmpp.MessageArchiving.List chatSessionList = archiveResult.Element<Matrix.Xmpp.MessageArchiving.List>( );
  18.  
  19. if ( chatSessionList != null )
  20. {
  21.     foreach ( var chatSession in chatSessionList.Elements<Chat>( ) )
  22.     {
  23.         Jid with = chatSession.With;
  24.         DateTime start = chatSession.Start;
  25.  
  26.         var retrieve = new Retrieve
  27.         {
  28.             With = with,
  29.             Start = start,
  30.             ResultSet = new Set { Maximum = 100 },
  31.         };
  32.  
  33.         var retrieveIq = new Matrix.Xmpp.Client.Iq
  34.         {
  35.             Type = Matrix.Xmpp.IqType.Get,
  36.             Query = retrieve,
  37.         };
  38.  
  39.         retrieveIq.GenerateId( );
  40.         var retrieveResult = await ChatClient.SendIqAsync( retrieveIq );
  41.  
  42.         if ( retrieveResult != null )
  43.         {
  44.             Chat chat = retrieveResult.Element<Chat>( );
  45.  
  46.             if ( chat != null )
  47.             {
  48.                 Jid chatWith = chat.With;
  49.                 DateTime firstChatStart = chat.Start;
  50.  
  51.                 string thread = chat.Thread;
  52.                 string subject = chat.Subject;
  53.                 var items = chat.GetItems( );   // <-- List is always empty
  54.  
  55.                 if ( items != null )
  56.                 {
  57.                     foreach ( MessageItem msg in items )
  58.                     {
  59.                         string from = "";
  60.  
  61.                         if ( msg.Jid != null )
  62.                             from = msg.Jid.User;
  63.  
  64.                         else
  65.                             from = User.ToLower( );
  66.  
  67.                         string body = msg.Body;
  68.                         DateTime messageDateTime = firstChatStart.AddSeconds( msg.Seconds );
  69.                     }
  70.                 }
  71.             }
  72.         }
  73.     }
  74. }
This post was edited on 2018-11-01, 18:52 by 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:
Forum: MatriX RSS