ConnectionEnumerate

From TrillWiki

Jump to: navigation, search

Will deliver each connection one by one to a callback function provided.

Compatibility: 1.0 and higher

Contents

Syntax

plugin_send(MYGUID, "connectionEnumerate", struct connection_enum_t *);

Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.

Parameters

ConnectionEnumerate utilitizes the connection_enum_t structure.

struct connection_enum_t
{
    unsigned int                struct_size;

    char                        *medium;

    ttkCallback                 callback;

    void                        *data;
};



medium
String for the medium. This value can be "all" if you wish to enumerate through all connections.
callback
The callback to receive the enumeration notifications.
data
Data passed to the callback.


Return Value

Negative value on error, 0 on success.

Remarks

The callback function will be an Enumeration Notification function. Therefore it will receive enum_start, enum_add and enum_finish. For each enum_add, the data passed in will be a struct connection_entry_t. The fields will be filled out as follows:


medium
The medium that the user is connected to.
connection_id
The connection ID.
name
The particular name associated with a connection. This varies from medium to medium.
status
The status of that connection at the time of the call. This varies from medium to medium.

It is important to note that this enumeration will only send back currently open connections, not every registered account. These connections can be online, offline, or any particular status, but a connection must be open. Accounts that have no open connection will not be returned back via this enumeration.

Personal tools