LeechCraft Azoth  0.6.70-18450-gabe19ee3b0
Modular multiprotocol IM plugin for LeechCraft
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 <util/azoth/emitters/clentry.h>
14 #include "azothcommon.h"
15 #include "message.h"
16 
17 class QAction;
18 class QImage;
19 
20 namespace LC::Azoth
21 {
22  class IAccount;
23  class IMessage;
24 
56  class ICLEntry
57  {
58  protected:
60 
61  virtual ~ICLEntry () = default;
62  public:
64 
68  enum Feature
69  {
77  FPermanentEntry = 0x0000,
78 
82  FSessionEntry = 0x0001,
83 
86  FMaskLongetivity = 0x0003,
87 
91  FSupportsRenames = 0x0020,
92 
96 
101  FSupportsAuth = 0x0080,
102 
106 
109  FSelfContact = 0x0200
110  };
111 
112  Q_DECLARE_FLAGS (Features, Feature)
113 
114  enum class EntryType
115  {
118  Chat,
119 
122  MUC,
123 
127  PrivateChat,
128 
132  UnauthEntry
133  };
134 
139  virtual QObject* GetQObject () = 0;
140 
146  virtual IAccount* GetParentAccount () const = 0;
147 
162  virtual ICLEntry* GetParentCLEntry () const
163  {
164  return nullptr;
165  }
166 
167  QObject* GetParentCLEntryObject () const
168  {
169  if (const auto entry = GetParentCLEntry ())
170  return entry->GetQObject ();
171  return nullptr;
172  }
173 
179  virtual Features GetEntryFeatures () const = 0;
180 
185  virtual EntryType GetEntryType () const = 0;
186 
193  virtual QString GetEntryName () const = 0;
194 
203  virtual void SetEntryName (const QString& name) = 0;
204 
223  virtual QString GetEntryID () const = 0;
224 
248  virtual QString GetHumanReadableID () const
249  {
250  return GetEntryID ();
251  }
252 
258  virtual QStringList Groups () const = 0;
259 
267  virtual void SetGroups (const QStringList& groups) = 0;
268 
285  virtual QStringList Variants () const = 0;
286 
289  virtual void SendMessage (const OutgoingMessage& message) = 0;
290 
301  virtual QList<IMessage*> GetAllMessages () const = 0;
302 
317  virtual void PurgeMessages (const QDateTime& before) = 0;
318 
327  virtual void SetChatPartState (ChatPartState state,
328  const QString& variant) = 0;
329 
341  virtual EntryStatus GetStatus (const QString& variant = QString ()) const = 0;
342 
345  virtual void ShowInfo () = 0;
346 
355  virtual QList<QAction*> GetActions () const = 0;
356 
380  virtual QMap<QString, QVariant> GetClientInfo (const QString& variant) const = 0;
381 
392  virtual void MarkMsgsRead () = 0;
393 
396  virtual void ChatTabClosed () = 0;
397  };
398 }
399 
400 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::Azoth::ICLEntry::Features)
401 Q_DECLARE_INTERFACE (LC::Azoth::ICLEntry, "org.Deviant.LeechCraft.Azoth.ICLEntry/1.0")
Emitters::CLEntry & GetCLEntryEmitter()
Definition: iclentry.h:63
virtual ICLEntry * GetParentCLEntry() const
Definition: iclentry.h:162
EntryType
Definition: iclentry.h:114
Definition: iclentry.h:86
virtual void ShowInfo()=0
Requests the entry to show dialog with info about it.
Definition: iclentry.h:77
virtual QString GetHumanReadableID() const
Returns the human-readable ID of this entry.
Definition: iclentry.h:248
Feature
Definition: iclentry.h:68
virtual void SetEntryName(const QString &name)=0
Sets the human-readable name of this entry.
Definition: iclentry.h:109
QObject * GetParentCLEntryObject() const
Definition: iclentry.h:167
Definition: iclentry.h:82
virtual Features GetEntryFeatures() const =0
virtual QList< IMessage * > GetAllMessages() const =0
Returns all already sent or received messages.
virtual QString GetEntryID() const =0
Returns the ID of this entry.
virtual void SetChatPartState(ChatPartState state, const QString &variant)=0
Notifies about our chat participation state change.
Emitters::CLEntry Emitter_
Definition: iclentry.h:59
virtual void SetGroups(const QStringList &groups)=0
Sets the list of groups this item belongs to.
virtual IAccount * GetParentAccount() const =0
Definition: iclentry.h:101
virtual void PurgeMessages(const QDateTime &before)=0
Purges messages before the given date.
virtual QStringList Variants() const =0
Returns the list of destination variants.
Definition: iclentry.h:91
Definition: iclentry.h:105
virtual QStringList Groups() const =0
Returns the list of human-readable names of the groups that this entry belongs to.
Describes a message to be sent, as formed by the user and before it has been sent to the wire...
Definition: message.h:21
Describes an entry&#39;s status.
Definition: azothcommon.h:151
virtual EntryStatus GetStatus(const QString &variant=QString()) const =0
Returns the current status of a variant of the item.
virtual QObject * GetQObject()=0
Definition: iclentry.h:95
virtual EntryType GetEntryType() const =0
virtual QString GetEntryName() const =0
virtual ~ICLEntry()=default
virtual void ChatTabClosed()=0
Called by Azoth when the chat with the entry is closed.
Interface representing a single account.
Definition: iaccount.h:45
virtual QMap< QString, QVariant > GetClientInfo(const QString &variant) const =0
Returns the client information for the given variant.
Represents a single entry in contact list.
Definition: iclentry.h:56
virtual void MarkMsgsRead()=0
Called whenever new messages are read.
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the item.
virtual void SendMessage(const OutgoingMessage &message)=0
Sends the message described by message.