Comment 0 for bug 174406

Revision history for this message
Michael Nagel (nailor) wrote :

Binary package hint: gajim

gajim does not start up correctly and produces quite some output when started from console, the last lines being:

  File "gajim.py", line 432, in handle_event_status
    self.roster.on_status_changed(account, status)
  File "/usr/share/gajim/src/roster_window.py", line 3038, in on_status_changed
    self.chg_contact_status(contact, 'offline', '', account)
  File "/usr/share/gajim/src/roster_window.py", line 1203, in chg_contact_status
    self.add_contact_to_roster(contact.jid, account)
  File "/usr/share/gajim/src/roster_window.py", line 315, in add_contact_to_roster
    shown_family)
  File "/usr/share/gajim/src/common/contacts.py", line 419, in get_metacontacts_big_brother
    score = self._get_data_score(data)
  File "/usr/share/gajim/src/common/contacts.py", line 399, in _get_data_score
    score = (max_order - order)*10000
TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'

adding two int-casts to the _get_data_score function in contacts.py seems to fix the problem.
starting at line 382 the code should read:

 def _get_data_score(self, data):
  '''compute thescore of a gived data
  data is {'jid': jid, 'account': account, 'order': order}
  order is optional
  score = (max_order - order)*10000 + is_jabber*priority*10 + status'''
  jid = data['jid']
  account = data['account']
  max_order = 0
  order = 0
  if data.has_key('order'):
   order = int(data['order']) # added cast here
  if order:
   family = self.get_metacontacts_family(account, jid)
   for data_ in family:
    if data_.has_key('order') and data_['order'] > max_order:
     max_order = int(data_['order']) # added cast here
  contact = self.get_contact_with_highest_priority(account, jid)
  score = (max_order - order)*10000

  if common.gajim.get_transport_name_from_jid(jid) is None and \
  contact.show not in ('error', 'offline'):
   score += 10
   if contact.priority > 0:
    score += contact.priority * 10
  score += ['not in roster', 'error', 'offline', 'invisible', 'dnd', 'xa',
  'away', 'chat', 'online', 'requested', 'message'].index(contact.show)
  if contact.show == 'offline' and contact.status:
   # Offline contacts with a status message have highest score
   score += 1
  return score