![]() |
LeechCraft Azoth
0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
|
Represents a protocol. More...
#include "iprotocol.h"
Public Types | |
enum | ProtocolFeature { PFNone = 0x0, PFSupportsMUCs = 0x01, PFMUCsJoinable = 0x02, PFSupportsInBandRegistration = 0x04, PFNoAccountRegistration = 0x08 } |
enum | AccountAddOption { AAONoOptions = 0, AAORegisterNewAccount = 0x01 } |
Public Member Functions | |
virtual | ~IProtocol () |
virtual QObject * | GetQObject ()=0 |
Returns the protocol object as a QObject. More... | |
virtual ProtocolFeatures | GetFeatures () const =0 |
virtual QList< QObject * > | GetRegisteredAccounts ()=0 |
Returns the accounts within this protocol. More... | |
virtual QObject * | GetParentProtocolPlugin () const =0 |
Returns the pointer to the parent protocol plugin that this protocol belongs to. More... | |
virtual QString | GetProtocolName () const =0 |
Returns the human-readable name of this protocol, like "Jabber" or "ICQ". More... | |
virtual QIcon | GetProtocolIcon () const =0 |
Returns the icon of this protocol. More... | |
virtual QByteArray | GetProtocolID () const =0 |
Returns the protocol ID, which must be unique among all the protocols. More... | |
virtual QList< QWidget * > | GetAccountRegistrationWidgets (AccountAddOptions options)=0 |
Returns the widgets used for account addition. More... | |
virtual void | RegisterAccount (const QString &name, const QList< QWidget * > &widgets)=0 |
Adds an account with the given name and widgets. More... | |
virtual void | RemoveAccount (QObject *account)=0 |
Removes the given account. More... | |
virtual void | accountAdded (QObject *account)=0 |
Notifies about new account. More... | |
virtual void | accountRemoved (QObject *account)=0 |
Notifies about an account having been removed. More... | |
Represents a protocol.
IProtocol class represents a single protocol with its own set of accounts.
A protocol may also implement IURIHandler if it supports handling of various URIs, like xmpp: for XMPP protocol.
When user decides to add a new account within this protocol, the GetAccountRegistrationWidgets() function is called to get the list of widgets that should be filled out by the user by the exact values of his account, and if the user accepts the registration, RegisterAccount() would be called with those widgets.
Definition at line 41 of file iprotocol.h.
This enum describes the options that may be selected by the user when adding a new account.
Enumerator | |
---|---|
AAONoOptions | No custom options. |
AAORegisterNewAccount | User has chosen to register a new account (if the protocol advertises PFSupportsInBandRegistration feature). |
Definition at line 86 of file iprotocol.h.
This enum describes the features that may be supported by a protocol.
Enumerator | |
---|---|
PFNone | None of these features are supported by the protocol. |
PFSupportsMUCs | Multiuser chats are possible in this proto. |
PFMUCsJoinable | One could join MUCs as he wishes. If this feature is supported, a proper widget should be returned from the GetMUCJoinWidget() method. |
PFSupportsInBandRegistration | This protocol supports in-band registration: accounts could be registered right from the client.
|
PFNoAccountRegistration | This protocol doesn't support registering new accounts. This may be usable for dummy protocols for implementing things like metacontacts, for example. |
Definition at line 49 of file iprotocol.h.
|
inlinevirtual |
Definition at line 44 of file iprotocol.h.
|
pure virtual |
Notifies about new account.
This signal should be emitted whenever a new account appears in this protocol.
[out] | account | The newly added account, which must implement IAccount. |
|
pure virtual |
Notifies about an account having been removed.
This signal should be emitted whenever an already registered account is removed, for example, as the result of the call to RemoveAccount().
[out] | account | The just removed account, which must implement IAccount. |
|
pure virtual |
Returns the widgets used for account addition.
The widgets from the returned list are shown in the account addition wizard in the same order they appear in the returned list.
If the user accepts registering the account, the RegisterAccount() method would be called with the same set of widgets in the same order as returned from this function.
The ownership is transferred to the caller.
[in] | options | The options selected by the user to perform the account addition. |
|
pure virtual |
Returns the list of features supported by this protocol.
|
pure virtual |
Returns the pointer to the parent protocol plugin that this protocol belongs to.
|
pure virtual |
Returns the icon of this protocol.
|
pure virtual |
Returns the protocol ID, which must be unique among all the protocols.
|
pure virtual |
Returns the human-readable name of this protocol, like "Jabber" or "ICQ".
|
pure virtual |
Returns the protocol object as a QObject.
|
pure virtual |
Returns the accounts within this protocol.
Each object in the returned list must implement IAccount.
|
pure virtual |
Adds an account with the given name and widgets.
The list of widgets is the same (and in the same order) as returned from the GetAccountRegistrationWidgets() function. If this method is called, the widgets were shown to the user, and the user has accepted the account registration, so the widgets would be filled by the user to contain the required values. One could use qobject_cast to cast each widget in the list to the exact widget type and then use the values filled by the user.
If the account is added successfully, the accountAdded() signal should be emitted, otherwise nothing should be done.
[in] | name | The name of the account to be registered. |
[in] | widgets | The list of widgets returned from the GetAccountRegistrationWidgets() and filled by the user. |
|
pure virtual |
Removes the given account.
This function shouldn't ask anything from the user, just remove the account.
If the account is not registered, this function should do nothing.
After the removal, the accountRemoved() signal is expected to be emitted.
[in] | account | The account to remove. |