Top |
TpPresenceMixinInterfaceTpPresenceMixinInterface — an interface that can be implemented on TpBaseConnection subclasses to add support for presence. |
struct | TpPresenceStatusSpec |
struct | TpPresenceStatus |
struct | TpPresenceMixinInterface |
TpBaseConnection subclasses can implement this interface to implement the corresponding DBus interface.
gboolean
tp_presence_status_spec_can_set_on_self
(const TpPresenceStatusSpec *self
);
TRUE
if the user can set this presence status on themselves (most
statuses), or FALSE
if they cannot directly set it on
themselves (typically used for TP_CONNECTION_PRESENCE_TYPE_OFFLINE
and TP_CONNECTION_PRESENCE_TYPE_ERROR
)
Since 0.99.5
const gchar *
tp_presence_status_spec_get_name (const TpPresenceStatusSpec *self
);
Since 0.99.5
TpConnectionPresenceType
tp_presence_status_spec_get_presence_type
(const TpPresenceStatusSpec *self
);
Return the category into which this presence type falls. For instance,
for XMPP's "" (do not disturb) status, this would return
TP_CONNECTION_PRESENCE_TYPE_BUSY
.
Since 0.99.5
gboolean
tp_presence_status_spec_has_message (const TpPresenceStatusSpec *self
);
Since 0.99.5
TpPresenceStatusSpec * tp_presence_status_spec_new (const gchar *name
,TpConnectionPresenceType type
,gboolean can_set_on_self
,gboolean has_message
);
Since 0.99.5
TpPresenceStatusSpec *
tp_presence_status_spec_copy (const TpPresenceStatusSpec *self
);
Copy a presence status specification.
Since 0.99.5
void
tp_presence_status_spec_free (TpPresenceStatusSpec *self
);
Free a presence status specification produced by
tp_presence_status_spec_new()
or tp_presence_status_spec_copy()
.
Since 0.99.5
gboolean (*TpPresenceMixinStatusAvailableFunc) (TpPresenceMixin *self
,guint which
);
Signature of a callback to be used to determine if a given presence status can be set on the connection. Most users of this interface do not need to supply an implementation of this callback: the value of TpPresenceStatusSpec.self is enough to determine whether this is a user-settable presence.
One place where this callback may be needed is on XMPP: not all server
implementation support the user becoming invisible. So an XMPP
implementation would implement this function, so that—once connected—the
hidden status is only available if the server supports it. Before the
connection is connected, this callback should return TRUE
for every status
that might possibly be supported: this allows the user to at least try to
sign in as invisible.
self |
A TpBaseConnection implementing TpPresenceMixinInterface |
|
which |
An index into the array of TpPresenceStatusSpec provided to
|
TpPresenceStatus * (*TpPresenceMixinGetContactStatusFunc) (TpPresenceMixin *self
,TpHandle contact
);
Return the contact's status
self |
A TpBaseConnection implementing TpPresenceMixinInterface |
|
contact |
A TpHandle of type |
gboolean (*TpPresenceMixinSetOwnStatusFunc) (TpPresenceMixin *self
,const TpPresenceStatus *status
,GError **error
);
Signature of the callback used to commit changes to the user's own presence
status in SetStatuses. It is also used in ClearStatus and RemoveStatus to
reset the user's own status back to the "default" one with a NULL
status
argument.
The callback is responsible for emitting PresenceUpdate, if appropriate,
by calling tp_presence_mixin_emit_presence_update()
.
self |
A TpBaseConnection implementing TpPresenceMixinInterface |
|
status |
The status to set, or NULL for whatever the protocol defines as a "default" status |
|
error |
Used to return a Telepathy D-Bus error if |
guint
(*TpPresenceMixinGetMaximumStatusMessageLengthFunc)
(TpPresenceMixin *self
);
Signature of a callback used to determine the maximum length of status messages. If this callback is provided and returns non-zero, the TpPresenceMixinSetOwnStatusFunc implementation is responsible for truncating the message to fit this limit, if necessary.
the maximum number of UTF-8 characters which may appear in a status message, or 0 if there is no limit.
Since 0.14.5
TpPresenceStatus * tp_presence_status_new (guint which
,const gchar *message
);
Construct a presence status structure. You should free the returned structure with tp_presence_status_free.
which |
Index of the presence status in the provided supported presence statuses array |
|
message |
a human-readable status message, or |
[allow-none] |
void
tp_presence_status_free (TpPresenceStatus *status
);
Deallocate all resources associated with a presence status structure.
void
tp_presence_mixin_init (TpPresenceMixin *self
);
Implement the Presence interface via this mixin. Call this from the GObjectClass.constructed function of a TpBaseConnection subclass that implements TpPresenceMixin.
gboolean tp_presence_mixin_fill_contact_attributes (TpPresenceMixin *self
,const gchar *dbus_interface
,TpHandle contact
,GVariantDict *attributes
);
If this mixin implements dbus_interface
, fill in the attributes
for contact
and return TRUE
.
Typical usage is something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
static void my_fill_contact_attributes (TpBaseConnection *base, ...) { if (!tp_strdiff (dbus_interface, INTERFACE_THAT_I_IMPLEMENT)) { // ... fill them in return; } // ... similar calls for any other interfaces if (tp_presence_mixin_fill_contact_attributes (base, ...)) return; // ... similar calls for any other mixins TP_BASE_CONNECTION_CLASS (my_connection_parent_class)-> fill_contact_attributes (base, ...); } |
self |
a connection that implements TpPresenceMixin |
|
dbus_interface |
the interface in which the client is interested |
|
contact |
a contact's handle |
|
attributes |
used to return the attributes of |
void tp_presence_mixin_emit_presence_update (TpPresenceMixin *self
,GHashTable *contact_presences
);
Emit the PresenceUpdate signal for multiple contacts. For emitting PresenceUpdate for a single contact, there is a convenience wrapper called tp_presence_mixin_emit_one_presence_update.
self |
A TpBaseConnection implementing TpPresenceMixinInterface |
|
contact_presences |
A mapping of contact handles to TpPresenceStatus structures with the presence data to emit |
void tp_presence_mixin_emit_one_presence_update (TpPresenceMixin *self
,TpHandle handle
,const TpPresenceStatus *status
);
Emit a presence update signal for a single contact. This method is
just a convenience wrapper around tp_presence_mixin_emit_presence_update()
.
self |
A TpBaseConnection implementing TpPresenceMixinInterface |
|
handle |
The handle of the contact to emit the signal for |
|
status |
The new status to emit |
struct TpPresenceStatusSpec { const gchar *name; TpConnectionPresenceType presence_type; gboolean self; gboolean has_message; };
Structure specifying a supported presence status.
In addition to the fields documented here, there are some reserved fields
which must currently be NULL
. A meaning may be defined for these in a
future version of telepathy-glib.
const gchar * |
String identifier of the presence status |
|
TpConnectionPresenceType |
A type value, as specified by TpConnectionPresenceType |
|
gboolean |
Indicates if this status may be set on yourself |
|
gboolean |
|
struct TpPresenceStatus { guint index; gchar *message; };
Structure representing a presence status.
In addition to the fields documented here, there are some gpointer fields
which must currently be NULL
. A meaning may be defined for these in a
future version of telepathy-glib.
struct TpPresenceMixinInterface { GTypeInterface parent; TpPresenceMixinStatusAvailableFunc status_available; TpPresenceMixinGetContactStatusFunc get_contact_status; TpPresenceMixinSetOwnStatusFunc set_own_status; TpPresenceMixinGetMaximumStatusMessageLengthFunc get_maximum_status_message_length; const TpPresenceStatusSpec *statuses; };
The interface vtable for a TP_TYPE_PRESENCE_MIXIN
.
GTypeInterface |
the parent interface |
|
TpPresenceMixinStatusAvailableFunc |
A callback to be used to determine if a given presence
status can be set on a particular connection. Should usually be |
|
TpPresenceMixinGetContactStatusFunc |
A callback to be used get the current presence status for contacts. This is used in implementations of various D-Bus methods and hence must be provided. |
|
TpPresenceMixinSetOwnStatusFunc |
A callback to be used to commit changes to the user's own presence status to the server. This is used in implementations of various D-Bus methods and hence must be provided. |
|
TpPresenceMixinGetMaximumStatusMessageLengthFunc |
The callback used to discover the the limit for status messages length, if any. |
|
const TpPresenceStatusSpec * |
An array of TpPresenceStatusSpec structures representing all presence statuses supported by the protocol, terminated by a NULL name. |