def addListGroup(self, name):
"""
Used to create a new list group.
A default callback is added to the
returned Deferred which updates the
contacts attribute of the factory.
@param name: The desired name of the new group.
@return: A Deferred, the callbacck for which will be called
when the server clarifies that the new group has been
created. The callback argument will be a tuple with 3
elements: the new list version (int), the new group name
(str) and the new group ID (int).
"""
id, d = self._createIDMapping()
self.sendLine("ADG %s %s 0" % (id, quote(name)))
def _cb(r):
self.factory.contacts.version = r[0]
self.factory.contacts.setGroup(r[1], r[2])
return r
return d.addCallback(_cb)
评论列表
文章目录