LeechCraft Azoth  0.6.70-14771-g9d21b0f8ad
Modular multiprotocol IM plugin for LeechCraft
ihaveserverhistory.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QList>
12 #include <QtPlugin>
13 #include <util/sll/eitherfwd.h>
14 #include "imessage.h"
15 #include "ihistoryplugin.h"
16 
17 class QModelIndex;
18 class QAbstractItemModel;
19 
20 template<typename>
21 class QFuture;
22 
23 namespace LC
24 {
25 namespace Azoth
26 {
28  {
30  QByteArray ID_;
31  QString Nick_;
32  QString Body_;
33  QDateTime TS_;
34 
35  QString RichBody_;
36  };
37 
39 
41  {
42  LastMessageDate = Qt::UserRole + 1,
45  };
46 
48  {
52  };
53 
55  {
56  int Column_;
57  int Role_;
58  Qt::SortOrder Order_;
59  };
60 
62  {
63  public:
64  virtual ~IHaveServerHistory () {}
65 
66  virtual bool HasFeature (ServerHistoryFeature) const = 0;
67 
68  virtual void OpenServerHistoryConfiguration () = 0;
69 
70  virtual QAbstractItemModel* GetServerContactsModel () const = 0;
71 
105  virtual void FetchServerHistory (const QModelIndex& contact,
106  const QByteArray& startId, int count) = 0;
107 
108  virtual DefaultSortParams GetSortParams () const = 0;
109 
111  {
112  QString VisibleName_;
114  };
115  using MessagesSyncMap_t = QHash<QString, UserHistorySyncInfo>;
116  using DatedFetchResult_t = Util::Either<QString, MessagesSyncMap_t>;
117 
118  virtual QFuture<DatedFetchResult_t> FetchServerHistory (const QDateTime& since) = 0;
119  protected:
138  virtual void serverHistoryFetched (const QModelIndex& contact,
139  const QByteArray& startId, const SrvHistMessages_t& messages) = 0;
140  };
141 }
142 }
143 
144 Q_DECLARE_INTERFACE (LC::Azoth::IHaveServerHistory,
145  "org.LeechCraft.Azoth.IHaveServerHistory/1.0")
virtual QFuture< DatedFetchResult_t > FetchServerHistory(const QDateTime &since)=0
virtual void serverHistoryFetched(const QModelIndex &contact, const QByteArray &startId, const SrvHistMessages_t &messages)=0
Emitted when messages are fetched.
virtual bool HasFeature(ServerHistoryFeature) const =0
virtual void FetchServerHistory(const QModelIndex &contact, const QByteArray &startId, int count)=0
Fetches the given history with the given contact.
virtual DefaultSortParams GetSortParams() const =0
Util::Either< QString, MessagesSyncMap_t > DatedFetchResult_t
virtual void OpenServerHistoryConfiguration()=0
QHash< QString, UserHistorySyncInfo > MessagesSyncMap_t
virtual QAbstractItemModel * GetServerContactsModel() const =0
Direction
Represents the direction of the message.
Definition: imessage.h:50
IMessage::Direction Dir_