LeechCraft Azoth  0.6.70-13907-g785196c688
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #ifndef PLUGINS_AZOTH_INTERFACES_IACCOUNT_H
31 #define PLUGINS_AZOTH_INTERFACES_IACCOUNT_H
32 #include <QFlags>
33 #include <QMetaType>
34 #include <QVariant>
35 #include <QStringList>
37 #include "iclentry.h"
38 
39 namespace LC
40 {
41 namespace Azoth
42 {
43  class IProtocol;
44  class ICLEntry;
45 
65  class IAccount
66  {
67  bool IsShown_ = true;
68  public:
69  virtual ~IAccount () {}
70 
73  enum AccountFeature
74  {
78  FRenamable = 0x01,
79 
82  FSupportsXA = 0x02,
83 
87 
91 
96 
101  };
102 
103  Q_DECLARE_FLAGS (AccountFeatures, AccountFeature)
104 
105 
109  virtual QObject* GetQObject () = 0;
110 
116  virtual QObject* GetParentProtocol () const = 0;
117 
123  virtual AccountFeatures GetAccountFeatures () const = 0;
124 
134  virtual QList<QObject*> GetCLEntries () = 0;
135 
142  virtual QString GetAccountName () const = 0;
143 
148  virtual QString GetOurNick () const = 0;
149 
157  virtual void RenameAccount (const QString& name) = 0;
158 
167  virtual QByteArray GetAccountID () const = 0;
168 
176  virtual QList<QAction*> GetActions () const = 0;
177 
180  virtual void OpenConfigurationDialog () = 0;
181 
186  virtual EntryStatus GetState () const = 0;
187 
195  virtual void ChangeState (const EntryStatus& status) = 0;
196 
203  virtual void Authorize (QObject *entry) = 0;
204 
211  virtual void DenyAuth (QObject *entry) = 0;
212 
242  virtual void RequestAuth (const QString& entry,
243  const QString& msg = QString (),
244  const QString& name = QString (),
245  const QStringList& groups = QStringList ()) = 0;
246 
257  virtual void RemoveEntry (QObject *entry) = 0;
258 
268  virtual QObject* GetTransferManager () const = 0;
269 
281  virtual bool IsShownInRoster () const
282  {
283  return IsShown_;
284  }
285 
304  virtual void SetShownInRoster (bool shown)
305  {
306  IsShown_ = shown;
307  }
308 
318  virtual void accountRenamed (const QString& newName) = 0;
319 
327  virtual void gotCLItems (const QList<QObject*>& items) = 0;
328 
340  virtual void removedCLItems (const QList<QObject*>& items) = 0;
341 
361  virtual void authorizationRequested (QObject *entry,
362  const QString& message) = 0;
363 
380  virtual void itemSubscribed (QObject *entry, const QString& message) = 0;
381 
399  virtual void itemUnsubscribed (QObject *entry, const QString& message) = 0;
400 
413  virtual void itemUnsubscribed (const QString& entryID, const QString& message) = 0;
414 
427  virtual void itemCancelledSubscription (QObject *entry, const QString& message) = 0;
428 
441  virtual void itemGrantedSubscription (QObject *entry, const QString& message) = 0;
442 
450  virtual void statusChanged (const EntryStatus& status) = 0;
451 
463  virtual void mucInvitationReceived (const QVariantMap& ident,
464  const QString& inviter, const QString& reason) = 0;
465  };
466 }
467 }
468 
469 Q_DECLARE_METATYPE (LC::Azoth::IAccount*)
470 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::Azoth::IAccount::AccountFeatures)
471 Q_DECLARE_INTERFACE (LC::Azoth::IAccount,
472  "org.Deviant.LeechCraft.Azoth.IAccount/1.0")
473 
474 #endif
LC::Azoth::IAccount::GetQObject
virtual QObject * GetQObject()=0
Returns the account object as a QObject.
LC::Azoth::IAccount::GetAccountFeatures
virtual AccountFeatures GetAccountFeatures() const =0
Returns the OR-ed combination of features of this account.
LC::Azoth::IAccount::FMUCsSupportFileTransfers
@ FMUCsSupportFileTransfers
Definition: iaccount.h:154
LC::Azoth::IAccount::IsShownInRoster
virtual bool IsShownInRoster() const
Whether the account should be shown in the roster.
Definition: iaccount.h:335
LC::Azoth::IAccount::GetCLEntries
virtual QList< QObject * > GetCLEntries()=0
Returns the list of contact list entries of this account.
LC::Azoth::IAccount::GetTransferManager
virtual QObject * GetTransferManager() const =0
Returns the object responsible for file transfers in this account.
QList
Definition: iaccountactionsprovider.h:37
LC::Azoth::IAccount::SetShownInRoster
virtual void SetShownInRoster(bool shown)
Sets whether the account should be shown in the roster.
Definition: iaccount.h:358
LC::Azoth::IAccount::accountRenamed
virtual void accountRenamed(const QString &newName)=0
This signal should be emitted when account is renamed.
LC::Azoth::IAccount::itemUnsubscribed
virtual void itemUnsubscribed(QObject *entry, const QString &message)=0
This signal should be emitted when an already added entry has just unsubscribed from us.
LC::Azoth::IAccount::authorizationRequested
virtual void authorizationRequested(QObject *entry, const QString &message)=0
This signal should be emitted when another user requests authorization from this account.
LC::Azoth::IAccount::statusChanged
virtual void statusChanged(const EntryStatus &status)=0
This signal should be emitted when status of this account changes for whatever reason.
LC::Azoth::IAccount::~IAccount
virtual ~IAccount()
Definition: iaccount.h:123
LC::Azoth::IAccount::itemCancelledSubscription
virtual void itemCancelledSubscription(QObject *entry, const QString &message)=0
This signal should be emitted when a roster item cancels (or denies) our subscription.
LC::Azoth::IAccount::mucInvitationReceived
virtual void mucInvitationReceived(const QVariantMap &ident, const QString &inviter, const QString &reason)=0
This signal should be emitted whenever a MUC invitation has been received.
LC::Azoth::IAccount::RequestAuth
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.
LC::Azoth::IAccount::RemoveEntry
virtual void RemoveEntry(QObject *entry)=0
Removes the given entry from the contact list.
LC::Azoth::IAccount::AccountFeature
AccountFeature
Definition: iaccount.h:128
LC::Azoth::IAccount::GetOurNick
virtual QString GetOurNick() const =0
Returns the nickname of our user.
LC::Azoth::IAccount::DenyAuth
virtual void DenyAuth(QObject *entry)=0
Denies authorization for the given entry.
LC::Azoth::IAccount::GetParentProtocol
virtual QObject * GetParentProtocol() const =0
Returns the pointer to the parent protocol that this account belongs to.
LC::Azoth::IAccount::itemSubscribed
virtual void itemSubscribed(QObject *entry, const QString &message)=0
This signal should be emitted when an already added entry has just subscribed to us.
LC::Azoth::IAccount::GetActions
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the account item.
LC::Azoth::IAccount::GetAccountName
virtual QString GetAccountName() const =0
Returns the human-readable name of this account.
LC::Azoth::IAccount::FCanViewContactsInfoInOffline
@ FCanViewContactsInfoInOffline
Definition: iaccount.h:149
LC::Azoth::IAccount::FRenamable
@ FRenamable
Definition: iaccount.h:132
LC::Azoth::IAccount::OpenConfigurationDialog
virtual void OpenConfigurationDialog()=0
Requests the account to open its configuration dialog.
LC
Definition: activityinfo.h:35
LC::Azoth::IAccount::gotCLItems
virtual void gotCLItems(const QList< QObject * > &items)=0
This signal should be emitted when new contact list items appear in this account.
LC::Azoth::IAccount::RenameAccount
virtual void RenameAccount(const QString &name)=0
Sets the human-readable name of this account to the new name.
LC::Azoth::IAccount::itemGrantedSubscription
virtual void itemGrantedSubscription(QObject *entry, const QString &message)=0
This signal should be emitted when a roster item grants us subscription.
LC::Azoth::IAccount::FHasConfigurationDialog
@ FHasConfigurationDialog
Definition: iaccount.h:140
azothcommon.h
LC::Azoth::IAccount::FCanAddContactsInOffline
@ FCanAddContactsInOffline
Definition: iaccount.h:144
LC::Azoth::IAccount::Authorize
virtual void Authorize(QObject *entry)=0
Grants authorization to the given entry.
iclentry.h
LC::Azoth::IAccount::GetAccountID
virtual QByteArray GetAccountID() const =0
Returns the ID of this account.
LC::Azoth::IAccount::ChangeState
virtual void ChangeState(const EntryStatus &status)=0
Sets the status of this account.
LC::Azoth::IAccount::FSupportsXA
@ FSupportsXA
Definition: iaccount.h:136
LC::Azoth::IAccount::GetState
virtual EntryStatus GetState() const =0
Returns the current status of this account.
LC::Azoth::IAccount
Interface representing a single account.
Definition: iaccount.h:120
LC::Azoth::EntryStatus
Describes an entry's status.
Definition: iclentry.h:56
LC::Azoth::IAccount::removedCLItems
virtual void removedCLItems(const QList< QObject * > &items)=0
This signal should be emitted after any contact list items are removed.