LeechCraft Azoth  0.6.70-10870-g558588d6ec
Modular multiprotocol IM plugin for LeechCraft
iprotocol.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 #pragma once
31 
32 #include <QFlags>
33 #include <QMetaType>
34 
35 class QObject;
36 class QIcon;
37 
38 namespace LeechCraft
39 {
40 namespace Azoth
41 {
42  class IAccount;
43  class IProtocolPlugin;
44 
62  class IProtocol
63  {
64  public:
65  virtual ~IProtocol () {}
66 
71  {
74  PFNone = 0x0,
75 
79 
86 
93 
100  };
101 
102  Q_DECLARE_FLAGS (ProtocolFeatures, ProtocolFeature)
103 
104 
108  {
112 
118  };
119 
120  Q_DECLARE_FLAGS (AccountAddOptions, AccountAddOption)
121 
122 
126  virtual QObject* GetQObject () = 0;
127 
130  virtual ProtocolFeatures GetFeatures () const = 0;
131 
138  virtual QList<QObject*> GetRegisteredAccounts () = 0;
139 
146  virtual QObject* GetParentProtocolPlugin () const = 0;
147 
153  virtual QString GetProtocolName () const = 0;
154 
159  virtual QIcon GetProtocolIcon () const = 0;
160 
166  virtual QByteArray GetProtocolID () const = 0;
167 
187  virtual QList<QWidget*> GetAccountRegistrationWidgets (AccountAddOptions options) = 0;
188 
213  virtual void RegisterAccount (const QString& name, const QList<QWidget*>& widgets) = 0;
214 
228  virtual void RemoveAccount (QObject *account) = 0;
229 
240  virtual void accountAdded (QObject *account) = 0;
241 
253  virtual void accountRemoved (QObject *account) = 0;
254  };
255 }
256 }
257 
258 Q_DECLARE_METATYPE (LeechCraft::Azoth::IProtocol*)
259 Q_DECLARE_OPERATORS_FOR_FLAGS (LeechCraft::Azoth::IProtocol::ProtocolFeatures)
260 Q_DECLARE_INTERFACE (LeechCraft::Azoth::IProtocol,
261  "org.Deviant.LeechCraft.Azoth.IProtocol/1.0")
virtual QObject * GetParentProtocolPlugin() const =0
Returns the pointer to the parent protocol plugin that this protocol belongs to.
Represents a protocol.
Definition: iprotocol.h:62
virtual QByteArray GetProtocolID() const =0
Returns the protocol ID, which must be unique among all the protocols.
virtual void accountAdded(QObject *account)=0
Notifies about new account.
virtual QList< QWidget * > GetAccountRegistrationWidgets(AccountAddOptions options)=0
Returns the widgets used for account addition.
virtual QString GetProtocolName() const =0
Returns the human-readable name of this protocol, like "Jabber" or "ICQ".
virtual QIcon GetProtocolIcon() const =0
Returns the icon of this protocol.
virtual ProtocolFeatures GetFeatures() const =0
virtual QObject * GetQObject()=0
Returns the protocol object as a QObject.
virtual QList< QObject * > GetRegisteredAccounts()=0
Returns the accounts within this protocol.
virtual void RegisterAccount(const QString &name, const QList< QWidget *> &widgets)=0
Adds an account with the given name and widgets.
virtual void accountRemoved(QObject *account)=0
Notifies about an account having been removed.
virtual void RemoveAccount(QObject *account)=0
Removes the given account.