Top |
GVariant * | channel-properties | Read / Write / Construct Only |
gchar * | channel-type | Read |
TpConnection * | connection | Read / Write / Construct Only |
guint | entity-type | Read |
guint | group-flags | Read |
TpContact * | group-self-contact | Read |
guint | handle | Read |
gchar * | identifier | Read |
TpContact * | initiator-contact | Read |
gboolean | password-needed | Read |
gboolean | requested | Read |
TpContact * | target-contact | Read |
struct | TpChannel |
struct | TpChannelClass |
#define | TP_CHANNEL_FEATURE_CORE |
#define | TP_CHANNEL_FEATURE_GROUP |
#define | TP_CHANNEL_FEATURE_PASSWORD |
GObject ╰── TpProxy ╰── TpChannel ├── TpCallChannel ├── TpDBusTubeChannel ├── TpFileTransferChannel ├── TpStreamTubeChannel ╰── TpTextChannel
TpChannel objects provide convenient access to Telepathy channels.
Compared with a simple proxy for method calls, they add the following features:
calling GetChannelType()
, GetInterfaces()
, GetHandles()
automatically
TpConnection *
tp_channel_get_connection (TpChannel *self
);
Returns the connection for this channel. The returned pointer is only valid
while this channel is valid - reference it with g_object_ref()
if needed.
Since 0.19.9
GVariant *
tp_channel_dup_immutable_properties (TpChannel *self
);
Returns the immutable D-Bus properties of this channel, in a variant of type
G_VARIANT_TYPE_VARDICT
where the keys are strings,
D-Bus interface name + "." + property name. Use g_variant_lookup()
or
g_variant_lookup_value()
for convenient access to the values.
If the “channel-properties” property was not set during
construction (e.g. by calling tp_channel_new_from_properties()
), a
reasonable but possibly incomplete version will be made up from the values
of individual properties; reading this property repeatedly may yield
progressively more complete values until the TP_CHANNEL_FEATURE_CORE
feature is prepared.
This function should be used only by TpChannel subclasses, otherwise it is recommended to use individual property getters instead.
a dictionary where the keys are strings, D-Bus interface name + "." + property name.
[transfer full]
Since 0.19.9
const gchar *
tp_channel_get_channel_type (TpChannel *self
);
Get the D-Bus interface name representing this channel's type, if it has been discovered.
This is the same as the “channel-type” property; it isn't
guaranteed to be non-NULL
until the TP_CHANNEL_FEATURE_CORE
feature has
been prepared.
the channel type, if the channel is ready; either the channel
type or NULL
, if the channel is not yet ready.
Since 0.7.12
GQuark
tp_channel_get_channel_type_id (TpChannel *self
);
Get the D-Bus interface name representing this channel's type, as a GQuark, if it has been discovered.
This is the same as the “channel-type” property, except that it
is a GQuark rather than a string. It isn't guaranteed to be nonzero until
the TP_CHANNEL_FEATURE_CORE
property is ready.
the channel type, if the channel is ready; either the channel type or 0, if the channel is not yet ready.
Since 0.7.12
TpHandle tp_channel_get_handle (TpChannel *self
,TpEntityType *entity_type
);
Get the handle representing the contact, chatroom, etc. with which this channel communicates for its whole lifetime, or 0 if there is no such handle or it has not yet been discovered.
This is the same as the “handle” property. It isn't
guaranteed to have its final value until the TP_CHANNEL_FEATURE_CORE
feature is ready.
If entity_type
is not NULL
, the type of handle is written into it.
This will be TP_UNKNOWN_ENTITY_TYPE
if the handle has not yet been
discovered, or TP_ENTITY_TYPE_NONE
if there is no handle with which this
channel will always communicate. This is the same as the
“entity-type” property.
Since 0.7.12
const gchar *
tp_channel_get_identifier (TpChannel *self
);
This channel's associated identifier, or the empty string if no identifier or unknown.
This is the same as the “identifier” property, and isn't guaranteed
to be set until the TP_CHANNEL_FEATURE_CORE
property is ready.
Changed in 0.11.4: as with “identifier”, this could
previously either be NULL
or the empty string if there was no suitable
value. It is now non-NULL
in all cases.
Since 0.7.21
TpContact *
tp_channel_get_target_contact (TpChannel *self
);
Since 0.15.6
gboolean
tp_channel_get_requested (TpChannel *self
);
Return the “requested” property
Since 0.11.15
TpContact *
tp_channel_get_initiator_contact (TpChannel *self
);
Since 0.15.6
void tp_channel_join_async (TpChannel *self
,const gchar *message
,GAsyncReadyCallback callback
,gpointer user_data
);
Join channel self
with message
as join message.
When we joined the channel, callback
will be called.
You can then call tp_channel_join_finish()
to get the result of
the operation.
TP_CHANNEL_FEATURE_GROUP
feature must be prepared before calling this
function.
self |
||
message |
the join message |
|
callback |
a callback to call when we joined the channel |
|
user_data |
data to pass to |
Since 0.99.1
gboolean tp_channel_join_finish (TpChannel *self
,GAsyncResult *result
,GError **error
);
Completes a call to tp_channel_join_async()
.
self |
||
result |
a GAsyncResult passed to the callback for |
|
error |
a GError to fill |
Since 0.99.1
void tp_channel_leave_async (TpChannel *self
,TpChannelGroupChangeReason reason
,const gchar *message
,GAsyncReadyCallback callback
,gpointer user_data
);
Leave channel self
with reason
as reason and message
as leave message.
If TP_CHANNEL_FEATURE_GROUP
feature is not prepared, we close it.
When we left the channel, callback
will be called.
You can then call tp_channel_leave_finish()
to get the result of
the operation.
self |
||
reason |
the leave reason |
|
message |
the leave message |
|
callback |
a callback to call when we left the channel |
|
user_data |
data to pass to |
Since 0.99.1
gboolean tp_channel_leave_finish (TpChannel *self
,GAsyncResult *result
,GError **error
);
Completes a call to tp_channel_leave_async()
.
self |
||
result |
a GAsyncResult passed to the callback for |
|
error |
a GError to fill |
Since 0.13.10
void tp_channel_close_async (TpChannel *self
,GAsyncReadyCallback callback
,gpointer user_data
);
Close channel self
. In most cases, it's generally cleaner to use
tp_channel_leave_async()
instead to properly leave and close the channel.
When the channel has been closed, callback
will be called.
You can then call tp_channel_close_finish()
to get the result of
the operation.
Since 0.13.10
gboolean tp_channel_close_finish (TpChannel *self
,GAsyncResult *result
,GError **error
);
Finishes a call to tp_channel_leave_async()
.
self |
||
result |
a GAsyncResult passed to the callback for |
|
error |
a GError to fill |
Since 0.13.10
void tp_channel_destroy_async (TpChannel *self
,GAsyncReadyCallback callback
,gpointer user_data
);
Destroy channel self
.
If self
doesn't implement TP_IFACE_QUARK_CHANNEL_INTERFACE_DESTROYABLE
or if for any reason we can't destroy the channel, we close it.
When the channel has been destroyed or closed, callback
will be called.
You can then call tp_channel_destroy_finish()
to get the result of
the operation.
self |
||
callback |
a callback to call when we left the channel |
|
user_data |
data to pass to |
Since 0.15.2
gboolean tp_channel_destroy_finish (TpChannel *self
,GAsyncResult *result
,GError **error
);
Completes a call to tp_channel_destroy_async()
.
self |
||
result |
a GAsyncResult passed to the callback for |
|
error |
a GError to fill |
Since 0.15.2
TpChannelGroupFlags
tp_channel_group_get_flags (TpChannel *self
);
Since 0.99.1
TpContact *
tp_channel_group_get_self_contact (TpChannel *self
);
Since 0.99.1
GPtrArray *
tp_channel_group_dup_members (TpChannel *self
);
If self
is a group and the TP_CHANNEL_FEATURE_GROUP
feature has been
prepared, return a GPtrArray containing its members.
If self
is a group but TP_CHANNEL_FEATURE_GROUP
has not been prepared,
the result may either be a set of members, or NULL
.
If self
is not a group, return NULL
.
a new GPtrArray of TpContact, free it with g_ptr_array_unref()
, or NULL
.
[transfer container][type GLib.PtrArray][element-type TelepathyGLib.Contact]
Since 0.99.1
GPtrArray *
tp_channel_group_dup_local_pending (TpChannel *self
);
If self
is a group and the TP_CHANNEL_FEATURE_GROUP
feature has been
prepared, return a GPtrArray containing its local-pending members.
If self
is a group but TP_CHANNEL_FEATURE_GROUP
has not been prepared,
the result may either be a set of local-pending members, or NULL
.
If self
is not a group, return NULL
.
a new GPtrArray of TpContact, free it with g_ptr_array_unref()
, or NULL
.
[transfer container][type GLib.PtrArray][element-type TelepathyGLib.Contact]
Since 0.99.1
gboolean tp_channel_group_get_local_pending_info (TpChannel *self
,TpContact *local_pending
,TpContact **actor
,TpChannelGroupChangeReason *reason
,const gchar **message
);
If local_pending
is actually a local-pending contact,
write additional information into actor
, reason
and message
and return
TRUE
. The contact and message are not referenced or copied, and can only be
assumed to remain valid until the main loop is re-entered.
If local_pending
is not the handle of a local-pending contact,
write NULL
into actor
, TP_CHANNEL_GROUP_CHANGE_REASON_NONE
into reason
and "" into message
, and return FALSE
.
self |
a channel |
|
local_pending |
the TpContact of a local-pending contact about whom more information is needed |
|
actor |
either |
[out][allow-none][transfer none] |
reason |
either |
[out][allow-none] |
message |
either |
[out][allow-none][transfer none] |
Since 0.99.1
GPtrArray *
tp_channel_group_dup_remote_pending (TpChannel *self
);
If self
is a group and the TP_CHANNEL_FEATURE_GROUP
feature has been
prepared, return a GPtrArray containing its remote-pending members.
If self
is a group but TP_CHANNEL_FEATURE_GROUP
has not been prepared,
the result may either be a set of remote-pending members, or NULL
.
If self
is not a group, return NULL
.
a new GPtrArray of TpContact, free it with g_ptr_array_unref()
, or NULL
.
[transfer container][type GLib.PtrArray][element-type TelepathyGLib.Contact]
Since 0.99.1
TpContact * tp_channel_group_get_contact_owner (TpChannel *self
,TpContact *contact
);
Synopsis (see below for further explanation):
if self
is not a group or contact
is not a member of this channel,
result is undefined;
if TP_CHANNEL_FEATURE_GROUP
has not yet been prepared, result is
undefined;
if self
does not have flags that include
TP_CHANNEL_GROUP_FLAG_PROPERTIES
,
result is undefined;
if contact
is channel-specific and its globally valid "owner" is known,
return that owner;
if contact
is channel-specific and its globally valid "owner" is unknown,
return NULL
;
if contact
is globally valid, return contact
itself
Some channels (those with flags that include
TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES
) have a concept of
"channel-specific contacts". These are contacts that only have meaning within
the context of the channel - for instance, in XMPP Multi-User Chat,
participants in a chatroom are identified by an in-room JID consisting
of the JID of the chatroom plus a local nickname.
Depending on the protocol and configuration, it might be possible to find out what globally valid contact (i.e. a contact that you could add to your contact list) "owns" a channel-specific contact. For instance, in most XMPP MUC chatrooms, normal users cannot see what global JID corresponds to an in-room JID, but moderators can.
This is further complicated by the fact that channels with channel-specific contacts can sometimes have members with globally valid contacts (for instance, if you invite someone to an XMPP MUC using their globally valid JID, you would expect to see the contact representing that JID in the Group's remote-pending set).
Since 0.99.1
#define TP_ERRORS_REMOVED_FROM_GROUP (tp_errors_removed_from_group_quark ())
GError domain representing the local user being removed from a channel
with the Group interface. The code
in a GError with this domain must
be a member of TpChannelGroupChangeReason.
This error may be raised on non-Group channels with certain reason codes
if there's no better error code to use (mainly
TP_CHANNEL_GROUP_CHANGE_REASON_NONE
).
This macro expands to a function call returning a GQuark.
Since 0.7.1
gboolean
tp_channel_password_needed (TpChannel *self
);
Return the “password-needed” property
Since 0.15.2
void tp_channel_provide_password_async (TpChannel *self
,const gchar *password
,GAsyncReadyCallback callback
,gpointer user_data
);
Provide password
so that self
can be joined.
This function must be called with the correct password in order for
channel joining to proceed if the TpChannel:password-needed property
is set.
Once the password has been provided, callback
will be
called. You can then call tp_channel_provide_password_finish()
to get the result of the operation.
self |
||
password |
the password |
|
callback |
a callback to call when |
|
user_data |
data to pass to |
Since 0.15.2
gboolean tp_channel_provide_password_finish (TpChannel *self
,GAsyncResult *result
,GError **error
);
Completes a call to tp_channel_provide_password_async()
.
If the password was rejected, the operation
fails with TP_ERROR_AUTHENTICATION_FAILED.
self |
||
result |
a GAsyncResult passed to the callback for
|
|
error |
a GError to fill |
Since 0.15.2
struct TpChannel;
A proxy object for a Telepathy channel. A proxy object for a Telepathy channel. There are no interesting public struct fields.
(Changed in 0.7.12: the layout of the structure is visible, allowing subclassing.)
Since 0.7.1
struct TpChannelClass { TpProxyClass parent_class; };
The class of a TpChannel. In addition to parent_class
there are four
pointers reserved for possible future use.
(Changed in 0.7.12: the layout of the structure is visible, allowing subclassing.)
Since 0.7.1
#define TP_CHANNEL_FEATURE_CORE
Expands to a call to a function that returns a quark for the "core" feature on a TpChannel.
When this feature is prepared, the basic Channel properties of the Channel have been retrieved and are available for use.
Specifically, this implies that:
“channel-type” is set
“entity-type” and “handle” are set
any extra interfaces will have been set up in TpProxy (i.e. “interfaces” contains at least all extra Channel interfaces)
One can ask for a feature to be prepared using the
tp_proxy_prepare_async()
function, and waiting for it to callback.
Since 0.11.3
#define TP_CHANNEL_FEATURE_GROUP
Expands to a call to a function that returns a quark representing the group features of a TpChannel.
When this feature is prepared, the Group properties of the Channel have been retrieved and are available for use, and change-notification has been set up for those that can change:
the initial value of the “group-self-contact” property will have been fetched and change notification will have been set up
the initial value of the “group-flags” property will have been fetched and change notification will have been set up
All TpContact objects are guaranteed to have all of the features previously
passed to tp_client_factory_add_contact_features()
prepared.
One can ask for a feature to be prepared using the
tp_proxy_prepare_async()
function, and waiting for it to callback.
Since 0.99.1
#define TP_CHANNEL_FEATURE_PASSWORD
Expands to a call to a function that returns a quark representing the password feature on a TpChannel.
When this feature is prepared, tp_channel_password_needed()
and the
“password-needed” property become useful.
One can ask for a feature to be prepared using the
tp_proxy_prepare_async()
function, and waiting for it to callback.
Since 0.15.2
“channel-properties”
property“channel-properties” GVariant *
The immutable D-Bus properties of this channel, represented by a
G_VARIANT_TYPE_VARDICT
where the keys are
D-Bus interface name + "." + property name.
Read-only except during construction. If this is not provided
during construction, a reasonable (but possibly incomplete) version
will be made up from the values of individual properties; reading this
property repeatedly may yield progressively more complete values until
tp_proxy_prepare_async()
has finished preparing TP_CHANNEL_FEATURE_CORE
.
Flags: Read / Write / Construct Only
Allowed values: GVariant<a{sv}>
Default value: NULL
“channel-type”
property“channel-type” gchar *
The D-Bus interface representing the type of this channel.
This is not guaranteed to be available until tp_proxy_prepare_async()
has finished preparing TP_CHANNEL_FEATURE_CORE
; it may be NULL
until then.
Flags: Read
Default value: NULL
“connection”
property“connection” TpConnection *
The TpConnection to which this TpChannel belongs. Used for e.g. handle manipulation.
Flags: Read / Write / Construct Only
“entity-type”
property“entity-type” guint
The TpEntityType of this channel's associated handle, or
TP_ENTITY_TYPE_NONE
(which is numerically 0) if no handle,
or TP_UNKNOWN_ENTITY_TYPE
if this property is not available yet.
This is not guaranteed to be available until tp_proxy_prepare_async()
has finished preparing TP_CHANNEL_FEATURE_CORE
.
Flags: Read
Default value: 4294967295
“group-flags”
property“group-flags” guint
If the TP_CHANNEL_FEATURE_GROUP
feature has been prepared successfully,
TpChannelGroupFlags indicating the capabilities and behaviour of that
group.
Otherwise, this may be 0.
Change notification is via notify::group-flags or TpChannel::group-flags-changed.
Flags: Read
Default value: 0
Since 0.99.1
“group-self-contact”
property“group-self-contact” TpContact *
If this channel is a group and TP_CHANNEL_FEATURE_GROUP
has been
prepared, and the user is a member of the group, the TpContact
representing them in this group.
Otherwise, the result may be either a contact representing the user,
or NULL
.
Change notification is via notify::group-self-contact.
Flags: Read
Since 0.99.1
“handle”
property“handle” guint
This channel's associated handle, or 0 if no handle or unknown.
This is not guaranteed to be known until tp_proxy_prepare_async()
has finished preparing TP_CHANNEL_FEATURE_CORE
.
Flags: Read
Default value: 0
“identifier”
property“identifier” gchar *
This channel's associated identifier, or the empty string if it has
entity type TP_ENTITY_TYPE_NONE
.
For channels where “handle” is non-zero, this is the result of inspecting “handle”.
This is not guaranteed to be set until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_CORE
; until then, it may be
the empty string.
Changed in 0.11.4: this property is never NULL
. Previously,
it was NULL
before an identifier was known, or when a channel
with no TargetID D-Bus property had TargetEntityType TP_ENTITY_TYPE_NONE
.
Flags: Read
Default value: ""
“initiator-contact”
property“initiator-contact” TpContact *
The TpContact of the initiator of this channel, or NULL
if there is no
particular initiator.
If the channel was initiated by a remote contact, this represents
that contact, and “requested” will be FALSE
. For instance,
for an incoming call this property indicates the caller, and for a
chatroom invitation this property indicates who sent the invitation.
If the channel was requested by the local user, “requested”
will be TRUE
, and this property may be the “group-self-contact”
or “self-contact”.
If the channel appeared for some other reason (for instance as a
side-effect of connecting to the server), this property may be NULL
.
This is not guaranteed to be set until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_CORE
; until then, it may be
NULL
.
The TpContact object is guaranteed to have all of the features previously
passed to tp_client_factory_add_contact_features()
prepared.
Flags: Read
Since 0.15.6
“password-needed”
property“password-needed” gboolean
If TRUE
, tp_channel_provide_password_async()
has to be called
to be able to join the channel.
This is not guaranteed to be meaningful until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_PASSWORD
; until then, it may return
FALSE
even if the channel is actually protected by a password.
Preparing TP_CHANNEL_FEATURE_PASSWORD
also ensures that the
notify::password-needed signal will be fired when this property changes.
Flags: Read
Default value: FALSE
Since 0.15.2
“requested”
property“requested” gboolean
TRUE
if this channel was created in response to a local request, such
as a call to tp_account_channel_request_create_channel_async()
. FALSE
if this channel was initiated by a remote contact
(the “initiator-contact”), or if it appeared as a side-effect
of some other action.
For instance, this is FALSE
on incoming calls and file transfers,
remotely-initiated 1-1 text conversations, and invitations to chatrooms,
and TRUE
on outgoing calls and file transfers, locally-initiated 1-1
text conversations, and chatrooms joined by local user action.
This is not guaranteed to be meaningful until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_CORE
; until then, it may return
FALSE
even if the channel was actually requested.
Flags: Read
Default value: FALSE
Since 0.11.15
“target-contact”
property“target-contact” TpContact *
If this channel is for communication with a single contact (that is,
“entity-type” is TP_ENTITY_TYPE_CONTACT
), then a TpContact
representing the remote contact. For chat rooms, contact search channels and
other channels without a single remote contact, NULL
.
This is not guaranteed to be set until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_CORE
; until then, it may be
NULL
.
The TpContact object is guaranteed to have all of the features previously
passed to tp_client_factory_add_contact_features()
prepared.
Flags: Read
Since 0.15.6
“group-flags-changed”
signalvoid user_function (TpChannel *self, guint added, guint removed, gpointer user_data)
Emitted when the “group-flags” property changes while the channel is ready.
self |
a channel |
|
added |
TpChannelGroupFlags which are newly set |
|
removed |
TpChannelGroupFlags which are no longer set |
|
user_data |
user data set when the signal handler was connected. |
Flags: Has Details
Since 0.7.12
“group-members-changed”
signalvoid user_function (TpChannel *self, GPtrArray *added, GPtrArray *removed, GPtrArray *local_pending, GPtrArray *remote_pending, TpContact *actor, GVariant *details, gpointer user_data)
Emitted when the group members change in a Group channel.
This is not guaranteed to be emitted until tp_proxy_prepare_async()
has
finished preparing TP_CHANNEL_FEATURE_GROUP
; until then, it may be
omitted.
self |
a channel |
|
added |
[type GLib.PtrArray][element-type TelepathyGLib.Contact] | |
removed |
a GPtrArray of TpContact containing the members (full, local-pending or remote-pending) removed. |
[type GLib.PtrArray][element-type TelepathyGLib.Contact] |
local_pending |
a GPtrArray of TpContact containing the local-pending members added. |
[type GLib.PtrArray][element-type TelepathyGLib.Contact] |
remote_pending |
a GPtrArray of TpContact containing the remote-pending members added. |
[type GLib.PtrArray][element-type TelepathyGLib.Contact] |
actor |
a TpContact for the "actor" handle in |
|
details |
a |
|
user_data |
user data set when the signal handler was connected. |
Flags: Has Details
Since 0.99.1