Connection
Object Hierarchy:
Description:
[ CCode ( type_id = "tp_connection_get_type ()" ) ]
[ Version ( since = "0.7.1" ) ]
public class Connection : Proxy
[ Version ( since = "0.7.1" ) ]
public class Connection : Proxy
A proxy object for a Telepathy connection.
There are no interesting public struct fields.
(Changed in 0.7.12: the layout of the structure is visible, allowing subclassing.)
Namespace: TelepathyGLib
Package: telepathy-glib
Content:
Properties:
- public int balance { get; }
The Amount field of the Balance.
- public string balance_currency { owned get; }
The Currency field of the Balance.
- public uint balance_scale { get; }
The Scale field of the Balance.
- public string balance_uri { get; }
The Balance.
- public GenericArray<void*> blocked_contacts { get; }
A GenericArray of blocked Contact.
- public bool can_change_contact_list { get; }
If true, presence subscription and publication can be changed using the RequestSubscription, AuthorizePublication and RemoveContacts methods.
- public bool can_report_abusive { get; }
If this property is
true
, contacts may be reported as abusive to the server administrators by setting report_abusive totrue
when calling block_contacts_async. - public Capabilities capabilities { get; }
The Capabilities object representing the capabilities of this connection, or NULL if we don't know yet.
- public string cm_name { get; }
This connection's connection manager name.
- public string connection_manager_name { get; }
This connection's connection manager name.
- public bool connection_ready { get; }
Initially
false
; changes totrue
when the connection has gone to CONNECTED status, introspection has finished and it's ready for use. - public string[] contact_groups { get; }
The names of all groups that currently exist.
- public bool contact_list_persists { get; }
If true, presence subscriptions (in both directions) on this connection are stored by the server or other infrastructure.
- public uint contact_list_state { get; }
The progress made in retrieving the contact list.
- public bool disjoint_groups { get; }
True if each contact can be in at most one group; false if each contact can be in many groups.
- public uint group_storage { get; }
Indicates the extent to which contacts' groups can be set and stored.
- public string protocol_name { get; }
The connection's machine-readable protocol name, such as "jabber", "msn" or "local-xmpp".
- public bool request_uses_message { get; }
If true, the Message parameter to RequestSubscription is likely to be significant, and user interfaces SHOULD prompt the user for a message to send with the request; a message such as "I would like to add you to my contact list", translated into the local user's language, might make a suitable default.
- public Contact self_contact { get; }
A Contact representing the local user on this connection, or
null
if not yet available. - public uint self_handle { get; }
The CONTACT handle of the local user on this connection, or 0 if we don't know yet or if the connection has become invalid.
- public uint status { get; }
This connection's status, or UNKNOWN_CONNECTION_STATUS if we don't know yet.
- public uint status_reason { get; }
To wait for a valid status (and other properties), call prepare_async with the feature
TP_CONNECTION_FEATURE_CORE
.
Static methods:
- public static Quark get_feature_quark_aliasing ()
- public static Quark get_feature_quark_avatar_requirements ()
- public static Quark get_feature_quark_balance ()
- public static Quark get_feature_quark_capabilities ()
- public static Quark get_feature_quark_connected ()
- public static Quark get_feature_quark_contact_blocking ()
- public static Quark get_feature_quark_contact_groups ()
- public static Quark get_feature_quark_contact_info ()
- public static Quark get_feature_quark_contact_list ()
- public static Quark get_feature_quark_contact_list_properties ()
- public static Quark get_feature_quark_core ()
- public static void init_known_interfaces ()
Ensure that the known interfaces for TpConnection have been set up.
- public static int presence_type_cmp_availability (ConnectionPresenceType p1, ConnectionPresenceType p2)
Compares
p1
andp2
likestrcmp
.
Creation methods:
- public Connection (DBusDaemon dbus, string? bus_name, string? object_path) throws Error
Methods:
- public void add_client_interest (string interested_in)
Subscribe to any opt-in change notifications for
interested_in
. - public async bool add_to_group_async (string group, Contact[] contacts) throws Error
Add the given
contacts
to the givengroup
, creating it if necessary. - public async bool authorize_publication_async (Contact[] contacts) throws Error
For each of the given
contacts
, request that the local user's presence is sent to that contact, i.e. that their publish_state property becomes YES. - public unowned Binding bind_connection_status_to_property (void* target, string target_property, bool invert)
- public async bool block_contacts_async (Contact[] contacts, bool report_abusive) throws Error
Direct the server to block
contacts
. - public bool can_set_contact_alias ()
- public async bool disconnect_async () throws Error
Disconnect the connection.
- public async Contact dup_contact_by_id_async (string id, ContactFeature[]? features) throws Error
Create a Contact object and make any asynchronous method calls necessary to ensure that all the features specified in
features
are ready for use (if they are supported at all). - public Contact dup_contact_if_possible (Handle handle, string identifier)
Try to return an existing contact object or create a new contact object immediately.
- public List<ContactInfoFieldSpec> dup_contact_info_supported_fields ()
Returns a newly allocated List of supported contact info fields for this connection.
- public GenericArray<unowned Contact> dup_contact_list ()
Retrieves the user's contact list.
- public string? dup_detailed_error_vardict (out Variant details)
If the connection has disconnected, return the D-Bus error name with which it disconnected (in particular, this is
TP_ERROR_STR_CANCELLED
if it was disconnected by a user request). - public unowned Account get_account ()
Return the the Account associated with this connection.
- public unowned AvatarRequirements get_avatar_requirements ()
To wait for valid avatar requirements, call prepare_async with the feature
TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS
. - public bool get_balance (out int balance, out uint scale, out unowned string currency)
If this has a valid account balance, returns
true
and sets the variables pointed to bybalance
,scale
andcurrency
to the appropriate fields of the Balance. - public unowned string get_balance_uri ()
The value of Balance.
- public unowned GenericArray<Contact> get_blocked_contacts ()
- public bool get_can_change_contact_list ()
- public unowned Capabilities get_capabilities ()
- public unowned string get_cm_name ()
- public unowned string get_connection_manager_name ()
- public void get_contact_attributes (int timeout_ms, Handle[] handles, string interfaces, bool hold, owned Callback callback, Object weak_object)
Return (via a callback) any number of attributes of the given handles.
- public unowned string[] get_contact_groups ()
- public ContactInfoFlags get_contact_info_flags ()
Returns the flags describing how contact info (vCards) behaves on this connection
- public List<unowned ContactInfoFieldSpec> get_contact_info_supported_fields ()
Returns a newly allocated List of supported contact info fields for this connection.
- public void get_contact_list_attributes (int timeout_ms, string interfaces, bool hold, owned Callback callback, Object weak_object)
Return (via a callback) the contacts on the contact list and any number of their attributes.
- public bool get_contact_list_persists ()
- public ContactListState get_contact_list_state ()
- public void get_contacts_by_handle (uint[] handles, uint[]? features, owned ConnectionContactsByHandleCb callback, Object? weak_object)
Create a number of Contact objects and make asynchronous method calls to hold their handles and ensure that all the features specified in
features
are ready for use (if they are supported at all). - public void get_contacts_by_id (string[] ids, ContactFeature[]? features, owned ConnectionContactsByIdCb callback, Object? weak_object)
Create a number of Contact objects and make asynchronous method calls to obtain their handles and ensure that all the features specified in
features
are ready for use (if they are supported at all). - public unowned string? get_detailed_error (out unowned HashTable<string,Value?> details)
If the connection has disconnected, return the D-Bus error name with which it disconnected (in particular, this is
TP_ERROR_STR_CANCELLED
if it was disconnected by a user request). - public bool get_disjoint_groups ()
- public ContactMetadataStorageType get_group_storage ()
- public unowned string get_protocol_name ()
- public bool get_request_uses_message ()
- public unowned Contact get_self_contact ()
Return a Contact representing the local user on this connection.
- public Handle get_self_handle ()
Return the CONTACT handle of the local user on this connection, or 0 if the self-handle is not known yet or the connection has become invalid (the TpProxy::invalidated signal).
- public ConnectionStatus get_status (out ConnectionStatusReason reason)
If
reason
is notnull
it is set to the reason why "status" changed to its current value, or NONE_SPECIFIED if unknown. - public bool has_immortal_handles ()
Return
true
if this connection is known to not destroy handles (#TpHandle) until it disconnects. - public void hold_handles (int timeout_ms, HandleType handle_type, Handle[] handles, owned ConnectionHoldHandlesCb callback, Object weak_object)
Hold (ensure a reference to) the given handles, if they are valid.
- public bool parse_object_path (out string protocol, out string cm_name)
If the object path of
connection
is in the correct form, setprotocol
andcm_name
, return TRUE. - public void refresh_contact_info (Contact[] contacts)
Requests to refresh the contact_info property on each contact from
contacts
, requesting it from the network if an up-to-date version is not cached locally. - public async bool remove_contacts_async (Contact[] contacts) throws Error
Remove the given
contacts
from the contact list entirely. - public async bool remove_from_group_async (string group, Contact[] contacts) throws Error
Remove the given
contacts
from the givengroup
. - public async bool remove_group_async (string group) throws Error
Remove all members from the given group, then remove the group itself.
- public async bool rename_group_async (string old_name, string new_name) throws Error
Rename the given
old_name
. - public void request_handles (int timeout_ms, HandleType handle_type, string[] ids, owned ConnectionRequestHandlesCb callback, Object weak_object)
Request the handles corresponding to the given identifiers, and if they are valid, hold (ensure a reference to) the corresponding handles.
- public async bool request_subscription_async (Contact[] contacts, string message) throws Error
Request that the given
contacts
allow the local user to subscribe to their presence, i.e. that their subscribe_state property becomes YES. - public async bool set_contact_info_async (List<ContactInfoField> info) throws Error
Requests an asynchronous set of the contact info of this.
- public async bool set_group_members_async (string group, Contact[] contacts) throws Error
Add the given
contacts
to the givengroup
(creating it if necessary), and remove all other members. - public async bool unblock_contacts_async (Contact[] contacts) throws Error
Direct the server to unblock
contacts
. - public async bool unpublish_async (Contact[] contacts) throws Error
Attempt to set the given
contacts
' publish_state property to NO, i.e. stop sending presence to them. - public void unref_handles (HandleType handle_type, Handle[] handles)
Do nothing.
- public async bool unsubscribe_async (Contact[] contacts) throws Error
Attempt to set the given
contacts
' subscribe_state property to NO, i.e. stop receiving their presence. - public void upgrade_contacts (Contact[] contacts, ContactFeature[] features, owned ConnectionUpgradeContactsCb callback, Object? weak_object)
Given several Contact objects, make asynchronous method calls ensure that all the features specified in
features
are ready for use (if they are supported at all). - public async bool upgrade_contacts_async (Contact[] contacts, ContactFeature[] features, out GenericArray<unowned Contact> contacts_out) throws Error
Given several Contact objects, make asynchronous method calls ensure that all the features specified in
features
are ready for use (if they are supported at all).
Signals:
- public signal void balance_changed (int balance, uint balance_scale, string balance_currency)
Emitted when at least one of the balance, balance_scale or balance_currency property is changed.
- public signal void blocked_contacts_changed (GenericArray<Contact> added, GenericArray<Contact> removed)
Notify of changes in blocked_contacts.
- public signal void contact_list_changed (GenericArray<Contact> added, GenericArray<Contact> removed)
Notify of changes in the list of contacts as returned by dup_contact_list.
- public signal void group_renamed (string old_name, string new_name)
Emitted when a group is renamed, in protocols where this can be distinguished from group creation, removal and membership changes.
- public signal void groups_created (string[] added)
Emitted when new, empty groups are created.
- public signal void groups_removed (string[] added)
Emitted when one or more groups are removed.
Inherited Members:
All known members inherited from class TelepathyGLib.Proxy
All known members inherited from class GLib.Object