Conn.I.ContactList — Telepathy D-Bus Interface Specification

# Interface Connection.Interface.ContactList

Interface Index (Compact) | Summary | Description | Methods | Signals | Properties | Contact Attributes | Types

### Methods

GetContactListAttributes | (as: Interfaces, b: Hold) | → | a{ua{sv}}: Attributes |
RequestSubscription | (au: Contacts, s: Message) | → | nothing |
AuthorizePublication | (au: Contacts) | → | nothing |
RemoveContacts | (au: Contacts) | → | nothing |
Unsubscribe | (au: Contacts) | → | nothing |
Unpublish | (au: Contacts) | → | nothing |

### Signals

ContactListStateChanged | (u: Contact_List_State) |
ContactsChangedWithID | (a{u(uus)}: Changes, a{us}: Identifiers, a{us}: Removals) |
ContactsChanged | (a{u(uus)}: Changes, au: Removals) | (deprecated)

### Properties

ContactListState | u (Contact_List_State) | Read only |  |
ContactListPersists | b | Read only |  |
CanChangeContactList | b | Read only |  |
RequestUsesMessage | b | Read only |  |

### Contact Attributes

org.freedesktop.Telepathy.Connection.Interface.ContactList/subscribe | u (Subscription_State)
org.freedesktop.Telepathy.Connection.Interface.ContactList/publish | u (Subscription_State)
org.freedesktop.Telepathy.Connection.Interface.ContactList/publish-request | s

### Types

Contact_List_State | Enum | u |
Subscription_State | Enum | u |
Contact_Metadata_Storage_Type | Enum | u |
Contact_Subscription_Map | Mapping | a{u(uus)} |
Contact_Subscriptions | Struct | (uus) |

Added in 0.21.0. (as stable API)
Objects implementing this interface must also implement:

- org.freedesktop.Telepathy.Connection

### Description

An interface for connections that have any concept of a list of known contacts (roster, buddy list, friends list etc.)

##### Rationale:

On many protocols, there's a server-side roster (as in XMPP), or a set of server-side lists that can be combined to form a roster (as in MSN).

In some protocols (like link-local XMPP), while there might not be any server or roster, it's possible to list "nearby" contacts.

In Telepathy 0.20 and older, we represented contact lists as a collection of ContactList channels. This is remarkably difficult to work with in practice - every client that cares about contact lists has to take the union of some hard-to-define set of these channels - and conflicts with the idea that channels that cannot be dispatched to a handler should be closed.

The list of contacts is not exposed as a D-Bus property; it can be fetched using GetContactListAttributes.

##### Rationale:

In some protocols, such as XMPP, the contact list may not be available immediately. The GetContactListAttributes method will fail until the contact list is available. Using a method also allows extra attributes to be retrieved at the same time.

# Methods

(Permalink)

## GetContactListAttributes (as: Interfaces, b: Hold) → a{ua{sv}}: Attributes

### Parameters

- Interfaces — as (DBus_Interface_List)

A list of strings indicating which D-Bus interfaces the calling process is interested in. Equivalent to the corresponding argument to GetContactAttributes, except that if this list does not contain the ContactList interface itself, it is treated as though that interface was also requested.

- Hold — b

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 Connection.HoldHandles. (If HasImmortalHandles is true, which SHOULD be the case in all new connection managers, this has no effect.)

### Returns

- Attributes — a{ua{sv}} (Contact_Attributes_Map)

A dictionary mapping the contact handles to contact attributes, equivalent to the result of GetContactAttributes.

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.

##### Rationale:

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.

##### Rationale:

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.

### Possible Errors

- Network Error
Raised when there is an error reading from or writing to the network.
- Not Implemented
Raised when the requested method, channel, etc is not available on this connection.
- Not Available
Raised when the requested functionality is temporarily unavailable.
- Service Busy
Raised if a server or some other piece of infrastructure cannot process the request, e.g. due to resource limitations. Clients MAY try again later.

##### Rationale:

This is not the same error as Busy, which indicates that a user is busy.
- Not Yet

The ContactListState is None or Waiting. In particular, this error is raised if the Status is not yet Connection_Status_Connected.

(Permalink)

## RequestSubscription (au: Contacts, s: Message) → nothing

### Parameters

- Contacts — au (Contact_Handle_List)

One or more contacts to whom requests are to be sent.

- Message — s

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.

##### Rationale:

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.

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.

##### Rationale:

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

##### Rationale:

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.

##### Rationale:

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.

### Possible Errors

- Disconnected
The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.

##### Rationale:

The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
- Invalid Handle
The handle specified is unknown on this channel or connection.
- Network Error
Raised when there is an error reading from or writing to the network.
- Not Yet
The ContactListState is None or Waiting.
- Not Implemented
It was not possible to perform the requested action, because CanChangeContactList is false.

(Permalink)

## AuthorizePublication (au: Contacts) → nothing

### Parameters

- Contacts — au (Contact_Handle_List)

One or more contacts to authorize.

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.

##### Rationale:

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.

##### Rationale:

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.

##### Rationale:

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.

### Possible Errors

- Disconnected
The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.

##### Rationale:

The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
- Invalid Handle
The handle specified is unknown on this channel or connection.
- Network Error
Raised when there is an error reading from or writing to the network.
- Not Implemented
It was not possible to perform the requested action, because CanChangeContactList is false.
- Not Yet
The ContactListState is None or Waiting.

(Permalink)

## RemoveContacts (au: Contacts) → nothing

### Parameters

- Contacts — au (Contact_Handle_List)

One or more contacts to remove.

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.

##### Rationale:

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.

### Possible Errors

- Disconnected
The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.

##### Rationale:

The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
- Invalid Handle
The handle specified is unknown on this channel or connection.
- Network Error
Raised when there is an error reading from or writing to the network.
- Not Implemented
It was not possible to perform the requested action because CanChangeContactList is false.
- Not Yet
The ContactListState is None or Waiting.

(Permalink)

## Unsubscribe (au: Contacts) → nothing

### Parameters

- Contacts — au (Contact_Handle_List)

One or more contacts to remove.

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.

### Possible Errors

- Disconnected
The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.

##### Rationale:

The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
- Invalid Handle
The handle specified is unknown on this channel or connection.
- Network Error
Raised when there is an error reading from or writing to the network.
- Not Implemented
It was not possible to perform the requested action because CanChangeContactList is false.

(Permalink)

## Unpublish (au: Contacts) → nothing

### Parameters

- Contacts — au (Contact_Handle_List)

One or more contacts to remove.

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.

### Possible Errors

- Disconnected
The connection is not currently connected and cannot be used. This error may also be raised when operations are performed on a Connection for which StatusChanged has signalled status Disconnected for reason None.

##### Rationale:

The second usage corresponds to None in the Connection_Status_Reason enum; if a better reason is available, the corresponding error should be used instead.
- Invalid Handle
The handle specified is unknown on this channel or connection.
- Network Error
Raised when there is an error reading from or writing to the network.
- Not Implemented
It was not possible to perform the requested action because CanChangeContactList is false.
- Not Yet
The ContactListState is None or Waiting.

# Signals

(Permalink)

## ContactListStateChanged (u: Contact_List_State)

### Parameters

- Contact_List_State — u (Contact_List_State)
The new value of ContactListState.

Emitted when ContactListState changes.
(Permalink)

## ContactsChangedWithID (a{u(uus)}: Changes, a{us}: Identifiers, a{us}: Removals)

Added in 0.21.8.

### Parameters

- Changes — a{u(uus)} (Contact_Subscription_Map)
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 — a{us} (Handle_Identifier_Map)
The identifiers of the contacts in the Changes map.
- Removals — a{us} (Handle_Identifier_Map)
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.

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.

##### Rationale:

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.

##### Rationale:

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

(Permalink)

## ContactsChanged (a{u(uus)}: Changes, au: Removals)

Deprecated since 0.21.8. Connection managers MUST still emit this signal, but clients SHOULD listen for the ContactsChangedWithID signal in addition, and ignore this signal after ContactsChangedWithID has been emitted at least once.

### Parameters

- Changes — a{u(uus)} (Contact_Subscription_Map)
The same as the corresponding argument to ContactsChangedWithID.
- Removals — au (Contact_Handle_List)
The same as the corresponding argument to ContactsChangedWithID, except that it only includes handles and not identifiers.

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.

# Properties

Accessed using the org.freedesktop.DBus.Properties interface.
(Permalink)

## ContactListState — u (Contact_List_State)

Read only
The progress made in retrieving the contact list. Change notification is via ContactListStateChanged.
(Permalink)

## ContactListPersists — b

Read only

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

##### Rationale:

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

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

##### Rationale:

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.

##### Rationale:

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.

(Permalink)

## CanChangeContactList — b

Read only

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.

##### Rationale:

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.

(Permalink)

## RequestUsesMessage — b

Read only

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.

##### Rationale:

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.

##### Rationale:

FIXME: is there any such protocol?

# Contact Attributes

Attributes that a contact can have, accessed with the org.freedesktop.Telepathy.Connection.Interface.Contacts interface.
(Permalink)

## org.freedesktop.Telepathy.Connection.Interface.ContactList/subscribe — u (Subscription_State)

If this attribute on a contact is Yes, this connection can expect to receive their presence, along with any other information that has the same access control.

##### Rationale:

This is subscription="from" or subscription="both" in XMPP, the "forward list" on MSN, or the contact being "added to the local user's buddy list" in ICQ, for example.

If this attribute is not Yes, the local user cannot generally expect to receive presence from this contact. Their presence status as returned by GetPresences is likely to be (Unknown, "unknown", ""), unless the local user can temporarily see their presence for some other reason (for instance, on XMPP, contacts seen in chatrooms will temporarily have available presence).

If this attribute is Ask, this indicates that the local user has asked to receive the contact's presence at some time. It is implementation-dependent whether contacts' subscribe attributes can remain set to Ask, or are reset to No, when the connection disconnects.

##### Rationale:

Some protocols store the fact that we wishes to see a contact's presence; on these protocols, this attribute can remain Ask indefinitely. On other protocols, only contacts who have been asked during the current session will ever have Ask status.

If this attribute is Removed_Remotely, this indicates that the local user has asked to receive the contact's presence at some time, but the remote contact has rejected that request, and a local user interface has not yet acknowledged this. It is implementation-dependent whether contacts' subscribe attributes can remain set to Removed_Remotely, or are reset to No, when the connection disconnects.

After notifying the user, user interfaces MAY acknowledge a change to `subscribe`=Removed_Remotely by calling either Unsubscribe or RemoveContacts, which will set `subscribe` to No (and perhaps remove the contact). This allows user interfaces to detect that the user has been notified about the rejected request.

This attribute's value will be Unknown or omitted until the ContactListState has changed to Success.

(Permalink)

## org.freedesktop.Telepathy.Connection.Interface.ContactList/publish — u (Subscription_State)

If this attribute on a contact is Yes, the local user's presence is published to that contact, along with any other information that shares an access-control mechanism with presence (depending on protocol, server configuration and/or user configuration, this may include avatars, "rich presence" such as location, etc.).

##### Rationale:

This is subscription="to" or subscription="both" in XMPP, the "reverse list" on MSN, or the state of "being added to the contact's buddy list" in ICQ, for example.

If this attribute is not Yes, the local user's presence is not published to that contact; however, if it is Ask, the contact has requested that the local user's presence is made available to them.

It is implementation-dependent whether contacts' `publish` attributes can remain set to Ask, or are reset to No, when the connection disconnects.

##### Rationale:

Some protocols store the fact that a contact wishes to see our presence; on these protocols, this attribute can remain Ask indefinitely. On other protocols, only contacts who have asked during the current session will ever have Ask status.

If this attribute is Removed_Remotely, this indicates that the remote contact has asked to receive the user's presence at some time, but has then cancelled that request before a response was given by the local user. User interfaces MAY reset `publish` from Removed_Remotely to No, by calling either Unpublish or RemoveContacts.

If multiple factors affect whether a contact can receive the local user's presence, this attribute SHOULD reflect the overall result. For instance, an XMPP contact with subscription="to" or subscription="both", but who has been blocked via XEP-0016 Privacy Lists, SHOULD have publish=No.

This attribute's value will be Unknown or omitted until the ContactListState has changed to Success.

(Permalink)

## org.freedesktop.Telepathy.Connection.Interface.ContactList/publish-request — s

If the publish attribute is Ask, an optional message that was sent by the contact asking to receive the local user's presence; omitted if none was given.

##### Rationale:

If the contact asking to receive our presence is also using Telepathy, this is the message they supplied as the Message argument to RequestSubscription.

Otherwise, this SHOULD be omitted.

This attribute will also be omitted until the ContactListState has changed to Success.

# Types

Enum (Permalink)

## Contact_List_State — u

The progress made in retrieving the contact list.

- None (0)
The connection has not started to retrieve the contact list. If GetContactListAttributes is called in this state, it will raise NotYet.
- Waiting (1)
The connection has started to retrieve the contact list, but has not yet succeeded or failed. If GetContactListAttributes is called in this state, it will raise NotYet.
- Failure (2)

The connection has tried and failed to retrieve the contact list. If GetContactListAttributes is called in this state, it will immediately raise an error indicating the reason for failure.

The connection manager SHOULD try again to obtain the contact list, if appropriate for the protocol. If it succeeds later, the ContactListState MUST advance to Success.

- Success (3)
The connection has successfully retrieved the contact list. If GetContactListAttributes is called in this state, it will return successfully.

Enum (Permalink)

## Subscription_State — u

An enumeration indicating whether presence subscription is denied, denied but pending permission, or allowed. The exact semantics vary according to where this type is used: see the subscribe and publish contact attributes for details.

- Unknown (0)
The presence subscription state is unknown.
- No (1)
Presence information cannot be seen, and either the subscription state Removed_Remotely does not apply, or it is not known whether that state applies.
- Removed_Remotely (2)
Presence information cannot be seen because the remote contact took action: either the local user's request to see the remote contact's presence was denied, or the remote contact requested to see the local user's presence but then cancelled their request.
- Ask (3)
Presence information cannot be seen. Permission to see presence information has been requested, and the request has not yet been declined or accepted.
- Yes (4)
Presence information can be seen.

Enum (Permalink)

## Contact_Metadata_Storage_Type — u

Values of this enumeration indicate the extent to which metadata such as aliases and group memberships can be stored for the contacts on a particular connection.

On some protocols, certain metadata (for instance, contact aliases) can only be stored for contacts on the contact list, or contacts with a particular contact list state.

To make it easier to deal with such protocols, if clients set metadata on a contact who is not in the required state, the Connection MUST cache the metadata for the duration of the session. If clients request the attributes of that contact after the appropriate "set" method has returned successfully, the Connection MUST return the new (cached) value.

If the contact is later placed in the required state to store metadata (for instance, if subscription to the contact's presence is requested, on a protocol like MSN where the alias has storage type Subscribed_Or_Pending), the connection MUST store the cached metadata at that time.

##### Rationale:

If the Connection didn't cache changes in this way, a client intending to change the alias on MSN would have to wait until the server acknowledged the subscription request; in the meantime, other clients would still display the old alias.

The only exception to that general rule is that if the Connection cannot store particular metadata at all (i.e. the storage type is None), it MUST reject attempts to set it.

##### Rationale:

If the implementation knows that metadata can't be stored at all, it's useful to report that, which can be done synchronously. In general, user interfaces should detect storage type None and not display editing controls at all.

- None (0)

This connection cannot store this type of metadata at all, and attempting to do so will fail with NotImplemented.

##### Rationale:

Link-local XMPP can't store aliases or group memberships at all, and subscription and presence states are implicit (all contacts on the local network have subscribe = publish = Yes and no other contacts exist).

As of April 2010, the XMPP server for Facebook Chat provides a read-only view of the user's Facebook contacts, so it could also usefully have this storage type.

- Subscribed_Or_Pending (1)

This type of metadata can only be stored permanently for contacts whose subscribe attribute is Ask or Yes.

##### Rationale:

Contact aliases and groups on MSN have this behaviour.

- Subscribed (2)

This type of metadata can only be stored permanently for contacts whose subscribe attribute is Yes.

##### Rationale:

No service with this behaviour is currently known, but it's a stricter form of Subscribed_Or_Pending.

- Anyone (3)

The user can set this metadata for any valid contact identifier, whether or not they have any presence subscription relationship to it, and it will be stored on their contact list.

##### Rationale:

Contact aliases and groups on XMPP have this behaviour; it is possible to put a contact in a group, or assign an alias to them, without requesting that presence be shared.

Mapping (Permalink)

## Contact_Subscription_Map — a{u(uus)}

A map from contacts to their subscribe, publish and publish-request attributes.

- Contact — u (Contact_Handle)
The contact's handle.
- States — (uus) (Contact_Subscriptions)
The contact's subscribe, publish and publish-request attributes.

Struct (Permalink)

## Contact_Subscriptions — (uus)

A single contact's subscribe, publish and publish-request attributes.

- Subscribe — u (Subscription_State)
The new value of the contact's "subscribe" attribute.
- Publish — u (Subscription_State)
The new value of the contact's "publish" attribute.
- Publish_Request — s
The new value of the contact's "publish-request" attribute, or the empty string if that attribute would be omitted.