LeechCraft Azoth  0.6.70-18450-gabe19ee3b0
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 
110  virtual Util::ContextTask<QList<History::SomeEntryWithMessages>> FetchServerHistory (const std::optional<QDateTime>& since) = 0;
111  protected:
130  virtual void serverHistoryFetched (const QModelIndex& contact,
131  const QByteArray& startId, const SrvHistMessages_t& messages) = 0;
132  };
133 }
134 }
135 
136 Q_DECLARE_INTERFACE (LC::Azoth::IHaveServerHistory,
137  "org.LeechCraft.Azoth.IHaveServerHistory/1.0")
virtual QAbstractItemModel * GetServerContactsModel() const =0
virtual DefaultSortParams GetSortParams() const =0
virtual void OpenServerHistoryConfiguration()=0
virtual void FetchServerHistory(const QModelIndex &contact, const QByteArray &startId, int count)=0
Fetches the given history with the given contact.
virtual void serverHistoryFetched(const QModelIndex &contact, const QByteArray &startId, const SrvHistMessages_t &messages)=0
Emitted when messages are fetched.
Direction
Represents the direction of the message.
Definition: imessage.h:46
virtual bool HasFeature(ServerHistoryFeature) const =0
IMessage::Direction Dir_