LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IHaveServerHistory Class Referenceabstract

#include "ihaveserverhistory.h"

Classes

struct  UserHistorySyncInfo
 

Public Types

using MessagesSyncMap_t = QHash< QString, UserHistorySyncInfo >
 
using DatedFetchResult_t = Util::Either< QString, MessagesSyncMap_t >
 

Public Member Functions

virtual ~IHaveServerHistory ()
 
virtual bool HasFeature (ServerHistoryFeature) const =0
 
virtual void OpenServerHistoryConfiguration ()=0
 
virtual QAbstractItemModel * GetServerContactsModel () const =0
 
virtual void FetchServerHistory (const QModelIndex &contact, const QByteArray &startId, int count)=0
 Fetches the given history with the given contact. More...
 
virtual DefaultSortParams GetSortParams () const =0
 
virtual QFuture< DatedFetchResult_tFetchServerHistory (const QDateTime &since)=0
 

Protected Member Functions

virtual void serverHistoryFetched (const QModelIndex &contact, const QByteArray &startId, const SrvHistMessages_t &messages)=0
 Emitted when messages are fetched. More...
 

Detailed Description

Definition at line 61 of file ihaveserverhistory.h.

Member Typedef Documentation

◆ DatedFetchResult_t

Definition at line 116 of file ihaveserverhistory.h.

◆ MessagesSyncMap_t

Constructor & Destructor Documentation

◆ ~IHaveServerHistory()

virtual LC::Azoth::IHaveServerHistory::~IHaveServerHistory ( )
inlinevirtual

Definition at line 64 of file ihaveserverhistory.h.

Member Function Documentation

◆ FetchServerHistory() [1/2]

virtual QFuture<DatedFetchResult_t> LC::Azoth::IHaveServerHistory::FetchServerHistory ( const QDateTime &  since)
pure virtual

◆ FetchServerHistory() [2/2]

virtual void LC::Azoth::IHaveServerHistory::FetchServerHistory ( const QModelIndex &  contact,
const QByteArray &  startId,
int  count 
)
pure virtual

Fetches the given history with the given contact.

This function should fetch the history with the contact, which is one of the indices of the model returned by GetServerContactsModel(), and emit the serverHistoryFetched() signal after fetching.

A natural ordering is implied on the messages: we say that one message comes before another one if its date is further in the past then other's one.

The history is fetched "around" the message identified by startId. If count is positive, then at most count messages should be fetched before the message specified by startId. Otherwise if count is negative, abs(count) messages should be fetched after startId.

If startId is empty, then most recent messages should be fetched.

Parameters
[in]contactThe contact index from the GetServerContactsModel() to fetch history with.
[in]startIdThe ID of the message around which to fetch messages, or an empty array if most recent messages are wanted.
[in]countThe absolute value of count is the number of messages to fetch. If the value is positive, then messages before startId should be fetched, otherwise messages after startId are to be fetched.
See also
serverHistoryFetched()

◆ GetServerContactsModel()

virtual QAbstractItemModel* LC::Azoth::IHaveServerHistory::GetServerContactsModel ( ) const
pure virtual

◆ GetSortParams()

virtual DefaultSortParams LC::Azoth::IHaveServerHistory::GetSortParams ( ) const
pure virtual

◆ HasFeature()

virtual bool LC::Azoth::IHaveServerHistory::HasFeature ( ServerHistoryFeature  ) const
pure virtual

◆ OpenServerHistoryConfiguration()

virtual void LC::Azoth::IHaveServerHistory::OpenServerHistoryConfiguration ( )
pure virtual

◆ serverHistoryFetched()

virtual void LC::Azoth::IHaveServerHistory::serverHistoryFetched ( const QModelIndex &  contact,
const QByteArray &  startId,
const SrvHistMessages_t messages 
)
protectedpure virtual

Emitted when messages are fetched.

This signal should be emitted when messages with the given contact are fetched as a result of some previous FetchServerHistory() call. The startId parameter corresponds to the same-named parameter of FetchServerHistory(), and messages is a list of messages kept on server (probaly empty).

Note
This function is expected to be a signal.
Parameters
[out]contactThe contact with which the server history is fetched.
[out]startIdThe ID of the message around which the messages are fetched (see FetchServerHistory() documentation).
[out]messagesThe list of fetched messages (probably empty). Expected to be sorted in ascending order.

The documentation for this class was generated from the following file: