Logo Search packages:      
Sourcecode: gajim version File versions  Download package

def roster_window::RosterWindow::fill_contacts_and_groups_dicts (   self,
  array,
  account 
)

fill gajim.contacts and gajim.groups

Definition at line 931 of file roster_window.py.

00931                                                               :
            '''fill gajim.contacts and gajim.groups'''
            if account not in gajim.contacts.get_accounts():
                  gajim.contacts.add_account(account)
            if not gajim.groups.has_key(account):
                  gajim.groups[account] = {}
            for jid in array.keys():
                  jids = jid.split('/')
                  #get jid
                  ji = jids[0]
                  #get resource
                  resource = ''
                  if len(jids) > 1:
                        resource = '/'.join(jids[1:])
                  #get name
                  name = array[jid]['name']
                  if not name:
                        name = ''
                  show = 'offline' # show is offline by default
                  status = '' #no status message by default

                  keyID = ''
                  attached_keys = gajim.config.get_per('accounts', account,
                        'attached_gpg_keys').split()
                  if jid in attached_keys:
                        keyID = attached_keys[attached_keys.index(jid) + 1]
                  contact1 = gajim.contacts.create_contact(jid = ji, name = name,
                        groups = array[jid]['groups'], show = show, status = status,
                        sub = array[jid]['subscription'], ask = array[jid]['ask'],
                        resource = resource, keyID = keyID)
                  gajim.contacts.add_contact(account, contact1)

                  # when we draw the roster, we avoid having the same contact
                  # more than once (f.e. we avoid showing it twice when 2 resources)
                  for g in array[jid]['groups']:
                        if g in gajim.groups[account].keys():
                              continue

                        if account + g in self.collapsed_rows:
                              ishidden = False
                        else:
                              ishidden = True
                        gajim.groups[account][g] = { 'expand': ishidden }
                  if gajim.config.get('ask_avatars_on_startup'):
                        pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(ji)
                        if pixbuf == 'ask':
                              jid_with_resource = contact1.jid
                              if contact1.resource:
                                    jid_with_resource += '/' + contact1.resource
                              gajim.connections[account].request_vcard(jid_with_resource)
                  # If we already have a chat window opened, update it with new contact
                  # instance
                  chat_control = gajim.interface.msg_win_mgr.get_control(ji, account)
                  if chat_control:
                        chat_control.contact = contact1

      def chg_contact_status(self, contact, show, status, account):


Generated by  Doxygen 1.6.0   Back to index