LeechCraft Azoth  0.6.70-16373-g319c272718
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")
virtual bool IsHistoryEnabledFor(QObject *entry) const =0
Whether history is enabled for the given entry.
virtual void gotLastMessages(QObject *entry, const QList< QObject *> &messages)=0
Notifies about last messages for the given entry.
QString Variant_
The variant of the other entry.
Interface for plugins storing chat history.
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.
IMessage::Direction Dir_
The direction of the message.
Type
Represents possible message types.
Definition: imessage.h:62
QDateTime Date_
The timestamp of the message.
QString RichMessage_
The rich message contents, if any.
virtual QFuture< MaxTimestampResult_t > RequestMaxTimestamp(IAccount *acc)=0
Describes a single chat log item.
Util::Either< QString, QDateTime > MaxTimestampResult_t
QString Message_
The message itself.
virtual void RequestLastMessages(QObject *entry, int num)=0
Requests last messages for the given entry.
Direction
Represents the direction of the message.
Definition: imessage.h:49
IMessage::Type Type_
The message type.
Interface representing a single account.
Definition: iaccount.h:44
IMessage::EscapePolicy EscPolicy_
Whether the message should be HTML-escaped when displayed to the user.