LeechCraft Azoth 0.6.70-17609-g3dde4097dd
Modular multiprotocol IM plugin for LeechCraft
Loading...
Searching...
No Matches
iclentry.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 <QFlags>
12#include <QMetaType>
13#include "imessage.h"
14#include "azothcommon.h"
15
16class QAction;
17class QImage;
18
19namespace LC
20{
21namespace Azoth
22{
23 class IAccount;
24 class IMessage;
25
35 {
39
43
48 {
49 }
50
57 EntryStatus (State state, const QString& string)
58 : State_ (state)
59 , StatusString_ (string)
60 {
61 }
62 };
63
71 inline bool operator== (const EntryStatus& es1, const EntryStatus& es2)
72 {
73 return es1.State_ == es2.State_ &&
75 }
76
84 inline bool operator!= (const EntryStatus& es1, const EntryStatus& es2)
85 {
86 return !(es1 == es2);
87 }
88
121 {
122 public:
123 virtual ~ICLEntry () {}
124
129 {
138
143
147
152
156
162
166
170 };
171
172 Q_DECLARE_FLAGS (Features, Feature)
173
174 enum class EntryType
175 {
179
183
188
193 };
194
199 virtual QObject* GetQObject () = 0;
200
206 virtual IAccount* GetParentAccount () const = 0;
207
222 virtual ICLEntry* GetParentCLEntry () const
223 {
224 return nullptr;
225 }
226
227 QObject* GetParentCLEntryObject () const
228 {
229 if (const auto entry = GetParentCLEntry ())
230 return entry->GetQObject ();
231 return nullptr;
232 }
233
239 virtual Features GetEntryFeatures () const = 0;
240
245 virtual EntryType GetEntryType () const = 0;
246
253 virtual QString GetEntryName () const = 0;
254
263 virtual void SetEntryName (const QString& name) = 0;
264
283 virtual QString GetEntryID () const = 0;
284
308 virtual QString GetHumanReadableID () const
309 {
310 return GetEntryID ();
311 }
312
318 virtual QStringList Groups () const = 0;
319
327 virtual void SetGroups (const QStringList& groups) = 0;
328
345 virtual QStringList Variants () const = 0;
346
367 const QString& variant,
368 const QString& body) = 0;
369
380 virtual QList<IMessage*> GetAllMessages () const = 0;
381
396 virtual void PurgeMessages (const QDateTime& before) = 0;
397
406 virtual void SetChatPartState (ChatPartState state,
407 const QString& variant) = 0;
408
420 virtual EntryStatus GetStatus (const QString& variant = QString ()) const = 0;
421
424 virtual void ShowInfo () = 0;
425
434 virtual QList<QAction*> GetActions () const = 0;
435
459 virtual QMap<QString, QVariant> GetClientInfo (const QString& variant) const = 0;
460
471 virtual void MarkMsgsRead () = 0;
472
475 virtual void ChatTabClosed () = 0;
476
484 virtual void gotMessage (QObject *msg) = 0;
485
494 virtual void statusChanged (const EntryStatus& st,
495 const QString& variant) = 0;
496
505 virtual void availableVariantsChanged (const QStringList& newVars) = 0;
506
519 virtual void nameChanged (const QString& name) = 0;
520
533 virtual void groupsChanged (const QStringList& groups) = 0;
534
543 virtual void chatPartStateChanged (const ChatPartState& state,
544 const QString& variant) = 0;
545
551 virtual void permsChanged () = 0;
552
561 virtual void entryGenerallyChanged () = 0;
562 };
563}
564}
565
566Q_DECLARE_METATYPE (LC::Azoth::EntryStatus)
567Q_DECLARE_OPERATORS_FOR_FLAGS (LC::Azoth::ICLEntry::Features)
568Q_DECLARE_INTERFACE (LC::Azoth::ICLEntry,
569 "org.Deviant.LeechCraft.Azoth.ICLEntry/1.0")
Interface representing a single account.
Definition iaccount.h:45
Represents a single entry in contact list.
Definition iclentry.h:121
virtual QObject * GetQObject()=0
virtual Features GetEntryFeatures() const =0
virtual void ChatTabClosed()=0
Called by Azoth when the chat with the entry is closed.
virtual void PurgeMessages(const QDateTime &before)=0
Purges messages before the given date.
EntryType
Definition iclentry.h:175
@ PrivateChat
Definition iclentry.h:187
@ Chat
Definition iclentry.h:178
@ MUC
Definition iclentry.h:182
@ UnauthEntry
Definition iclentry.h:192
virtual QString GetEntryID() const =0
Returns the ID of this entry.
virtual QStringList Groups() const =0
Returns the list of human-readable names of the groups that this entry belongs to.
virtual QString GetHumanReadableID() const
Returns the human-readable ID of this entry.
Definition iclentry.h:308
virtual void groupsChanged(const QStringList &groups)=0
This signal should be emitted whenever the entry's groups are changed.
virtual void SetChatPartState(ChatPartState state, const QString &variant)=0
Notifies about our chat participation state change.
virtual void MarkMsgsRead()=0
Called whenever new messages are read.
Feature
Definition iclentry.h:129
@ FSelfContact
Definition iclentry.h:169
@ FHasCustomChatWidget
Definition iclentry.h:155
@ FMaskLongetivity
Definition iclentry.h:146
@ FSessionEntry
Definition iclentry.h:142
@ FSupportsRenames
Definition iclentry.h:151
@ FSupportsGrouping
Definition iclentry.h:165
@ FPermanentEntry
Definition iclentry.h:137
@ FSupportsAuth
Definition iclentry.h:161
virtual void entryGenerallyChanged()=0
This signal should be emitted when the entry changes.
virtual void availableVariantsChanged(const QStringList &newVars)=0
This signal should be emitted whenever the list of available variants changes.
virtual void chatPartStateChanged(const ChatPartState &state, const QString &variant)=0
This signal should be emitted whenever the chat participation state of this entry changes.
virtual void SetGroups(const QStringList &groups)=0
Sets the list of groups this item belongs to.
virtual QList< IMessage * > GetAllMessages() const =0
Returns all already sent or received messages.
virtual EntryType GetEntryType() const =0
virtual void permsChanged()=0
This signal should be emitted if it's a MUC participant and his role/affiliation changes.
virtual void gotMessage(QObject *msg)=0
This signal should be emitted whenever a new message is received.
virtual EntryStatus GetStatus(const QString &variant=QString()) const =0
Returns the current status of a variant of the item.
virtual QMap< QString, QVariant > GetClientInfo(const QString &variant) const =0
Returns the client information for the given variant.
virtual IMessage * CreateMessage(IMessage::Type type, const QString &variant, const QString &body)=0
Creates the message of the given type to the given variant.
virtual QString GetEntryName() const =0
virtual ~ICLEntry()
Definition iclentry.h:123
virtual IAccount * GetParentAccount() const =0
virtual void statusChanged(const EntryStatus &st, const QString &variant)=0
This signal should be emitted whenever the status of a variant in this entry changes.
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the item.
QObject * GetParentCLEntryObject() const
Definition iclentry.h:227
virtual void ShowInfo()=0
Requests the entry to show dialog with info about it.
virtual void nameChanged(const QString &name)=0
This signal should be emitted whenever the entry changes name.
virtual ICLEntry * GetParentCLEntry() const
Definition iclentry.h:222
virtual QStringList Variants() const =0
Returns the list of destination variants.
virtual void SetEntryName(const QString &name)=0
Sets the human-readable name of this entry.
This interface is used to represent a message.
Definition imessage.h:43
Type
Represents possible message types.
Definition imessage.h:63
State
Describes possible presence states of an account or a contact.
Definition azothcommon.h:23
bool operator!=(const ActivityInfo &i1, const ActivityInfo &i2)
Checks whether the activity info structures are not equal.
bool operator==(const ActivityInfo &i1, const ActivityInfo &i2)
Checks whether the activity info structures are equal.
Describes an entry's status.
Definition iclentry.h:35
State State_
The general state of the entry.
Definition iclentry.h:38
EntryStatus()
Default-constructs an (offline) status.
Definition iclentry.h:46
QString StatusString_
The string of the entry accompanying its state.
Definition iclentry.h:42
EntryStatus(State state, const QString &string)
Constructs a status with a given state and status string.
Definition iclentry.h:57