/usr/share/pyshared/telepathy/_generated/Connection_Interface_Contact_List.py is in python-telepathy 0.15.19-2.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | # -*- coding: utf-8 -*-
# Generated from the Telepathy spec
"""Copyright © 2009-2010 Collabora Ltd.
Copyright © 2009 Nokia Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
"""
import dbus.service
class ConnectionInterfaceContactList(dbus.service.Interface):
"""\
An interface for connections that have any concept of a list of
known contacts (roster, buddy list, friends list etc.)
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.
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.
"""
def __init__(self):
self._interfaces.add('org.freedesktop.Telepathy.Connection.Interface.ContactList')
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='asb', out_signature='a{ua{sv}}')
def GetContactListAttributes(self, Interfaces, Hold):
"""
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.
"""
raise NotImplementedError
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='aus', out_signature='')
def RequestSubscription(self, Contacts, Message):
"""
Request that the given contacts allow the local user to
subscribe to their presence, i.e. that their subscribe attribute
becomes Yes.
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.
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.
"""
raise NotImplementedError
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='au', out_signature='')
def AuthorizePublication(self, Contacts):
"""
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.
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.
"""
raise NotImplementedError
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='au', out_signature='')
def RemoveContacts(self, Contacts):
"""
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.
"""
raise NotImplementedError
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='au', out_signature='')
def Unsubscribe(self, Contacts):
"""
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.
"""
raise NotImplementedError
@dbus.service.method('org.freedesktop.Telepathy.Connection.Interface.ContactList', in_signature='au', out_signature='')
def Unpublish(self, Contacts):
"""
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.
"""
raise NotImplementedError
@dbus.service.signal('org.freedesktop.Telepathy.Connection.Interface.ContactList', signature='u')
def ContactListStateChanged(self, Contact_List_State):
"""
Emitted when ContactListState
changes.
"""
pass
@dbus.service.signal('org.freedesktop.Telepathy.Connection.Interface.ContactList', signature='a{u(uus)}au')
def ContactsChanged(self, Changes, Removals):
"""
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.
"""
pass
|