LeechCraft Azoth  0.6.70-18450-gabe19ee3b0
Modular multiprotocol IM plugin for LeechCraft
iaccount.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 <QVariant>
14 #include <QStringList>
16 #include <util/azoth/emitters/account.h>
17 #include "iclentry.h"
18 
19 namespace LC
20 {
21 namespace Azoth
22 {
23  class IProtocol;
24  class ICLEntry;
25 
45  class IAccount
46  {
47  bool IsShown_ = true;
48  protected:
49  Emitters::Account Emitter_;
50 
51  virtual ~IAccount () = default;
52  public:
53  Emitters::Account& GetAccountEmitter () { return Emitter_; }
54 
58  {
62  FRenamable = 0x01,
63 
66  FSupportsXA = 0x02,
67 
71 
75 
80 
85  };
86 
87  Q_DECLARE_FLAGS (AccountFeatures, AccountFeature)
88 
89 
93  virtual QObject* GetQObject () = 0;
94 
100  virtual QObject* GetParentProtocol () const = 0;
101 
107  virtual AccountFeatures GetAccountFeatures () const = 0;
108 
118  virtual QList<ICLEntry*> GetCLEntries () = 0;
119 
126  virtual QString GetAccountName () const = 0;
127 
132  virtual QString GetOurNick () const = 0;
133 
141  virtual void RenameAccount (const QString& name) = 0;
142 
151  virtual QByteArray GetAccountID () const = 0;
152 
160  virtual QList<QAction*> GetActions () const = 0;
161 
164  virtual void OpenConfigurationDialog () = 0;
165 
170  virtual EntryStatus GetState () const = 0;
171 
179  virtual void ChangeState (const EntryStatus& status) = 0;
180 
187  virtual void Authorize (QObject *entry) = 0;
188 
195  virtual void DenyAuth (QObject *entry) = 0;
196 
226  virtual void RequestAuth (const QString& entry,
227  const QString& msg = QString (),
228  const QString& name = QString (),
229  const QStringList& groups = QStringList ()) = 0;
230 
241  virtual void RemoveEntry (QObject *entry) = 0;
242 
252  virtual QObject* GetTransferManager () const = 0;
253 
265  virtual bool IsShownInRoster () const
266  {
267  return IsShown_;
268  }
269 
288  virtual void SetShownInRoster (bool shown)
289  {
290  IsShown_ = shown;
291  }
292  };
293 }
294 }
295 
296 Q_DECLARE_METATYPE (LC::Azoth::IAccount*)
297 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::Azoth::IAccount::AccountFeatures)
298 Q_DECLARE_INTERFACE (LC::Azoth::IAccount, "org.Deviant.LeechCraft.Azoth.IAccount/1.0")
virtual void RequestAuth(const QString &entry, const QString &msg=QString(), const QString &name=QString(), const QStringList &groups=QStringList())=0
Requests authorization from the given entry.
virtual void RemoveEntry(QObject *entry)=0
Removes the given entry from the contact list.
virtual QString GetOurNick() const =0
Returns the nickname of our user.
virtual void Authorize(QObject *entry)=0
Grants authorization to the given entry.
virtual QObject * GetParentProtocol() const =0
Returns the pointer to the parent protocol that this account belongs to.
virtual QObject * GetTransferManager() const =0
Returns the object responsible for file transfers in this account.
Emitters::Account & GetAccountEmitter()
Definition: iaccount.h:53
virtual EntryStatus GetState() const =0
Returns the current status of this account.
virtual bool IsShownInRoster() const
Whether the account should be shown in the roster.
Definition: iaccount.h:265
virtual void SetShownInRoster(bool shown)
Sets whether the account should be shown in the roster.
Definition: iaccount.h:288
virtual void OpenConfigurationDialog()=0
Requests the account to open its configuration dialog.
virtual QString GetAccountName() const =0
Returns the human-readable name of this account.
virtual void RenameAccount(const QString &name)=0
Sets the human-readable name of this account to the new name.
virtual QList< ICLEntry * > GetCLEntries()=0
Returns the list of contact list entries of this account.
virtual void ChangeState(const EntryStatus &status)=0
Sets the status of this account.
virtual QByteArray GetAccountID() const =0
Returns the ID of this account.
Describes an entry&#39;s status.
Definition: azothcommon.h:151
virtual AccountFeatures GetAccountFeatures() const =0
Returns the OR-ed combination of features of this account.
virtual QObject * GetQObject()=0
Returns the account object as a QObject.
virtual void DenyAuth(QObject *entry)=0
Denies authorization for the given entry.
Emitters::Account Emitter_
Definition: iaccount.h:49
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the account item.
virtual ~IAccount()=default
Interface representing a single account.
Definition: iaccount.h:45