3. Additional features
Tigase Message Archiving Component contains few additional features useful for working with message archives.
3.1. Querying in all messages
Feature allows user to search all of his archived messages without a need to specify who was send/receiver of this message. To search in all messages, request sent to retrieve archived messages should not contain with
attribute. As a result, when with
attribute is omitted <chat/>
element of response will not contain with
attribute but every <to/>
and <from/>
element will contain with
attribute.
3.2. Querying by part of message body
This feature allows user to query for messages or collections containing messages which in body of a message contained text passed by user.
To execute request in which user wants to find messages with “test failed” string XMPP client needs to add following element
<query xmlns="http://tigase.org/protocol/archive#query">
<contains>test failed</contains>
</query>
as child element of @retrieve@ or @list@ element of request.
3.2.1. Example query requests
3.2.1.1. Example 1
Retrieving messages with “test failed” string with user juliet@capulet.com
between 2014-01-01 00:00:00
and 2014-05-01 00:00:00
<iq type="get" id="query2">
<retrieve xmlns='urn:xmpp:archive'
with='[email protected]'
from='2014-01-01T00:00:00Z'
end='2014-05-01T00:00:00Z'>
<query xmlns="http://tigase.org/protocol/archive#query">
<contains>test failed</contains>
</query>
</retrieve>
</iq>
3.2.1.2. Example 2
Retrieving collections containing messages with “test failed” string with user juliet@capulet.com
between 2014-01-01 00:00:00
and 2014-05-01 00:00:00
<iq type="get" id="query2">
<list xmlns='urn:xmpp:archive'
with='[email protected]'
from='2014-01-01T00:00:00Z'
end='2014-05-01T00:00:00Z'>
<query xmlns="http://tigase.org/protocol/archive#query">
<contains>test failed</contains>
</query>
</list>
</iq>
3.4. Automatic archiving of MUC messages
If this feature is enabled MUC messages are stored in Message Archiving repository and are added in same way as for any other messages and jid
of MUC room is used as jid
of message sender, so if MUC message sent from test@muc.example.com
was stored then to retrieve this messages test@muc.example.com
needs to be passed as with
attribute to message retrieve request. Retrieved MUC messages will be retrieved in same format as normal message with one exception - each message will contain name
attribute with name of occupant in room which sent this message.
This feature is by default disabled but it is possible to enable it for particular user. Additionally it is possible to change default setting on installation level and on hosted domain level to enable this feature, disable feature or allow user to decide if user want this feature to be enabled. For more information about configuration of this feature look at Configuration of automatic archiving of MUC messages
Note
It is worth to mention that even if more than on user resource joined same room and each resource will receive same messages then only single message will be stored in Message Archving repository.
It is also important to note that MUC messages are archived to user message archive only when user is joined to MUC room (so if message was sent to room but it was not sent to particular user)