MessageHistoryService Developer Documentation

Description

The Message History Service stores messages exchanged through the various protocols in the Jitsi. It will log messages for all protocol providers that support basic instant messaging (i.e. those that implement OperationSetBasicInstantMessaging). The default implementation of this service depends on the history service for storing the messages.

Using it

After the service is started it will discover all protocol providers that implement basic instant messaging and would start listening for message events. The service would also listen for newly added protocol providers supporting instant messaging so that it could log messages even when it is loaded before the protocol providers are started. In order to use this service, you need to obtain a reference to the service and use its finder methods for retrieving already stored data.

The result of the finders

All finder methods return a QueryResultSet of HistoryRecords (described in Documentation.HistoryService). The record consists of several values :

  • dir - this is the direction of the message. Can be either ‘in’ or ‘out’
  • msg - the content of the message
  • msgTyp - the content type of the message. The default is ‘text\plain’
  • enc - the encoding. Default is UTF-8
  • uid - unique id of the message
  • sub - subject of the message. Default is without subject.

The Finders

The finder methods are similar to the history find methods with one difference - the supplied parameter MetaContact.

  • findByStartDate - by providing a start date
  • findByEndDate - by providing an end date
  • findByPeriod - by providing a start date and an end date (optional and a list of keywords)
  • findByKeyword - by providing a keyword
  • findByKeywords - by providing a list of keywords
  • findLast - by providing a number of messages to be returned

Returned results will containing records pertaining to any of the protocol contacts that the specified MetaConatct currently contains.

Author: Damian Minkov