Change very bad var names

This commit is contained in:
Jean-Marie Traissard 2008-05-05 03:18:09 +00:00
parent 5742d2e1e7
commit 75ffe12157
4 changed files with 34 additions and 34 deletions

View File

@ -1539,17 +1539,17 @@ class Connection(ConnectionHandlers):
item.addChild(name = 'reason', payload = reason)
self.connection.send(iq)
def send_gc_affiliation_list(self, room_jid, list):
def send_gc_affiliation_list(self, room_jid, users_dict):
if not self.connection:
return
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS = \
common.xmpp.NS_MUC_ADMIN)
item = iq.getTag('query')
for jid in list:
for jid in users_dict:
item_tag = item.addChild('item', {'jid': jid,
'affiliation': list[jid]['affiliation']})
if list[jid].has_key('reason') and list[jid]['reason']:
item_tag.setTagData('reason', list[jid]['reason'])
'affiliation': users_dict[jid]['affiliation']})
if users_dict[jid].has_key('reason') and users_dict[jid]['reason']:
item_tag.setTagData('reason', users_dict[jid]['reason'])
self.connection.send(iq)
def get_affiliation_list(self, room_jid, affiliation):

View File

@ -2093,22 +2093,22 @@ returns the session that we last sent a message to.'''
def _MucAdminCB(self, con, iq_obj):
gajim.log.debug('MucAdminCB')
items = iq_obj.getTag('query', namespace = common.xmpp.NS_MUC_ADMIN).getTags('item')
list = {}
users_dict = {}
for item in items:
if item.has_attr('jid') and item.has_attr('affiliation'):
jid = item.getAttr('jid')
affiliation = item.getAttr('affiliation')
list[jid] = {'affiliation': affiliation}
users_dict[jid] = {'affiliation': affiliation}
if item.has_attr('nick'):
list[jid]['nick'] = item.getAttr('nick')
users_dict[jid]['nick'] = item.getAttr('nick')
if item.has_attr('role'):
list[jid]['role'] = item.getAttr('role')
users_dict[jid]['role'] = item.getAttr('role')
reason = item.getTagData('reason')
if reason:
list[jid]['reason'] = reason
users_dict[jid]['reason'] = reason
self.dispatch('GC_AFFILIATION', (helpers.get_full_jid_from_iq(iq_obj),
list))
users_dict))
def _MucErrorCB(self, con, iq_obj):
gajim.log.debug('MucErrorCB')

View File

@ -2361,7 +2361,7 @@ class GroupchatConfigWindow:
self.form = form
self.remove_button = {}
self.affiliation_treeview = {}
self.list_init = {} # list at the beginning
self.start_users_dict = {} # list at the beginning
self.affiliation_labels = {'outcast': _('Ban List'),
'member': _('Member List'),
'owner': _('Owner List'),
@ -2387,7 +2387,7 @@ class GroupchatConfigWindow:
add_on_vbox = self.xml.get_widget('add_on_vbox')
for affiliation in self.affiliation_labels.keys():
self.list_init[affiliation] = {}
self.start_users_dict[affiliation] = {}
hbox = gtk.HBox(spacing = 5)
add_on_vbox.pack_start(hbox, False)
@ -2501,25 +2501,25 @@ class GroupchatConfigWindow:
def on_affiliation_treeview_cursor_changed(self, widget, affiliation):
self.remove_button[affiliation].set_sensitive(True)
def affiliation_list_received(self, list):
def affiliation_list_received(self, users_dict):
'''Fill the affiliation treeview'''
for jid in list:
affiliation = list[jid]['affiliation']
for jid in users_dict:
affiliation = users_dict[jid]['affiliation']
if affiliation not in self.affiliation_labels.keys():
# Unknown affiliation or 'none' affiliation, do not show it
continue
self.list_init[affiliation][jid] = list[jid]
self.start_users_dict[affiliation][jid] = users_dict[jid]
tv = self.affiliation_treeview[affiliation]
model = tv.get_model()
reason = ''
if list[jid].has_key('reason'):
reason = list[jid]['reason']
if users_dict[jid].has_key('reason'):
reason = users_dict[jid]['reason']
nick = ''
if list[jid].has_key('nick'):
nick = list[jid]['nick']
if users_dict[jid].has_key('nick'):
nick = users_dict[jid]['nick']
role = ''
if list[jid].has_key('role'):
role = list[jid]['role']
if users_dict[jid].has_key('role'):
role = users_dict[jid]['role']
model.append((jid, reason, nick, role))
def on_data_form_window_destroy(self, widget):
@ -2530,7 +2530,7 @@ class GroupchatConfigWindow:
form = self.data_form_widget.data_form
gajim.connections[self.account].send_gc_config(self.room_jid, form)
for affiliation in self.affiliation_labels.keys():
list = {}
users_dict = {}
actual_jid_list = []
model = self.affiliation_treeview[affiliation].get_model()
iter = model.get_iter_first()
@ -2538,21 +2538,21 @@ class GroupchatConfigWindow:
while iter:
jid = model[iter][0].decode('utf-8')
actual_jid_list.append(jid)
if jid not in self.list_init[affiliation] or \
(affiliation == 'outcast' and self.list_init[affiliation]\
[jid].has_key('reason') and self.list_init[affiliation][jid]\
if jid not in self.start_users_dict[affiliation] or \
(affiliation == 'outcast' and self.start_users_dict[affiliation]\
[jid].has_key('reason') and self.start_users_dict[affiliation][jid]\
['reason'] != model[iter][1].decode('utf-8')):
list[jid] = {'affiliation': affiliation}
users_dict[jid] = {'affiliation': affiliation}
if affiliation == 'outcast':
list[jid]['reason'] = model[iter][1].decode('utf-8')
users_dict[jid]['reason'] = model[iter][1].decode('utf-8')
iter = model.iter_next(iter)
# remove removed one
for jid in self.list_init[affiliation]:
for jid in self.start_users_dict[affiliation]:
if jid not in actual_jid_list:
list[jid] = {'affiliation': 'none'}
if list:
users_dict[jid] = {'affiliation': 'none'}
if users_dict:
gajim.connections[self.account].send_gc_affiliation_list(
self.room_jid, list)
self.room_jid, users_dict)
self.window.destroy()
#---------- RemoveAccountWindow class -------------#

View File

@ -1373,7 +1373,7 @@ class Interface:
gc_control.print_conversation(change)
def handle_event_gc_affiliation(self, account, array):
#('GC_AFFILIATION', account, (room_jid, list)) list is list
#('GC_AFFILIATION', account, (room_jid, users_dict))
room_jid = array[0]
if self.instances[account]['gc_config'].has_key(room_jid):
self.instances[account]['gc_config'][room_jid].\