Change very bad var names
This commit is contained in:
parent
5742d2e1e7
commit
75ffe12157
|
@ -1539,17 +1539,17 @@ class Connection(ConnectionHandlers):
|
||||||
item.addChild(name = 'reason', payload = reason)
|
item.addChild(name = 'reason', payload = reason)
|
||||||
self.connection.send(iq)
|
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:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS = \
|
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS = \
|
||||||
common.xmpp.NS_MUC_ADMIN)
|
common.xmpp.NS_MUC_ADMIN)
|
||||||
item = iq.getTag('query')
|
item = iq.getTag('query')
|
||||||
for jid in list:
|
for jid in users_dict:
|
||||||
item_tag = item.addChild('item', {'jid': jid,
|
item_tag = item.addChild('item', {'jid': jid,
|
||||||
'affiliation': list[jid]['affiliation']})
|
'affiliation': users_dict[jid]['affiliation']})
|
||||||
if list[jid].has_key('reason') and list[jid]['reason']:
|
if users_dict[jid].has_key('reason') and users_dict[jid]['reason']:
|
||||||
item_tag.setTagData('reason', list[jid]['reason'])
|
item_tag.setTagData('reason', users_dict[jid]['reason'])
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def get_affiliation_list(self, room_jid, affiliation):
|
def get_affiliation_list(self, room_jid, affiliation):
|
||||||
|
|
|
@ -2093,22 +2093,22 @@ returns the session that we last sent a message to.'''
|
||||||
def _MucAdminCB(self, con, iq_obj):
|
def _MucAdminCB(self, con, iq_obj):
|
||||||
gajim.log.debug('MucAdminCB')
|
gajim.log.debug('MucAdminCB')
|
||||||
items = iq_obj.getTag('query', namespace = common.xmpp.NS_MUC_ADMIN).getTags('item')
|
items = iq_obj.getTag('query', namespace = common.xmpp.NS_MUC_ADMIN).getTags('item')
|
||||||
list = {}
|
users_dict = {}
|
||||||
for item in items:
|
for item in items:
|
||||||
if item.has_attr('jid') and item.has_attr('affiliation'):
|
if item.has_attr('jid') and item.has_attr('affiliation'):
|
||||||
jid = item.getAttr('jid')
|
jid = item.getAttr('jid')
|
||||||
affiliation = item.getAttr('affiliation')
|
affiliation = item.getAttr('affiliation')
|
||||||
list[jid] = {'affiliation': affiliation}
|
users_dict[jid] = {'affiliation': affiliation}
|
||||||
if item.has_attr('nick'):
|
if item.has_attr('nick'):
|
||||||
list[jid]['nick'] = item.getAttr('nick')
|
users_dict[jid]['nick'] = item.getAttr('nick')
|
||||||
if item.has_attr('role'):
|
if item.has_attr('role'):
|
||||||
list[jid]['role'] = item.getAttr('role')
|
users_dict[jid]['role'] = item.getAttr('role')
|
||||||
reason = item.getTagData('reason')
|
reason = item.getTagData('reason')
|
||||||
if reason:
|
if reason:
|
||||||
list[jid]['reason'] = reason
|
users_dict[jid]['reason'] = reason
|
||||||
|
|
||||||
self.dispatch('GC_AFFILIATION', (helpers.get_full_jid_from_iq(iq_obj),
|
self.dispatch('GC_AFFILIATION', (helpers.get_full_jid_from_iq(iq_obj),
|
||||||
list))
|
users_dict))
|
||||||
|
|
||||||
def _MucErrorCB(self, con, iq_obj):
|
def _MucErrorCB(self, con, iq_obj):
|
||||||
gajim.log.debug('MucErrorCB')
|
gajim.log.debug('MucErrorCB')
|
||||||
|
|
|
@ -2361,7 +2361,7 @@ class GroupchatConfigWindow:
|
||||||
self.form = form
|
self.form = form
|
||||||
self.remove_button = {}
|
self.remove_button = {}
|
||||||
self.affiliation_treeview = {}
|
self.affiliation_treeview = {}
|
||||||
self.list_init = {} # list at the beginning
|
self.start_users_dict = {} # list at the beginning
|
||||||
self.affiliation_labels = {'outcast': _('Ban List'),
|
self.affiliation_labels = {'outcast': _('Ban List'),
|
||||||
'member': _('Member List'),
|
'member': _('Member List'),
|
||||||
'owner': _('Owner List'),
|
'owner': _('Owner List'),
|
||||||
|
@ -2387,7 +2387,7 @@ class GroupchatConfigWindow:
|
||||||
add_on_vbox = self.xml.get_widget('add_on_vbox')
|
add_on_vbox = self.xml.get_widget('add_on_vbox')
|
||||||
|
|
||||||
for affiliation in self.affiliation_labels.keys():
|
for affiliation in self.affiliation_labels.keys():
|
||||||
self.list_init[affiliation] = {}
|
self.start_users_dict[affiliation] = {}
|
||||||
hbox = gtk.HBox(spacing = 5)
|
hbox = gtk.HBox(spacing = 5)
|
||||||
add_on_vbox.pack_start(hbox, False)
|
add_on_vbox.pack_start(hbox, False)
|
||||||
|
|
||||||
|
@ -2501,25 +2501,25 @@ class GroupchatConfigWindow:
|
||||||
def on_affiliation_treeview_cursor_changed(self, widget, affiliation):
|
def on_affiliation_treeview_cursor_changed(self, widget, affiliation):
|
||||||
self.remove_button[affiliation].set_sensitive(True)
|
self.remove_button[affiliation].set_sensitive(True)
|
||||||
|
|
||||||
def affiliation_list_received(self, list):
|
def affiliation_list_received(self, users_dict):
|
||||||
'''Fill the affiliation treeview'''
|
'''Fill the affiliation treeview'''
|
||||||
for jid in list:
|
for jid in users_dict:
|
||||||
affiliation = list[jid]['affiliation']
|
affiliation = users_dict[jid]['affiliation']
|
||||||
if affiliation not in self.affiliation_labels.keys():
|
if affiliation not in self.affiliation_labels.keys():
|
||||||
# Unknown affiliation or 'none' affiliation, do not show it
|
# Unknown affiliation or 'none' affiliation, do not show it
|
||||||
continue
|
continue
|
||||||
self.list_init[affiliation][jid] = list[jid]
|
self.start_users_dict[affiliation][jid] = users_dict[jid]
|
||||||
tv = self.affiliation_treeview[affiliation]
|
tv = self.affiliation_treeview[affiliation]
|
||||||
model = tv.get_model()
|
model = tv.get_model()
|
||||||
reason = ''
|
reason = ''
|
||||||
if list[jid].has_key('reason'):
|
if users_dict[jid].has_key('reason'):
|
||||||
reason = list[jid]['reason']
|
reason = users_dict[jid]['reason']
|
||||||
nick = ''
|
nick = ''
|
||||||
if list[jid].has_key('nick'):
|
if users_dict[jid].has_key('nick'):
|
||||||
nick = list[jid]['nick']
|
nick = users_dict[jid]['nick']
|
||||||
role = ''
|
role = ''
|
||||||
if list[jid].has_key('role'):
|
if users_dict[jid].has_key('role'):
|
||||||
role = list[jid]['role']
|
role = users_dict[jid]['role']
|
||||||
model.append((jid, reason, nick, role))
|
model.append((jid, reason, nick, role))
|
||||||
|
|
||||||
def on_data_form_window_destroy(self, widget):
|
def on_data_form_window_destroy(self, widget):
|
||||||
|
@ -2530,7 +2530,7 @@ class GroupchatConfigWindow:
|
||||||
form = self.data_form_widget.data_form
|
form = self.data_form_widget.data_form
|
||||||
gajim.connections[self.account].send_gc_config(self.room_jid, form)
|
gajim.connections[self.account].send_gc_config(self.room_jid, form)
|
||||||
for affiliation in self.affiliation_labels.keys():
|
for affiliation in self.affiliation_labels.keys():
|
||||||
list = {}
|
users_dict = {}
|
||||||
actual_jid_list = []
|
actual_jid_list = []
|
||||||
model = self.affiliation_treeview[affiliation].get_model()
|
model = self.affiliation_treeview[affiliation].get_model()
|
||||||
iter = model.get_iter_first()
|
iter = model.get_iter_first()
|
||||||
|
@ -2538,21 +2538,21 @@ class GroupchatConfigWindow:
|
||||||
while iter:
|
while iter:
|
||||||
jid = model[iter][0].decode('utf-8')
|
jid = model[iter][0].decode('utf-8')
|
||||||
actual_jid_list.append(jid)
|
actual_jid_list.append(jid)
|
||||||
if jid not in self.list_init[affiliation] or \
|
if jid not in self.start_users_dict[affiliation] or \
|
||||||
(affiliation == 'outcast' and self.list_init[affiliation]\
|
(affiliation == 'outcast' and self.start_users_dict[affiliation]\
|
||||||
[jid].has_key('reason') and self.list_init[affiliation][jid]\
|
[jid].has_key('reason') and self.start_users_dict[affiliation][jid]\
|
||||||
['reason'] != model[iter][1].decode('utf-8')):
|
['reason'] != model[iter][1].decode('utf-8')):
|
||||||
list[jid] = {'affiliation': affiliation}
|
users_dict[jid] = {'affiliation': affiliation}
|
||||||
if affiliation == 'outcast':
|
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)
|
iter = model.iter_next(iter)
|
||||||
# remove removed one
|
# 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:
|
if jid not in actual_jid_list:
|
||||||
list[jid] = {'affiliation': 'none'}
|
users_dict[jid] = {'affiliation': 'none'}
|
||||||
if list:
|
if users_dict:
|
||||||
gajim.connections[self.account].send_gc_affiliation_list(
|
gajim.connections[self.account].send_gc_affiliation_list(
|
||||||
self.room_jid, list)
|
self.room_jid, users_dict)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
#---------- RemoveAccountWindow class -------------#
|
#---------- RemoveAccountWindow class -------------#
|
||||||
|
|
|
@ -1373,7 +1373,7 @@ class Interface:
|
||||||
gc_control.print_conversation(change)
|
gc_control.print_conversation(change)
|
||||||
|
|
||||||
def handle_event_gc_affiliation(self, account, array):
|
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]
|
room_jid = array[0]
|
||||||
if self.instances[account]['gc_config'].has_key(room_jid):
|
if self.instances[account]['gc_config'].has_key(room_jid):
|
||||||
self.instances[account]['gc_config'][room_jid].\
|
self.instances[account]['gc_config'][room_jid].\
|
||||||
|
|
Loading…
Reference in New Issue