| Home · All Classes · All Namespaces · Modules · Functions · Files

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions
Tp::Client::ConnectionInterfaceContactListInterface Class Reference
Connection proxies

`#include <TelepathyQt/Connection>`

Inherits Tp::AbstractInterface.

List of all members.

## Public Slots

- QDBusPendingReply
  < Tp::ContactAttributesMap > GetContactListAttributes (const QStringList &interfaces, bool hold, int timeout=-1)
- QDBusPendingReply RequestSubscription (const Tp::UIntList &contacts, const QString &message, int timeout=-1)
- QDBusPendingReply AuthorizePublication (const Tp::UIntList &contacts, int timeout=-1)
- QDBusPendingReply RemoveContacts (const Tp::UIntList &contacts, int timeout=-1)
- QDBusPendingReply Unsubscribe (const Tp::UIntList &contacts, int timeout=-1)
- QDBusPendingReply Unpublish (const Tp::UIntList &contacts, int timeout=-1)
- QDBusPendingReply Download (int timeout=-1)

## Signals

- void ContactListStateChanged (uint contactListState)
- void ContactsChangedWithID (const Tp::ContactSubscriptionMap &changes, const Tp::HandleIdentifierMap &identifiers, const Tp::HandleIdentifierMap &removals)
- void ContactsChanged (const Tp::ContactSubscriptionMap &changes, const Tp::UIntList &removals)

## Public Member Functions

- ConnectionInterfaceContactListInterface (const QString &busName, const QString &objectPath, QObject *parent=0)
- ConnectionInterfaceContactListInterface (const QDBusConnection &connection, const QString &busName, const QString &objectPath, QObject *parent=0)
- ConnectionInterfaceContactListInterface (Tp::DBusProxy *proxy)
- ConnectionInterfaceContactListInterface (const Tp::Client::ConnectionInterface &mainInterface)
- ConnectionInterfaceContactListInterface (const Tp::Client::ConnectionInterface &mainInterface, QObject *parent)
- Tp::PendingVariant * requestPropertyContactListState () const
- Tp::PendingVariant * requestPropertyContactListPersists () const
- Tp::PendingVariant * requestPropertyCanChangeContactList () const
- Tp::PendingVariant * requestPropertyRequestUsesMessage () const
- Tp::PendingVariant * requestPropertyDownloadAtConnection () const
- Tp::PendingVariantMap * requestAllProperties () const

## Static Public Member Functions

- static QLatin1String staticInterfaceName ()

## Protected Member Functions

- virtual void invalidate (Tp::DBusProxy *, const QString &, const QString &)

## Detailed Description

Proxy class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Connection.Interface.ContactList".

## Constructor & Destructor Documentation

Tp::Client::ConnectionInterfaceContactListInterface::ConnectionInterfaceContactListInterface | ( | const QString & | busName,
|  | const QString & | objectPath,
|  | QObject * | parent = `0`
| ) |  |

Creates a ConnectionInterfaceContactListInterface associated with the given object on the session bus.

Parameters:

  busName | Name of the service the object is on.
  objectPath | Path to the object on the service.
  parent | Passed to the parent class constructor.

Tp::Client::ConnectionInterfaceContactListInterface::ConnectionInterfaceContactListInterface | ( | const QDBusConnection & | connection,
|  | const QString & | busName,
|  | const QString & | objectPath,
|  | QObject * | parent = `0`
| ) |  |

Creates a ConnectionInterfaceContactListInterface associated with the given object on the given bus.

Parameters:

  connection | The bus via which the object can be reached.
  busName | Name of the service the object is on.
  objectPath | Path to the object on the service.
  parent | Passed to the parent class constructor.

Tp::Client::ConnectionInterfaceContactListInterface::ConnectionInterfaceContactListInterface | ( | Tp::DBusProxy * | proxy | ) |

Creates a ConnectionInterfaceContactListInterface associated with the same object as the given proxy.

Parameters:

  proxy | The proxy to use. It will also be the QObject::parent() for this object.

Tp::Client::ConnectionInterfaceContactListInterface::ConnectionInterfaceContactListInterface | ( | const Tp::Client::ConnectionInterface & | mainInterface | ) | `[explicit]`

Creates a ConnectionInterfaceContactListInterface associated with the same object as the given proxy. Additionally, the created proxy will have the same parent as the given proxy.

Parameters:

  mainInterface | The proxy to use.

Tp::Client::ConnectionInterfaceContactListInterface::ConnectionInterfaceContactListInterface | ( | const Tp::Client::ConnectionInterface & | mainInterface,
|  | QObject * | parent
| ) |  |

Creates a ConnectionInterfaceContactListInterface associated with the same object as the given proxy. However, a different parent object can be specified.

Parameters:

  mainInterface | The proxy to use.
  parent | Passed to the parent class constructor.

## Member Function Documentation

static QLatin1String Tp::Client::ConnectionInterfaceContactListInterface::staticInterfaceName | ( |  | ) | `[inline, static]`

Returns the name of the interface "org.freedesktop.Telepathy.Connection.Interface.ContactList", which this class represents.

Returns:
  The D-Bus interface name.

Tp::PendingVariant* Tp::Client::ConnectionInterfaceContactListInterface::requestPropertyContactListState | ( |  | ) | const`[inline]`

Asynchronous getter for the remote object property `ContactListState` of type `uint`.

The progress made in retrieving the contact list. Change notification is via ContactListStateChanged.

Returns:
  A pending variant which will emit finished when the property has been retrieved.

Tp::PendingVariant* Tp::Client::ConnectionInterfaceContactListInterface::requestPropertyContactListPersists | ( |  | ) | const`[inline]`

Asynchronous getter for the remote object property `ContactListPersists` of type `bool`.

If true, presence subscriptions (in both directions) on this connection are stored by the server or other infrastructure.

XMPP, MSN, ICQ, etc. all behave like this.

If false, presence subscriptions on this connection are not stored.

In SIMPLE (SIP), clients are expected to keep a record of subscriptions, as described below. In link-local XMPP, subscriptions are implicit (everyone on the local network receives presence from everyone else) so nothing is ever stored.

If CanChangeContactList is true, Telepathy clients (e.g. user interfaces or address books) MAY keep a record of permission to publish and requests to subscribe locally, and attempt to restore it for each Connection. If ContactListPersists is false, clients MAY do this for all contacts; if ContactListPersists is true, clients SHOULD NOT change the state of contacts that were not changed locally.

In SIMPLE (SIP), ContactListPersists is false, but CanChangeContactList is true. Presence will not be received unless clients renew any subscriptions they have for each connection, in the way described. There is no server-side storage, so clients have no alternative but to maintain independent contact lists.

In protocols like XMPP and MSN, it may be useful for clients to queue up subscription requests or removals made while offline and process them next time the connection is online. However, clients should only replay the changes, rather than resetting the contact list to match a stored copy, to avoid overwriting changes that were made on the server.

Clients that replay requests like this SHOULD do so by calling AuthorizePublication to pre-approve publication of presence to the appropriate contacts, followed by RequestSubscription to request the appropriate contacts' presences.

This property cannot change after the connection has moved to the Connected state. Until then, its value is undefined, and it may change at any time, without notification.

Returns:
  A pending variant which will emit finished when the property has been retrieved.

Tp::PendingVariant* Tp::Client::ConnectionInterfaceContactListInterface::requestPropertyCanChangeContactList | ( |  | ) | const`[inline]`

Asynchronous getter for the remote object property `CanChangeContactList` of type `bool`.

If true, presence subscription and publication can be changed using the RequestSubscription() , AuthorizePublication() and RemoveContacts() methods.

If false, all of those methods will always fail; they SHOULD raise the error org.freedesktop.Telepathy.Error.NotImplemented.

In XEP-0174 "Serverless Messaging" (link-local XMPP), presence is implicitly published to everyone in the local subnet, so the user cannot control their presence publication.

This property cannot change after the connection has moved to the Connected state. Until then, its value is undefined, and it may change at any time, without notification.

Returns:
  A pending variant which will emit finished when the property has been retrieved.

Tp::PendingVariant* Tp::Client::ConnectionInterfaceContactListInterface::requestPropertyRequestUsesMessage | ( |  | ) | const`[inline]`

Asynchronous getter for the remote object property `RequestUsesMessage` of type `bool`.

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.

This matches user expectations in XMPP and ICQ, for instance.

If false, the parameter is ignored; user interfaces SHOULD avoid prompting the user, and SHOULD pass an empty string to RequestSubscription.

FIXME: is there any such protocol?

Returns:
  A pending variant which will emit finished when the property has been retrieved.

Tp::PendingVariant* Tp::Client::ConnectionInterfaceContactListInterface::requestPropertyDownloadAtConnection | ( |  | ) | const`[inline]`

Asynchronous getter for the remote object property `DownloadAtConnection` of type `bool`.

If true, the contact list is automatically downloaded at connection. If false, the contact list is only downloaded when requested explicitely with Download() .

Downloading the contact list uses bandwidth and is not always necessary or desired. For example, a client could cache the contact list from previous connections and accept less regular updates, it could get the contact list from an out-of-band protocol-specific way, or it could not need the contact list at all.

Connection managers MUST default to true.

If a connection manager starts supporting this property but defaults to false, it would break all existing clients that don't call Download() .

Returns:
  A pending variant which will emit finished when the property has been retrieved.

Tp::PendingVariantMap* Tp::Client::ConnectionInterfaceContactListInterface::requestAllProperties | ( |  | ) | const`[inline]`

Request all of the DBus properties on the interface.

Returns:
  A pending variant map which will emit finished when the properties have been retrieved.

QDBusPendingReply<Tp::ContactAttributesMap> Tp::Client::ConnectionInterfaceContactListInterface::GetContactListAttributes | ( | const QStringList & | interfaces,
|  | bool | hold,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `GetContactListAttributes` on the remote object.

Return some contact attributes for a list of contacts associated with the user. This list MUST include at least:

- all contacts whose subscribe attribute is not No
- all contacts whose publish attribute is not No

but MAY contain other contacts.

For instance, on XMPP, all contacts on the roster would appear here even if they have subscription="none", unless there's reason to believe the user does not want to see them (such as having been blocked).

This list does not need to contain every visible contact: for instance, contacts seen in XMPP or IRC chatrooms SHOULD NOT appear here. Blocked contacts SHOULD NOT appear here, unless they still have a non-`No` subscribe or publish attribute for some reason.

It's reasonable to assume that blocked contacts should not be visible to the user unless they specifically go looking for them, at least in protocols like XMPP where blocking a contact suppresses presence.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  interfaces | A list of strings indicating which D-Bus interfaces the calling process is interested in. Equivalent to the corresponding argument to ConnectionInterfaceContactsInterface::GetContactAttributes() , except that if this list does not contain the ContactList interface itself, it is treated as though that interface was also requested.
  hold | If true, all handles that appear as keys in the result have been held on behalf of the calling process, as if by a call to ConnectionInterface::HoldHandles() . (If ConnectionInterface::HasImmortalHandles is true, which SHOULD be the case in all new connection managers, this has no effect.)
  timeout | The timeout in milliseconds.

Returns:

A dictionary mapping the contact handles to contact attributes, equivalent to the result of ConnectionInterfaceContactsInterface::GetContactAttributes() .

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::RequestSubscription | ( | const Tp::UIntList & | contacts,
|  | const QString & | message,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `RequestSubscription` on the remote object.

Request that the given contacts allow the local user to subscribe to their presence, i.e. that their subscribe attribute becomes Yes.

Connection managers SHOULD NOT attempt to enforce a mutual-subscription policy (i.e. when this method is called, they should not automatically allow the contacts to see the local user's presence). User interfaces that require mutual subscription MAY call AuthorizePublication() at the same time as this method.

Whether to enforce mutual subscription is a matter of policy, so it is left to the user interface and/or the server.

Before calling this method on a connection where ConnectionInterfaceAliasingInterface::GetAliasFlags() returns the `User_Set` flag, user interfaces SHOULD obtain, from the user, an alias to identify the contact in future, and store it using ConnectionInterfaceAliasingInterface::SetAliases() .

The user MAY be prompted using the contact's current self-assigned nickname, or something derived from the contact's (presumably self-assigned) identifier, as a default, but these names chosen by the contact SHOULD NOT be used without user approval.

This is a generalization of XEP-0165 "Best Practices to Discourage JID Mimicking") to protocols other than XMPP. A reasonable user interface for this, as used in many XMPP clients, is to have a text entry for the alias adjacent to the text entry for the identifier to add.

For contacts with subscribe=Yes, this method has no effect. It MUST return successfully if all contacts are in this state.

For contacts with subscribe=Ask, this method SHOULD send a new request, with the given message, if allowed by the underlying protocol.

For contacts with subscribe=No or subscribe=Rejected, this method SHOULD request that the contact allows the local user to subscribe to their presence; in general, this will change their publish attribute to Ask (although it could change directly to Yes in some situations).

Any state changes that immediately result from this request MUST be signalled via ContactsChanged() before this method returns.

This makes it easy for user interfaces to see what practical effect this method had.

If the remote contact accepts the request, their subscribe attribute will later change from Ask to Yes.

If the remote contact explicitly rejects the request (in protocols that allow this), their subscribe attribute will later change from Ask to Rejected.

If the subscription request is cancelled by the local user, the contact's subscribe attribute will change from Ask to No.

This method SHOULD NOT be called until the ContactListState changes to Success. If the ContactListState changes to Failure, this method SHOULD raise the same error as GetContactListAttributes() .

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  contacts | One or more contacts to whom requests are to be sent.
  message | An optional plain-text message from the user, to send to those contacts with the subscription request. The RequestUsesMessage property indicates whether this message will be used or ignored. Clients SHOULD NOT send a non-empty message without first giving the user an opportunity to edit it. These messages are typically presented to the remote contact as if the user had typed them, so as a minimum, the user should be allowed to see what the UI will be saying on their behalf. Connections where this message is not useful MUST still allow it to be non-empty.
  timeout | The timeout in milliseconds.

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::AuthorizePublication | ( | const Tp::UIntList & | contacts,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `AuthorizePublication` on the remote object.

For each of the given contacts, request that the local user's presence is sent to that contact, i.e. that their publish attribute becomes Yes.

Connection managers SHOULD NOT attempt to enforce a mutual-subscription policy (i.e. when this method is called, they should not automatically request that the contacts allow the user to subscribe to their presence). User interfaces that require mutual subscription MAY call RequestSubscription() at the same time as this method.

Whether to enforce mutual subscription is a matter of policy, so it is left to the user interface and/or the server.

For contacts with publish=Yes, this method has no effect; it MUST return successfully if all contacts given have this state.

For contacts with publish=Ask, this method accepts the contact's request to see the local user's presence, changing their publish attribute from Ask to Yes.

For contacts with publish=No, if the protocol allows it, this method allows the contacts to see the local user's presence even though they have not requested it, changing their publish attribute from No to Yes. Otherwise, it merely records the fact that presence publication to those contacts is allowed; if any of those contacts ask to receive the local user's presence later in the lifetime of the connection, the connection SHOULD immediately allow them to do so, changing their publish attribute directly from No to Yes.

This makes it easy to implement the common UI policy that if the user attempts to subscribe to a contact's presence, requests for reciprocal subscription are automatically approved.

Any state changes that immediately result from this request MUST be signalled via ContactsChanged() before this method returns.

This makes it easy for user interfaces to see what practical effect this method had.

This method SHOULD NOT be called until the ContactListState changes to Success. If the ContactListState changes to Failure, this method SHOULD raise the same error as GetContactListAttributes() .

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  contacts | One or more contacts to authorize.
  timeout | The timeout in milliseconds.

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::RemoveContacts | ( | const Tp::UIntList & | contacts,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `RemoveContacts` on the remote object.

Remove the given contacts from the contact list entirely. It is protocol-dependent whether this works, and under which circumstances.

If possible, this method SHOULD set the contacts' subscribe and publish attributes to No, remove any stored aliases for those contacts, and remove the contacts from the result of GetContactListAttributes() .

This method SHOULD succeed even if it was not possible to carry out the request entirely or for all contacts (for instance, if there is an outstanding request to subscribe to the contact's presence, and it's not possible to cancel such requests). However, all signals that immediately result from this method call MUST be emitted before it returns, so that clients can interpret the result.

User interfaces removing a contact from the contact list are unlikely to want spurious failure notifications resulting from limitations of a particular protocol. However, emitting the signals first means that if a client does want to check exactly what happened, it can wait for the method to return (while applying change-notification signals to its local cache of the contact list's state), then consult its local cache of the contact list's state to see whether the contact is still there.

This method SHOULD NOT be called until the ContactListState changes to Success. If the ContactListState changes to Failure, this method SHOULD raise the same error as GetContactListAttributes() .

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  contacts | One or more contacts to remove.
  timeout | The timeout in milliseconds.

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::Unsubscribe | ( | const Tp::UIntList & | contacts,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `Unsubscribe` on the remote object.

Attempt to set the given contacts' subscribe attribute to No, i.e. stop receiving their presence.

For contacts with subscribe=Ask, this attempts to cancel an earlier request to subscribe to the contact's presence; for contacts with subscribe=Yes, this attempts to unsubscribe from the contact's presence.

As with RemoveContacts() , this method SHOULD succeed even if it was not possible to carry out the request entirely or for all contacts; however, all signals that immediately result from this method call MUST be emitted before it returns.

This method SHOULD NOT be called until the ContactListState changes to Success. If the ContactListState changes to Failure, this method SHOULD raise the same error as GetContactListAttributes() .

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  contacts | One or more contacts to remove.
  timeout | The timeout in milliseconds.

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::Unpublish | ( | const Tp::UIntList & | contacts,
|  | int | timeout = `-1`
| ) |  | `[inline, slot]`

Begins a call to the D-Bus method `Unpublish` on the remote object.

Attempt to set the given contacts' publish attribute to No, i.e. stop sending presence to them.

For contacts with publish=Ask, this method explicitly rejects the contact's request to subscribe to the user's presence; for contacts with publish=Yes, this method attempts to prevent the user's presence from being received by the contact.

As with RemoveContacts() , this method SHOULD succeed even if it was not possible to carry out the request entirely or for all contacts; however, all signals that immediately result from this method call MUST be emitted before it returns.

This method SHOULD NOT be called until the ContactListState changes to Success. If the ContactListState changes to Failure, this method SHOULD raise the same error as GetContactListAttributes() .

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  contacts | One or more contacts to remove.
  timeout | The timeout in milliseconds.

QDBusPendingReply Tp::Client::ConnectionInterfaceContactListInterface::Download | ( | int | timeout = `-1` | ) | `[inline, slot]`

Begins a call to the D-Bus method `Download` on the remote object.

Download the contact list from the server. If DownloadAtConnection is true, Download does nothing.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:

  timeout | The timeout in milliseconds.

void Tp::Client::ConnectionInterfaceContactListInterface::ContactListStateChanged | ( | uint | contactListState | ) | `[signal]`

Represents the signal `ContactListStateChanged` on the remote object.

Emitted when ContactListState changes.

Parameters:

  contactListState | The new value of ContactListState.

void Tp::Client::ConnectionInterfaceContactListInterface::ContactsChangedWithID | ( | const Tp::ContactSubscriptionMap & | changes,
|  | const Tp::HandleIdentifierMap & | identifiers,
|  | const Tp::HandleIdentifierMap & | removals
| ) |  | `[signal]`

Represents the signal `ContactsChangedWithID` on the remote object.

Emitted when the contact list becomes available, when contacts' basic stored properties change, when new contacts are added to the list that would be returned by GetContactListAttributes() , or when contacts are removed from that list.

This provides change notification for that list, and for contacts' subscribe, publish and publish-request attributes.

Connection managers SHOULD also emit this signal when a contact requests that the user's presence is published to them, even if that contact's publish attribute is already Ask and the publish-request has not changed.

If the same contact sends 10 identical requests, 10 identical signals should be emitted.

Parameters:

  changes | The new subscribe, publish and publish-request attributes of all the contacts that have been added, and all the contacts for which those attributes have changed.
  identifiers | The identifiers of the contacts in the Changes map.
  removals | The contacts that have been removed from the list that would be returned by GetContactListAttributes() . This also implies that they have subscribe = No and publish = No; contacts MUST NOT be listed both here and in Changes.

void Tp::Client::ConnectionInterfaceContactListInterface::ContactsChanged | ( | const Tp::ContactSubscriptionMap & | changes,
|  | const Tp::UIntList & | removals
| ) |  | `[signal]`

Represents the signal `ContactsChanged` on the remote object.

Emitted immediately after ContactsChangedWithID() , under the same circumstances.

If clients receive this signal without first receiving a corresponding ContactsChangedWithID() , they MUST assume that only this signal will be emitted.

Parameters:

  changes | The same as the corresponding argument to ContactsChangedWithID.
  removals | The same as the corresponding argument to ContactsChangedWithID, except that it only includes handles and not identifiers.

void Tp::Client::ConnectionInterfaceContactListInterface::invalidate | ( | Tp::DBusProxy * | proxy,
|  | const QString & | error,
|  | const QString & | message
| ) |  | `[protected, virtual]`

Reimplemented from Tp::AbstractInterface.