fix arguments order in contacts.py, some coding standards. should fix #4081

This commit is contained in:
Yann Leboulanger 2008-07-05 19:04:27 +00:00
parent 3ad1f9afed
commit 74c53da32a
6 changed files with 56 additions and 59 deletions

View file

@ -186,17 +186,20 @@ class Contacts:
sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None,
chatstate=None, last_status_time=None, composing_xep=None,
mood={}, tune={}, activity={}):
return Contact(jid, name, groups, show, status, sub, ask, resource,
priority, keyID, our_chatstate, chatstate, last_status_time,
None, composing_xep, mood, tune, activity)
return Contact(jid=jid, name=name, groups=groups, show=show,
status=status, sub=sub, ask=ask, resource=resource, priority=priority,
keyID=keyID, chatstate=our_chatstate, chatstate=chatstate,
last_status_time=last_status_time, composing_xep=composing_xep,
mood=mood, tune=tune, activity=activity)
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,
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,
last_status_time = contact.last_status_time)
caps_node=contact.caps_node, caps_hash_method=contact.caps_hash_method,
caps_hash=contact.caps_hash, our_chatstate=contact.our_chatstate,
chatstate=contact.chatstate, last_status_time=contact.last_status_time)
def add_contact(self, account, contact):
# No such account before ?

View file

@ -276,8 +276,7 @@ _('Connection with peer cannot be established.'))
if contact.find('/') == -1:
return
(jid, resource) = contact.split('/', 1)
contact = gajim.contacts.create_contact(jid = jid,
resource = resource)
contact = gajim.contacts.create_contact(jid=jid, resource=resource)
(file_dir, file_name) = os.path.split(file_path)
file_props = self.get_send_file_props(account, contact,
file_path, file_name, file_desc)

View file

@ -675,9 +675,8 @@ class Interface:
return
contact1 = gajim.contacts.create_contact(jid=ji,
name=gajim.nicks[account], groups=['self_contact'],
show = array[1], status = status_message, sub = 'both',
ask = 'none', priority = priority, keyID = keyID,
resource = resource)
show=array[1], status=status_message, sub='both', ask='none',
priority=priority, keyID=keyID, resource=resource)
old_show = 0
gajim.contacts.add_contact(account, contact1)
lcontact.append(contact1)

View file

@ -732,8 +732,7 @@ class RosterWindow:
show = 'offline'
status = ''
contact = gajim.contacts.create_contact(jid=jid, name=jid,
groups = [_('Groupchats')], show = show,
status = status, sub = 'none')
groups=[_('Groupchats')], show=show, status=status, sub='none')
gajim.contacts.add_contact(account, contact)
self.add_contact(jid, account)
else:
@ -759,8 +758,8 @@ class RosterWindow:
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
if contact is None:
contact = gajim.contacts.create_contact(jid=jid, name=jid,
groups = [_('Transports')], show = 'offline',
status = 'offline', sub = 'from')
groups=[_('Transports')], show='offline', status='offline',
sub='from')
gajim.contacts.add_contact(account, contact)
self.add_contact(jid, account)
return contact
@ -2218,14 +2217,11 @@ class RosterWindow:
account_name = account
if gajim.account_is_connected(account):
account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
contact = gajim.contacts.create_contact(jid = jid,
name = account_name, show = connection.get_status(), sub = '',
status = connection.status,
contact = gajim.contacts.create_contact(jid=jid, name=account_name,
show=connection.get_status(), sub='', status=connection.status,
resource=connection.server_resource,
priority = connection.priority,
mood = connection.mood,
tune = connection.tune,
activity = connection.activity)
priority=connection.priority, mood=connection.mood,
tune=connection.tune, activity=connection.activity)
if gajim.connections[account].gpg:
contact.keyID = gajim.config.get_per('accounts', connection.name,
'keyid')