LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IAccount Class Referenceabstract

Interface representing a single account. More...

#include "iaccount.h"

Public Types

enum  AccountFeature {
  FRenamable = 0x01, FSupportsXA = 0x02, FHasConfigurationDialog = 0x04, FCanAddContactsInOffline = 0x08,
  FCanViewContactsInfoInOffline = 0x10, FMUCsSupportFileTransfers = 0x20
}
 

Public Member Functions

virtual ~IAccount ()
 
virtual QObject * GetQObject ()=0
 Returns the account object as a QObject. More...
 
virtual QObject * GetParentProtocol () const =0
 Returns the pointer to the parent protocol that this account belongs to. More...
 
virtual AccountFeatures GetAccountFeatures () const =0
 Returns the OR-ed combination of features of this account. More...
 
virtual QList< QObject * > GetCLEntries ()=0
 Returns the list of contact list entries of this account. More...
 
virtual QString GetAccountName () const =0
 Returns the human-readable name of this account. More...
 
virtual QString GetOurNick () const =0
 Returns the nickname of our user. More...
 
virtual void RenameAccount (const QString &name)=0
 Sets the human-readable name of this account to the new name. More...
 
virtual QByteArray GetAccountID () const =0
 Returns the ID of this account. More...
 
virtual QList< QAction * > GetActions () const =0
 Returns the list of actions for the account item. More...
 
virtual void OpenConfigurationDialog ()=0
 Requests the account to open its configuration dialog. More...
 
virtual EntryStatus GetState () const =0
 Returns the current status of this account. More...
 
virtual void ChangeState (const EntryStatus &status)=0
 Sets the status of this account. More...
 
virtual void Authorize (QObject *entry)=0
 Grants authorization to the given entry. More...
 
virtual void DenyAuth (QObject *entry)=0
 Denies authorization for the given entry. More...
 
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. More...
 
virtual void RemoveEntry (QObject *entry)=0
 Removes the given entry from the contact list. More...
 
virtual QObject * GetTransferManager () const =0
 Returns the object responsible for file transfers in this account. More...
 
virtual bool IsShownInRoster () const
 Whether the account should be shown in the roster. More...
 
virtual void SetShownInRoster (bool shown)
 Sets whether the account should be shown in the roster. More...
 
virtual void accountRenamed (const QString &newName)=0
 This signal should be emitted when account is renamed. More...
 
virtual void gotCLItems (const QList< QObject * > &items)=0
 This signal should be emitted when new contact list items appear in this account. More...
 
virtual void removedCLItems (const QList< QObject * > &items)=0
 This signal should be emitted after any contact list items are removed. More...
 
virtual void authorizationRequested (QObject *entry, const QString &message)=0
 This signal should be emitted when another user requests authorization from this account. More...
 
virtual void itemSubscribed (QObject *entry, const QString &message)=0
 This signal should be emitted when an already added entry has just subscribed to us. More...
 
virtual void itemUnsubscribed (QObject *entry, const QString &message)=0
 This signal should be emitted when an already added entry has just unsubscribed from us. More...
 
virtual void itemUnsubscribed (const QString &entryID, const QString &message)=0
 This signal should be emitted when a non-roster item has just unsubscribed from us. More...
 
virtual void itemCancelledSubscription (QObject *entry, const QString &message)=0
 This signal should be emitted when a roster item cancels (or denies) our subscription. More...
 
virtual void itemGrantedSubscription (QObject *entry, const QString &message)=0
 This signal should be emitted when a roster item grants us subscription. More...
 
virtual void statusChanged (const EntryStatus &status)=0
 This signal should be emitted when status of this account changes for whatever reason. More...
 
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. More...
 

Detailed Description

Interface representing a single account.

This interface represents an account — an entity within IProtocol owning some ICLEntry objects.

The account may also implement IHaveServiceDiscovery if it supports some XMPP's service discovery-like functionality. Look at that documentation for more information.

If the account supports something similar to XML console, it can also implement the IHaveConsole interface.

If the account supports publishing user tune, it may implement ISupportTune.

See also
IHaveServiceDiscovery, IHaveConsole
ISupportTune, ISupportMood, ISupportActivity
ISupportGeolocation

Definition at line 56 of file iaccount.h.

Member Enumeration Documentation

◆ AccountFeature

Represents the features that may be supported by an acoount.

Enumerator
FRenamable 

This account can be renamed, so calls to RenameAccount() would not be senseless.

FSupportsXA 

This account supports Extended Away statuses.

FHasConfigurationDialog 

This account has configuration dialog.

FCanAddContactsInOffline 

This account can add accounts to CL while being offline.

FCanViewContactsInfoInOffline 

This account supports viewing contacts information while offline.

FMUCsSupportFileTransfers 

This account supports sending and receiving files to or from MUCs.

Definition at line 64 of file iaccount.h.

Constructor & Destructor Documentation

◆ ~IAccount()

virtual LC::Azoth::IAccount::~IAccount ( )
inlinevirtual

Definition at line 60 of file iaccount.h.

Member Function Documentation

◆ accountRenamed()

virtual void LC::Azoth::IAccount::accountRenamed ( const QString &  newName)
pure virtual

This signal should be emitted when account is renamed.

This signal should be emitted even after an explicit call to RenameAccount().

Note
This function is expected to be a signal.
Parameters
[out]newNameThe new name of this account.

◆ authorizationRequested()

virtual void LC::Azoth::IAccount::authorizationRequested ( QObject *  entry,
const QString &  message 
)
pure virtual

This signal should be emitted when another user requests authorization from this account.

When a remote user requests authorization (or subscription in terms of XMPP, for example) from this account, this signal should be emitted. The entry is expected to represent the remote that requested the authorization and it must implement ICLEntry.

Note
This function is expected to be a signal.
Parameters
[out]entryThe object representing the requesting entry, must be an ICLEntry.
[out]messageOptional request message, if applicable.
See also
Authorize(), DenyAuth(), RequestAuth(), itemSubscribed(), itemUnsubscribed(), itemCancelledSubscription(), itemGrantedSubscription()

◆ Authorize()

virtual void LC::Azoth::IAccount::Authorize ( QObject *  entry)
pure virtual

Grants authorization to the given entry.

entry is expected to be deleted in this function.

Parameters
[in]entryEntry object implementing ICLEntry.

◆ ChangeState()

virtual void LC::Azoth::IAccount::ChangeState ( const EntryStatus status)
pure virtual

Sets the status of this account.

If the account was offline, it is expected to connect at this point automatically.

Parameters
[in]statusThe new status of this account.

◆ DenyAuth()

virtual void LC::Azoth::IAccount::DenyAuth ( QObject *  entry)
pure virtual

Denies authorization for the given entry.

entry is expected to be deleted in this function.

Parameters
[in]entryEntry object implementing ICLEntry.

◆ GetAccountFeatures()

virtual AccountFeatures LC::Azoth::IAccount::GetAccountFeatures ( ) const
pure virtual

Returns the OR-ed combination of features of this account.

Returns
The features of this account.

◆ GetAccountID()

virtual QByteArray LC::Azoth::IAccount::GetAccountID ( ) const
pure virtual

Returns the ID of this account.

The returned ID should be unique among all accounts and should not depend on the value of GetAccountName() (the human-readable name of the account).

Returns
The unique and persistent account ID.

◆ GetAccountName()

virtual QString LC::Azoth::IAccount::GetAccountName ( ) const
pure virtual

Returns the human-readable name of this account.

Returns
Human-readable name of this account.
See also
RenameAccount()

◆ GetActions()

virtual QList<QAction*> LC::Azoth::IAccount::GetActions ( ) const
pure virtual

Returns the list of actions for the account item.

The list is showed, for example, when user calls the context menu on the account item, or such.

Returns
The list of actions.

◆ GetCLEntries()

virtual QList<QObject*> LC::Azoth::IAccount::GetCLEntries ( )
pure virtual

Returns the list of contact list entries of this account.

Typically this would be the list of contacts added to the account plus any entries that represent multiuser chatrooms, their participants and such, if applicable.

Returns
The list of contact list entries of this account.

◆ GetOurNick()

virtual QString LC::Azoth::IAccount::GetOurNick ( ) const
pure virtual

Returns the nickname of our user.

Returns
Nickname of our user.

◆ GetParentProtocol()

virtual QObject* LC::Azoth::IAccount::GetParentProtocol ( ) const
pure virtual

Returns the pointer to the parent protocol that this account belongs to.

Returns
The parent protocol of this account.

◆ GetQObject()

virtual QObject* LC::Azoth::IAccount::GetQObject ( )
pure virtual

Returns the account object as a QObject.

Returns
Account object as QObject.

◆ GetState()

virtual EntryStatus LC::Azoth::IAccount::GetState ( ) const
pure virtual

Returns the current status of this account.

Returns
Current status of this account.

◆ GetTransferManager()

virtual QObject* LC::Azoth::IAccount::GetTransferManager ( ) const
pure virtual

Returns the object responsible for file transfers in this account.

If file transfers aren't supported, NULL should be returned. The returned object, is not NULL, is expected to implement ITransferManager.

Returns
The file transfer manager, or NULL if not supported.

◆ gotCLItems()

virtual void LC::Azoth::IAccount::gotCLItems ( const QList< QObject * > &  items)
pure virtual

This signal should be emitted when new contact list items appear in this account.

Note
This function is expected to be a signal.
Parameters
[out]itemsThe list of newly appeared items.

◆ IsShownInRoster()

virtual bool LC::Azoth::IAccount::IsShownInRoster ( ) const
inlinevirtual

Whether the account should be shown in the roster.

The default implementation simply returns the value of a the return variable set by SetShownInRoster().

By default, accounts should be shown in the roster.

Returns
Whether the account should be shown in roster.
See also
SetShownInRoster()

Definition at line 272 of file iaccount.h.

◆ itemCancelledSubscription()

virtual void LC::Azoth::IAccount::itemCancelledSubscription ( QObject *  entry,
const QString &  message 
)
pure virtual

This signal should be emitted when a roster item cancels (or denies) our subscription.

Note
This function is expected to be a signal.
Parameters
[out]entryThe object representing the entry that granted the subscription, must be an ICLEntry.
[out]messageOptional reason message.
See also
RequestAuth(), authorizationRequested(), itemSubscribed(), itemGrantedSubscription()

◆ itemGrantedSubscription()

virtual void LC::Azoth::IAccount::itemGrantedSubscription ( QObject *  entry,
const QString &  message 
)
pure virtual

This signal should be emitted when a roster item grants us subscription.

Note
This function is expected to be a signal.
Parameters
[out]entryThe object representing the entry that granted the subscription, must be an ICLEntry.
[out]messageOptional reason message.
See also
RequestAuth(), authorizationRequested(), itemSubscribed(), itemCancelledSubscription()

◆ itemSubscribed()

virtual void LC::Azoth::IAccount::itemSubscribed ( QObject *  entry,
const QString &  message 
)
pure virtual

This signal should be emitted when an already added entry has just subscribed to us.

If the item didn't previously exist, the proper gotCLItems() signal should be emitted before this one, of course.

Note
This function is expected to be a signal.
Parameters
[out]entryThe object representing the just subscribed entry in the contact list, must be an ICLEntry.
[out]messageAn optional reason message.
See also
Authorize(), DenyAuth(), RequestAuth(), authorizationRequested(), itemUnsubscribed(), itemCancelledSubscription(), itemGrantedSubscription()

◆ itemUnsubscribed() [1/2]

virtual void LC::Azoth::IAccount::itemUnsubscribed ( const QString &  entryID,
const QString &  message 
)
pure virtual

This signal should be emitted when a non-roster item has just unsubscribed from us.

Note
This function is expected to be a signal.
Parameters
[out]entryIDThe ID of just unsubscribed entry.
[out]messageAn optional reason message.
See also
Authorize(), DenyAuth(), RequestAuth(), authorizationRequested(), itemSubscribed(), itemCancelledSubscription(), itemGrantedSubscription()

◆ itemUnsubscribed() [2/2]

virtual void LC::Azoth::IAccount::itemUnsubscribed ( QObject *  entry,
const QString &  message 
)
pure virtual

This signal should be emitted when an already added entry has just unsubscribed from us.

If the item didn't exist in the roster, another overload of itemUnsubscribed() should be used, which takes the entry's ID as first parameter.

Note
This function is expected to be a signal.
Parameters
[out]entryThe object representing the unsubscribed entry in the contact list, must be an ICLEntry.
[out]messageAn optional reason message.
See also
Authorize(), DenyAuth(), RequestAuth(), authorizationRequested(), itemSubscribed(), itemCancelledSubscription(), itemGrantedSubscription()

◆ mucInvitationReceived()

virtual void LC::Azoth::IAccount::mucInvitationReceived ( const QVariantMap &  ident,
const QString &  inviter,
const QString &  reason 
)
pure virtual

This signal should be emitted whenever a MUC invitation has been received.

The ident parameter contains the map with the identifying data suitable for the IMUCJoinWidget of this account. Refer to IMUCJoinWidget documentation for more information.

Parameters
[out]identMUC identifying data for IMUCJoinWidget.
[out]inviterThe inviter's source ID or nickname.
[out]reasonAn optional reason string.

◆ OpenConfigurationDialog()

virtual void LC::Azoth::IAccount::OpenConfigurationDialog ( )
pure virtual

Requests the account to open its configuration dialog.

◆ removedCLItems()

virtual void LC::Azoth::IAccount::removedCLItems ( const QList< QObject * > &  items)
pure virtual

This signal should be emitted after any contact list items are removed.

The reason for removal doesn't matter. It could be a groupchat participant that exited or changed nickname, or some other stuff.

Note
This functions is expected to be a signal.
Parameters
[out]itemsThe list of removed items.

◆ RemoveEntry()

virtual void LC::Azoth::IAccount::RemoveEntry ( QObject *  entry)
pure virtual

Removes the given entry from the contact list.

Removes the entry from the contact list and automatically synchronizes the changes in the contact list, if applicable.

If the entry could not be removed at the moment, or if the parameter is invalid, this function should do nothing.

Parameters
[in]entryThe entry to remove.

◆ RenameAccount()

virtual void LC::Azoth::IAccount::RenameAccount ( const QString &  name)
pure virtual

Sets the human-readable name of this account to the new name.

Parameters
[in]nameThe new name of the account.
See also
GetAccountName()

◆ RequestAuth()

virtual void LC::Azoth::IAccount::RequestAuth ( const QString &  entry,
const QString &  msg = QString(),
const QString &  name = QString(),
const QStringList &  groups = QStringList() 
)
pure virtual

Requests authorization from the given entry.

entry is a human-readable identifier of the remote, as returned by ICLEntry::GetHumanReadableID().

If applicable and msg is a non-empty string, the msg should be sent to the entry as the message sent along with the request.

name should be the name under which the entry is added to the contact list, if applicable. If name is an empty string, a sane default should be used, like the human-readable ID — entry.

groups is the list of groups that this entry is added to. If groups is an emptry list, the behavior should be defined by the plugin - the entry should either be added to some kind of default group or have no assigned groups at all. If protocol supports only one group per entry, the first one in the list should be used.

Parameters
[in]entryHuman-readable ID of the remote.
[in]msgOptional request string to display to remote, if applicable.
[in]nameThe name under which the entry should be added to the contact list. May be blank.
[in]groupsThe groups to add the entry to, if applicable. May be blank.

◆ SetShownInRoster()

virtual void LC::Azoth::IAccount::SetShownInRoster ( bool  shown)
inlinevirtual

Sets whether the account should be shown in the roster.

The default implementation simply sets the corresponding private variable that is returned from IsShownInRoster().

Calling this function does not have to result in any kind of account saving, signal emission and so on. This function (and its IsShownInRoster() counterpart) are provided solely for Azoth core convenience.

After calling this function the IsShownInRoster() method should return the last value of shown.

Parameters
[in]shownWhether the account should be shown in the roster.
See also
IsShownInRoster()

Definition at line 295 of file iaccount.h.

◆ statusChanged()

virtual void LC::Azoth::IAccount::statusChanged ( const EntryStatus status)
pure virtual

This signal should be emitted when status of this account changes for whatever reason.

Note
This function is expected to be a signal.
Parameters
[out]statusNew status of this account.

The documentation for this class was generated from the following file: