LeechCraft Azoth  0.6.70-13605-g8cd066ad6a
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 LC
39 {
40 namespace Azoth
41 {
42  class IAccount;
43  class IProtocolPlugin;
44 
62  class IProtocol
63  {
64  public:
65  virtual ~IProtocol () {}
66 
70  enum ProtocolFeature
71  {
74  PFNone = 0x0,
75 
78  PFSupportsMUCs = 0x01,
79 
85  PFMUCsJoinable = 0x02,
86 
93 
100  };
101 
102  Q_DECLARE_FLAGS (ProtocolFeatures, ProtocolFeature)
103 
104 
107  enum AccountAddOption
108  {
111  AAONoOptions = 0,
112 
117  AAORegisterNewAccount = 0x01
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 (LC::Azoth::IProtocol*)
259 Q_DECLARE_OPERATORS_FOR_FLAGS (LC::Azoth::IProtocol::ProtocolFeatures)
260 Q_DECLARE_INTERFACE (LC::Azoth::IProtocol,
261  "org.Deviant.LeechCraft.Azoth.IProtocol/1.0")
LC::Azoth::IProtocol::AAONoOptions
Definition: iprotocol.h:110
LC::Azoth::IProtocol::RegisterAccount
virtual void RegisterAccount(const QString &name, const QList< QWidget * > &widgets)=0
Adds an account with the given name and widgets.
LC::Azoth::IProtocol
Represents a protocol.
Definition: iprotocol.h:61
QList
Definition: iaccountactionsprovider.h:36
LC::Azoth::IProtocol::ProtocolFeature
ProtocolFeature
Definition: iprotocol.h:69
LC::Azoth::IProtocol::accountRemoved
virtual void accountRemoved(QObject *account)=0
Notifies about an account having been removed.
LC::Azoth::IProtocol::accountAdded
virtual void accountAdded(QObject *account)=0
Notifies about new account.
LC::Azoth::IProtocol::GetFeatures
virtual ProtocolFeatures GetFeatures() const =0
LC::Azoth::IProtocol::GetQObject
virtual QObject * GetQObject()=0
Returns the protocol object as a QObject.
LC::Azoth::IProtocol::GetProtocolIcon
virtual QIcon GetProtocolIcon() const =0
Returns the icon of this protocol.
LC::Azoth::IProtocol::PFNone
Definition: iprotocol.h:73
LC::Azoth::IProtocol::GetAccountRegistrationWidgets
virtual QList< QWidget * > GetAccountRegistrationWidgets(AccountAddOptions options)=0
Returns the widgets used for account addition.
LC::Azoth::IProtocol::PFSupportsMUCs
Definition: iprotocol.h:77
LC::Azoth::IProtocol::GetProtocolID
virtual QByteArray GetProtocolID() const =0
Returns the protocol ID, which must be unique among all the protocols.
LC::Azoth::IProtocol::GetParentProtocolPlugin
virtual QObject * GetParentProtocolPlugin() const =0
Returns the pointer to the parent protocol plugin that this protocol belongs to.
LC::Azoth::IProtocol::PFNoAccountRegistration
Definition: iprotocol.h:98
LC::Azoth::IProtocol::GetRegisteredAccounts
virtual QList< QObject * > GetRegisteredAccounts()=0
Returns the accounts within this protocol.
LC::Azoth::IProtocol::PFSupportsInBandRegistration
Definition: iprotocol.h:91
LC
Definition: activityinfo.h:33
LC::Azoth::IProtocol::RemoveAccount
virtual void RemoveAccount(QObject *account)=0
Removes the given account.
LC::Azoth::IProtocol::GetProtocolName
virtual QString GetProtocolName() const =0
Returns the human-readable name of this protocol, like "Jabber" or "ICQ".
LC::Azoth::IProtocol::AccountAddOption
AccountAddOption
Definition: iprotocol.h:106
LC::Azoth::IProtocol::PFMUCsJoinable
Definition: iprotocol.h:84
LC::Azoth::IProtocol::~IProtocol
virtual ~IProtocol()
Definition: iprotocol.h:64
LC::Azoth::IProtocol::AAORegisterNewAccount
Definition: iprotocol.h:116