LeechCraft Azoth  0.6.70-6645-gcd10d7e
Modular multiprotocol IM plugin for LeechCraft
LeechCraft::Azoth::ISDSession Class Referenceabstract

Interface for service discovery sessions. More...

#include "ihaveservicediscovery.h"

Public Member Functions

virtual ~ISDSession ()
 
virtual void SetQuery (const QString &query)=0
 Sets the service discovery query. More...
 
virtual QString GetQuery () const =0
 Returns the query of this SD session. More...
 
virtual QAbstractItemModel * GetRepresentationModel () const =0
 Returns the model representing discovery results. More...
 
virtual QList< QPair< QByteArray, QString > > GetActionsFor (const QModelIndex &index)=0
 Returns the list of actions for the given index. More...
 
virtual void ExecuteAction (const QModelIndex &index, const QByteArray &id)=0
 Executes the action with the given id. More...
 

Detailed Description

Interface for service discovery sessions.

This interface is expected to be implemented by the objects returned from IHaveServiceDiscovery::CreateSDSession() representing service discovery sessions.

The service discovery query string is set via SetQuery() method, and the model representing service discovery results is obtained via GetRepresentationModel() method. The list of possible actions for a given index in that model is obtained via GetActionsFor(), and if the user chooses to execute an action, ExecuteAction() is called.

See also
IHaveServiceDiscovery

Definition at line 57 of file ihaveservicediscovery.h.

Constructor & Destructor Documentation

virtual LeechCraft::Azoth::ISDSession::~ISDSession ( )
inlinevirtual

Definition at line 60 of file ihaveservicediscovery.h.

References ExecuteAction(), GetActionsFor(), GetQuery(), GetRepresentationModel(), and SetQuery().

+ Here is the call graph for this function:

Member Function Documentation

virtual void LeechCraft::Azoth::ISDSession::ExecuteAction ( const QModelIndex &  index,
const QByteArray &  id 
)
pure virtual

Executes the action with the given id.

This function is called when the user selects an action from the list returned by GetActionsFor().

The id is the same ID that was returned from the GetActionsFor().

Parameters
[in]indexThe model index for which to execute the action.
[in]idThe ID of the action to be executed.
See also
GetActionsFor

Referenced by ~ISDSession().

+ Here is the caller graph for this function:

virtual QList<QPair<QByteArray, QString> > LeechCraft::Azoth::ISDSession::GetActionsFor ( const QModelIndex &  index)
pure virtual

Returns the list of actions for the given index.

This function should return the list of actions for the given model index, which belongs to the model returned by the GetRepresentationModel(). If the protocol (or account) doesn't support the concept of actions, or there are no actions for the index, an empty list should be returned.

The actual return value is the list of pairs. In each pair, the first element is the ID of the action (defined by the underlying implementation, of course), and the other one is the human-readable name of the action. If the user selects an action to be executed, its ID is passed to the ExecuteAction() function.

Parameters
[in]indexThe model index for which to return the list of actions.
Returns
The list of actions for the given index.
See also
GetRepresentationModel, ExecuteAction

Referenced by ~ISDSession().

+ Here is the caller graph for this function:

virtual QString LeechCraft::Azoth::ISDSession::GetQuery ( ) const
pure virtual

Returns the query of this SD session.

This function should return the query string of this service discovery session, or an empty string if no query has been set.

Returns
The query string.
See also
SetQuery()

Referenced by ~ISDSession().

+ Here is the caller graph for this function:

virtual QAbstractItemModel* LeechCraft::Azoth::ISDSession::GetRepresentationModel ( ) const
pure virtual

Returns the model representing discovery results.

Of course, this model can be changed dynamically by the account in accordance with the query set by the SetQuery() method.

If the protocol (and account) supports recursive and hierarchical service discovery results, it is recommended that the model fetches data lazily, as long as fetchMore() and such is called, to minimize network traffic and load.

The model returned by this function must be the same during the whole lifetime of this service discovery session.

Returns
The model with service discovery results.
See also
SetQuery, GetActionsFor, ExecuteAction

Referenced by ~ISDSession().

+ Here is the caller graph for this function:

virtual void LeechCraft::Azoth::ISDSession::SetQuery ( const QString &  query)
pure virtual

Sets the service discovery query.

The contents and semantics of the query string vary depending on the protocol. For example, for XMPP protocol it could be "neko.im" for querying an XMPP server or something like "c_plus_plus@conference.jabber.ru" for querying a MUC room.

Parameters
[in]queryThe query string.
See also
GetRepresentationModel, GetQuery()

Referenced by ~ISDSession().

+ Here is the caller graph for this function:


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