LeechCraft Azoth  0.6.70-15082-g543737046d
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")
LC::Azoth::ServerHistoryFeature::DatedFetching
@ DatedFetching
LC::Azoth::IHaveServerHistory::DatedFetchResult_t
Util::Either< QString, MessagesSyncMap_t > DatedFetchResult_t
Definition: ihaveserverhistory.h:116
LC::Azoth::ServerHistoryRoleMax
@ ServerHistoryRoleMax
Definition: ihaveserverhistory.h:44
LC::Azoth::SrvHistMessage::ID_
QByteArray ID_
Definition: ihaveserverhistory.h:30
QList
Definition: iaccountactionsprovider.h:16
LC::Azoth::SrvHistMessage::Body_
QString Body_
Definition: ihaveserverhistory.h:32
LC::Azoth::IHaveServerHistory::GetSortParams
virtual DefaultSortParams GetSortParams() const =0
LC::Azoth::DefaultSortParams
Definition: ihaveserverhistory.h:54
LC::Azoth::IHaveServerHistory::GetServerContactsModel
virtual QAbstractItemModel * GetServerContactsModel() const =0
LC::Azoth::IHaveServerHistory::UserHistorySyncInfo::VisibleName_
QString VisibleName_
Definition: ihaveserverhistory.h:112
LC::Azoth::IHaveServerHistory::~IHaveServerHistory
virtual ~IHaveServerHistory()
Definition: ihaveserverhistory.h:64
LC::Azoth::CLEntry
@ CLEntry
Definition: ihaveserverhistory.h:43
LC::Azoth::IHaveServerHistory::MessagesSyncMap_t
QHash< QString, UserHistorySyncInfo > MessagesSyncMap_t
Definition: ihaveserverhistory.h:115
LC::Azoth::IHaveServerHistory::FetchServerHistory
virtual void FetchServerHistory(const QModelIndex &contact, const QByteArray &startId, int count)=0
Fetches the given history with the given contact.
LC::Azoth::IMessage::Direction
Direction
Represents the direction of the message.
Definition: imessage.h:49
LC::Azoth::LastMessageDate
@ LastMessageDate
Definition: ihaveserverhistory.h:42
LC::Azoth::ServerHistoryRole
ServerHistoryRole
Definition: ihaveserverhistory.h:40
LC::Azoth::SrvHistMessage::RichBody_
QString RichBody_
Definition: ihaveserverhistory.h:35
LC::Azoth::IHaveServerHistory::HasFeature
virtual bool HasFeature(ServerHistoryFeature) const =0
LC::Azoth::DefaultSortParams::Order_
Qt::SortOrder Order_
Definition: ihaveserverhistory.h:58
LC::Azoth::IHaveServerHistory
Definition: ihaveserverhistory.h:61
LC::Azoth::ServerHistoryFeature::AccountSupportsHistory
@ AccountSupportsHistory
LC::Azoth::SrvHistMessage
Definition: ihaveserverhistory.h:27
LC::Azoth::DefaultSortParams::Column_
int Column_
Definition: ihaveserverhistory.h:56
LC::Azoth::SrvHistMessage::Nick_
QString Nick_
Definition: ihaveserverhistory.h:31
LC
Definition: activityinfo.h:13
LC::Azoth::IHaveServerHistory::OpenServerHistoryConfiguration
virtual void OpenServerHistoryConfiguration()=0
LC::Azoth::ServerHistoryFeature::Configurable
@ Configurable
QFuture
Definition: ihaveserverhistory.h:21
LC::Azoth::IHaveServerHistory::UserHistorySyncInfo
Definition: ihaveserverhistory.h:110
LC::Azoth::IHaveServerHistory::UserHistorySyncInfo::Messages_
QList< HistoryItem > Messages_
Definition: ihaveserverhistory.h:113
LC::Azoth::DefaultSortParams::Role_
int Role_
Definition: ihaveserverhistory.h:57
ihistoryplugin.h
imessage.h
LC::Azoth::SrvHistMessage::TS_
QDateTime TS_
Definition: ihaveserverhistory.h:33
LC::Azoth::SrvHistMessage::Dir_
IMessage::Direction Dir_
Definition: ihaveserverhistory.h:29
LC::Azoth::ServerHistoryFeature
ServerHistoryFeature
Definition: ihaveserverhistory.h:47
LC::Azoth::IHaveServerHistory::serverHistoryFetched
virtual void serverHistoryFetched(const QModelIndex &contact, const QByteArray &startId, const SrvHistMessages_t &messages)=0
Emitted when messages are fetched.