Home · All Classes · All Namespaces · Modules · Functions · Files
Public Slots | Signals | Public Member Functions | List of all members
Tp::Service::ConnectionInterfaceContactListAdaptor Class Reference

#include <TelepathyQt/_gen/svc-connection.h>

Inherits Tp::AbstractAdaptor.

Public Slots

Tp::ContactAttributesMap GetContactListAttributes (const QStringList &interfaces, bool hold, const QDBusMessage &dbusMessage)
 
void RequestSubscription (const Tp::UIntList &contacts, const QString &message, const QDBusMessage &dbusMessage)
 
void AuthorizePublication (const Tp::UIntList &contacts, const QDBusMessage &dbusMessage)
 
void RemoveContacts (const Tp::UIntList &contacts, const QDBusMessage &dbusMessage)
 
void Unsubscribe (const Tp::UIntList &contacts, const QDBusMessage &dbusMessage)
 
void Unpublish (const Tp::UIntList &contacts, const QDBusMessage &dbusMessage)
 
void Download (const QDBusMessage &dbusMessage)
 

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

uint ContactListState () const
 
bool ContactListPersists () const
 
bool CanChangeContactList () const
 
bool RequestUsesMessage () const
 
bool DownloadAtConnection () const
 
- Public Member Functions inherited from Tp::AbstractAdaptor
 AbstractAdaptor (const QDBusConnection &connection, QObject *adaptee, QObject *parent)
 
 ~AbstractAdaptor ()
 
QDBusConnection dbusConnection () const
 
QObject * adaptee () const
 

Detailed Description

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

Member Function Documentation

uint Tp::Service::ConnectionInterfaceContactListAdaptor::ContactListState ( ) const

Return the value of the exported D-Bus object property ContactListState of type uint.

Adaptees should export this property as a Qt property named 'contactListState' with type uint.

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

Returns
The value of exported property ContactListState.
bool Tp::Service::ConnectionInterfaceContactListAdaptor::ContactListPersists ( ) const

Return the value of the exported D-Bus object property ContactListPersists of type bool.

Adaptees should export this property as a Qt property named 'contactListPersists' with 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
The value of exported property ContactListPersists.
bool Tp::Service::ConnectionInterfaceContactListAdaptor::CanChangeContactList ( ) const

Return the value of the exported D-Bus object property CanChangeContactList of type bool.

Adaptees should export this property as a Qt property named 'canChangeContactList' with 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
The value of exported property CanChangeContactList.
bool Tp::Service::ConnectionInterfaceContactListAdaptor::RequestUsesMessage ( ) const

Return the value of the exported D-Bus object property RequestUsesMessage of type bool.

Adaptees should export this property as a Qt property named 'requestUsesMessage' with 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
The value of exported property RequestUsesMessage.
bool Tp::Service::ConnectionInterfaceContactListAdaptor::DownloadAtConnection ( ) const

Return the value of the exported D-Bus object property DownloadAtConnection of type bool.

Adaptees should export this property as a Qt property named 'downloadAtConnection' with 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
The value of exported property DownloadAtConnection.
Tp::ContactAttributesMap Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributes ( const QStringList &  interfaces,
bool  hold,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method GetContactListAttributes on this object.

Adaptees should export this method as a Qt slot with the following signature: void getContactListAttributes(const QStringList& interfaces, bool hold, const Tp::Service::ConnectionInterfaceContactListAdaptor::GetContactListAttributesContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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.

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() \\htmlonly , 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() \\htmlonly . (If \\endhtmlonly \\link ConnectionInterface::requestPropertyHasImmortalHandles() ConnectionInterface::HasImmortalHandles \\endlink \\htmlonly is true, which SHOULD be the case in all new connection managers, this has no effect.)

Returns

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

void Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscription ( const Tp::UIntList contacts,
const QString &  message,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method RequestSubscription on this object.

Adaptees should export this method as a Qt slot with the following signature: void requestSubscription(const Tp::UIntList& contacts, const QString& message, const Tp::Service::ConnectionInterfaceContactListAdaptor::RequestSubscriptionContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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() .

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 \\\ \\link requestPropertyRequestUsesMessage() RequestUsesMessage \\endlink \\htmlonly 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.

void Tp::Service::ConnectionInterfaceContactListAdaptor::AuthorizePublication ( const Tp::UIntList contacts,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method AuthorizePublication on this object.

Adaptees should export this method as a Qt slot with the following signature: void authorizePublication(const Tp::UIntList& contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::AuthorizePublicationContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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() .

Parameters
contacts

One or more contacts to authorize.

void Tp::Service::ConnectionInterfaceContactListAdaptor::RemoveContacts ( const Tp::UIntList contacts,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method RemoveContacts on this object.

Adaptees should export this method as a Qt slot with the following signature: void removeContacts(const Tp::UIntList& contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::RemoveContactsContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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() .

Parameters
contacts

One or more contacts to remove.

void Tp::Service::ConnectionInterfaceContactListAdaptor::Unsubscribe ( const Tp::UIntList contacts,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method Unsubscribe on this object.

Adaptees should export this method as a Qt slot with the following signature: void unsubscribe(const Tp::UIntList& contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::UnsubscribeContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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() .

Parameters
contacts

One or more contacts to remove.

void Tp::Service::ConnectionInterfaceContactListAdaptor::Unpublish ( const Tp::UIntList contacts,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method Unpublish on this object.

Adaptees should export this method as a Qt slot with the following signature: void unpublish(const Tp::UIntList& contacts, const Tp::Service::ConnectionInterfaceContactListAdaptor::UnpublishContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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() .

Parameters
contacts

One or more contacts to remove.

void Tp::Service::ConnectionInterfaceContactListAdaptor::Download ( const QDBusMessage &  dbusMessage)
slot

Begins a call to the exported D-Bus method Download on this object.

Adaptees should export this method as a Qt slot with the following signature: void download(const Tp::Service::ConnectionInterfaceContactListAdaptor::DownloadContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

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

void Tp::Service::ConnectionInterfaceContactListAdaptor::ContactListStateChanged ( uint  contactListState)
signal

Represents the exported D-Bus signal ContactListStateChanged on this object.

Adaptees should export this signal as a Qt signal with the following signature: void contactListStateChanged(uint contactListState);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters
contactListState
The new value of ContactListState.
void Tp::Service::ConnectionInterfaceContactListAdaptor::ContactsChangedWithID ( const Tp::ContactSubscriptionMap changes,
const Tp::HandleIdentifierMap identifiers,
const Tp::HandleIdentifierMap removals 
)
signal

Represents the exported D-Bus signal ContactsChangedWithID on this object.

Adaptees should export this signal as a Qt signal with the following signature: void contactsChangedWithID(const Tp::ContactSubscriptionMap& changes, const Tp::HandleIdentifierMap& identifiers, const Tp::HandleIdentifierMap& removals);

The adaptee signal will be automatically relayed as a D-Bus signal once 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() \\htmlonly . This also implies that they have subscribe = No and publish = No; contacts MUST NOT be listed both here and in Changes.
void Tp::Service::ConnectionInterfaceContactListAdaptor::ContactsChanged ( const Tp::ContactSubscriptionMap changes,
const Tp::UIntList removals 
)
signal

Represents the exported D-Bus signal ContactsChanged on this object.

Adaptees should export this signal as a Qt signal with the following signature: void contactsChanged(const Tp::ContactSubscriptionMap& changes, const Tp::UIntList& removals);

The adaptee signal will be automatically relayed as a D-Bus signal once 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.


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.7