![]() |
LeechCraft Azoth
0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
|
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... | |
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.
Definition at line 36 of file ihaveservicediscovery.h.
|
inlinevirtual |
Definition at line 39 of file ihaveservicediscovery.h.
|
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().
[in] | index | The model index for which to execute the action. |
[in] | id | The ID of the action to be executed. |
|
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.
[in] | index | The model index for which to return the list of actions. |
|
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.
|
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.
|
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.
[in] | query | The query string. |