| Wocky Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define WOCKY_META_PORTER_ERROR struct WockyMetaPorterClass; enum WockyMetaPorterError; GSocketConnection * wocky_meta_porter_borrow_connection (WockyMetaPorter *porter,WockyLLContact *contact); GQuark wocky_meta_porter_error_quark (void); guint16 wocky_meta_porter_get_port (WockyMetaPorter *porter); void wocky_meta_porter_hold (WockyMetaPorter *porter,WockyContact *contact); WockyPorter * wocky_meta_porter_new (const gchar *jid,WockyContactFactory *contact_factory); void wocky_meta_porter_open_async (WockyMetaPorter *porter,WockyLLContact *contact,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data); gboolean wocky_meta_porter_open_finish (WockyMetaPorter *porter,GAsyncResult *result,GError **error); void wocky_meta_porter_set_jid (WockyMetaPorter *porter,const gchar *jid); void wocky_meta_porter_unhold (WockyMetaPorter *porter,WockyContact *contact);
typedef enum {
WOCKY_META_PORTER_ERROR_NO_CONTACT_ADDRESS,
WOCKY_META_PORTER_ERROR_FAILED_TO_CLOSE,
} WockyMetaPorterError;
GSocketConnection * wocky_meta_porter_borrow_connection (WockyMetaPorter *porter,WockyLLContact *contact);
Borrow the GSocketConnection of the porter to contact, if one
exists, otherwise NULL will be returned.
Note that the connection returned should be reffed using
g_object_ref() if it needs to be kept. However, it will still be
operated on by the underlying WockyXmppConnection object so can
close spontaneously unless wocky_meta_porter_hold() is called with
contact.
|
a WockyMetaPorter |
|
the WockyContact |
Returns : |
the GSocketConnection or NULL if no connection is open |
guint16 wocky_meta_porter_get_port (WockyMetaPorter *porter);
Returns the port porter is listening in on for new incoming XMPP
connections, or 0 if it has not been started yet with
wocky_porter_start().
|
a WockyMetaPorter |
Returns : |
the port porter is listening in on for new incoming XMPP
connections, or 0 if it has not been started. |
void wocky_meta_porter_hold (WockyMetaPorter *porter,WockyContact *contact);
Increases the hold count of the porter to contact by
one. This means that if there is a connection open to contact then
it will not disconnected after a timeout. Note that calling this
function does not mean a connection will be opened. The hold
count on a contact survives across connections.
To decrement the hold count of the porter to contact, one
must call wocky_meta_porter_unhold().
|
a WockyMetaPorter |
|
a WockyContact |
WockyPorter * wocky_meta_porter_new (const gchar *jid,WockyContactFactory *contact_factory);
Convenience function to create a new WockyMetaPorter object. The
JID can be set later by using wocky_meta_porter_set_jid().
|
the JID of the local user, or NULL
|
|
a WockyContactFactory object |
Returns : |
a new WockyMetaPorter |
void wocky_meta_porter_open_async (WockyMetaPorter *porter,WockyLLContact *contact,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Make an asynchronous request to open a connection to contact if
one is not already open. The hold count of the porter to
contact will be incrememented and so after completion
wocky_meta_porter_unhold() should be called on contact to release
the hold.
When the request is complete, callback will be called and the user
should call wocky_meta_porter_open_finish() to finish the request.
|
a WockyMetaPorter |
|
the WockyLLContact |
|
an optional GCancellable, or NULL
|
|
a callback to be called |
|
data for callback
|
gboolean wocky_meta_porter_open_finish (WockyMetaPorter *porter,GAsyncResult *result,GError **error);
Finishes an asynchronous request to open a connection if one is not
already open. See wocky_meta_porter_open_async() for more details.
|
a WockyMetaPorter |
|
the GAsyncResult |
|
an optional GError location to store an error message |
Returns : |
TRUE if the operation was a success, otherwise FALSE
|
void wocky_meta_porter_set_jid (WockyMetaPorter *porter,const gchar *jid);
Changes the local JID according to porter. Note that this function
can only be called once, and only if NULL was passed to
wocky_meta_porter_new() when creating porter. Calling it again
will be a no-op.
|
a WockyMetaPorter |
|
a new JID |
void wocky_meta_porter_unhold (WockyMetaPorter *porter,WockyContact *contact);
Decreases the hold count of the porter to contact by
one. This means that if there is a connection open to contact and
the hold count is zero, a connection timeout will be
started.
|
a WockyMetaPorter |
|
a WockyContact |