LeechCraft Azoth  0.6.70-3565-g2d86529
Modular multiprotocol IM plugin for LeechCraft
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
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 LeechCraft
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 
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  protected:
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 
470 Q_DECLARE_OPERATORS_FOR_FLAGS (LeechCraft::Azoth::IAccount::AccountFeatures);
472  "org.Deviant.LeechCraft.Azoth.IAccount/1.0");
473 
474 #endif
virtual void gotCLItems(const QList< QObject * > &items)=0
This signal should be emitted when new contact list items appear in this account. ...
virtual QString GetOurNick() const =0
Returns the nickname of our user.
virtual void itemSubscribed(QObject *entry, const QString &message)=0
This signal should be emitted when an already added entry has just subscribed to us.
virtual void DenyAuth(QObject *entry)=0
Denies authorization for the given entry.
virtual void itemGrantedSubscription(QObject *entry, const QString &message)=0
This signal should be emitted when a roster item grants us subscription.
virtual QObject * GetTransferManager() const =0
Returns the object responsible for file transfers in this account.
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.
Q_DECLARE_INTERFACE(LeechCraft::Azoth::IAccount,"org.Deviant.LeechCraft.Azoth.IAccount/1.0")
virtual QString GetAccountName() const =0
Returns the human-readable name of this account.
virtual void SetShownInRoster(bool shown)
Sets whether the account should be shown in the roster.
Definition: iaccount.h:304
virtual QObject * GetQObject()=0
Returns the account object as a QObject.
virtual QList< QObject * > GetCLEntries()=0
Returns the list of contact list entries of this account.
virtual void statusChanged(const EntryStatus &status)=0
This signal should be emitted when status of this account changes for whatever reason.
virtual AccountFeatures GetAccountFeatures() const =0
Returns the OR-ed combination of features of this account.
Definition: iclentry.h:47
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the account item.
virtual void accountRenamed(const QString &newName)=0
This signal should be emitted when account is renamed.
virtual void RenameAccount(const QString &name)=0
Sets the human-readable name of this account to the new name.
Q_DECLARE_OPERATORS_FOR_FLAGS(LeechCraft::Azoth::IAccount::AccountFeatures)
virtual bool IsShownInRoster() const
Whether the account should be shown in the roster.
Definition: iaccount.h:281
virtual void itemCancelledSubscription(QObject *entry, const QString &message)=0
This signal should be emitted when a roster item cancels (or denies) our subscription.
virtual void RemoveEntry(QObject *entry)=0
Removes the given entry from the contact list.
virtual void OpenConfigurationDialog()=0
Requests the account to open its configuration dialog.
Interface representing a single account.
Definition: iaccount.h:65
virtual EntryStatus GetState() const =0
Returns the current status of this account.
virtual void authorizationRequested(QObject *entry, const QString &message)=0
This signal should be emitted when another user requests authorization from this account.
Q_DECLARE_METATYPE(LeechCraft::Azoth::IAccount *)
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 QObject * GetParentProtocol() const =0
Returns the pointer to the parent protocol that this account belongs to.
virtual void removedCLItems(const QList< QObject * > &items)=0
This signal should be emitted after any contact list items are removed.
virtual void itemUnsubscribed(QObject *entry, const QString &message)=0
This signal should be emitted when an already added entry has just unsubscribed from us...
virtual QByteArray GetAccountID() const =0
Returns the ID of this account.
virtual void ChangeState(const EntryStatus &status)=0
Sets the status of this account.
virtual void Authorize(QObject *entry)=0
Grants authorization to the given entry.