LeechCraft Azoth
0.6.70-19424-g027e980fd1
Modular multiprotocol IM plugin for LeechCraft
Toggle main menu visibility
Loading...
Searching...
No Matches
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 <util/threads/coro/taskfwd.h>
13
#include "
azothcommon.h
"
14
#include "
imessage.h
"
15
16
class
QDateTime;
17
class
QObject;
18
19
namespace
LC::Azoth::History
20
{
21
enum class
EntryKind
: std::uint8_t
22
{
23
Chat
,
24
MUC
,
25
PrivateChat
,
26
};
27
28
template
<
template
<EntryKind K>
typename
Kinded>
29
using
KindedGADT
= std::variant<
30
Kinded<EntryKind::Chat>,
31
Kinded<EntryKind::MUC>,
32
Kinded<EntryKind::PrivateChat>
33
>;
34
35
template
<EntryKind>
struct
EntryDescr
;
36
template
<>
struct
EntryDescr
<
EntryKind
::
Chat
> { QString
Nick_
; };
37
template
<>
struct
EntryDescr
<
EntryKind
::
MUC
> { QString
MucName_
; };
38
template
<>
struct
EntryDescr
<
EntryKind
::
PrivateChat
> { QString
MucName_
; QString
Nick_
; std::optional<QByteArray>
PersistentId_
; };
39
40
using
SomeEntryDescr
=
KindedGADT<EntryDescr>
;
41
42
template
<
template
<EntryKind K>
typename
EntryKinded>
43
EntryKind
GetEntryKind
(
const
KindedGADT<EntryKinded>
& gadt)
44
{
45
return
static_cast<
EntryKind
>
(gadt.index ());
46
}
47
48
template
<EntryKind K>
49
struct
Entry
50
{
51
QByteArray
AccountId_
;
52
QString
AccountName_
;
53
EntryConventionalId
ConventionalId_
;
54
55
EntryDescr<K>
Description_
;
56
};
57
58
struct
SelfEndpoint
{ QString
Name_
; std::optional<QString>
Variant_
; };
59
60
template
<EntryKind>
struct
EntryEndpoint
;
61
template
<>
struct
EntryEndpoint
<
EntryKind
::
Chat
> { std::optional<QString>
Variant_
; };
62
template
<>
struct
EntryEndpoint
<
EntryKind
::
MUC
> { QString
Nick_
; std::optional<QByteArray>
PersistentId_
; };
63
template
<>
struct
EntryEndpoint
<
EntryKind
::
PrivateChat
> {};
64
65
template
<EntryKind K>
66
using
Endpoint
= std::variant<SelfEndpoint, EntryEndpoint<K>>;
67
68
template
<EntryKind K>
69
struct
EntryDescrWithEndpoint
70
{
71
EntryDescr<K>
Description_
;
72
Endpoint<K>
Endpoint_
;
73
};
74
using
SomeEntryDescrWithEndpoint
=
KindedGADT<EntryDescrWithEndpoint>
;
75
76
template
<EntryKind K>
77
struct
NewMessage
78
{
79
Endpoint<K>
Endpoint_
;
80
81
QDateTime
TS_
;
82
QString
Body_
;
83
std::optional<QString>
RichBody_
;
84
};
85
86
template
<EntryKind K>
87
using
EntryWithMessages
= std::pair<Entry<K>,
QList<NewMessage<K>
>>;
88
89
using
SomeEntryWithMessages
=
KindedGADT<EntryWithMessages>
;
90
}
91
92
namespace
LC::Azoth
93
{
94
class
IAccount
;
95
102
class
IHistoryPlugin
103
{
104
protected
:
105
virtual
~IHistoryPlugin
() =
default
;
106
public
:
115
virtual
bool
IsHistoryEnabledFor
(
ICLEntry
& entry)
const
= 0;
116
131
virtual
Util::ContextTask<void>
RequestLastMessages
(
ICLEntry
& entry,
int
count) = 0;
132
133
virtual
Util::ContextTask<std::optional<QDateTime>>
RequestMaxTimestamp
(
IAccount
& acc) = 0;
134
137
virtual
void
AddMessages
(
const
History::SomeEntryWithMessages
&) = 0;
138
protected
:
153
virtual
void
gotLastMessages
(QObject *entry,
const
QList<QObject*>
& messages) = 0;
154
};
155
}
156
157
Q_DECLARE_INTERFACE (
LC::Azoth::IHistoryPlugin
,
158
"org.Deviant.LeechCraft.Azoth.IHistoryPlugin/1.0"
)
azothcommon.h
LC::Azoth::IAccount
Interface representing a single account.
Definition
iaccount.h:47
LC::Azoth::ICLEntry
Represents a single entry in contact list.
Definition
iclentry.h:49
LC::Azoth::IHistoryPlugin
Interface for plugins storing chat history.
Definition
ihistoryplugin.h:103
LC::Azoth::IHistoryPlugin::RequestMaxTimestamp
virtual Util::ContextTask< std::optional< QDateTime > > RequestMaxTimestamp(IAccount &acc)=0
LC::Azoth::IHistoryPlugin::RequestLastMessages
virtual Util::ContextTask< void > RequestLastMessages(ICLEntry &entry, int count)=0
Requests last messages for the given entry.
LC::Azoth::IHistoryPlugin::IsHistoryEnabledFor
virtual bool IsHistoryEnabledFor(ICLEntry &entry) const =0
Whether history is enabled for the given entry.
LC::Azoth::IHistoryPlugin::~IHistoryPlugin
virtual ~IHistoryPlugin()=default
LC::Azoth::IHistoryPlugin::AddMessages
virtual void AddMessages(const History::SomeEntryWithMessages &)=0
Adds a set of messages to the history.
LC::Azoth::IHistoryPlugin::gotLastMessages
virtual void gotLastMessages(QObject *entry, const QList< QObject * > &messages)=0
Notifies about last messages for the given entry.
QList
Definition
iaccountactionsprovider.h:16
imessage.h
LC::Azoth::History
Definition
ihistoryplugin.h:20
LC::Azoth::History::SomeEntryWithMessages
KindedGADT< EntryWithMessages > SomeEntryWithMessages
Definition
ihistoryplugin.h:89
LC::Azoth::History::SomeEntryDescrWithEndpoint
KindedGADT< EntryDescrWithEndpoint > SomeEntryDescrWithEndpoint
Definition
ihistoryplugin.h:74
LC::Azoth::History::KindedGADT
std::variant< Kinded< EntryKind::Chat >, Kinded< EntryKind::MUC >, Kinded< EntryKind::PrivateChat > > KindedGADT
Definition
ihistoryplugin.h:29
LC::Azoth::History::SomeEntryDescr
KindedGADT< EntryDescr > SomeEntryDescr
Definition
ihistoryplugin.h:40
LC::Azoth::History::GetEntryKind
EntryKind GetEntryKind(const KindedGADT< EntryKinded > &gadt)
Definition
ihistoryplugin.h:43
LC::Azoth::History::EntryWithMessages
std::pair< Entry< K >, QList< NewMessage< K > > > EntryWithMessages
Definition
ihistoryplugin.h:87
LC::Azoth::History::Endpoint
std::variant< SelfEndpoint, EntryEndpoint< K > > Endpoint
Definition
ihistoryplugin.h:66
LC::Azoth::History::EntryKind
EntryKind
Definition
ihistoryplugin.h:22
LC::Azoth::History::EntryKind::PrivateChat
@ PrivateChat
Definition
ihistoryplugin.h:25
LC::Azoth::History::EntryKind::Chat
@ Chat
Definition
ihistoryplugin.h:23
LC::Azoth::History::EntryKind::MUC
@ MUC
Definition
ihistoryplugin.h:24
LC::Azoth
Definition
activityinfo.h:16
LC::Azoth::EntryConventionalId
EntryId< IdKind::Conventional > EntryConventionalId
Definition
azothcommon.h:45
LC::Azoth::History::EntryDescr< EntryKind::Chat >::Nick_
QString Nick_
Definition
ihistoryplugin.h:36
LC::Azoth::History::EntryDescr< EntryKind::MUC >::MucName_
QString MucName_
Definition
ihistoryplugin.h:37
LC::Azoth::History::EntryDescr< EntryKind::PrivateChat >::PersistentId_
std::optional< QByteArray > PersistentId_
Definition
ihistoryplugin.h:38
LC::Azoth::History::EntryDescr< EntryKind::PrivateChat >::Nick_
QString Nick_
Definition
ihistoryplugin.h:38
LC::Azoth::History::EntryDescr< EntryKind::PrivateChat >::MucName_
QString MucName_
Definition
ihistoryplugin.h:38
LC::Azoth::History::EntryDescr
Definition
ihistoryplugin.h:35
LC::Azoth::History::EntryDescrWithEndpoint
Definition
ihistoryplugin.h:70
LC::Azoth::History::EntryDescrWithEndpoint::Endpoint_
Endpoint< K > Endpoint_
Definition
ihistoryplugin.h:72
LC::Azoth::History::EntryDescrWithEndpoint::Description_
EntryDescr< K > Description_
Definition
ihistoryplugin.h:71
LC::Azoth::History::EntryEndpoint< EntryKind::Chat >::Variant_
std::optional< QString > Variant_
Definition
ihistoryplugin.h:61
LC::Azoth::History::EntryEndpoint< EntryKind::MUC >::Nick_
QString Nick_
Definition
ihistoryplugin.h:62
LC::Azoth::History::EntryEndpoint< EntryKind::MUC >::PersistentId_
std::optional< QByteArray > PersistentId_
Definition
ihistoryplugin.h:62
LC::Azoth::History::EntryEndpoint
Definition
ihistoryplugin.h:60
LC::Azoth::History::Entry
Definition
ihistoryplugin.h:50
LC::Azoth::History::Entry::ConventionalId_
EntryConventionalId ConventionalId_
Definition
ihistoryplugin.h:53
LC::Azoth::History::Entry::Description_
EntryDescr< K > Description_
Definition
ihistoryplugin.h:55
LC::Azoth::History::Entry::AccountId_
QByteArray AccountId_
Definition
ihistoryplugin.h:51
LC::Azoth::History::Entry::AccountName_
QString AccountName_
Definition
ihistoryplugin.h:52
LC::Azoth::History::NewMessage
Definition
ihistoryplugin.h:78
LC::Azoth::History::NewMessage::Endpoint_
Endpoint< K > Endpoint_
Definition
ihistoryplugin.h:79
LC::Azoth::History::NewMessage::TS_
QDateTime TS_
Definition
ihistoryplugin.h:81
LC::Azoth::History::NewMessage::RichBody_
std::optional< QString > RichBody_
Definition
ihistoryplugin.h:83
LC::Azoth::History::NewMessage::Body_
QString Body_
Definition
ihistoryplugin.h:82
LC::Azoth::History::SelfEndpoint
Definition
ihistoryplugin.h:58
LC::Azoth::History::SelfEndpoint::Name_
QString Name_
Definition
ihistoryplugin.h:58
LC::Azoth::History::SelfEndpoint::Variant_
std::optional< QString > Variant_
Definition
ihistoryplugin.h:58
src
plugins
azoth
interfaces
azoth
ihistoryplugin.h
Generated by
1.18.0