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