core: improved roster management + misc:

- updated methods to no use anymore methods deprecated in Wokkel
    - use of full jid when it make sense instead of bare jid
    - getContacts, updateContact and delContact are now asynchronous
This commit is contained in:
Goffi 2014-12-10 18:32:33 +01:00
commit 6e144c6458
2 changed files with 102 additions and 98 deletions

View file

@ -230,9 +230,9 @@ class DbusObject(dbus.service.Object):
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ss', out_signature='',
async_callbacks=None)
def delContact(self, entity_jid, profile_key="@DEFAULT@"):
return self._callback("delContact", unicode(entity_jid), unicode(profile_key))
async_callbacks=('callback', 'errback'))
def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
return self._callback("delContact", unicode(entity_jid), unicode(profile_key), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ss', out_signature='(asa(sss))',
@ -260,9 +260,9 @@ class DbusObject(dbus.service.Object):
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='a(sa{ss}as)',
async_callbacks=None)
def getContacts(self, profile_key="@DEFAULT@"):
return self._callback("getContacts", unicode(profile_key))
async_callbacks=('callback', 'errback'))
def getContacts(self, profile_key="@DEFAULT@", callback=None, errback=None):
return self._callback("getContacts", unicode(profile_key), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ss', out_signature='as',
@ -434,9 +434,9 @@ class DbusObject(dbus.service.Object):
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='ssass', out_signature='',
async_callbacks=None)
def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key))
async_callbacks=('callback', 'errback'))
def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
return self._callback("updateContact", unicode(entity_jid), unicode(name), groups, unicode(profile_key), callback=callback, errback=errback)
def __attributes(self, in_sign):
"""Return arguments to user given a in_sign

View file

@ -255,12 +255,13 @@ doc=Tell if a profile is connected
doc_param_0=%(doc_profile_key)s
[getContacts]
async=
type=method
category=core
sig_in=s
sig_out=a(sa{ss}as)
param_0_default="@DEFAULT@"
doc=Return information about all contacts
doc=Return information about all contacts (the roster)
doc_param_0=%(doc_profile_key)s
doc_return=array of tuples with the following values:
- JID of the contact
@ -508,6 +509,7 @@ doc_param_0=entity_jid: JID to add to roster
doc_param_1=%(doc_profile_key)s
[updateContact]
async=
type=method
category=core
sig_in=ssass
@ -520,6 +522,7 @@ doc_param_2=groups: list of group where the entity is
doc_param_3=%(doc_profile_key)s
[delContact]
async=
type=method
category=core
sig_in=ss