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

View file

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

View file

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

View file

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