new functions in Contacts instance
This commit is contained in:
parent
5fbf3c9b55
commit
944449009d
|
@ -82,6 +82,13 @@ class Contacts:
|
||||||
return Contact(jid, name, groups, show, status, sub, ask, resource,
|
return Contact(jid, name, groups, show, status, sub, ask, resource,
|
||||||
priority, keyID, our_chatstate, chatstate)
|
priority, keyID, our_chatstate, chatstate)
|
||||||
|
|
||||||
|
def copy_contact(self, contact):
|
||||||
|
return self.create_contact(jid = contact.jid, name = contact.name,
|
||||||
|
groups = contact.groups, show = contact.show, status = contact.status,
|
||||||
|
sub = contact.sub, ask = contact.ask, resource = contact.resource,
|
||||||
|
priority = contact.priority, keyID = contact.keyID,
|
||||||
|
our_chatstate = contact.our_chatstate, chatstate = contact.chatstate)
|
||||||
|
|
||||||
def add_contact(self, account, contact):
|
def add_contact(self, account, contact):
|
||||||
# No such account before ?
|
# No such account before ?
|
||||||
if not self._contacts.has_key(account):
|
if not self._contacts.has_key(account):
|
||||||
|
@ -109,6 +116,10 @@ class Contacts:
|
||||||
if not len(self._contacts[account][contact.jid]):
|
if not len(self._contacts[account][contact.jid]):
|
||||||
self._contacts[account].remove(contact.jid)
|
self._contacts[account].remove(contact.jid)
|
||||||
|
|
||||||
|
def create_gc_contact(self, room_jid='', nick='', show='', status='',
|
||||||
|
role='', affiliation='', jid=''):
|
||||||
|
return GC_Contact(room_jid, nick, show, status, role, affiliation, jid)
|
||||||
|
|
||||||
def add_gc_contact(self, account, gc_contact):
|
def add_gc_contact(self, account, gc_contact):
|
||||||
# No such account before ?
|
# No such account before ?
|
||||||
if not self._gc_contacts.has_key(account):
|
if not self._gc_contacts.has_key(account):
|
||||||
|
|
Loading…
Reference in New Issue