keep caps info when we create a contact instance from groupchat_contact instance

This commit is contained in:
Yann Leboulanger 2008-07-03 21:43:28 +00:00
parent 9ce8e28c0a
commit 2fd4ea7637
1 changed files with 12 additions and 9 deletions

View File

@ -26,9 +26,10 @@ import common.gajim
class Contact: class Contact:
'''Information concerning each contact''' '''Information concerning each contact'''
def __init__(self, jid='', name='', groups=[], show='', status='', sub='', def __init__(self, jid='', name='', groups=[], show='', status='', sub='',
ask='', resource='', priority=0, keyID='', our_chatstate=None, ask='', resource='', priority=0, keyID='', caps_node=None,
chatstate=None, last_status_time=None, msg_id = None, composing_xep = None, caps_hash_method=None, caps_hash=None, our_chatstate=None, chatstate=None,
mood={}, tune={}, activity={}): last_status_time=None, msg_id = None, composing_xep = None, mood={}, tune={},
activity={}):
self.jid = jid self.jid = jid
self.name = name self.name = name
self.contact_name = '' # nick choosen by contact self.contact_name = '' # nick choosen by contact
@ -43,9 +44,9 @@ class Contact:
# Capabilities; filled by caps.py/ConnectionCaps object # Capabilities; filled by caps.py/ConnectionCaps object
# every time it gets these from presence stanzas # every time it gets these from presence stanzas
self.caps_node = None self.caps_node = caps_node
self.caps_hash_method = None self.caps_hash_method = caps_hash_method
self.caps_hash = None self.caps_hash = caps_hash
# please read xep-85 http://www.xmpp.org/extensions/xep-0085.html # please read xep-85 http://www.xmpp.org/extensions/xep-0085.html
# we keep track of xep85 support with the peer by three extra states: # we keep track of xep85 support with the peer by three extra states:
@ -533,9 +534,11 @@ class Contacts:
def contact_from_gc_contact(self, gc_contact): def contact_from_gc_contact(self, gc_contact):
'''Create a Contact instance from a GC_Contact instance''' '''Create a Contact instance from a GC_Contact instance'''
jid = gc_contact.get_full_jid() jid = gc_contact.get_full_jid()
return Contact(jid = jid, resource = '', name = gc_contact.name, return Contact(jid=jid, resource='', name=gc_contact.name, groups=[],
groups = [], show = gc_contact.show, status = gc_contact.status, show=gc_contact.show, status=gc_contact.status, sub='none',
sub = 'none') caps_node=gc_contact.caps_node,
caps_hash_method=gc_contact.caps_hash_method,
caps_hash=gc_contact.caps_hash)
def create_gc_contact(self, room_jid='', name='', show='', status='', def create_gc_contact(self, room_jid='', name='', show='', status='',
role='', affiliation='', jid='', resource=''): role='', affiliation='', jid='', resource=''):