LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::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 36 of file ihaveservicediscovery.h.

Constructor & Destructor Documentation

◆ ~ISDSession()

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

Definition at line 39 of file ihaveservicediscovery.h.

Member Function Documentation

◆ ExecuteAction()

virtual void LC::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

◆ GetActionsFor()

virtual QList<QPair<QByteArray, QString> > LC::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

◆ GetQuery()

virtual QString LC::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()

◆ GetRepresentationModel()

virtual QAbstractItemModel* LC::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

◆ SetQuery()

virtual void LC::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()

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