LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
ihistoryplugin.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 <QVariantMap>
13 #include <util/sll/eitherfwd.h>
14 #include "imessage.h"
15 
16 template<typename>
17 class QFuture;
18 
19 class QDateTime;
20 
21 class QObject;
22 
23 namespace LC
24 {
25 namespace Azoth
26 {
27  class IAccount;
28 
31  struct HistoryItem
32  {
35  QDateTime Date_;
36 
40 
43  QString Message_;
44 
47  QString Variant_;
48 
52 
55  QString RichMessage_;
56 
61  };
62 
70  {
71  public:
72  virtual ~IHistoryPlugin () {}
73 
82  virtual bool IsHistoryEnabledFor (QObject *entry) const = 0;
83 
99  virtual void RequestLastMessages (QObject *entry, int num) = 0;
100 
101  using MaxTimestampResult_t = Util::Either<QString, QDateTime>;
102 
104 
115  virtual void AddRawMessages (const QString& accountId,
116  const QString& entryId,
117  const QString& visibleName,
118  const QList<HistoryItem>& items) = 0;
119  protected:
134  virtual void gotLastMessages (QObject *entry, const QList<QObject*>& messages) = 0;
135  };
136 }
137 }
138 
139 Q_DECLARE_INTERFACE (LC::Azoth::IHistoryPlugin,
140  "org.Deviant.LeechCraft.Azoth.IHistoryPlugin/1.0")
QList
Definition: iaccountactionsprovider.h:16
LC::Azoth::IMessage::EscapePolicy
EscapePolicy
Definition: imessage.h:165
LC::Azoth::IHistoryPlugin::AddRawMessages
virtual void AddRawMessages(const QString &accountId, const QString &entryId, const QString &visibleName, const QList< HistoryItem > &items)=0
Adds a set of messages to the history.
LC::Azoth::HistoryItem::Date_
QDateTime Date_
The timestamp of the message.
Definition: ihistoryplugin.h:35
LC::Azoth::IHistoryPlugin::RequestLastMessages
virtual void RequestLastMessages(QObject *entry, int num)=0
Requests last messages for the given entry.
LC::Azoth::HistoryItem::RichMessage_
QString RichMessage_
The rich message contents, if any.
Definition: ihistoryplugin.h:55
LC::Azoth::IHistoryPlugin::RequestMaxTimestamp
virtual QFuture< MaxTimestampResult_t > RequestMaxTimestamp(IAccount *acc)=0
LC::Azoth::IHistoryPlugin::~IHistoryPlugin
virtual ~IHistoryPlugin()
Definition: ihistoryplugin.h:72
LC::Azoth::IMessage::Direction
Direction
Represents the direction of the message.
Definition: imessage.h:49
LC::Azoth::IHistoryPlugin::IsHistoryEnabledFor
virtual bool IsHistoryEnabledFor(QObject *entry) const =0
Whether history is enabled for the given entry.
LC::Azoth::HistoryItem
Describes a single chat log item.
Definition: ihistoryplugin.h:31
LC::Azoth::HistoryItem::Variant_
QString Variant_
The variant of the other entry.
Definition: ihistoryplugin.h:47
LC::Azoth::IHistoryPlugin::MaxTimestampResult_t
Util::Either< QString, QDateTime > MaxTimestampResult_t
Definition: ihistoryplugin.h:101
LC::Azoth::IHistoryPlugin::gotLastMessages
virtual void gotLastMessages(QObject *entry, const QList< QObject * > &messages)=0
Notifies about last messages for the given entry.
LC::Azoth::IHistoryPlugin
Interface for plugins storing chat history.
Definition: ihistoryplugin.h:69
LC::Azoth::HistoryItem::Dir_
IMessage::Direction Dir_
The direction of the message.
Definition: ihistoryplugin.h:39
LC
Definition: activityinfo.h:13
LC::Azoth::HistoryItem::Message_
QString Message_
The message itself.
Definition: ihistoryplugin.h:43
QFuture
Definition: ihaveserverhistory.h:21
LC::Azoth::HistoryItem::EscPolicy_
IMessage::EscapePolicy EscPolicy_
Whether the message should be HTML-escaped when displayed to the user.
Definition: ihistoryplugin.h:60
LC::Azoth::HistoryItem::Type_
IMessage::Type Type_
The message type.
Definition: ihistoryplugin.h:51
imessage.h
LC::Azoth::IAccount
Interface representing a single account.
Definition: iaccount.h:56
LC::Azoth::IMessage::Type
Type
Represents possible message types.
Definition: imessage.h:62