Contact
Object Hierarchy:
Description:
[ Version ( since = "0.7.18" ) ]
public sealed class Contact : Object
An object representing a contact on a Connection.
Contact objects support tracking a number of attributes of contacts, as described by the ContactFeature flags. Features can be specified when instantiating contact objects (with get_contacts_by_id or get_contacts_by_handle), or added to an existing contact object with upgrade_contacts. For example, a client wishing to keep track of a contact's alias would set ALIAS, and then listen for the "notify::alias" signal, emitted whenever the alias property changes.
Note that releasing a Contact object might release handle references held by calling
tp_cli_connection_call_request_handles
, tp_cli_connection_run_request_handles
, tp_cli_connection_call_hold_handles
, tp_cli_connection_run_hold_handles
, tp_cli_connection_interface_contacts_call_get_contact_attributes
or
tp_cli_connection_interface_contacts_run_get_contact_attributes
directly. Those functions should be avoided in favour of using
Contact, hold_handles,
request_handles and
get_contact_attributes.
Content:
Properties:
- public string alias { get; }
The contact's alias if available, falling back to their identifier if no alias is available or if the Contact has not been set up to track ALIAS.
- public File avatar_file { get; }
File to the latest cached avatar image, or
null
if this contact has no avatar, or if the avatar data is not yet retrieved. - public string avatar_mime_type { get; }
MIME type of the latest cached avatar image, or
null
if this contact has no avatar, or if the avatar data is not yet retrieved. - public string avatar_token { get; }
An opaque string representing state of the contact's avatar (depending on the protocol, this might be a hash, a timestamp or something else), or an empty string if there is no avatar.
- public Capabilities capabilities { get; }
The capabilities supported by this contact.
- public string[] client_types { get; }
A
GStrv
containing the client types of this contact. - public Connection connection { get; }
The Connection to which this contact belongs.
- public string[] contact_groups { get; }
a
GStrv
with names of groups of which a contact is a member. - public ContactInfoList contact_info { owned get; }
A List of ContactInfoField representing the vCard of this contact.
- public uint handle { get; }
The contact's handle in the Telepathy D-Bus API, a handle of type CONTACT representing the string given by identifier.
- public string identifier { get; }
The contact's identifier in the instant messaging protocol (e.g. XMPP JID, SIP URI, AOL screenname or IRC nick - whatever the underlying protocol uses to identify a user).
- public bool is_blocked { get; }
true
if the contact has been blocked. - public Variant location_vardict { owned get; }
If this contact has set a user-defined location, a string to variant map containing his location.
- public string presence_message { get; }
If this contact has set a user-defined status message, that message; if not, an empty string (which user interfaces may replace with a localized form of the presence_status or presence_type).
- public string presence_status { get; }
A string representing the presence status of this contact.
- public uint presence_type { get; }
The ConnectionPresenceType representing the type of presence status for this contact.
- public string publish_request { get; }
The message that contact sent when they requested permission to see the local user's presence, if publish_state is ASK, an empty string ("") otherwise.
- public uint publish_state { get; }
A SubscriptionState indicating the state of this contact's subscription to the local user's presence.
- public uint subscribe_state { get; }
A SubscriptionState indicating the state of the local user's subscription to this contact's presence.
Creation methods:
- protected Contact ()
Methods:
- public async bool add_to_group_async (string group) throws Error
Convenience wrapper for add_to_group_async on a single contact.
- public async bool authorize_publication_async () throws Error
Convenience wrapper for authorize_publication_async on a single contact.
- public async bool block_async (bool report_abusive) throws Error
Block communications with a contact, optionally reporting the contact as abusive to the server administrators.
- public List<ContactInfoField> dup_contact_info ()
Returns a newly allocated List of contact's vCard fields.
- public Variant dup_location ()
Return the contact's user-defined location, or
null
if the location is unspecified. - public unowned Account get_account ()
Return the Account of this's connection.
- public unowned string get_alias ()
Return the contact's alias.
- public unowned File get_avatar_file ()
Return the contact's avatar file.
- public unowned string get_avatar_mime_type ()
Return the contact's avatar MIME type.
- public unowned string get_avatar_token ()
Return the contact's avatar token.
- public unowned Capabilities get_capabilities ()
- public unowned string[] get_client_types ()
Return the contact's client types or
null
if the client types are unspecified. - public unowned Connection get_connection ()
- public unowned string[] get_contact_groups ()
Return names of groups of which a contact is a member.
- public List<unowned ContactInfoField> get_contact_info ()
Returns a newly allocated List of contact's vCard fields.
- public Handle get_handle ()
Return the contact's handle, which is of type CONTACT, or 0 if the connection has become invalid.
- public unowned string get_identifier ()
Return the contact's identifier.
- public unowned HashTable<string,Value?> get_location ()
Return the contact's user-defined location or
null
if the location is unspecified. - public unowned string get_presence_message ()
Return the contact's user-defined status message, or an empty string.
- public unowned string get_presence_status ()
Return the name of the contact's presence status, or an empty string.
- public ConnectionPresenceType get_presence_type ()
If this object has been set up to track PRESENCE and the underlying connection supports either the Presence or SimplePresence interfaces, return the type of the contact's presence.
- public unowned string get_publish_request ()
If publish_state is set to ASK, return the message that this remote contact sent when they requested permission to see the local user's presence, an empty string ("") otherwise.
- public SubscriptionState get_publish_state ()
Return the state of this remote contact's subscription to the local user's presence.
- public SubscriptionState get_subscribe_state ()
Return the state of the local user's subscription to this remote contact's presence.
- public bool has_feature (ContactFeature feature)
- public async bool remove_async () throws Error
Convenience wrapper for remove_contacts_async on a single contact.
- public async bool remove_from_group_async (string group) throws Error
Convenience wrapper for remove_from_group_async on a single contact.
- public async bool request_contact_info_async (Cancellable? cancellable) throws Error
Requests an asynchronous request of the contact info of this.
- public async bool request_subscription_async (string message) throws Error
Convenience wrapper for request_subscription_async on a single contact.
- public async bool set_contact_groups_async (string[]? groups) throws Error
Add this to the given groups (creating new groups if necessary), and remove it from all other groups.
- public async bool unblock_async () throws Error
Unblock communications with a contact.
- public async bool unpublish_async () throws Error
Convenience wrapper for unpublish_async on a single contact.
- public async bool unsubscribe_async () throws Error
Convenience wrapper for unsubscribe_async on a single contact.
Signals:
- public signal void contact_groups_changed (string[] added, string[] removed)
Emitted when this contact's groups changes.
- public signal void presence_changed (uint type, string status, string message)
Emitted when this contact's presence changes.
- public signal void subscription_states_changed (uint subscribe, uint publish, string publish_request)
Emitted when this contact's subscription states changes.