From 31dc32eeb92a235650e0f2f01c8aa7b5a95f1398 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 3 Dec 2008 17:16:04 +0000
Subject: [PATCH] [thorstenp] fix redefined builtins

---
 src/advanced.py                               |   6 +-
 src/cell_renderer_image.py                    |  12 +-
 src/chat_control.py                           | 199 +++++------
 src/common/caps.py                            |  24 +-
 src/common/config.py                          |  36 +-
 src/common/connection.py                      |  40 +--
 src/common/connection_handlers.py             | 175 +++++-----
 src/common/helpers.py                         |   9 +-
 src/common/logger.py                          |  10 +-
 src/common/pubsub.py                          |  18 +-
 src/common/stanza_session.py                  |   8 +-
 src/common/xmpp/auth.py                       |   4 +-
 src/common/xmpp/auth_nb.py                    |  19 +-
 src/common/xmpp/browser.py                    |   2 +-
 src/common/xmpp/commands.py                   |   6 +-
 src/common/xmpp/dispatcher.py                 |  10 +-
 src/common/xmpp/dispatcher_nb.py              |  10 +-
 src/common/xmpp/features.py                   |  10 +-
 src/common/xmpp/features_nb.py                |  26 +-
 src/common/xmpp/protocol.py                   |   8 +-
 src/common/zeroconf/client_zeroconf.py        |  18 +-
 .../zeroconf/connection_handlers_zeroconf.py  |  30 +-
 src/common/zeroconf/zeroconf_bonjour.py       |   5 +-
 src/config.py                                 | 326 +++++++++---------
 src/conversation_textview.py                  | 326 +++++++++---------
 src/dataforms_widget.py                       |  34 +-
 src/dialogs.py                                | 212 ++++++------
 src/disco.py                                  | 217 ++++++------
 src/features_window.py                        |   8 +-
 src/filetransfers_window.py                   |  58 ++--
 src/gajim-remote.py                           |  51 +--
 src/gajim.py                                  |  31 +-
 src/gajim_themes_window.py                    |  40 +--
 src/groupchat_control.py                      | 229 ++++++------
 src/groups.py                                 |   4 +-
 src/gtkgui_helpers.py                         |  20 +-
 src/htmltextview.py                           |   6 +-
 src/ipython_view.py                           |  20 +-
 src/message_textview.py                       |   6 +-
 src/message_window.py                         |  33 +-
 src/search_window.py                          |  18 +-
 src/tooltips.py                               |  54 +--
 src/vcard.py                                  |  10 +-
 43 files changed, 1186 insertions(+), 1202 deletions(-)

diff --git a/src/advanced.py b/src/advanced.py
index 2ba9d42233..06a4514d6d 100644
--- a/src/advanced.py
+++ b/src/advanced.py
@@ -162,10 +162,10 @@ class AdvancedConfigurationWindow(object):
 		return path
 
 	def on_advanced_treeview_selection_changed(self, treeselection):
-		model, iter = treeselection.get_selected()
+		model, iter_ = treeselection.get_selected()
 		# Check for GtkTreeIter
-		if iter:
-			opt_path = self.get_option_path(model, iter)
+		if iter_:
+			opt_path = self.get_option_path(model, iter_)
 			# Get text from first column in this row
 			desc = None
 			if len(opt_path) == 3:
diff --git a/src/cell_renderer_image.py b/src/cell_renderer_image.py
index 2cdbaca181..c026351f9c 100644
--- a/src/cell_renderer_image.py
+++ b/src/cell_renderer_image.py
@@ -60,13 +60,13 @@ class CellRendererImage(gtk.GenericCellRenderer):
 		if image.get_storage_type() != gtk.IMAGE_ANIMATION:
 			return
 		self.redraw = 0
-		iter = self.iters[image]
-		iter.advance()
+		iter_ = self.iters[image]
+		iter_.advance()
 		model = tree.get_model()
 		if model:
 			model.foreach(self.func, (image, tree))
 		if self.redraw:
-			gobject.timeout_add(iter.get_delay_time(),
+			gobject.timeout_add(iter_.get_delay_time(),
 					self.animation_timeout, tree, image)
 		elif image in self.iters:
 			del self.iters[image]
@@ -92,9 +92,9 @@ class CellRendererImage(gtk.GenericCellRenderer):
 				if not isinstance(widget, gtk.TreeView):
 					return
 				animation = self.image.get_animation()
-				iter =  animation.get_iter()
-				self.iters[self.image] = iter
-				gobject.timeout_add(iter.get_delay_time(),
+				iter_ = animation.get_iter()
+				self.iters[self.image] = iter_
+				gobject.timeout_add(iter_.get_delay_time(),
 					self.animation_timeout, widget, self.image)
 
 			pix = self.iters[self.image].get_pixbuf()
diff --git a/src/chat_control.py b/src/chat_control.py
index dfa8beef50..81ceb09439 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -153,20 +153,20 @@ class ChatControlBase(MessageControl):
 			contact, acct, resource = resource)
 
 		widget = self.xml.get_widget('history_button')
-		id = widget.connect('clicked', self._on_history_menuitem_activate)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self._on_history_menuitem_activate)
+		self.handlers[id_] = widget
 
 		# when/if we do XHTML we will put formatting buttons back
 		widget = self.xml.get_widget('emoticons_button')
-		id = widget.connect('clicked', self.on_emoticons_button_clicked)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self.on_emoticons_button_clicked)
+		self.handlers[id_] = widget
 
 		# Create banner and connect signals
 		widget = self.xml.get_widget('banner_eventbox')
 		widget.set_property('height-request', gajim.config.get('chat_avatar_height'))
-		id = widget.connect('button-press-event',
+		id_ = widget.connect('button-press-event',
 			self._on_banner_eventbox_button_press_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
 		self.urlfinder = re.compile(r"(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'\"]+[^!,\.\s<>\)'\"\]]")
 
@@ -187,9 +187,9 @@ class ChatControlBase(MessageControl):
 		self.TARGET_TYPE_URI_LIST = 80
 		self.dnd_list = [ ( 'text/uri-list', 0, self.TARGET_TYPE_URI_LIST ),
 				('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP, 0)]
-		id = self.widget.connect('drag_data_received',
+		id_ = self.widget.connect('drag_data_received',
 			self._on_drag_data_received)
-		self.handlers[id] = self.widget
+		self.handlers[id_] = self.widget
 		self.widget.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
 			gtk.DEST_DEFAULT_HIGHLIGHT |
 			gtk.DEST_DEFAULT_DROP,
@@ -197,18 +197,18 @@ class ChatControlBase(MessageControl):
 
 		# Create textviews and connect signals
 		self.conv_textview = ConversationTextview(self.account)
-		id = self.conv_textview.tv.connect('key_press_event',
+		id_ = self.conv_textview.tv.connect('key_press_event',
 			self._conv_textview_key_press_event)
-		self.handlers[id] = self.conv_textview.tv
+		self.handlers[id_] = self.conv_textview.tv
 		# FIXME: DND on non editable TextView, find a better way
 		self.drag_entered = False
-		id = self.conv_textview.tv.connect('drag_data_received',
+		id_ = self.conv_textview.tv.connect('drag_data_received',
 			self._on_drag_data_received)
-		self.handlers[id] = self.conv_textview.tv
-		id = self.conv_textview.tv.connect('drag_motion', self._on_drag_motion)
-		self.handlers[id] = self.conv_textview.tv
-		id = self.conv_textview.tv.connect('drag_leave', self._on_drag_leave)
-		self.handlers[id] = self.conv_textview.tv
+		self.handlers[id_] = self.conv_textview.tv
+		id_ = self.conv_textview.tv.connect('drag_motion', self._on_drag_motion)
+		self.handlers[id_] = self.conv_textview.tv
+		id_ = self.conv_textview.tv.connect('drag_leave', self._on_drag_leave)
+		self.handlers[id_] = self.conv_textview.tv
 		self.conv_textview.tv.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
 			gtk.DEST_DEFAULT_HIGHLIGHT |
 			gtk.DEST_DEFAULT_DROP,
@@ -218,34 +218,34 @@ class ChatControlBase(MessageControl):
 			'conversation_scrolledwindow')
 		self.conv_scrolledwindow.add(self.conv_textview.tv)
 		widget = self.conv_scrolledwindow.get_vadjustment()
-		id = widget.connect('value-changed',
+		id_ = widget.connect('value-changed',
 			self.on_conversation_vadjustment_value_changed)
-		self.handlers[id] = widget
-		id = widget.connect('changed',
+		self.handlers[id_] = widget
+		id_ = widget.connect('changed',
 			self.on_conversation_vadjustment_changed)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 		self.scroll_to_end_id = None
 		self.was_at_the_end = True
 
 		# add MessageTextView to UI and connect signals
 		self.msg_scrolledwindow = self.xml.get_widget('message_scrolledwindow')
 		self.msg_textview = MessageTextView()
-		id = self.msg_textview.connect('mykeypress',
+		id_ = self.msg_textview.connect('mykeypress',
 			self._on_message_textview_mykeypress_event)
-		self.handlers[id] = self.msg_textview
+		self.handlers[id_] = self.msg_textview
 		self.msg_scrolledwindow.add(self.msg_textview)
-		id = self.msg_textview.connect('key_press_event',
+		id_ = self.msg_textview.connect('key_press_event',
 			self._on_message_textview_key_press_event)
-		self.handlers[id] = self.msg_textview
-		id = self.msg_textview.connect('size-request', self.size_request)
-		self.handlers[id] = self.msg_textview
-		id = self.msg_textview.connect('populate_popup',
+		self.handlers[id_] = self.msg_textview
+		id_ = self.msg_textview.connect('size-request', self.size_request)
+		self.handlers[id_] = self.msg_textview
+		id_ = self.msg_textview.connect('populate_popup',
 			self.on_msg_textview_populate_popup)
-		self.handlers[id] = self.msg_textview
+		self.handlers[id_] = self.msg_textview
 		# Setup DND
-		id = self.msg_textview.connect('drag_data_received',
+		id_ = self.msg_textview.connect('drag_data_received',
 			self._on_drag_data_received)
-		self.handlers[id] = self.msg_textview
+		self.handlers[id_] = self.msg_textview
 		self.msg_textview.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
 			gtk.DEST_DEFAULT_HIGHLIGHT,
 			self.dnd_list, gtk.gdk.ACTION_COPY)
@@ -254,12 +254,12 @@ class ChatControlBase(MessageControl):
 
 		# Hook up send button
 		widget = self.xml.get_widget('send_button')
-		id = widget.connect('clicked', self._on_send_button_clicked)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self._on_send_button_clicked)
+		self.handlers[id_] = widget
 
 		widget = self.xml.get_widget('formattings_button')
-		id = widget.connect('clicked', self.on_formattings_button_clicked)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self.on_formattings_button_clicked)
+		self.handlers[id_] = widget
 
 		# the following vars are used to keep history of user's messages
 		self.sent_history = []
@@ -328,8 +328,8 @@ class ChatControlBase(MessageControl):
 
 		item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
 		menu.prepend(item)
-		id = item.connect('activate', self.msg_textview.clear)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.msg_textview.clear)
+		self.handlers[id_] = item
 
 		if gajim.config.get('use_speller') and HAS_GTK_SPELL:
 			item = gtk.MenuItem(_('Spelling language'))
@@ -341,8 +341,8 @@ class ChatControlBase(MessageControl):
 				if langs[lang] == self.msg_textview.lang:
 					item.set_active(True)
 				submenu.append(item)
-				id = item.connect('activate', _on_select_dictionary, langs[lang])
-				self.handlers[id] = item
+				id_ = item.connect('activate', _on_select_dictionary, langs[lang])
+				self.handlers[id_] = item
 
 		menu.show_all()
 
@@ -401,18 +401,18 @@ class ChatControlBase(MessageControl):
 	def disconnect_style_event(self, widget):
 		# Try to find the event_id
 		found = False
-		for id in self.handlers:
-			if self.handlers[id] == widget:
+		for id_ in self.handlers:
+			if self.handlers[id_] == widget:
 				found = True
 				break
 		if found:
-			widget.disconnect(id)
-			del self.handlers[id]
+			widget.disconnect(id_)
+			del self.handlers[id_]
 
 	def connect_style_event(self, widget, set_fg = False, set_bg = False):
 		self.disconnect_style_event(widget)
-		id = widget.connect('style-set', self._on_style_set_event, set_fg, set_bg)
-		self.handlers[id] = widget
+		id_ = widget.connect('style-set', self._on_style_set_event, set_fg, set_bg)
+		self.handlers[id_] = widget
 
 	def _on_style_set_event(self, widget, style, *opts):
 		'''set style of widget from style class *.Frame.Eventbox
@@ -731,11 +731,11 @@ class ChatControlBase(MessageControl):
 			emoticons_button.set_no_show_all(True)
 
 	def append_emoticon(self, str_):
-		buffer = self.msg_textview.get_buffer()
-		if buffer.get_char_count():
-			buffer.insert_at_cursor(' %s ' % str_)
+		buffer_ = self.msg_textview.get_buffer()
+		if buffer_.get_char_count():
+			buffer_.insert_at_cursor(' %s ' % str_)
 		else: # we are the beginning of buffer
-			buffer.insert_at_cursor('%s ' % str_)
+			buffer_.insert_at_cursor('%s ' % str_)
 		self.msg_textview.grab_focus()
 
 	def on_emoticons_button_clicked(self, widget):
@@ -821,9 +821,9 @@ class ChatControlBase(MessageControl):
 		self.conv_textview.update_tags()
 
 	def clear(self, tv):
-		buffer = tv.get_buffer()
-		start, end = buffer.get_bounds()
-		buffer.delete(start, end)
+		buffer_ = tv.get_buffer()
+		start, end = buffer_.get_bounds()
+		buffer_.delete(start, end)
 
 	def _on_history_menuitem_activate(self, widget = None, jid = None):
 		'''When history menuitem is pressed: call history window'''
@@ -872,8 +872,8 @@ class ChatControlBase(MessageControl):
 		if self.scroll_to_end_id:
 			# a scroll is already planned
 			return
-		buffer = textview.get_buffer()
-		end_iter = buffer.get_end_iter()
+		buffer_ = textview.get_buffer()
+		end_iter = buffer_.get_end_iter()
 		end_rect = textview.get_iter_location(end_iter)
 		visible_rect = textview.get_visible_rect()
 		# scroll only if expected end is not visible
@@ -882,8 +882,8 @@ class ChatControlBase(MessageControl):
 				textview)
 
 	def scroll_to_end_iter(self, textview):
-		buffer = textview.get_buffer()
-		end_iter = buffer.get_end_iter()
+		buffer_ = textview.get_buffer()
+		end_iter = buffer_.get_end_iter()
 		textview.scroll_to_iter(end_iter, 0, False, 1, 1)
 		self.scroll_to_end_id = None
 		return False
@@ -1081,16 +1081,17 @@ class ChatControl(ChatControlBase):
 		# for muc use:
 		# widget = self.xml.get_widget('muc_window_actions_button')
 		self.actions_button = self.xml.get_widget('message_window_actions_button')
-		id = self.actions_button.connect('clicked', self.on_actions_button_clicked)
-		self.handlers[id] = self.actions_button
+		id_ = self.actions_button.connect('clicked',
+			self.on_actions_button_clicked)
+		self.handlers[id_] = self.actions_button
 
 		self._formattings_button = self.xml.get_widget('formattings_button')
 
 		self._add_to_roster_button = self.xml.get_widget(
 			'add_to_roster_button')
-		id = self._add_to_roster_button.connect('clicked',
+		id_ = self._add_to_roster_button.connect('clicked',
 			self._on_add_to_roster_menuitem_activate)
-		self.handlers[id] = self._add_to_roster_button
+		self.handlers[id_] = self._add_to_roster_button
 
 		self._send_file_button = self.xml.get_widget('send_file_button')
 		# add a special img for send file button
@@ -1098,21 +1099,21 @@ class ChatControl(ChatControlBase):
 		img = gtk.Image()
 		img.set_from_file(path_to_upload_img)
 		self._send_file_button.set_image(img)
-		id = self._send_file_button.connect('clicked',
+		id_ = self._send_file_button.connect('clicked',
 			self._on_send_file_menuitem_activate)
-		self.handlers[id] = self._send_file_button
+		self.handlers[id_] = self._send_file_button
 
 		self._convert_to_gc_button = self.xml.get_widget(
 			'convert_to_gc_button')
-		id = self._convert_to_gc_button.connect('clicked',
+		id_ = self._convert_to_gc_button.connect('clicked',
 			self._on_convert_to_gc_menuitem_activate)
-		self.handlers[id] = self._convert_to_gc_button
+		self.handlers[id_] = self._convert_to_gc_button
 
 		contact_information_button = self.xml.get_widget(
 			'contact_information_button')
-		id = contact_information_button.connect('clicked',
+		id_ = contact_information_button.connect('clicked',
 			self._on_contact_information_menuitem_activate)
-		self.handlers[id] = contact_information_button
+		self.handlers[id_] = contact_information_button
 
 		compact_view = gajim.config.get('compact_view')
 		self.chat_buttons_set_visible(compact_view)
@@ -1121,9 +1122,9 @@ class ChatControl(ChatControlBase):
 
 		self.authentication_button = self.xml.get_widget(
 			'authentication_button')
-		id = self.authentication_button.connect('clicked',
+		id_ = self.authentication_button.connect('clicked',
 			self._on_authentication_button_clicked)
-		self.handlers[id] = self.authentication_button
+		self.handlers[id_] = self.authentication_button
 
 		# Add lock image to show chat encryption
 		self.lock_image = self.xml.get_widget('lock_image')
@@ -1161,26 +1162,26 @@ class ChatControl(ChatControlBase):
 		self._schedule_activity_timers()
 
 		# Hook up signals
-		id = self.parent_win.window.connect('motion-notify-event',
+		id_ = self.parent_win.window.connect('motion-notify-event',
 			self._on_window_motion_notify)
-		self.handlers[id] = self.parent_win.window
+		self.handlers[id_] = self.parent_win.window
 		message_tv_buffer = self.msg_textview.get_buffer()
-		id = message_tv_buffer.connect('changed',
+		id_ = message_tv_buffer.connect('changed',
 			self._on_message_tv_buffer_changed)
-		self.handlers[id] = message_tv_buffer
+		self.handlers[id_] = message_tv_buffer
 
 		widget = self.xml.get_widget('avatar_eventbox')
-		id = widget.connect('enter-notify-event',
+		id_ = widget.connect('enter-notify-event',
 			self.on_avatar_eventbox_enter_notify_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('leave-notify-event',
+		id_ = widget.connect('leave-notify-event',
 			self.on_avatar_eventbox_leave_notify_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('button-press-event',
+		id_ = widget.connect('button-press-event',
 			self.on_avatar_eventbox_button_press_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
 		if not session:
 			session = gajim.connections[self.account]. \
@@ -1429,11 +1430,11 @@ class ChatControl(ChatControlBase):
 		if event.button == 3: # right click
 			menu = gtk.Menu()
 			menuitem = gtk.ImageMenuItem(gtk.STOCK_SAVE_AS)
-			id = menuitem.connect('activate',
+			id_ = menuitem.connect('activate',
 				gtkgui_helpers.on_avatar_save_as_menuitem_activate,
 				self.contact.jid, self.account, self.contact.get_shown_name() + \
 					'.jpeg')
-			self.handlers[id] = menuitem
+			self.handlers[id_] = menuitem
 			menu.append(menuitem)
 			menu.show_all()
 			menu.connect('selection-done', lambda w:w.destroy())
@@ -1797,17 +1798,17 @@ class ChatControl(ChatControlBase):
 				gobject.source_remove(self.possible_inactive_timeout_id)
 				self._schedule_activity_timers()
 
-		id = ChatControlBase.send_message(self, message, keyID,
+		id_ = ChatControlBase.send_message(self, message, keyID,
 			type_ = 'chat', chatstate = chatstate_to_send,
 			composing_xep = composing_xep,
 			process_command = process_command, xhtml = xhtml)
-		if id:
+		if id_:
 			# XXX: Once we have fallback to disco, remove notexistant check
 			if gajim.capscache.is_supported(contact, NS_RECEIPTS) \
 			and not gajim.capscache.is_supported(contact,
 			'notexistant') and gajim.config.get_per('accounts',
 			self.account, 'request_receipt'):
-				xep0184_id = id
+				xep0184_id = id_
 			else:
 				xep0184_id = None
 
@@ -2124,27 +2125,27 @@ class ChatControl(ChatControlBase):
 			convert_to_gc_menuitem.set_sensitive(False)
 
 		# connect signals
-		id = history_menuitem.connect('activate',
+		id_ = history_menuitem.connect('activate',
 			self._on_history_menuitem_activate)
-		self.handlers[id] = history_menuitem
-		id = send_file_menuitem.connect('activate',
+		self.handlers[id_] = history_menuitem
+		id_ = send_file_menuitem.connect('activate',
 			self._on_send_file_menuitem_activate)
-		self.handlers[id] = send_file_menuitem
-		id = add_to_roster_menuitem.connect('activate',
+		self.handlers[id_] = send_file_menuitem
+		id_ = add_to_roster_menuitem.connect('activate',
 			self._on_add_to_roster_menuitem_activate)
-		self.handlers[id] = add_to_roster_menuitem
-		id = toggle_gpg_menuitem.connect('activate',
+		self.handlers[id_] = add_to_roster_menuitem
+		id_ = toggle_gpg_menuitem.connect('activate',
 			self._on_toggle_gpg_menuitem_activate)
-		self.handlers[id] = toggle_gpg_menuitem
-		id = toggle_e2e_menuitem.connect('activate',
+		self.handlers[id_] = toggle_gpg_menuitem
+		id_ = toggle_e2e_menuitem.connect('activate',
 			self._on_toggle_e2e_menuitem_activate)
-		self.handlers[id] = toggle_e2e_menuitem
-		id = information_menuitem.connect('activate',
+		self.handlers[id_] = toggle_e2e_menuitem
+		id_ = information_menuitem.connect('activate',
 			self._on_contact_information_menuitem_activate)
-		self.handlers[id] = information_menuitem
-		id = convert_to_gc_menuitem.connect('activate',
+		self.handlers[id_] = information_menuitem
+		id_ = convert_to_gc_menuitem.connect('activate',
 			self._on_convert_to_gc_menuitem_activate)
-		self.handlers[id] = convert_to_gc_menuitem
+		self.handlers[id_] = convert_to_gc_menuitem
 
 		menu.connect('selection-done', self.destroy_menu,
 			send_file_menuitem, convert_to_gc_menuitem,
@@ -2383,9 +2384,9 @@ class ChatControl(ChatControlBase):
 		model = treeview.get_model()
 		data = selection.data
 		path = treeview.get_selection().get_selected_rows()[1][0]
-		iter = model.get_iter(path)
-		type = model[iter][2]
-		if type != 'contact': # source is not a contact
+		iter_ = model.get_iter(path)
+		type_ = model[iter_][2]
+		if type_ != 'contact': # source is not a contact
 			return
 		dropped_jid = data.decode('utf-8')
 
diff --git a/src/common/caps.py b/src/common/caps.py
index d4ef634d08..0d955e2243 100644
--- a/src/common/caps.py
+++ b/src/common/caps.py
@@ -103,6 +103,7 @@ class CapsCache(object):
 
 			def _get_features(ciself):
 				return ciself._features
+
 			def _set_features(ciself, value):
 				ciself._features = []
 				for feature in value:
@@ -128,7 +129,8 @@ class CapsCache(object):
 				ciself._identities = []
 				for identity in value:
 					# dict are not hashable, so transform it into a tuple
-					t = (identity['category'], identity.get('type'), identity.get('xml:lang'), identity.get('name'))
+					t = (identity['category'], identity.get('type'),
+						identity.get('xml:lang'), identity.get('name'))
 					ciself._identities.append(ciself.__names.setdefault(t, t))
 			identities = property(_get_identities, _set_identities)
 
@@ -155,9 +157,9 @@ class CapsCache(object):
 	def load_from_db(self):
 		# get data from logger...
 		if self.logger is not None:
-			for hash_method, hash, identities, features in \
+			for hash_method, hash_, identities, features in \
 			self.logger.iter_caps_data():
-				x = self[(hash_method, hash)]
+				x = self[(hash_method, hash_)]
 				x.identities = identities
 				x.features = features
 				x.queried = 2
@@ -166,10 +168,10 @@ class CapsCache(object):
 		if caps in self.__cache:
 			return self.__cache[caps]
 
-		hash_method, hash = caps
+		hash_method, hash_ = caps
 
-		x = self.__CacheItem(hash_method, hash)
-		self.__cache[(hash_method, hash)] = x
+		x = self.__CacheItem(hash_method, hash_)
+		self.__cache[(hash_method, hash_)] = x
 		return x
 
 	def preload(self, con, jid, node, hash_method, hash_):
@@ -247,13 +249,13 @@ class ConnectionCaps(object):
 			contact.caps_hash_method = None
 			return
 
-		hash_method, node, hash = caps['hash'], caps['node'], caps['ver']
+		hash_method, node, hash_ = caps['hash'], caps['node'], caps['ver']
 
-		if hash_method is None and node and hash:
+		if hash_method is None and node and hash_:
 			# Old XEP-115 implentation
 			hash_method = 'old'
 
-		if hash_method is None or node is None or hash is None:
+		if hash_method is None or node is None or hash_ is None:
 			# improper caps in stanza, ignoring
 			contact.caps_node = None
 			contact.caps_hash = None
@@ -261,12 +263,12 @@ class ConnectionCaps(object):
 			return
 
 		# start disco query...
-		gajim.capscache.preload(self, jid, node, hash_method, hash)
+		gajim.capscache.preload(self, jid, node, hash_method, hash_)
 
 		# overwriting old data
 		contact.caps_node = node
 		contact.caps_hash_method = hash_method
-		contact.caps_hash = hash
+		contact.caps_hash = hash_
 		if pm_ctrl:
 			pm_ctrl.update_contact()
 
diff --git a/src/common/config.py b/src/common/config.py
index 1b6fd7cb07..95e5fa7631 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -475,11 +475,11 @@ class Config:
 			cb(data, opt, None, self.__options[opt])
 		for opt in self.__options_per_key:
 			cb(data, opt, None, None)
-			dict = self.__options_per_key[opt][1]
-			for opt2 in dict.keys():
+			dict_ = self.__options_per_key[opt][1]
+			for opt2 in dict_.keys():
 				cb(data, opt2, [opt], None)
-				for opt3 in dict[opt2]:
-					cb(data, opt3, [opt, opt2], dict[opt2][opt3])
+				for opt3 in dict_[opt2]:
+					cb(data, opt3, [opt, opt2], dict_[opt2][opt3])
 
 	def get_children(self, node=None):
 		''' Tree-like interface '''
@@ -599,11 +599,11 @@ class Config:
 			return
 		if not key:
 			return
-		dict = self.__options_per_key[optname][1]
-		if key not in dict:
-#			raise RuntimeError, '%s is not a key of %s' % (key, dict)
+		dict_ = self.__options_per_key[optname][1]
+		if key not in dict_:
+#			raise RuntimeError, '%s is not a key of %s' % (key, dict_)
 			self.add_per(optname, key)
-		obj = dict[key]
+		obj = dict_[key]
 		if subname not in obj:
 #			raise RuntimeError, '%s is not a key of %s' % (subname, obj)
 			return
@@ -617,16 +617,16 @@ class Config:
 	def get_per(self, optname, key = None, subname = None): # per_group_of_option
 		if optname not in self.__options_per_key:
 			return None
-		dict = self.__options_per_key[optname][1]
+		dict_ = self.__options_per_key[optname][1]
 		if not key:
-			return dict.keys()
-		if key not in dict:
+			return dict_.keys()
+		if key not in dict_:
 			if optname in self.__options_per_key \
 			and subname in self.__options_per_key[optname][0]:
 				return self.__options_per_key \
 					[optname][0][subname][1]
 			return None
-		obj = dict[key]
+		obj = dict_[key]
 		if not subname:
 			return obj
 		if subname not in obj:
@@ -636,12 +636,12 @@ class Config:
 	def get_desc_per(self, optname, key = None, subname = None):
 		if optname not in self.__options_per_key:
 			return None
-		dict = self.__options_per_key[optname][1]
+		dict_ = self.__options_per_key[optname][1]
 		if not key:
 			return None
-		if key not in dict:
+		if key not in dict_:
 			return None
-		obj = dict[key]
+		obj = dict_[key]
 		if not subname:
 			return None
 		if subname not in obj:
@@ -653,12 +653,12 @@ class Config:
 	def get_restart_per(self, optname, key = None, subname = None):
 		if optname not in self.__options_per_key:
 			return False
-		dict = self.__options_per_key[optname][1]
+		dict_ = self.__options_per_key[optname][1]
 		if not key:
 			return False
-		if key not in dict:
+		if key not in dict_:
 			return False
-		obj = dict[key]
+		obj = dict_[key]
 		if not subname:
 			return False
 		if subname not in obj:
diff --git a/src/common/connection.py b/src/common/connection.py
index a3b459629a..94a2da3778 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -759,16 +759,16 @@ class Connection(ConnectionHandlers):
 		to server to detect connection failure at application level.'''
 		if not self.connection:
 			return
-		id = self.connection.getAnID()
+		id_ = self.connection.getAnID()
 		if pingTo:
 			to = pingTo.get_full_jid()
 			self.dispatch('PING_SENT', (pingTo))
 		else:
 			to = gajim.config.get_per('accounts', self.name, 'hostname')
-			self.awaiting_xmpp_ping_id = id
+			self.awaiting_xmpp_ping_id = id_
 		iq = common.xmpp.Iq('get', to=to)
 		iq.addChild(name = 'ping', namespace = common.xmpp.NS_PING)
-		iq.setID(id)
+		iq.setID(id_)
 		def _on_response(resp):
 			timePong = time_time()
 			if not common.xmpp.isResultNode(resp):
@@ -945,9 +945,9 @@ class Connection(ConnectionHandlers):
 		self.connection.set_send_timeout(self.keepalives, self.sendPing)
 		self.connection.onreceive(None)
 		iq = common.xmpp.Iq('get', common.xmpp.NS_PRIVACY, xmlns = '')
-		id = self.connection.getAnID()
-		iq.setID(id)
-		self.awaiting_answers[id] = (PRIVACY_ARRIVED, )
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
+		self.awaiting_answers[id_] = (PRIVACY_ARRIVED, )
 		self.connection.send(iq)
 
 	def send_custom_status(self, show, msg, jid):
@@ -1299,9 +1299,9 @@ class Connection(ConnectionHandlers):
 			return
 		iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent)
 		iq.getTag('query').setTag('remove')
-		id = self.connection.getAnID()
-		iq.setID(id)
-		self.awaiting_answers[id] = (AGENT_REMOVED, agent)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
+		self.awaiting_answers[id_] = (AGENT_REMOVED, agent)
 		self.connection.send(iq)
 		self.connection.getRoster().delItem(agent)
 
@@ -1364,11 +1364,11 @@ class Connection(ConnectionHandlers):
 			to_whom_jid += '/' + resource
 		iq = common.xmpp.Iq(to = to_whom_jid, typ = 'get', queryNS =\
 			common.xmpp.NS_LAST)
-		id = self.connection.getAnID()
-		iq.setID(id)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
 		if groupchat_jid:
-			self.groupchat_jids[id] = groupchat_jid
-		self.last_ids.append(id)
+			self.groupchat_jids[id_] = groupchat_jid
+		self.last_ids.append(id_)
 		self.connection.send(iq)
 
 	def request_os_info(self, jid, resource, groupchat_jid=None):
@@ -1385,11 +1385,11 @@ class Connection(ConnectionHandlers):
 			to_whom_jid += '/' + resource
 		iq = common.xmpp.Iq(to = to_whom_jid, typ = 'get', queryNS =\
 			common.xmpp.NS_VERSION)
-		id = self.connection.getAnID()
-		iq.setID(id)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
 		if groupchat_jid:
-			self.groupchat_jids[id] = groupchat_jid
-		self.version_ids.append(id)
+			self.groupchat_jids[id_] = groupchat_jid
+		self.version_ids.append(id_)
 		self.connection.send(iq)
 
 	def get_settings(self):
@@ -1467,9 +1467,9 @@ class Connection(ConnectionHandlers):
 		iq = common.xmpp.Iq(typ='get')
 		iq2 = iq.addChild(name='query', namespace=common.xmpp.NS_PRIVATE)
 		iq2.addChild(name='storage', namespace='storage:metacontacts')
-		id = self.connection.getAnID()
-		iq.setID(id)
-		self.awaiting_answers[id] = (METACONTACTS_ARRIVED, )
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
+		self.awaiting_answers[id_] = (METACONTACTS_ARRIVED, )
 		self.connection.send(iq)
 
 	def store_metacontacts(self, tags_list):
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index 6bae049d51..b066cefd15 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -375,15 +375,15 @@ class ConnectionBytestream:
 	# register xmpppy handlers for bytestream and FT stanzas
 	def _bytestreamErrorCB(self, con, iq_obj):
 		gajim.log.debug('_bytestreamErrorCB')
-		id = unicode(iq_obj.getAttr('id'))
+		id_ = unicode(iq_obj.getAttr('id'))
 		frm = helpers.get_full_jid_from_iq(iq_obj)
 		query = iq_obj.getTag('query')
 		gajim.proxy65_manager.error_cb(frm, query)
 		jid = helpers.get_jid_from_iq(iq_obj)
-		id = id[3:]
-		if id not in self.files_props:
+		id_ = id_[3:]
+		if id_ not in self.files_props:
 			return
-		file_props = self.files_props[id]
+		file_props = self.files_props[id_]
 		file_props['error'] = -4
 		self.dispatch('FILE_REQUEST_ERROR', (jid, file_props, ''))
 		raise common.xmpp.NodeProcessed
@@ -391,7 +391,7 @@ class ConnectionBytestream:
 	def _bytestreamSetCB(self, con, iq_obj):
 		gajim.log.debug('_bytestreamSetCB')
 		target = unicode(iq_obj.getAttr('to'))
-		id = unicode(iq_obj.getAttr('id'))
+		id_ = unicode(iq_obj.getAttr('id'))
 		query = iq_obj.getTag('query')
 		sid = unicode(query.getAttr('sid'))
 		file_props = gajim.socks5queue.get_file_props(
@@ -402,7 +402,7 @@ class ConnectionBytestream:
 				host_dict={
 					'state': 0,
 					'target': target,
-					'id': id,
+					'id': id_,
 					'sid': sid,
 					'initiator': helpers.get_full_jid_from_iq(iq_obj)
 				}
@@ -443,9 +443,9 @@ class ConnectionBytestream:
 		if not real_id.startswith('au_'):
 			return
 		frm = helpers.get_full_jid_from_iq(iq_obj)
-		id = real_id[3:]
-		if id in self.files_props:
-			file_props = self.files_props[id]
+		id_ = real_id[3:]
+		if id_ in self.files_props:
+			file_props = self.files_props[id_]
 			if file_props['streamhost-used']:
 				for host in file_props['proxyhosts']:
 					if host['initiator'] == frm and 'idx' in host:
@@ -463,17 +463,16 @@ class ConnectionBytestream:
 			streamhost = query.getTag('streamhost-used')
 		except Exception: # this bytestream result is not what we need
 			pass
-		id = real_id[3:]
-		if id in self.files_props:
-			file_props = self.files_props[id]
+		id_ = real_id[3:]
+		if id_ in self.files_props:
+			file_props = self.files_props[id_]
 		else:
 			raise common.xmpp.NodeProcessed
 		if streamhost is None:
 			# proxy approves the activate query
 			if real_id.startswith('au_'):
-				id = real_id[3:]
 				if 'streamhost-used' not in file_props or \
-					file_props['streamhost-used'] is False:
+				file_props['streamhost-used'] is False:
 					raise common.xmpp.NodeProcessed
 				if 'proxyhosts' not in file_props:
 					raise common.xmpp.NodeProcessed
@@ -507,7 +506,8 @@ class ConnectionBytestream:
 				file_props['streamhosts'] = []
 			file_props['streamhosts'].append(proxy)
 			file_props['is_a_proxy'] = True
-			receiver = socks5.Socks5Receiver(gajim.idlequeue, proxy, file_props['sid'], file_props)
+			receiver = socks5.Socks5Receiver(gajim.idlequeue, proxy,
+				file_props['sid'], file_props)
 			gajim.socks5queue.add_receiver(self.name, receiver)
 			proxy['idx'] = receiver.queue_idx
 			gajim.socks5queue.on_success = self._proxy_auth_ok
@@ -528,11 +528,11 @@ class ConnectionBytestream:
 
 	def _siResultCB(self, con, iq_obj):
 		gajim.log.debug('_siResultCB')
-		id = iq_obj.getAttr('id')
-		if id not in self.files_props:
+		id_ = iq_obj.getAttr('id')
+		if id_ not in self.files_props:
 			# no such jid
 			return
-		file_props = self.files_props[id]
+		file_props = self.files_props[id_]
 		if file_props is None:
 			# file properties for jid is none
 			return
@@ -602,11 +602,11 @@ class ConnectionBytestream:
 		profile = si.getAttr('profile')
 		if profile != common.xmpp.NS_FILE:
 			return
-		id = iq_obj.getAttr('id')
-		if id not in self.files_props:
+		id_ = iq_obj.getAttr('id')
+		if id_ not in self.files_props:
 			# no such jid
 			return
-		file_props = self.files_props[id]
+		file_props = self.files_props[id_]
 		if file_props is None:
 			# file properties for jid is none
 			return
@@ -632,10 +632,10 @@ class ConnectionDisco:
 		if not self.connection or self.connected < 2:
 			return None
 		iq=common.xmpp.Iq('get', common.xmpp.NS_REGISTER, to=agent)
-		id = self.connection.getAnID()
-		iq.setID(id)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
 		# Wait the answer during 30 secondes
-		self.awaiting_timeouts[gajim.idlequeue.current_time() + 30] = (id,
+		self.awaiting_timeouts[gajim.idlequeue.current_time() + 30] = (id_,
 			_('Registration information for transport %s has not arrived in time') % \
 			agent)
 		self.connection.SendAndCallForResponse(iq, self._ReceivedRegInfo,
@@ -659,8 +659,8 @@ class ConnectionDisco:
 			return
 		iq = common.xmpp.Iq(typ = 'get', to = jid, queryNS = ns)
 		if id_prefix:
-			id = self.connection.getAnID()
-			iq.setID('%s%s' % (id_prefix, id))
+			id_ = self.connection.getAnID()
+			iq.setID('%s%s' % (id_prefix, id_))
 		if node:
 			iq.setQuerynode(node)
 		self.connection.send(iq)
@@ -675,10 +675,10 @@ class ConnectionDisco:
 			return
 		frm = helpers.get_full_jid_from_iq(iq_obj)
 		to = unicode(iq_obj.getAttr('to'))
-		id = unicode(iq_obj.getAttr('id'))
+		id_ = unicode(iq_obj.getAttr('id'))
 		iq = common.xmpp.Iq(to = frm, typ = 'result', queryNS =\
 			common.xmpp.NS_DISCO, frm = to)
-		iq.setAttr('id', id)
+		iq.setAttr('id', id_)
 		query = iq.setTag('query')
 		query.setAttr('node','http://gajim.org#' + gajim.version.split('-',
 			1)[0])
@@ -724,8 +724,8 @@ class ConnectionDisco:
 		jid = helpers.get_full_jid_from_iq(iq_obj)
 		hostname = gajim.config.get_per('accounts', self.name,
 													'hostname')
-		id = iq_obj.getID()
-		if jid == hostname and id[0] == 'p':
+		id_ = iq_obj.getID()
+		if jid == hostname and id_[0] == 'p':
 			for item in items:
 				self.discoverInfo(item['jid'], id_prefix='p')
 		else:
@@ -758,8 +758,8 @@ class ConnectionDisco:
 		if self.commandInfoQuery(con, iq_obj):
 			raise common.xmpp.NodeProcessed
 
-		id = unicode(iq_obj.getAttr('id'))
-		if id[0] == 'p':
+		id_ = unicode(iq_obj.getAttr('id'))
+		if id_[0] == 'p':
 			# We get this request from echo.server
 			raise common.xmpp.NodeProcessed
 
@@ -822,11 +822,11 @@ class ConnectionDisco:
 		if transport_type and jid not in gajim.transport_type:
 			gajim.transport_type[jid] = transport_type
 			gajim.logger.save_transport_type(jid, transport_type)
-		id = iq_obj.getID()
+		id_ = iq_obj.getID()
 		if not identities: # ejabberd doesn't send identities when we browse online users
 		#FIXME: see http://www.jabber.ru/bugzilla/show_bug.cgi?id=225
 			identities = [{'category': 'server', 'type': 'im', 'name': node}]
-		if id[0] == 'p':
+		if id_[0] == 'p':
 			if jid == gajim.config.get_per('accounts', self.name, 'hostname'):
 				if features.__contains__(common.xmpp.NS_GMAILNOTIFY):
 					gajim.gmail_domains.append(jid)
@@ -884,23 +884,22 @@ class ConnectionVcard:
 		return p
 
 	def node_to_dict(self, node):
-		dict = {}
+		dict_ = {}
 		for info in node.getChildren():
 			name = info.getName()
 			if name in ('ADR', 'TEL', 'EMAIL'): # we can have several
-				if name not in dict:
-					dict[name] = []
+				dict_.setdefault(name, [])
 				entry = {}
 				for c in info.getChildren():
 					entry[c.getName()] = c.getData()
-				dict[name].append(entry)
+				dict_[name].append(entry)
 			elif info.getChildren() == []:
-				dict[name] = info.getData()
+				dict_[name] = info.getData()
 			else:
-				dict[name] = {}
+				dict_[name] = {}
 				for c in info.getChildren():
-					dict[name][c.getName()] = c.getData()
-		return dict
+					dict_[name][c.getName()] = c.getData()
+		return dict_
 
 	def save_vcard_to_hd(self, full_jid, card):
 		jid, nick = gajim.get_room_and_nick_from_fjid(full_jid)
@@ -974,17 +973,17 @@ class ConnectionVcard:
 			iq.setTo(jid)
 		iq.setTag(common.xmpp.NS_VCARD + ' vCard')
 
-		id = self.connection.getAnID()
-		iq.setID(id)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
 		j = jid
 		if not j:
 			j = gajim.get_jid_from_account(self.name)
-		self.awaiting_answers[id] = (VCARD_ARRIVED, j, groupchat_jid)
+		self.awaiting_answers[id_] = (VCARD_ARRIVED, j, groupchat_jid)
 		if groupchat_jid:
 			room_jid = gajim.get_room_and_nick_from_fjid(groupchat_jid)[0]
 			if not room_jid in self.room_jids:
 				self.room_jids.append(room_jid)
-			self.groupchat_jids[id] = groupchat_jid
+			self.groupchat_jids[id_] = groupchat_jid
 		self.connection.send(iq)
 
 	def send_vcard(self, vcard):
@@ -1007,8 +1006,8 @@ class ConnectionVcard:
 			else:
 				iq2.addChild(i).setData(vcard[i])
 
-		id = self.connection.getAnID()
-		iq.setID(id)
+		id_ = self.connection.getAnID()
+		iq.setID(id_)
 		self.connection.send(iq)
 
 		our_jid = gajim.get_jid_from_account(self.name)
@@ -1023,25 +1022,25 @@ class ConnectionVcard:
 		else:
 			gajim.interface.remove_avatar_files(our_jid)
 
-		self.awaiting_answers[id] = (VCARD_PUBLISHED, iq2)
+		self.awaiting_answers[id_] = (VCARD_PUBLISHED, iq2)
 
 	def _IqCB(self, con, iq_obj):
-		id = iq_obj.getID()
+		id_ = iq_obj.getID()
 
 		# Check if we were waiting a timeout for this id
 		found_tim = None
 		for tim in self.awaiting_timeouts:
-			if id == self.awaiting_timeouts[tim][0]:
+			if id_ == self.awaiting_timeouts[tim][0]:
 				found_tim = tim
 				break
 		if found_tim:
 			del self.awaiting_timeouts[found_tim]
 
-		if id not in self.awaiting_answers:
+		if id_ not in self.awaiting_answers:
 			return
-		if self.awaiting_answers[id][0] == VCARD_PUBLISHED:
+		if self.awaiting_answers[id_][0] == VCARD_PUBLISHED:
 			if iq_obj.getType() == 'result':
-				vcard_iq = self.awaiting_answers[id][1]
+				vcard_iq = self.awaiting_answers[id_][1]
 				# Save vcard to HD
 				if vcard_iq.getTag('PHOTO') and vcard_iq.getTag('PHOTO').getTag('SHA'):
 					new_sha = vcard_iq.getTag('PHOTO').getTagData('SHA')
@@ -1066,11 +1065,11 @@ class ConnectionVcard:
 				self.dispatch('VCARD_PUBLISHED', ())
 			elif iq_obj.getType() == 'error':
 				self.dispatch('VCARD_NOT_PUBLISHED', ())
-		elif self.awaiting_answers[id][0] == VCARD_ARRIVED:
+		elif self.awaiting_answers[id_][0] == VCARD_ARRIVED:
 			# If vcard is empty, we send to the interface an empty vcard so that
 			# it knows it arrived
-			jid = self.awaiting_answers[id][1]
-			groupchat_jid = self.awaiting_answers[id][2]
+			jid = self.awaiting_answers[id_][1]
+			groupchat_jid = self.awaiting_answers[id_][2]
 			frm = jid
 			if groupchat_jid:
 				# We do as if it comes from the fake_jid
@@ -1088,10 +1087,10 @@ class ConnectionVcard:
 					self.dispatch('VCARD', {'jid': jid, 'resource': resource})
 				elif frm == our_jid:
 					self.dispatch('MYVCARD', {'jid': frm})
-		elif self.awaiting_answers[id][0] == AGENT_REMOVED:
-			jid = self.awaiting_answers[id][1]
+		elif self.awaiting_answers[id_][0] == AGENT_REMOVED:
+			jid = self.awaiting_answers[id_][1]
 			self.dispatch('AGENT_REMOVED', jid)
-		elif self.awaiting_answers[id][0] == METACONTACTS_ARRIVED:
+		elif self.awaiting_answers[id_][0] == METACONTACTS_ARRIVED:
 			if not self.connection:
 				return
 			if iq_obj.getType() == 'result':
@@ -1122,7 +1121,7 @@ class ConnectionVcard:
 					self.private_storage_supported = False
 			# We can now continue connection by requesting the roster
 			self.connection.initRoster()
-		elif self.awaiting_answers[id][0] == PRIVACY_ARRIVED:
+		elif self.awaiting_answers[id_][0] == PRIVACY_ARRIVED:
 			if iq_obj.getType() != 'error':
 				self.privacy_rules_supported = True
 				self.get_privacy_list('block')
@@ -1136,7 +1135,7 @@ class ConnectionVcard:
 					return
 			# Ask metacontacts before roster
 			self.get_metacontacts()
-		elif self.awaiting_answers[id][0] == PEP_CONFIG:
+		elif self.awaiting_answers[id_][0] == PEP_CONFIG:
 			conf = iq_obj.getTag('pubsub').getTag('configure')
 			node = conf.getAttr('node')
 			form_tag = conf.getTag('x', namespace=common.xmpp.NS_DATA)
@@ -1144,7 +1143,7 @@ class ConnectionVcard:
 				form = common.dataforms.ExtendForm(node=form_tag)
 				self.dispatch('PEP_CONFIG', (node, form))
 
-		del self.awaiting_answers[id]
+		del self.awaiting_answers[id_]
 
 	def _vCardCB(self, con, vc):
 		'''Called when we receive a vCard
@@ -1153,14 +1152,14 @@ class ConnectionVcard:
 			return
 		if not vc.getTag('vCard').getNamespace() == common.xmpp.NS_VCARD:
 			return
-		id = vc.getID()
+		id_ = vc.getID()
 		frm_iq = vc.getFrom()
 		our_jid = gajim.get_jid_from_account(self.name)
 		resource = ''
-		if id in self.groupchat_jids:
-			who = self.groupchat_jids[id]
+		if id_ in self.groupchat_jids:
+			who = self.groupchat_jids[id_]
 			frm, resource = gajim.get_room_and_nick_from_fjid(who)
-			del self.groupchat_jids[id]
+			del self.groupchat_jids[id_]
 		elif frm_iq:
 			who = helpers.get_full_jid_from_iq(vc)
 			frm, resource = gajim.get_room_and_nick_from_fjid(who)
@@ -1414,31 +1413,31 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
 		if opt in ('yes', 'no'):
 			self.build_http_auth_answer(iq_obj, opt)
 		else:
-			id = iq_obj.getTagAttr('confirm', 'id')
+			id_ = iq_obj.getTagAttr('confirm', 'id')
 			method = iq_obj.getTagAttr('confirm', 'method')
 			url = iq_obj.getTagAttr('confirm', 'url')
 			msg = iq_obj.getTagData('body') # In case it's a message with a body
-			self.dispatch('HTTP_AUTH', (method, url, id, iq_obj, msg))
+			self.dispatch('HTTP_AUTH', (method, url, id_, iq_obj, msg))
 		raise common.xmpp.NodeProcessed
 
 	def _ErrorCB(self, con, iq_obj):
 		gajim.log.debug('ErrorCB')
 		jid_from = helpers.get_full_jid_from_iq(iq_obj)
 		jid_stripped, resource = gajim.get_room_and_nick_from_fjid(jid_from)
-		id = unicode(iq_obj.getID())
-		if id in self.version_ids:
+		id_ = unicode(iq_obj.getID())
+		if id_ in self.version_ids:
 			self.dispatch('OS_INFO', (jid_stripped, resource, '', ''))
-			self.version_ids.remove(id)
+			self.version_ids.remove(id_)
 			return
-		if id in self.last_ids:
+		if id_ in self.last_ids:
 			self.dispatch('LAST_STATUS_TIME', (jid_stripped, resource, -1, ''))
-			self.last_ids.remove(id)
+			self.last_ids.remove(id_)
 			return
-		if id == self.awaiting_xmpp_ping_id:
+		if id_ == self.awaiting_xmpp_ping_id:
 			self.awaiting_xmpp_ping_id = None
 		errmsg = iq_obj.getErrorMsg()
 		errcode = iq_obj.getErrorCode()
-		self.dispatch('ERROR_ANSWER', (id, jid_from, errmsg, errcode))
+		self.dispatch('ERROR_ANSWER', (id_, jid_from, errmsg, errcode))
 
 	def _PrivateCB(self, con, iq_obj):
 		'''
@@ -1538,14 +1537,14 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
 			seconds = int(seconds)
 		except Exception:
 			return
-		id = iq_obj.getID()
-		if id in self.groupchat_jids:
-			who = self.groupchat_jids[id]
-			del self.groupchat_jids[id]
+		id_ = iq_obj.getID()
+		if id_ in self.groupchat_jids:
+			who = self.groupchat_jids[id_]
+			del self.groupchat_jids[id_]
 		else:
 			who = helpers.get_full_jid_from_iq(iq_obj)
-		if id in self.last_ids:
-			self.last_ids.remove(id)
+		if id_ in self.last_ids:
+			self.last_ids.remove(id_)
 		jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
 		self.dispatch('LAST_STATUS_TIME', (jid_stripped, resource, seconds, status))
 
@@ -1560,15 +1559,15 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
 			client_info += ' ' + qp.getTag('version').getData()
 		if qp.getTag('os'):
 			os_info += qp.getTag('os').getData()
-		id = iq_obj.getID()
-		if id in self.groupchat_jids:
-			who = self.groupchat_jids[id]
-			del self.groupchat_jids[id]
+		id_ = iq_obj.getID()
+		if id_ in self.groupchat_jids:
+			who = self.groupchat_jids[id_]
+			del self.groupchat_jids[id_]
 		else:
 			who = helpers.get_full_jid_from_iq(iq_obj)
 		jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
-		if id in self.version_ids:
-			self.version_ids.remove(id)
+		if id_ in self.version_ids:
+			self.version_ids.remove(id_)
 		self.dispatch('OS_INFO', (jid_stripped, resource, client_info, os_info))
 
 	def _TimeCB(self, con, iq_obj):
diff --git a/src/common/helpers.py b/src/common/helpers.py
index 9fe6dd7953..5f3e8edd38 100644
--- a/src/common/helpers.py
+++ b/src/common/helpers.py
@@ -1241,20 +1241,19 @@ def compute_caps_hash(identities, features, dataforms=[], hash_method='sha-1'):
 		if form_type:
 			S += form_type.getValue() + '<'
 			del fields['FORM_TYPE']
-		vars = sorted(fields.keys())
-		for var in vars:
+		for var in sorted(fields.keys()):
 			S += '%s<' % var
 			values = sorted(fields[var].getValues())
 			for value in values:
 				S += '%s<' % value
 
 	if hash_method == 'sha-1':
-		hash = hash_sha1(S)
+		hash_ = hash_sha1(S)
 	elif hash_method == 'md5':
-		hash = hash_md5(S)
+		hash_ = hash_md5(S)
 	else:
 		return ''
-	return base64.b64encode(hash.digest())
+	return base64.b64encode(hash_.digest())
 
 def update_optional_features(account = None):
 	if account:
diff --git a/src/common/logger.py b/src/common/logger.py
index a8582bca38..5a2c24c15b 100644
--- a/src/common/logger.py
+++ b/src/common/logger.py
@@ -759,7 +759,7 @@ class Logger:
 
 		# list of corrupted entries that will be removed
 		to_be_removed = []
-		for hash_method, hash, data in self.cur:
+		for hash_method, hash_, data in self.cur:
 			# for each row: unpack the data field
 			# (format: (category, type, name, category, type, name, ...
 			#   ..., 'FEAT', feature1, feature2, ...).join(' '))
@@ -768,7 +768,7 @@ class Logger:
 				data = GzipFile(fileobj=StringIO(str(data))).read().decode('utf-8').split('\0')
 			except IOError:
 				# This data is corrupted. It probably contains non-ascii chars
-				to_be_removed.append((hash_method, hash))
+				to_be_removed.append((hash_method, hash_))
 				continue
 			i=0
 			identities = list()
@@ -787,9 +787,9 @@ class Logger:
 				i += 1
 
 			# yield the row
-			yield hash_method, hash, identities, features
-		for hash_method, hash in to_be_removed:
-			sql = 'DELETE FROM caps_cache WHERE hash_method = "%s" AND hash = "%s"' % (hash_method, hash)
+			yield hash_method, hash_, identities, features
+		for hash_method, hash_ in to_be_removed:
+			sql = 'DELETE FROM caps_cache WHERE hash_method = "%s" AND hash = "%s"' % (hash_method, hash_)
 			self.simple_commit(sql)
 
 	def add_caps_entry(self, hash_method, hash_, identities, features):
diff --git a/src/common/pubsub.py b/src/common/pubsub.py
index cdd429f209..517d947a88 100644
--- a/src/common/pubsub.py
+++ b/src/common/pubsub.py
@@ -36,9 +36,9 @@ class ConnectionPubSub:
 		pb = query.addChild('pubsub', {'xmlns': xmpp.NS_PUBSUB})
 		pb.addChild('subscriptions')
 
-		id = self.connection.send(query)
+		id_ = self.connection.send(query)
 
-		self.__callbacks[id]=(cb, args, kwargs)
+		self.__callbacks[id_]=(cb, args, kwargs)
 
 	def send_pb_subscribe(self, jid, node, cb, *args, **kwargs):
 		if not self.connection or self.connected < 2:
@@ -48,9 +48,9 @@ class ConnectionPubSub:
 		pb = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
 		pb.addChild('subscribe', {'node': node, 'jid': our_jid})
 
-		id = self.connection.send(query)
+		id_ = self.connection.send(query)
 
-		self.__callbacks[id]=(cb, args, kwargs)
+		self.__callbacks[id_]=(cb, args, kwargs)
 
 	def send_pb_unsubscribe(self, jid, node, cb, *args, **kwargs):
 		if not self.connection or self.connected < 2:
@@ -60,9 +60,9 @@ class ConnectionPubSub:
 		pb = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
 		pb.addChild('unsubscribe', {'node': node, 'jid': our_jid})
 
-		id = self.connection.send(query)
+		id_ = self.connection.send(query)
 
-		self.__callbacks[id]=(cb, args, kwargs)
+		self.__callbacks[id_]=(cb, args, kwargs)
 
 	def send_pb_publish(self, jid, node, item, id_):
 		'''Publish item to a node.'''
@@ -141,9 +141,9 @@ class ConnectionPubSub:
 		query = xmpp.Iq('get', to=jid)
 		e = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB_OWNER)
 		e = e.addChild('configure', {'node': node})
-		id = self.connection.getAnID()
-		query.setID(id)
-		self.awaiting_answers[id] = (connection_handlers.PEP_CONFIG,)
+		id_ = self.connection.getAnID()
+		query.setID(id_)
+		self.awaiting_answers[id_] = (connection_handlers.PEP_CONFIG,)
 		self.connection.send(query)
 
 # vim: se ts=3:
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 6e3d3f0677..15bebafa12 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -240,8 +240,8 @@ class EncryptedStanzaSession(StanzaSession):
 
 	def sign(self, string):
 		if self.negotiated['sign_algs'] == (XmlDsig + 'rsa-sha256'):
-			hash = crypto.sha256(string)
-			return crypto.encode_mpi(gajim.pubkey.sign(hash, '')[0])
+			hash_ = crypto.sha256(string)
+			return crypto.encode_mpi(gajim.pubkey.sign(hash_, '')[0])
 
 	def encrypt_stanza(self, stanza):
 		encryptable = filter(lambda x: x.getName() not in ('error', 'amp',
@@ -424,9 +424,9 @@ class EncryptedStanzaSession(StanzaSession):
 		mac_o_calculated = self.hmac(self.ks_o, content)
 
 		if self.negotiated['recv_pubkey']:
-			hash = crypto.sha256(mac_o_calculated)
+			hash_ = crypto.sha256(mac_o_calculated)
 
-			if not eir_pubkey.verify(hash, signature):
+			if not eir_pubkey.verify(hash_, signature):
 				raise exceptions.NegotiationError, 'public key signature verification failed!'
 
 		elif mac_o_calculated != mac_o:
diff --git a/src/common/xmpp/auth.py b/src/common/xmpp/auth.py
index af3b86405c..1c7721cb88 100644
--- a/src/common/xmpp/auth.py
+++ b/src/common/xmpp/auth.py
@@ -68,8 +68,8 @@ class NonSASL(PlugIn):
             def hash_n_times(s, count):
                return count and hasher(hash_n_times(s, count-1)) or s
 
-            hash = hash_n_times(hasher(hasher(self.password)+token), int(seq))
-            query.setTagData('hash',hash)
+            hash_ = hash_n_times(hasher(hasher(self.password)+token), int(seq))
+            query.setTagData('hash', hash_)
             method='0k'
         else:
             self.DEBUG("Sequre methods unsupported, performing plain text authentication",'warn')
diff --git a/src/common/xmpp/auth_nb.py b/src/common/xmpp/auth_nb.py
index 64296a3f84..034cb9a6f9 100644
--- a/src/common/xmpp/auth_nb.py
+++ b/src/common/xmpp/auth_nb.py
@@ -48,16 +48,17 @@ def challenge_splitter(data):
 	X_KEYWORD, X_VALUE, X_END = 0, 1, 2
 	quotes_open = False
 	keyword, value = '', ''
-	dict, arr = {}, None
+	dict_ = {}
+	arr = None
 	
 	expecting = X_KEYWORD
-	for iter in range(len(data) + 1):
+	for iter_ in range(len(data) + 1):
 		end = False
-		if iter == len(data):
+		if iter_ == len(data):
 			expecting = X_END
 			end = True
 		else:
-			char = data[iter]
+			char = data[iter_]
 		if expecting == X_KEYWORD:
 			if char == '=':
 				expecting  = X_VALUE
@@ -85,14 +86,14 @@ def challenge_splitter(data):
 		if end:
 			if arr:
 				arr.append(value)
-				dict[keyword] = arr
+				dict_[keyword] = arr
 				arr = None
 			else:
-				dict[keyword] = value
+				dict_[keyword] = value
 			value, keyword = '', ''
 			expecting = X_KEYWORD
 			quotes_open = False
-	return dict
+	return dict_
 
 class SASL(PlugIn):
 	''' Implements SASL authentication. '''
@@ -321,8 +322,8 @@ class NonBlockingNonSASL(PlugIn):
 			def hash_n_times(s, count):
 				return count and hasher(hash_n_times(s, count-1)) or s
 
-			hash = hash_n_times(hasher(hasher(self.password) + token), int(seq))
-			query.setTagData('hash',hash)
+			hash_ = hash_n_times(hasher(hasher(self.password) + token), int(seq))
+			query.setTagData('hash', hash_)
 			self._method='0k'
 		else:
 			self.DEBUG("Sequre methods unsupported, performing plain text authentication",'warn')
diff --git a/src/common/xmpp/browser.py b/src/common/xmpp/browser.py
index 1b932bb154..10b9d0364a 100644
--- a/src/common/xmpp/browser.py
+++ b/src/common/xmpp/browser.py
@@ -212,7 +212,7 @@ class Browser(PlugIn):
                 raise NodeProcessed
             # handler must return dictionary:
             # {'ids':[{},{},{},{}], 'features':[fe,at,ur,es], 'xdata':DataForm}
-            for id in dt['ids']: q.addChild('identity',id)
+            for id_ in dt['ids']: q.addChild('identity',id_)
             for feature in dt['features']: q.addChild('feature',{'var':feature})
             if 'xdata' in dt: q.addChild(node=dt['xdata'])
         conn.send(rep)
diff --git a/src/common/xmpp/commands.py b/src/common/xmpp/commands.py
index 37ffe9171e..555a372fa2 100644
--- a/src/common/xmpp/commands.py
+++ b/src/common/xmpp/commands.py
@@ -105,7 +105,7 @@ class Commands(PlugIn):
             #   Enumerate the 'item' disco of each command for the specified jid
             #   Build responce and send
             #   To make this code easy to write we add an 'list' disco type, it returns a tuple or 'none' if not advertised
-            list = []
+            list_ = []
             items = []
             jid = str(request.getTo())
             # Get specific jid based results
@@ -120,10 +120,10 @@ class Commands(PlugIn):
                 for each in items:
                     i = self._handlers[each[0]][each[1]]['disco'](conn,request,'list')
                     if i is not None:
-                        list.append(Node(tag='item',attrs={'jid':i[0],'node':i[1],'name':i[2]}))
+                        list_.append(Node(tag='item',attrs={'jid':i[0],'node':i[1],'name':i[2]}))
                 iq = request.buildReply('result')
                 if request.getQuerynode(): iq.setQuerynode(request.getQuerynode())
-                iq.setQueryPayload(list)
+                iq.setQueryPayload(list_)
                 conn.send(iq)
             else:
                 conn.send(Error(request,ERR_ITEM_NOT_FOUND))
diff --git a/src/common/xmpp/dispatcher.py b/src/common/xmpp/dispatcher.py
index 84cd6f6d12..364207a2b1 100644
--- a/src/common/xmpp/dispatcher.py
+++ b/src/common/xmpp/dispatcher.py
@@ -285,14 +285,14 @@ class Dispatcher(PlugIn):
 
         session.DEBUG("Dispatching %s stanza with type->%s props->%s id->%s"%(name,typ,stanza.props,ID),'ok')
 
-        list=['default']                                                     # we will use all handlers:
-        if typ in self.handlers[xmlns][name]: list.append(typ)                # from very common...
+        list_=['default']                                                     # we will use all handlers:
+        if typ in self.handlers[xmlns][name]: list_.append(typ)                # from very common...
         for prop in stanza.props:
-            if prop in self.handlers[xmlns][name]: list.append(prop)
-            if typ and typ+prop in self.handlers[xmlns][name]: list.append(typ+prop)  # ...to very particular
+            if prop in self.handlers[xmlns][name]: list_.append(prop)
+            if typ and typ+prop in self.handlers[xmlns][name]: list_.append(typ+prop)  # ...to very particular
 
         chain=self.handlers[xmlns]['default']['default']
-        for key in list:
+        for key in list_:
             if key: chain = chain + self.handlers[xmlns][name][key]
 
         if ID in session._expected:
diff --git a/src/common/xmpp/dispatcher_nb.py b/src/common/xmpp/dispatcher_nb.py
index 604be9b02c..5c7cc84f5d 100644
--- a/src/common/xmpp/dispatcher_nb.py
+++ b/src/common/xmpp/dispatcher_nb.py
@@ -328,14 +328,14 @@ class Dispatcher(PlugIn):
 		ID=stanza.getID()
 		
 		session.DEBUG("Dispatching %s stanza with type->%s props->%s id->%s"%(name,typ,stanza.props,ID),'ok')
-		list=['default']                                                     # we will use all handlers:
-		if typ in self.handlers[xmlns][name]: list.append(typ)                # from very common...
+		list_=['default']                                                     # we will use all handlers:
+		if typ in self.handlers[xmlns][name]: list_.append(typ)                # from very common...
 		for prop in stanza.props:
-			if prop in self.handlers[xmlns][name]: list.append(prop)
-			if typ and typ+prop in self.handlers[xmlns][name]: list.append(typ+prop)  # ...to very particular
+			if prop in self.handlers[xmlns][name]: list_.append(prop)
+			if typ and typ+prop in self.handlers[xmlns][name]: list_.append(typ+prop)  # ...to very particular
 		
 		chain=self.handlers[xmlns]['default']['default']
-		for key in list:
+		for key in list_:
 			if key: chain = chain + self.handlers[xmlns][name][key]
 		
 		if ID in session._expected:
diff --git a/src/common/xmpp/features.py b/src/common/xmpp/features.py
index c5d67dffa1..277e7c8d38 100644
--- a/src/common/xmpp/features.py
+++ b/src/common/xmpp/features.py
@@ -142,13 +142,13 @@ def getPrivacyLists(disp):
     """ Requests privacy lists from connected server.
         Returns dictionary of existing lists on success."""
     try:
-        dict={'lists':[]}
+        dict_={'lists':[]}
         resp=disp.SendAndWaitForResponse(Iq('get',NS_PRIVACY))
         if not isResultNode(resp): return
-        for list in resp.getQueryPayload():
-            if list.getName()=='list': dict['lists'].append(list.getAttr('name'))
-            else: dict[list.getName()]=list.getAttr('name')
-        return dict
+        for list_ in resp.getQueryPayload():
+            if list_.getName()=='list': dict_['lists'].append(list_.getAttr('name'))
+            else: dict_[list_.getName()]=list_.getAttr('name')
+        return dict_
     except: pass
 
 def getPrivacyList(disp,listname):
diff --git a/src/common/xmpp/features_nb.py b/src/common/xmpp/features_nb.py
index 0895578ecb..bf83ac9612 100644
--- a/src/common/xmpp/features_nb.py
+++ b/src/common/xmpp/features_nb.py
@@ -177,31 +177,31 @@ def getPrivacyLists(disp):
 		Returns dictionary of existing lists on success."""
 	iq = Iq('get', NS_PRIVACY)
 	def _on_response(resp):
-		dict = {'lists': []}
+		dict_ = {'lists': []}
 		if not isResultNode(resp):
 			disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, (False))
 			return
-		for list in resp.getQueryPayload():
-			if list.getName()=='list':
-				dict['lists'].append(list.getAttr('name'))
+		for list_ in resp.getQueryPayload():
+			if list_.getName()=='list':
+				dict_['lists'].append(list_.getAttr('name'))
 			else:
-				dict[list.getName()]=list.getAttr('name')
-		disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, (dict))
+				dict_[list_.getName()]=list_.getAttr('name')
+		disp.Event(NS_PRIVACY, PRIVACY_LISTS_RECEIVED, (dict_))
 	disp.SendAndCallForResponse(iq, _on_response)
 
 def getActiveAndDefaultPrivacyLists(disp):
 	iq = Iq('get', NS_PRIVACY)
 	def _on_response(resp):
-		dict = {'active': '', 'default': ''}
+		dict_ = {'active': '', 'default': ''}
 		if not isResultNode(resp):
 			disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, (False))
 			return
-		for list in resp.getQueryPayload():
-			if list.getName() == 'active':
-				dict['active'] = list.getAttr('name')
-			elif list.getName() == 'default':
-				dict['default'] = list.getAttr('name')
-		disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, (dict))
+		for list_ in resp.getQueryPayload():
+			if list_.getName() == 'active':
+				dict_['active'] = list_.getAttr('name')
+			elif list_.getName() == 'default':
+				dict_['default'] = list_.getAttr('name')
+		disp.Event(NS_PRIVACY, PRIVACY_LISTS_ACTIVE_DEFAULT, (dict_))
 	disp.SendAndCallForResponse(iq, _on_response)
 
 def getPrivacyList(disp, listname):
diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py
index 1f5af01d66..5f553941b5 100644
--- a/src/common/xmpp/protocol.py
+++ b/src/common/xmpp/protocol.py
@@ -600,14 +600,14 @@ class ErrorNode(Node):
             Mandatory parameter: name - name of error condition.
             Optional parameters: code, typ, text. Used for backwards compartibility with older jabber protocol."""
         if name in ERRORS:
-            cod,type,txt=ERRORS[name]
+            cod,type_,txt=ERRORS[name]
             ns=name.split()[0]
-        else: cod,ns,type,txt='500',NS_STANZAS,'cancel',''
-        if typ: type=typ
+        else: cod,ns,type_,txt='500',NS_STANZAS,'cancel',''
+        if typ: type_=typ
         if code: cod=code
         if text: txt=text
         Node.__init__(self,'error',{},[Node(name)])
-        if type: self.setAttr('type',type)
+        if type_: self.setAttr('type',type_)
         if not cod: self.setName('stream:error')
         if txt: self.addChild(node=Node(ns+' text',{},[txt]))
         if cod: self.setAttr('code',cod)
diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py
index 166fd12dcb..0b842e239e 100644
--- a/src/common/zeroconf/client_zeroconf.py
+++ b/src/common/zeroconf/client_zeroconf.py
@@ -688,23 +688,23 @@ class ClientZeroconf:
 		# look for hashed connections
 		if to in self.recipient_to_hash:
 			conn = self.connections[self.recipient_to_hash[to]]
-			id = conn.Dispatcher.getAnID()
-			stanza.setID(id)
+			id_ = conn.Dispatcher.getAnID()
+			stanza.setID(id_)
 			if conn.add_stanza(stanza, is_message):
 				if on_ok:
 					on_ok()
-				return id
+				return id_
 
 		if item['address'] in self.ip_to_hash:
-			hash = self.ip_to_hash[item['address']]
-			if self.hash_to_port[hash] == item['port']:
-				conn = self.connections[hash]
-				id = conn.Dispatcher.getAnID()
-				stanza.setID(id)
+			hash_ = self.ip_to_hash[item['address']]
+			if self.hash_to_port[hash_] == item['port']:
+				conn = self.connections[hash_]
+				id_ = conn.Dispatcher.getAnID()
+				stanza.setID(id_)
 				if conn.add_stanza(stanza, is_message):
 					if on_ok:
 						on_ok()
-					return id
+					return id_
 
 		# otherwise open new connection
 		stanza.setID('zero')
diff --git a/src/common/zeroconf/connection_handlers_zeroconf.py b/src/common/zeroconf/connection_handlers_zeroconf.py
index d9a4fb3286..3c5f482346 100644
--- a/src/common/zeroconf/connection_handlers_zeroconf.py
+++ b/src/common/zeroconf/connection_handlers_zeroconf.py
@@ -159,7 +159,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 	def _bytestreamSetCB(self, con, iq_obj):
 		gajim.log.debug('_bytestreamSetCB')
 		target = unicode(iq_obj.getAttr('to'))
-		id = unicode(iq_obj.getAttr('id'))
+		id_ = unicode(iq_obj.getAttr('id'))
 		query = iq_obj.getTag('query')
 		sid = unicode(query.getAttr('sid'))
 		file_props = gajim.socks5queue.get_file_props(
@@ -170,7 +170,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 				host_dict={
 					'state': 0,
 					'target': target,
-					'id': id,
+					'id': id_,
 					'sid': sid,
 					'initiator': unicode(iq_obj.getFrom())
 				}
@@ -206,9 +206,9 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 		if not real_id.startswith('au_'):
 			return
 		frm = unicode(iq_obj.getFrom())
-		id = real_id[3:]
-		if id in self.files_props:
-			file_props = self.files_props[id]
+		id_ = real_id[3:]
+		if id_ in self.files_props:
+			file_props = self.files_props[id_]
 			if file_props['streamhost-used']:
 				for host in file_props['proxyhosts']:
 					if host['initiator'] == frm and 'idx' in host:
@@ -226,15 +226,15 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 			streamhost =  query.getTag('streamhost-used')
 		except Exception: # this bytestream result is not what we need
 			pass
-		id = real_id[3:]
-		if id in self.files_props:
-			file_props = self.files_props[id]
+		id_ = real_id[3:]
+		if id_ in self.files_props:
+			file_props = self.files_props[id_]
 		else:
 			raise common.xmpp.NodeProcessed
 		if streamhost is None:
 			# proxy approves the activate query
 			if real_id.startswith('au_'):
-				id = real_id[3:]
+				id_ = real_id[3:]
 				if 'streamhost-used' not in file_props or \
 					file_props['streamhost-used'] is False:
 					raise common.xmpp.NodeProcessed
@@ -286,11 +286,11 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 	def _siResultCB(self, con, iq_obj):
 		gajim.log.debug('_siResultCB')
 		self.peerhost = con._owner.Connection._sock.getsockname()
-		id = iq_obj.getAttr('id')
-		if id not in self.files_props:
+		id_ = iq_obj.getAttr('id')
+		if id_ not in self.files_props:
 			# no such jid
 			return
-		file_props = self.files_props[id]
+		file_props = self.files_props[id_]
 		if file_props is None:
 			# file properties for jid is none
 			return
@@ -359,11 +359,11 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
 		profile = si.getAttr('profile')
 		if profile != common.xmpp.NS_FILE:
 			return
-		id = iq_obj.getAttr('id')
-		if id not in self.files_props:
+		id_ = iq_obj.getAttr('id')
+		if id_ not in self.files_props:
 			# no such jid
 			return
-		file_props = self.files_props[id]
+		file_props = self.files_props[id_]
 		if file_props is None:
 			# file properties for jid is none
 			return
diff --git a/src/common/zeroconf/zeroconf_bonjour.py b/src/common/zeroconf/zeroconf_bonjour.py
index a57daf1735..3e7a37e6dd 100644
--- a/src/common/zeroconf/zeroconf_bonjour.py
+++ b/src/common/zeroconf/zeroconf_bonjour.py
@@ -99,10 +99,7 @@ class Zeroconf:
 	# takes a TXTRecord instance
 	def txt_array_to_dict(self, txt):
 		items = pybonjour.TXTRecord.parse(txt)._items
-		dict = {}
-		for val in items.values():
-			dict[val[0]] = val[1]
-		return dict
+		return dict((v[0], v[1]) for v in items.values())
 
 	def service_resolved_callback(self, sdRef, flags, interfaceIndex, errorCode, fullname, 
 			hosttarget, port, txtRecord):
diff --git a/src/config.py b/src/config.py
index 6974f78162..c072c74198 100644
--- a/src/config.py
+++ b/src/config.py
@@ -141,12 +141,12 @@ class PreferencesWindow:
 		model = gtk.ListStore(str)
 		emoticons_combobox.set_model(model)
 		l = []
-		for dir in emoticons_list:
-			if not os.path.isdir(os.path.join(gajim.DATA_DIR, 'emoticons', dir)) \
-			and not os.path.isdir(os.path.join(gajim.MY_EMOTS_PATH, dir)) :
+		for dir_ in emoticons_list:
+			if not os.path.isdir(os.path.join(gajim.DATA_DIR, 'emoticons', dir_)) \
+			and not os.path.isdir(os.path.join(gajim.MY_EMOTS_PATH, dir_)) :
 				continue
-			if dir != '.svn':
-				l.append(dir)
+			if dir_ != '.svn':
+				l.append(dir_)
 		l.append(_('Disabled'))
 		for i in xrange(len(l)):
 			model.append([l[i]])
@@ -157,9 +157,9 @@ class PreferencesWindow:
 
 		# Set default for single window type
 		choices = common.config.opt_one_window_types
-		type = gajim.config.get('one_message_window')
-		if type in choices:
-			self.one_window_type_combobox.set_active(choices.index(type))
+		type_ = gajim.config.get('one_message_window')
+		if type_ in choices:
+			self.one_window_type_combobox.set_active(choices.index(type_))
 		else:
 			self.one_window_type_combobox.set_active(0)
 
@@ -216,9 +216,9 @@ class PreferencesWindow:
 				'online.png'))
 			files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
 				'online.gif'))
-			for file in files:
-				if os.path.exists(file):
-					preview.set_from_file(file)
+			for file_ in files:
+				if os.path.exists(file_):
+					preview.set_from_file(file_)
 			model.append([preview, l[i]])
 			if gajim.config.get('iconset') == l[i]:
 				self.iconset_combobox.set_active(i)
@@ -872,14 +872,14 @@ class PreferencesWindow:
 		for status_ in status:
 			msg = gajim.config.get_per('defaultstatusmsg', status_, 'message')
 			enabled = gajim.config.get_per('defaultstatusmsg', status_, 'enabled')
-			iter = model.append()
+			iter_ = model.append()
 			uf_show = helpers.get_uf_show(status_)
-			model.set(iter, 0, status_, 1, uf_show, 2, msg, 3, enabled)
+			model.set(iter_, 0, status_, 1, uf_show, 2, msg, 3, enabled)
 
 	def on_default_msg_cell_edited(self, cell, row, new_text):
 		model = self.default_msg_tree.get_model()
-		iter = model.get_iter_from_string(row)
-		model.set_value(iter, 2, new_text)
+		iter_ = model.get_iter_from_string(row)
+		model.set_value(iter_, 2, new_text)
 
 	def default_msg_toggled_cb(self, cell, path):
 		model = self.default_msg_tree.get_model()
@@ -901,16 +901,16 @@ class PreferencesWindow:
 	def save_status_messages(self, model):
 		for msg in gajim.config.get_per('statusmsg'):
 			gajim.config.del_per('statusmsg', msg)
-		iter = model.get_iter_first()
-		while iter:
-			val = model[iter][0].decode('utf-8')
-			if model[iter][1]: # we have a preset message
+		iter_ = model.get_iter_first()
+		while iter_:
+			val = model[iter_][0].decode('utf-8')
+			if model[iter_][1]: # we have a preset message
 				if not val: # no title, use message text for title
-					val = model[iter][1]
+					val = model[iter_][1]
 				gajim.config.add_per('statusmsg', val)
-				msg = helpers.to_one_line(model[iter][1].decode('utf-8'))
+				msg = helpers.to_one_line(model[iter_][1].decode('utf-8'))
 				gajim.config.set_per('statusmsg', val, 'message', msg)
-			iter = model.iter_next(iter)
+			iter_ = model.iter_next(iter_)
 		gajim.interface.save_config()
 
 	def on_msg_treemodel_row_changed(self, model, path, iter_):
@@ -988,45 +988,45 @@ class PreferencesWindow:
 		for msg_name in preset_status:
 			msg_text = gajim.config.get_per('statusmsg', msg_name, 'message')
 			msg_text = helpers.from_one_line(msg_text)
-			iter = model.append()
-			model.set(iter, 0, msg_name, 1, msg_text)
+			iter_ = model.append()
+			model.set(iter_, 0, msg_name, 1, msg_text)
 
 	def on_msg_cell_edited(self, cell, row, new_text):
 		model = self.msg_tree.get_model()
-		iter = model.get_iter_from_string(row)
-		model.set_value(iter, 0, new_text)
+		iter_ = model.get_iter_from_string(row)
+		model.set_value(iter_, 0, new_text)
 
 	def on_msg_treeview_cursor_changed(self, widget, data = None):
-		(model, iter) = self.msg_tree.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.msg_tree.get_selection().get_selected()
+		if not iter_:
 			return
 		self.xml.get_widget('delete_msg_button').set_sensitive(True)
 		buf = self.xml.get_widget('msg_textview').get_buffer()
-		msg = model[iter][1]
+		msg = model[iter_][1]
 		buf.set_text(msg)
 
 	def on_new_msg_button_clicked(self, widget, data = None):
 		model = self.msg_tree.get_model()
-		iter = model.append()
-		model.set(iter, 0, _('status message title'), 1, _('status message text'))
-		self.msg_tree.set_cursor(model.get_path(iter))
+		iter_ = model.append()
+		model.set(iter_, 0, _('status message title'), 1, _('status message text'))
+		self.msg_tree.set_cursor(model.get_path(iter_))
 
 	def on_delete_msg_button_clicked(self, widget, data = None):
-		(model, iter) = self.msg_tree.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.msg_tree.get_selection().get_selected()
+		if not iter_:
 			return
 		buf = self.xml.get_widget('msg_textview').get_buffer()
-		model.remove(iter)
+		model.remove(iter_)
 		buf.set_text('')
 		self.xml.get_widget('delete_msg_button').set_sensitive(False)
 
 	def on_msg_textview_changed(self, widget, data = None):
-		(model, iter) = self.msg_tree.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.msg_tree.get_selection().get_selected()
+		if not iter_:
 			return
 		buf = self.xml.get_widget('msg_textview').get_buffer()
 		first_iter, end_iter = buf.get_bounds()
-		model.set_value(iter, 1, buf.get_text(first_iter, end_iter))
+		model.set_value(iter_, 1, buf.get_text(first_iter, end_iter))
 
 	def on_msg_treeview_key_press_event(self, widget, event):
 		if event.keyval == gtk.keysyms.Delete:
@@ -1064,54 +1064,54 @@ class PreferencesWindow:
 			model.append((enabled, sound_ui_name, path, sound_event_config_name))
 
 	def on_treeview_sounds_cursor_changed(self, widget, data = None):
-		(model, iter) = self.sound_tree.get_selection().get_selected()
+		(model, iter_) = self.sound_tree.get_selection().get_selected()
 		sounds_entry = self.xml.get_widget('sounds_entry')
-		if not iter:
+		if not iter_:
 			sounds_entry.set_text('')
 			return
-		path_to_snd_file = model[iter][2]
+		path_to_snd_file = model[iter_][2]
 		sounds_entry.set_text(path_to_snd_file)
 
 	def on_browse_for_sounds_button_clicked(self, widget, data = None):
-		(model, iter) = self.sound_tree.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.sound_tree.get_selection().get_selected()
+		if not iter_:
 			return
 		def on_ok(widget, path_to_snd_file):
 			self.dialog.destroy()
-			model, iter = self.sound_tree.get_selection().get_selected()
+			model, iter_ = self.sound_tree.get_selection().get_selected()
 			if not path_to_snd_file:
-				model[iter][2] = ''
+				model[iter_][2] = ''
 				self.xml.get_widget('sounds_entry').set_text('')
-				model[iter][0] = False
+				model[iter_][0] = False
 				return
 			directory = os.path.dirname(path_to_snd_file)
 			gajim.config.set('last_sounds_dir', directory)
 			self.xml.get_widget('sounds_entry').set_text(path_to_snd_file)
 
-			model[iter][2] = path_to_snd_file # set new path to sounds_model
-			model[iter][0] = True # set the sound to enabled
+			model[iter_][2] = path_to_snd_file # set new path to sounds_model
+			model[iter_][0] = True # set the sound to enabled
 
 		def on_cancel(widget):
 			self.dialog.destroy()
-			model, iter = self.sound_tree.get_selection().get_selected()
-			model[iter][2] = ''
-			model[iter][0] = False
+			model, iter_ = self.sound_tree.get_selection().get_selected()
+			model[iter_][2] = ''
+			model[iter_][0] = False
 
-		path_to_snd_file = model[iter][2].decode('utf-8')
+		path_to_snd_file = model[iter_][2].decode('utf-8')
 		path_to_snd_file = os.path.join(os.getcwd(), path_to_snd_file)
 		self.dialog = dialogs.SoundChooserDialog(path_to_snd_file, on_ok,
 			on_cancel)
 
 	def on_sounds_entry_changed(self, widget):
 		path_to_snd_file = widget.get_text()
-		model, iter = self.sound_tree.get_selection().get_selected()
-		model[iter][2] = path_to_snd_file # set new path to sounds_model
+		model, iter_ = self.sound_tree.get_selection().get_selected()
+		model[iter_][2] = path_to_snd_file # set new path to sounds_model
 
 	def on_play_button_clicked(self, widget):
-		model, iter = self.sound_tree.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.sound_tree.get_selection().get_selected()
+		if not iter_:
 			return
-		snd_event_config_name = model[iter][3]
+		snd_event_config_name = model[iter_][3]
 		helpers.play_sound(snd_event_config_name)
 
 	def on_open_advanced_editor_button_clicked(self, widget, data = None):
@@ -1137,11 +1137,11 @@ class ManageProxiesWindow:
 	def fill_proxies_treeview(self):
 		model = self.proxies_treeview.get_model()
 		model.clear()
-		iter = model.append()
-		model.set(iter, 0, _('None'))
+		iter_ = model.append()
+		model.set(iter_, 0, _('None'))
 		for p in gajim.config.get_per('proxies'):
-			iter = model.append()
-			model.set(iter, 0, p)
+			iter_ = model.append()
+			model.set(iter_, 0, p)
 
 	def init_list(self):
 		self.xml.get_widget('remove_proxy_button').set_sensitive(False)
@@ -1169,16 +1169,16 @@ class ManageProxiesWindow:
 		i = 1
 		while ('proxy' + unicode(i)) in proxies:
 			i += 1
-		iter = model.append()
-		model.set(iter, 0, 'proxy' + unicode(i))
+		iter_ = model.append()
+		model.set(iter_, 0, 'proxy' + unicode(i))
 		gajim.config.add_per('proxies', 'proxy' + unicode(i))
 
 	def on_remove_proxy_button_clicked(self, widget):
-		(model, iter) = self.proxies_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.proxies_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		proxy = model[iter][0].decode('utf-8')
-		model.remove(iter)
+		proxy = model[iter_][0].decode('utf-8')
+		model.remove(iter_)
 		gajim.config.del_per('proxies', proxy)
 		self.xml.get_widget('remove_proxy_button').set_sensitive(False)
 
@@ -1193,10 +1193,10 @@ class ManageProxiesWindow:
 	def on_proxies_treeview_cursor_changed(self, widget):
 		#FIXME: check if off proxy settings are correct (see
 		# http://trac.gajim.org/changeset/1921#file2 line 1221
-		(model, iter) = widget.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = widget.get_selection().get_selected()
+		if not iter_:
 			return
-		proxy = model[iter][0]
+		proxy = model[iter_][0]
 		self.xml.get_widget('proxyname_entry').set_text(proxy)
 		proxyhost_entry = self.xml.get_widget('proxyhost_entry')
 		proxyport_entry = self.xml.get_widget('proxyport_entry')
@@ -1238,10 +1238,10 @@ class ManageProxiesWindow:
 			self.on_remove_proxy_button_clicked(widget)
 
 	def on_proxyname_entry_changed(self, widget):
-		(model, iter) = self.proxies_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.proxies_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		old_name = model.get_value(iter, 0).decode('utf-8')
+		old_name = model.get_value(iter_, 0).decode('utf-8')
 		new_name = widget.get_text().decode('utf-8')
 		if new_name == '':
 			return
@@ -1253,7 +1253,7 @@ class ManageProxiesWindow:
 		for option in config:
 			gajim.config.set_per('proxies', new_name, option,
 				config[option][common.config.OPT_VAL])
-		model.set_value(iter, 0, new_name)
+		model.set_value(iter_, 0, new_name)
 
 	def on_proxytype_combobox_changed(self, widget):
 		types = ['http', 'socks5']
@@ -1343,13 +1343,13 @@ class AccountsWindow:
 
 	def select_account(self, account):
 		model = self.accounts_treeview.get_model()
-		iter = model.get_iter_root()
-		while iter:
-			acct = model[iter][0].decode('utf-8')
+		iter_ = model.get_iter_root()
+		while iter_:
+			acct = model[iter_][0].decode('utf-8')
 			if account == acct:
-				self.accounts_treeview.set_cursor(model.get_path(iter))
+				self.accounts_treeview.set_cursor(model.get_path(iter_))
 				return
-			iter = model.iter_next(iter)
+			iter_ = model.iter_next(iter_)
 
 	def init_accounts(self):
 		'''initialize listStore with existing accounts'''
@@ -1359,8 +1359,8 @@ class AccountsWindow:
 		model = self.accounts_treeview.get_model()
 		model.clear()
 		for account in gajim.config.get_per('accounts'):
-			iter = model.append()
-			model.set(iter, 0, account)
+			iter_ = model.append()
+			model.set(iter_, 0, account)
 
 	def resend(self, account):
 		show = gajim.SHOW_LIST[gajim.connections[account].connected]
@@ -1409,9 +1409,9 @@ class AccountsWindow:
 	def on_accounts_treeview_cursor_changed(self, widget):
 		'''Activate modify buttons when a row is selected, update accounts info'''
 		sel = self.accounts_treeview.get_selection()
-		(model, iter) = sel.get_selected()
-		if iter:
-			account = model[iter][0].decode('utf-8')
+		(model, iter_) = sel.get_selected()
+		if iter_:
+			account = model[iter_][0].decode('utf-8')
 		else:
 			account = None
 		if self.current_account and self.current_account == account:
@@ -1441,7 +1441,7 @@ class AccountsWindow:
 
 		self.remove_button.set_sensitive(True)
 		self.rename_button.set_sensitive(True)
-		if iter:
+		if iter_:
 			self.current_account = account
 			if account == gajim.ZEROCONF_ACC_NAME:
 				self.remove_button.set_sensitive(False)
@@ -2226,11 +2226,11 @@ class AccountsWindow:
 	def on_jabber_id_entry2_changed(self, widget):
 		if self.ignore_events:
 			return
-		id = widget.get_text().decode('utf-8')
-		if self.option_changed('zeroconf_jabber_id', id):
+		id_ = widget.get_text().decode('utf-8')
+		if self.option_changed('zeroconf_jabber_id', id_):
 			self.need_relogin = True
 		gajim.config.set_per('accounts', self.current_account,
-			'zeroconf_jabber_id', id)
+			'zeroconf_jabber_id', id_)
 
 	def on_email_entry2_changed(self, widget):
 		if self.ignore_events:
@@ -2431,8 +2431,8 @@ class GroupchatConfigWindow:
 	def on_cell_edited(self, cell, path, new_text):
 		model = self.affiliation_treeview['outcast'].get_model()
 		new_text = new_text.decode('utf-8')
-		iter = model.get_iter(path)
-		model[iter][1] = new_text
+		iter_ = model.get_iter(path)
+		model[iter_][1] = new_text
 
 	def on_add_button_clicked(self, widget, affiliation):
 		if affiliation == 'outcast':
@@ -2470,9 +2470,9 @@ class GroupchatConfigWindow:
 			row_refs.append(gtk.TreeRowReference(model, path))
 		for row_ref in row_refs:
 			path = row_ref.get_path()
-			iter = model.get_iter(path)
-			jid = model[iter][0]
-			model.remove(iter)
+			iter_ = model.get_iter(path)
+			jid = model[iter_][0]
+			model.remove(iter_)
 		self.remove_button[affiliation].set_sensitive(False)
 
 	def on_affiliation_treeview_cursor_changed(self, widget, affiliation):
@@ -2504,19 +2504,19 @@ class GroupchatConfigWindow:
 			users_dict = {}
 			actual_jid_list = []
 			model = self.affiliation_treeview[affiliation].get_model()
-			iter = model.get_iter_first()
+			iter_ = model.get_iter_first()
 			# add new jid
-			while iter:
-				jid = model[iter][0].decode('utf-8')
+			while iter_:
+				jid = model[iter_][0].decode('utf-8')
 				actual_jid_list.append(jid)
 				if jid not in self.start_users_dict[affiliation] or \
 				(affiliation == 'outcast' and 'reason' in self.start_users_dict[affiliation]\
 				[jid] and self.start_users_dict[affiliation][jid]\
-				['reason'] != model[iter][1].decode('utf-8')):
+				['reason'] != model[iter_][1].decode('utf-8')):
 					users_dict[jid] = {'affiliation': affiliation}
 					if affiliation == 'outcast':
-						users_dict[jid]['reason'] = model[iter][1].decode('utf-8')
-				iter = model.iter_next(iter)
+						users_dict[jid]['reason'] = model[iter_][1].decode('utf-8')
+				iter_ = model.iter_next(iter_)
 			# remove removed one
 			for jid in self.start_users_dict[affiliation]:
 				if jid not in actual_jid_list:
@@ -2642,7 +2642,7 @@ class ManageBookmarksWindow:
 				continue
 			if not gajim.connections[account].private_storage_supported:
 				continue
-			iter = self.treestore.append(None, [None, account, None, None,
+			iter_ = self.treestore.append(None, [None, account, None, None,
 				None, None, None, None])
 
 			for bookmark in gajim.connections[account].bookmarks:
@@ -2662,7 +2662,7 @@ class ManageBookmarksWindow:
 				print_status = bookmark.get('print_status', '')
 				if print_status not in ('', 'all', 'in_and_out', 'none'):
 					print_status = ''
-				self.treestore.append( iter, [
+				self.treestore.append(iter_, [
 						account,
 						bookmark['name'],
 						bookmark['jid'],
@@ -2714,12 +2714,12 @@ class ManageBookmarksWindow:
 		self.window.show_all()
 
 	def on_bookmarks_treeview_button_press_event(self, widget, event):
-		(model, iter) = self.selection.get_selected()
-		if not iter:
+		(model, iter_) = self.selection.get_selected()
+		if not iter_:
 			# Removed a bookmark before
 			return
 
-		if model.iter_parent(iter):
+		if model.iter_parent(iter_):
 			# The currently selected node is a bookmark
 			return not self.check_valid_bookmark()
 
@@ -2730,18 +2730,18 @@ class ManageBookmarksWindow:
 		'''Add a new bookmark.'''
 		# Get the account that is currently used
 		# (the parent of the currently selected item)
-		(model, iter) = self.selection.get_selected()
-		if not iter: # Nothing selected, do nothing
+		(model, iter_) = self.selection.get_selected()
+		if not iter_: # Nothing selected, do nothing
 			return
 
-		parent = model.iter_parent(iter)
+		parent = model.iter_parent(iter_)
 
 		if parent:
 			# We got a bookmark selected, so we add_to the parent
 			add_to = parent
 		else:
 			# No parent, so we got an account -> add to this.
-			add_to = iter
+			add_to = iter_
 
 		account = model[add_to][1].decode('utf-8')
 		nick = gajim.nicks[account]
@@ -2755,24 +2755,24 @@ class ManageBookmarksWindow:
 		'''
 		Remove selected bookmark.
 		'''
-		(model, iter) = self.selection.get_selected()
-		if not iter: # Nothing selected
+		(model, iter_) = self.selection.get_selected()
+		if not iter_: # Nothing selected
 			return
 
-		if not model.iter_parent(iter):
+		if not model.iter_parent(iter_):
 			# Don't remove account iters
 			return
 
-		model.remove(iter)
+		model.remove(iter_)
 		self.clear_fields()
 
 	def check_valid_bookmark(self):
 		'''
 		Check if all neccessary fields are entered correctly.
 		'''
-		(model, iter) = self.selection.get_selected()
+		(model, iter_) = self.selection.get_selected()
 
-		if not model.iter_parent(iter):
+		if not model.iter_parent(iter_):
 			#Account data can't be changed
 			return
 
@@ -2790,8 +2790,8 @@ class ManageBookmarksWindow:
 		Parse the treestore data into our new bookmarks array,
 		then send the new bookmarks to the server.
 		'''
-		(model, iter) = self.selection.get_selected()
-		if iter and model.iter_parent(iter):
+		(model, iter_) = self.selection.get_selected()
+		if iter_ and model.iter_parent(iter_):
 			#bookmark selected, check it
 			if not self.check_valid_bookmark():
 				return
@@ -2823,9 +2823,9 @@ class ManageBookmarksWindow:
 		'''
 		Fill in the bookmark's data into the fields.
 		'''
-		(model, iter) = selection.get_selected()
+		(model, iter_) = selection.get_selected()
 
-		if not iter:
+		if not iter_:
 			# After removing the last bookmark for one account
 			# this will be None, so we will just:
 			return
@@ -2834,7 +2834,7 @@ class ManageBookmarksWindow:
 			self.server_entry, self.pass_entry, self.autojoin_checkbutton,
 			self.minimize_checkbutton, self.print_status_combobox]
 
-		if model.iter_parent(iter):
+		if model.iter_parent(iter_):
 			# make the fields sensitive
 			for field in widgets:
 				field.set_sensitive(True)
@@ -2847,8 +2847,8 @@ class ManageBookmarksWindow:
 			return
 
 		# Fill in the data for childs
-		self.title_entry.set_text(model[iter][1])
-		room_jid = model[iter][2].decode('utf-8')
+		self.title_entry.set_text(model[iter_][1])
+		room_jid = model[iter_][2].decode('utf-8')
 		try:
 			(room, server) = room_jid.split('@')
 		except ValueError:
@@ -2858,13 +2858,13 @@ class ManageBookmarksWindow:
 		self.room_entry.set_text(room)
 		self.server_entry.set_text(server)
 
-		self.autojoin_checkbutton.set_active(model[iter][3])
-		self.minimize_checkbutton.set_active(model[iter][4])
+		self.autojoin_checkbutton.set_active(model[iter_][3])
+		self.minimize_checkbutton.set_active(model[iter_][4])
 		# sensitive only if auto join is checked
-		self.minimize_checkbutton.set_sensitive(model[iter][3])
+		self.minimize_checkbutton.set_sensitive(model[iter_][3])
 
-		if model[iter][5] is not None:
-			password = model[iter][5].decode('utf-8')
+		if model[iter_][5] is not None:
+			password = model[iter_][5].decode('utf-8')
 		else:
 			password = None
 
@@ -2872,66 +2872,66 @@ class ManageBookmarksWindow:
 			self.pass_entry.set_text(password)
 		else:
 			self.pass_entry.set_text('')
-		nick = model[iter][6]
+		nick = model[iter_][6]
 		if nick:
 			nick = nick.decode('utf-8')
 			self.nick_entry.set_text(nick)
 		else:
 			self.nick_entry.set_text('')
 
-		print_status = model[iter][7]
+		print_status = model[iter_][7]
 		opts = sorted(self.option_list.keys())
 		self.print_status_combobox.set_active(opts.index(print_status))
 
 	def on_title_entry_changed(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter: # After removing a bookmark, we got nothing selected
-			if model.iter_parent(iter):
+		(model, iter_) = self.selection.get_selected()
+		if iter_: # After removing a bookmark, we got nothing selected
+			if model.iter_parent(iter_):
 				# Don't clear the title field for account nodes
-				model[iter][1] = self.title_entry.get_text()
+				model[iter_][1] = self.title_entry.get_text()
 
 	def on_nick_entry_changed(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
-			model[iter][6] = self.nick_entry.get_text()
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
+			model[iter_][6] = self.nick_entry.get_text()
 
 	def on_server_entry_changed(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
 			room_jid = self.room_entry.get_text().decode('utf-8').strip() + '@' + \
 				self.server_entry.get_text().decode('utf-8').strip()
-			model[iter][2] = room_jid.replace(' ', '')
+			model[iter_][2] = room_jid.replace(' ', '')
 
 	def on_room_entry_changed(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
 			room_jid = self.room_entry.get_text().decode('utf-8') + '@' + \
 				self.server_entry.get_text().decode('utf-8')
-			model[iter][2] = room_jid
+			model[iter_][2] = room_jid
 
 	def on_pass_entry_changed(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
-			model[iter][5] = self.pass_entry.get_text()
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
+			model[iter_][5] = self.pass_entry.get_text()
 
 	def on_autojoin_checkbutton_toggled(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
-			model[iter][3] = self.autojoin_checkbutton.get_active()
-			self.minimize_checkbutton.set_sensitive(model[iter][3])
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
+			model[iter_][3] = self.autojoin_checkbutton.get_active()
+			self.minimize_checkbutton.set_sensitive(model[iter_][3])
 
 	def on_minimize_checkbutton_toggled(self, widget):
-		(model, iter) = self.selection.get_selected()
-		if iter:
-			model[iter][4] = self.minimize_checkbutton.get_active()
+		(model, iter_) = self.selection.get_selected()
+		if iter_:
+			model[iter_][4] = self.minimize_checkbutton.get_active()
 
 	def on_print_status_combobox_changed(self, widget):
 		active = widget.get_active()
 		model = widget.get_model()
 		print_status = model[active][1]
-		(model2, iter) = self.selection.get_selected()
-		if iter:
-			model2[iter][7] = print_status
+		(model2, iter_) = self.selection.get_selected()
+		if iter_:
+			model2[iter_][7] = print_status
 
 	def clear_fields(self):
 		widgets = [ self.title_entry, self.nick_entry, self.room_entry,
@@ -3504,19 +3504,19 @@ class ManagePEPServicesWindow:
 
 	def node_removed(self, node):
 		model = self.treeview.get_model()
-		iter = model.get_iter_root()
-		while iter:
-			if model[iter][0] == node:
-				model.remove(iter)
+		iter_ = model.get_iter_root()
+		while iter_:
+			if model[iter_][0] == node:
+				model.remove(iter_)
 				break
-			iter = model.get_iter_next(iter)
+			iter_ = model.get_iter_next(iter_)
 
 	def on_delete_button_clicked(self, widget):
 		selection = self.treeview.get_selection()
 		if not selection:
 			return
-		model, iter = selection.get_selected()
-		node = model[iter][0]
+		model, iter_ = selection.get_selected()
+		node = model[iter_][0]
 		our_jid = gajim.get_jid_from_account(self.account)
 		gajim.connections[self.account].send_pb_delete(our_jid, node)
 
@@ -3524,8 +3524,8 @@ class ManagePEPServicesWindow:
 		selection = self.treeview.get_selection()
 		if not selection:
 			return
-		model, iter = selection.get_selected()
-		node = model[iter][0]
+		model, iter_ = selection.get_selected()
+		node = model[iter_][0]
 		our_jid = gajim.get_jid_from_account(self.account)
 		gajim.connections[self.account].request_pb_configuration(our_jid, node)
 
diff --git a/src/conversation_textview.py b/src/conversation_textview.py
index 7f0c445291..6713976381 100644
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -79,9 +79,9 @@ class TextViewImage(gtk.Image):
 	def _get_selected(self):
 		parent = self.get_parent()
 		if not parent or not self.anchor: return False
-		buffer = parent.get_buffer()
-		position = buffer.get_iter_at_child_anchor(self.anchor)
-		bounds = buffer.get_selection_bounds()
+		buffer_ = parent.get_buffer()
+		position = buffer_.get_iter_at_child_anchor(self.anchor)
+		bounds = buffer_.get_selection_bounds()
 		if bounds and position.in_range(*bounds):
 			return True
 		else:
@@ -106,9 +106,9 @@ class TextViewImage(gtk.Image):
 			self.queue_draw()
 
 	def _do_connect(self, widget, signal, callback):
-		id = widget.connect(signal, callback)
+		id_ = widget.connect(signal, callback)
 		def disconnect():
-			widget.disconnect(id)
+			widget.disconnect(id_)
 		self._disconnect_funcs.append(disconnect)
 
 	def _disconnect_signals(self):
@@ -196,18 +196,18 @@ class ConversationTextview:
 		self.auto_scrolling = False
 
 		# connect signals
-		id = self.tv.connect('motion_notify_event',
+		id_ = self.tv.connect('motion_notify_event',
 			self.on_textview_motion_notify_event)
-		self.handlers[id] = self.tv
-		id = self.tv.connect('populate_popup', self.on_textview_populate_popup)
-		self.handlers[id] = self.tv
-		id = self.tv.connect('button_press_event',
+		self.handlers[id_] = self.tv
+		id_ = self.tv.connect('populate_popup', self.on_textview_populate_popup)
+		self.handlers[id_] = self.tv
+		id_ = self.tv.connect('button_press_event',
 			self.on_textview_button_press_event)
-		self.handlers[id] = self.tv
+		self.handlers[id_] = self.tv
 
-		id = self.tv.connect('expose-event',
+		id_ = self.tv.connect('expose-event',
 			self.on_textview_expose_event)
-		self.handlers[id] = self.tv
+		self.handlers[id_] = self.tv
 
 
 		self.account = account
@@ -216,17 +216,17 @@ class ConversationTextview:
 
 		font = pango.FontDescription(gajim.config.get('conversation_font'))
 		self.tv.modify_font(font)
-		buffer = self.tv.get_buffer()
-		end_iter = buffer.get_end_iter()
-		buffer.create_mark('end', end_iter, False)
+		buffer_ = self.tv.get_buffer()
+		end_iter = buffer_.get_end_iter()
+		buffer_.create_mark('end', end_iter, False)
 
-		self.tagIn = buffer.create_tag('incoming')
+		self.tagIn = buffer_.create_tag('incoming')
 		color = gajim.config.get('inmsgcolor')
 		self.tagIn.set_property('foreground', color)
-		self.tagOut = buffer.create_tag('outgoing')
+		self.tagOut = buffer_.create_tag('outgoing')
 		color = gajim.config.get('outmsgcolor')
 		self.tagOut.set_property('foreground', color)
-		self.tagStatus = buffer.create_tag('status')
+		self.tagStatus = buffer_.create_tag('status')
 		color = gajim.config.get('statusmsgcolor')
 		self.tagStatus.set_property('foreground', color)
 
@@ -234,64 +234,64 @@ class ConversationTextview:
 		colors = colors.split(':')
 		for i,color in enumerate(colors):
 			tagname = 'gc_nickname_color_' + str(i)
-			tag = buffer.create_tag(tagname)
+			tag = buffer_.create_tag(tagname)
 			tag.set_property('foreground', color)
 
-		tag = buffer.create_tag('marked')
+		tag = buffer_.create_tag('marked')
 		color = gajim.config.get('markedmsgcolor')
 		tag.set_property('foreground', color)
 		tag.set_property('weight', pango.WEIGHT_BOLD)
 
-		tag = buffer.create_tag('time_sometimes')
+		tag = buffer_.create_tag('time_sometimes')
 		tag.set_property('foreground', 'darkgrey')
 		tag.set_property('scale', pango.SCALE_SMALL)
 		tag.set_property('justification', gtk.JUSTIFY_CENTER)
 
-		tag = buffer.create_tag('small')
+		tag = buffer_.create_tag('small')
 		tag.set_property('scale', pango.SCALE_SMALL)
 
-		tag = buffer.create_tag('restored_message')
+		tag = buffer_.create_tag('restored_message')
 		color = gajim.config.get('restored_messages_color')
 		tag.set_property('foreground', color)
 
-		self.tagURL = buffer.create_tag('url')
+		self.tagURL = buffer_.create_tag('url')
 		color = gajim.config.get('urlmsgcolor')
 		self.tagURL.set_property('foreground', color)
 		self.tagURL.set_property('underline', pango.UNDERLINE_SINGLE)
-		id = self.tagURL.connect('event', self.hyperlink_handler, 'url')
-		self.handlers[id] = self.tagURL
+		id_ = self.tagURL.connect('event', self.hyperlink_handler, 'url')
+		self.handlers[id_] = self.tagURL
 
-		self.tagMail = buffer.create_tag('mail')
+		self.tagMail = buffer_.create_tag('mail')
 		self.tagMail.set_property('foreground', color)
 		self.tagMail.set_property('underline', pango.UNDERLINE_SINGLE)
-		id = self.tagMail.connect('event', self.hyperlink_handler, 'mail')
-		self.handlers[id] = self.tagMail
+		id_ = self.tagMail.connect('event', self.hyperlink_handler, 'mail')
+		self.handlers[id_] = self.tagMail
 
-		self.tagXMPP = buffer.create_tag('xmpp')
+		self.tagXMPP = buffer_.create_tag('xmpp')
 		self.tagXMPP.set_property('foreground', color)
 		self.tagXMPP.set_property('underline', pango.UNDERLINE_SINGLE)
-		id = self.tagXMPP.connect('event', self.hyperlink_handler, 'xmpp')
-		self.handlers[id] = self.tagXMPP
+		id_ = self.tagXMPP.connect('event', self.hyperlink_handler, 'xmpp')
+		self.handlers[id_] = self.tagXMPP
 
-		self.tagSthAtSth = buffer.create_tag('sth_at_sth')
+		self.tagSthAtSth = buffer_.create_tag('sth_at_sth')
 		self.tagSthAtSth.set_property('foreground', color)
 		self.tagSthAtSth.set_property('underline', pango.UNDERLINE_SINGLE)
-		id = self.tagSthAtSth.connect('event', self.hyperlink_handler,
+		id_ = self.tagSthAtSth.connect('event', self.hyperlink_handler,
 			'sth_at_sth')
-		self.handlers[id] = self.tagSthAtSth
+		self.handlers[id_] = self.tagSthAtSth
 
-		tag = buffer.create_tag('bold')
+		tag = buffer_.create_tag('bold')
 		tag.set_property('weight', pango.WEIGHT_BOLD)
 
-		tag = buffer.create_tag('italic')
+		tag = buffer_.create_tag('italic')
 		tag.set_property('style', pango.STYLE_ITALIC)
 
-		tag = buffer.create_tag('underline')
+		tag = buffer_.create_tag('underline')
 		tag.set_property('underline', pango.UNDERLINE_SINGLE)
 
-		buffer.create_tag('focus-out-line', justification = gtk.JUSTIFY_CENTER)
+		buffer_.create_tag('focus-out-line', justification = gtk.JUSTIFY_CENTER)
 
-		tag = buffer.create_tag('xep0184-warning')
+		tag = buffer_.create_tag('xep0184-warning')
 
 		# One mark at the begining then 2 marks between each lines
 		size = gajim.config.get('max_conversation_lines')
@@ -327,8 +327,8 @@ class ConversationTextview:
 		self.tagMail.set_property('foreground', gajim.config.get('urlmsgcolor'))
 
 	def at_the_end(self):
-		buffer = self.tv.get_buffer()
-		end_iter = buffer.get_end_iter()
+		buffer_ = self.tv.get_buffer()
+		end_iter = buffer_.get_end_iter()
 		end_rect = self.tv.get_iter_location(end_iter)
 		visible_rect = self.tv.get_visible_rect()
 		if end_rect.y <= (visible_rect.y + visible_rect.height):
@@ -383,8 +383,8 @@ class ConversationTextview:
 
 	def scroll_to_end(self):
 		parent = self.tv.get_parent()
-		buffer = self.tv.get_buffer()
-		end_mark = buffer.get_mark('end')
+		buffer_ = self.tv.get_buffer()
+		end_mark = buffer_.get_mark('end')
 		if not end_mark:
 			return False
 		self.auto_scrolling = True
@@ -397,8 +397,8 @@ class ConversationTextview:
 	def bring_scroll_to_end(self, diff_y = 0,
 	use_smooth=gajim.config.get('use_smooth_scrolling')):
 		''' scrolls to the end of textview if end is not visible '''
-		buffer = self.tv.get_buffer()
-		end_iter = buffer.get_end_iter()
+		buffer_ = self.tv.get_buffer()
+		end_iter = buffer_.get_end_iter()
 		end_rect = self.tv.get_iter_location(end_iter)
 		visible_rect = self.tv.get_visible_rect()
 		# scroll only if expected end is not visible
@@ -409,8 +409,8 @@ class ConversationTextview:
 				gobject.idle_add(self.scroll_to_end_iter)
 
 	def scroll_to_end_iter(self):
-		buffer = self.tv.get_buffer()
-		end_iter = buffer.get_end_iter()
+		buffer_ = self.tv.get_buffer()
+		end_iter = buffer_.get_end_iter()
 		if not end_iter:
 			return False
 		self.tv.scroll_to_iter(end_iter, 0, False, 1, 1)
@@ -426,11 +426,11 @@ class ConversationTextview:
 		if id_ in self.xep0184_marks:
 			return
 
-		buffer = self.tv.get_buffer()
-		buffer.begin_user_action()
+		buffer_ = self.tv.get_buffer()
+		buffer_.begin_user_action()
 
-		self.xep0184_marks[id_] = buffer.create_mark(None,
-			buffer.get_end_iter(), left_gravity=True)
+		self.xep0184_marks[id_] = buffer_.create_mark(None,
+			buffer_.get_end_iter(), left_gravity=True)
 		self.xep0184_shown[id_] = NOT_SHOWN
 
 		def show_it():
@@ -438,24 +438,24 @@ class ConversationTextview:
 			self.xep0184_shown[id_] == ALREADY_RECEIVED:
 				return False
 
-			end_iter = buffer.get_iter_at_mark(
+			end_iter = buffer_.get_iter_at_mark(
 				self.xep0184_marks[id_])
-			buffer.insert(end_iter, ' ')
-			buffer.insert_pixbuf(end_iter,
+			buffer_.insert(end_iter, ' ')
+			buffer_.insert_pixbuf(end_iter,
 				ConversationTextview.XEP0184_WARNING_PIXBUF)
-			before_img_iter = buffer.get_iter_at_mark(
+			before_img_iter = buffer_.get_iter_at_mark(
 				self.xep0184_marks[id_])
 			before_img_iter.forward_char()
 			post_img_iter = before_img_iter.copy()
 			post_img_iter.forward_char()
-			buffer.apply_tag_by_name('xep0184-warning', before_img_iter,
+			buffer_.apply_tag_by_name('xep0184-warning', before_img_iter,
 				post_img_iter)
 
 			self.xep0184_shown[id_] = SHOWN
 			return False
 		gobject.timeout_add_seconds(3, show_it)
 
-		buffer.end_user_action()
+		buffer_.end_user_action()
 
 	def hide_xep0184_warning(self, id_):
 		if id_ not in self.xep0184_marks:
@@ -465,20 +465,20 @@ class ConversationTextview:
 			self.xep0184_shown[id_] = ALREADY_RECEIVED
 			return
 
-		buffer = self.tv.get_buffer()
-		buffer.begin_user_action()
+		buffer_ = self.tv.get_buffer()
+		buffer_.begin_user_action()
 
-		begin_iter = buffer.get_iter_at_mark(self.xep0184_marks[id_])
+		begin_iter = buffer_.get_iter_at_mark(self.xep0184_marks[id_])
 
 		end_iter = begin_iter.copy()
 		# XXX: Is there a nicer way?
 		end_iter.forward_char()
 		end_iter.forward_char()
 
-		buffer.delete(begin_iter, end_iter)
-		buffer.delete_mark(self.xep0184_marks[id_])
+		buffer_.delete(begin_iter, end_iter)
+		buffer_.delete_mark(self.xep0184_marks[id_])
 
-		buffer.end_user_action()
+		buffer_.end_user_action()
 
 		del self.xep0184_marks[id_]
 		del self.xep0184_shown[id_]
@@ -490,57 +490,57 @@ class ConversationTextview:
 			return
 
 		print_focus_out_line = False
-		buffer = self.tv.get_buffer()
+		buffer_ = self.tv.get_buffer()
 
 		if self.focus_out_end_mark is None:
 			# this happens only first time we focus out on this room
 			print_focus_out_line = True
 
 		else:
-			focus_out_end_iter = buffer.get_iter_at_mark(self.focus_out_end_mark)
+			focus_out_end_iter = buffer_.get_iter_at_mark(self.focus_out_end_mark)
 			focus_out_end_iter_offset = focus_out_end_iter.get_offset()
-			if focus_out_end_iter_offset != buffer.get_end_iter().get_offset():
+			if focus_out_end_iter_offset != buffer_.get_end_iter().get_offset():
 				# this means after last-focus something was printed
 				# (else end_iter's offset is the same as before)
 				# only then print ---- line (eg. we avoid printing many following
 				# ---- lines)
 				print_focus_out_line = True
 
-		if print_focus_out_line and buffer.get_char_count() > 0:
-			buffer.begin_user_action()
+		if print_focus_out_line and buffer_.get_char_count() > 0:
+			buffer_.begin_user_action()
 
 			# remove previous focus out line if such focus out line exists
 			if self.focus_out_end_mark is not None:
-				end_iter_for_previous_line = buffer.get_iter_at_mark(
+				end_iter_for_previous_line = buffer_.get_iter_at_mark(
 					self.focus_out_end_mark)
 				begin_iter_for_previous_line = end_iter_for_previous_line.copy()
 				# img_char+1 (the '\n')
 				begin_iter_for_previous_line.backward_chars(2)
 
 				# remove focus out line
-				buffer.delete(begin_iter_for_previous_line,
+				buffer_.delete(begin_iter_for_previous_line,
 					end_iter_for_previous_line)
-				buffer.delete_mark(self.focus_out_end_mark)
+				buffer_.delete_mark(self.focus_out_end_mark)
 
 			# add the new focus out line
-			end_iter = buffer.get_end_iter()
-			buffer.insert(end_iter, '\n')
-			buffer.insert_pixbuf(end_iter,
+			end_iter = buffer_.get_end_iter()
+			buffer_.insert(end_iter, '\n')
+			buffer_.insert_pixbuf(end_iter,
 				ConversationTextview.FOCUS_OUT_LINE_PIXBUF)
 
-			end_iter = buffer.get_end_iter()
+			end_iter = buffer_.get_end_iter()
 			before_img_iter = end_iter.copy()
 			# one char back (an image also takes one char)
 			before_img_iter.backward_char()
-			buffer.apply_tag_by_name('focus-out-line', before_img_iter, end_iter)
+			buffer_.apply_tag_by_name('focus-out-line', before_img_iter, end_iter)
 
 			self.allow_focus_out_line = False
 
 			# update the iter we hold to make comparison the next time
-			self.focus_out_end_mark = buffer.create_mark(None,
-				buffer.get_end_iter(), left_gravity=True)
+			self.focus_out_end_mark = buffer_.create_mark(None,
+				buffer_.get_end_iter(), left_gravity=True)
 
-			buffer.end_user_action()
+			buffer_.end_user_action()
 
 			# scroll to the end (via idle in case the scrollbar has appeared)
 			gobject.idle_add(self.scroll_to_end)
@@ -653,9 +653,9 @@ class ConversationTextview:
 
 	def clear(self, tv = None):
 		'''clear text in the textview'''
-		buffer = self.tv.get_buffer()
-		start, end = buffer.get_bounds()
-		buffer.delete(start, end)
+		buffer_ = self.tv.get_buffer()
+		start, end = buffer_.get_bounds()
+		buffer_.delete(start, end)
 		size = gajim.config.get('max_conversation_lines')
 		size = 2 * size - 1
 		self.marks_queue = Queue.Queue(size)
@@ -679,8 +679,8 @@ class ConversationTextview:
 
 			item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
 			menu.prepend(item)
-			id = item.connect('activate', self.clear)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.clear)
+			self.handlers[id_] = item
 
 		if self.selected_phrase:
 			if not separator_menuitem_was_added:
@@ -702,8 +702,8 @@ class ConversationTextview:
 				link = 'http://%s.wikipedia.org/wiki/Special:Search?search=%s'\
 					% (gajim.LANG, self.selected_phrase)
 			item = gtk.MenuItem(_('Read _Wikipedia Article'))
-			id = item.connect('activate', self.visit_url_from_menuitem, link)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.visit_url_from_menuitem, link)
+			self.handlers[id_] = item
 			submenu.append(item)
 
 			item = gtk.MenuItem(_('Look it up in _Dictionary'))
@@ -717,8 +717,8 @@ class ConversationTextview:
 				else:
 					link = 'http://%s.wiktionary.org/wiki/Special:Search?search=%s'\
 						% (gajim.LANG, self.selected_phrase)
-				id = item.connect('activate', self.visit_url_from_menuitem, link)
-				self.handlers[id] = item
+				id_ = item.connect('activate', self.visit_url_from_menuitem, link)
+				self.handlers[id_] = item
 			else:
 				if dict_link.find('%s') == -1:
 					# we must have %s in the url if not WIKTIONARY
@@ -727,9 +727,9 @@ class ConversationTextview:
 					item.set_property('sensitive', False)
 				else:
 					link = dict_link % self.selected_phrase
-					id = item.connect('activate', self.visit_url_from_menuitem,
+					id_ = item.connect('activate', self.visit_url_from_menuitem,
 						link)
-					self.handlers[id] = item
+					self.handlers[id_] = item
 			submenu.append(item)
 
 
@@ -741,13 +741,13 @@ class ConversationTextview:
 			else:
 				item = gtk.MenuItem(_('Web _Search for it'))
 				link =	search_link % self.selected_phrase
-				id = item.connect('activate', self.visit_url_from_menuitem, link)
-				self.handlers[id] = item
+				id_ = item.connect('activate', self.visit_url_from_menuitem, link)
+				self.handlers[id_] = item
 			submenu.append(item)
 
 			item = gtk.MenuItem(_('Open as _Link'))
-			id = item.connect('activate', self.visit_url_from_menuitem, link)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.visit_url_from_menuitem, link)
+			self.handlers[id_] = item
 			submenu.append(item)
 
 		menu.show_all()
@@ -762,8 +762,8 @@ class ConversationTextview:
 
 		x, y = self.tv.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT,
 			int(event.x), int(event.y))
-		iter = self.tv.get_iter_at_location(x, y)
-		tags = iter.get_tags()
+		iter_ = self.tv.get_iter_at_location(x, y)
+		tags = iter_.get_tags()
 
 
 		if tags: # we clicked on sth special (it can be status message too)
@@ -775,22 +775,22 @@ class ConversationTextview:
 		# we check if sth was selected and if it was we assign
 		# selected_phrase variable
 		# so on_conversation_textview_populate_popup can use it
-		buffer = self.tv.get_buffer()
-		return_val = buffer.get_selection_bounds()
+		buffer_ = self.tv.get_buffer()
+		return_val = buffer_.get_selection_bounds()
 		if return_val: # if sth was selected when we right-clicked
 			# get the selected text
 			start_sel, finish_sel = return_val[0], return_val[1]
-			self.selected_phrase = buffer.get_text(start_sel, finish_sel).decode(
+			self.selected_phrase = buffer_.get_text(start_sel, finish_sel).decode(
 				'utf-8')
-		elif ord(iter.get_char()) > 31:
+		elif ord(iter_.get_char()) > 31:
 			# we clicked on a word, do as if it's selected for context menu
-			start_sel = iter.copy()
+			start_sel = iter_.copy()
 			if not start_sel.starts_word():
 				start_sel.backward_word_start()
-			finish_sel = iter.copy()
+			finish_sel = iter_.copy()
 			if not finish_sel.ends_word():
 				finish_sel.forward_word_end()
-			self.selected_phrase = buffer.get_text(start_sel, finish_sel).decode(
+			self.selected_phrase = buffer_.get_text(start_sel, finish_sel).decode(
 				'utf-8')
 
 	def on_open_link_activate(self, widget, kind, text):
@@ -823,11 +823,11 @@ class ConversationTextview:
 		menu = xml.get_widget('chat_context_menu')
 		childs = menu.get_children()
 		if kind == 'url':
-			id = childs[0].connect('activate', self.on_copy_link_activate, text)
-			self.handlers[id] = childs[0]
-			id = childs[1].connect('activate', self.on_open_link_activate, kind,
+			id_ = childs[0].connect('activate', self.on_copy_link_activate, text)
+			self.handlers[id_] = childs[0]
+			id_ = childs[1].connect('activate', self.on_open_link_activate, kind,
 				text)
-			self.handlers[id] = childs[1]
+			self.handlers[id_] = childs[1]
 			childs[2].hide() # copy mail address
 			childs[3].hide() # open mail composer
 			childs[4].hide() # jid section separator
@@ -844,16 +844,16 @@ class ConversationTextview:
 			text = text.lower()
 			if text.startswith('xmpp:'):
 				text = text[5:]
-			id = childs[2].connect('activate', self.on_copy_link_activate, text)
-			self.handlers[id] = childs[2]
-			id = childs[3].connect('activate', self.on_open_link_activate, kind,
+			id_ = childs[2].connect('activate', self.on_copy_link_activate, text)
+			self.handlers[id_] = childs[2]
+			id_ = childs[3].connect('activate', self.on_open_link_activate, kind,
 				text)
-			self.handlers[id] = childs[3]
-			id = childs[5].connect('activate', self.on_start_chat_activate, text)
-			self.handlers[id] = childs[5]
-			id = childs[6].connect('activate',
+			self.handlers[id_] = childs[3]
+			id_ = childs[5].connect('activate', self.on_start_chat_activate, text)
+			self.handlers[id_] = childs[5]
+			id_ = childs[6].connect('activate',
 				self.on_join_group_chat_menuitem_activate, text)
-			self.handlers[id] = childs[6]
+			self.handlers[id_] = childs[6]
 
 			allow_add = False
 			c = gajim.contacts.get_first_contact_from_jid(self.account, text)
@@ -864,9 +864,9 @@ class ConversationTextview:
 				allow_add = True
 
 			if allow_add:
-				id = childs[7].connect('activate', self.on_add_to_roster_activate,
+				id_ = childs[7].connect('activate', self.on_add_to_roster_activate,
 					text)
-				self.handlers[id] = childs[7]
+				self.handlers[id_] = childs[7]
 				childs[7].show() # show add to roster menuitem
 			else:
 				childs[7].hide() # hide add to roster menuitem
@@ -933,7 +933,7 @@ class ConversationTextview:
 		after *last* special text, so we can print it in
 		print_conversation_line()'''
 
-		buffer = self.tv.get_buffer()
+		buffer_ = self.tv.get_buffer()
 
 		start = 0
 		end = 0
@@ -949,9 +949,9 @@ class ConversationTextview:
 			special_text = otext[start:end]
 			if start != 0:
 				text_before_special_text = otext[index:start]
-				end_iter = buffer.get_end_iter()
+				end_iter = buffer_.get_end_iter()
 				# we insert normal text
-				buffer.insert_with_tags_by_name(end_iter,
+				buffer_.insert_with_tags_by_name(end_iter,
 					text_before_special_text, *other_tags)
 			index = end # update index
 
@@ -997,10 +997,10 @@ class ConversationTextview:
 			texstr += str_
 			texstr += '\\end{gather*}\\end{large}\\end{document}'
 
-			file = open(os.path.join(tmpfile + '.tex'), 'w+')
-			file.write(texstr)
-			file.flush()
-			file.close()
+			file_ = open(os.path.join(tmpfile + '.tex'), 'w+')
+			file_.write(texstr)
+			file_.flush()
+			file_.close()
 
 			try:
 				if os.name == 'nt':
@@ -1057,7 +1057,7 @@ class ConversationTextview:
 		text_is_valid_uri = False
 		show_ascii_formatting_chars = \
 			gajim.config.get('show_ascii_formatting_chars')
-		buffer = self.tv.get_buffer()
+		buffer_ = self.tv.get_buffer()
 
 		# Check if we accept this as an uri
 		schemes = gajim.config.get('uri_schemes').split()
@@ -1070,8 +1070,8 @@ class ConversationTextview:
 		possible_emot_ascii_caps in gajim.interface.emoticons.keys():
 			# it's an emoticon
 			emot_ascii = possible_emot_ascii_caps
-			end_iter = buffer.get_end_iter()
-			anchor = buffer.create_child_anchor(end_iter)
+			end_iter = buffer_.get_end_iter()
+			anchor = buffer_.create_child_anchor(end_iter)
 			img = TextViewImage(anchor)
 			animations = gajim.interface.emoticons_animations
 			if not emot_ascii in animations:
@@ -1150,8 +1150,8 @@ class ConversationTextview:
 				gobject.idle_add(self.print_conversation_line, str(e), '', 'info',
 					'', None)
 				imagepath = None
-			end_iter = buffer.get_end_iter()
-			anchor = buffer.create_child_anchor(end_iter)
+			end_iter = buffer_.get_end_iter()
+			anchor = buffer_.create_child_anchor(end_iter)
 			if imagepath is not None:
 				img = gtk.Image()
 				img.set_from_file(imagepath)
@@ -1164,41 +1164,41 @@ class ConversationTextview:
 				except Exception:
 					pass
 			else:
-				buffer.insert(end_iter, special_text)
+				buffer_.insert(end_iter, special_text)
 			use_other_tags = False
 		else:
 			# It's nothing special
 			if use_other_tags:
-				end_iter = buffer.get_end_iter()
-				buffer.insert_with_tags_by_name(end_iter, special_text, *other_tags)
+				end_iter = buffer_.get_end_iter()
+				buffer_.insert_with_tags_by_name(end_iter, special_text, *other_tags)
 
 		if len(tags) > 0:
-			end_iter = buffer.get_end_iter()
+			end_iter = buffer_.get_end_iter()
 			all_tags = tags[:]
 			if use_other_tags:
 				all_tags += other_tags
-			buffer.insert_with_tags_by_name(end_iter, special_text, *all_tags)
+			buffer_.insert_with_tags_by_name(end_iter, special_text, *all_tags)
 
 	def print_empty_line(self):
-		buffer = self.tv.get_buffer()
-		end_iter = buffer.get_end_iter()
-		buffer.insert_with_tags_by_name(end_iter, '\n', 'eol')
+		buffer_ = self.tv.get_buffer()
+		end_iter = buffer_.get_end_iter()
+		buffer_.insert_with_tags_by_name(end_iter, '\n', 'eol')
 
 	def print_conversation_line(self, text, jid, kind, name, tim,
 	other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
 	subject=None, old_kind=None, xhtml=None, simple=False):
 		'''prints 'chat' type messages'''
-		buffer = self.tv.get_buffer()
-		buffer.begin_user_action()
+		buffer_ = self.tv.get_buffer()
+		buffer_.begin_user_action()
 		if self.marks_queue.full():
 			# remove oldest line
 			m1 = self.marks_queue.get()
 			m2 = self.marks_queue.get()
-			i1 = buffer.get_iter_at_mark(m1)
-			i2 = buffer.get_iter_at_mark(m2)
-			buffer.delete(i1, i2)
-			buffer.delete_mark(m1)
-		end_iter = buffer.get_end_iter()
+			i1 = buffer_.get_iter_at_mark(m1)
+			i2 = buffer_.get_iter_at_mark(m2)
+			buffer_.delete(i1, i2)
+			buffer_.delete_mark(m1)
+		end_iter = buffer_.get_end_iter()
 		at_the_end = False
 		if self.at_the_end():
 			at_the_end = True
@@ -1206,13 +1206,13 @@ class ConversationTextview:
 		# Create one mark and add it to queue once if it's the first line
 		# else twice (one for end bound, one for start bound)
 		mark = None
-		if buffer.get_char_count() > 0:
+		if buffer_.get_char_count() > 0:
 			if not simple:
-				buffer.insert_with_tags_by_name(end_iter, '\n', 'eol')
-			mark = buffer.create_mark(None, end_iter, left_gravity=True)
+				buffer_.insert_with_tags_by_name(end_iter, '\n', 'eol')
+			mark = buffer_.create_mark(None, end_iter, left_gravity=True)
 			self.marks_queue.put(mark)
 		if not mark:
-			mark = buffer.create_mark(None, end_iter, left_gravity=True)
+			mark = buffer_.create_mark(None, end_iter, left_gravity=True)
 		self.marks_queue.put(mark)
 		if kind == 'incoming_queue':
 			kind = 'incoming'
@@ -1226,7 +1226,7 @@ class ConversationTextview:
 		if current_print_time == 'always' and kind != 'info' and not simple:
 			timestamp_str = self.get_time_to_show(tim)
 			timestamp = time.strftime(timestamp_str, tim)
-			buffer.insert_with_tags_by_name(end_iter, timestamp,
+			buffer_.insert_with_tags_by_name(end_iter, timestamp,
 				*other_tags_for_time)
 		elif current_print_time == 'sometimes' and kind != 'info' and not simple:
 			every_foo_seconds = 60 * gajim.config.get(
@@ -1234,7 +1234,7 @@ class ConversationTextview:
 			seconds_passed = time.mktime(tim) - self.last_time_printout
 			if seconds_passed > every_foo_seconds:
 				self.last_time_printout = time.mktime(tim)
-				end_iter = buffer.get_end_iter()
+				end_iter = buffer_.get_end_iter()
 				if gajim.config.get('print_time_fuzzy') > 0:
 					fc = FuzzyClock()
 					fc.setTime(time.strftime('%H:%M', tim))
@@ -1242,7 +1242,7 @@ class ConversationTextview:
 					tim_format = ft.decode(locale.getpreferredencoding())
 				else:
 					tim_format = self.get_time_to_show(tim)
-				buffer.insert_with_tags_by_name(end_iter, tim_format + '\n',
+				buffer_.insert_with_tags_by_name(end_iter, tim_format + '\n',
 					'time_sometimes')
 		# kind = info, we print things as if it was a status: same color, ...
 		if kind == 'info':
@@ -1273,7 +1273,7 @@ class ConversationTextview:
 			else:
 				gobject.idle_add(self.scroll_to_end)
 
-		buffer.end_user_action()
+		buffer_.end_user_action()
 
 	def get_time_to_show(self, tim):
 		'''Get the time, with the day before if needed and return it.
@@ -1312,8 +1312,8 @@ class ConversationTextview:
 
 	def print_name(self, name, kind, other_tags_for_name):
 		if name:
-			buffer = self.tv.get_buffer()
-			end_iter = buffer.get_end_iter()
+			buffer_ = self.tv.get_buffer()
+			end_iter = buffer_.get_end_iter()
 			name_tags = other_tags_for_name[:] # create a new list
 			name_tags.append(kind)
 			before_str = gajim.config.get('before_nickname')
@@ -1321,14 +1321,14 @@ class ConversationTextview:
 			after_str = gajim.config.get('after_nickname')
 			after_str = helpers.from_one_line(after_str)
 			format = before_str + name + after_str + ' '
-			buffer.insert_with_tags_by_name(end_iter, format, *name_tags)
+			buffer_.insert_with_tags_by_name(end_iter, format, *name_tags)
 
 	def print_subject(self, subject):
 		if subject: # if we have subject, show it too!
 			subject = _('Subject: %s\n') % subject
-			buffer = self.tv.get_buffer()
-			end_iter = buffer.get_end_iter()
-			buffer.insert(end_iter, subject)
+			buffer_ = self.tv.get_buffer()
+			end_iter = buffer_.get_end_iter()
+			buffer_.insert(end_iter, subject)
 			self.print_empty_line()
 
 	def print_real_text(self, text, text_tags=[], name=None, xhtml=None):
@@ -1343,7 +1343,7 @@ class ConversationTextview:
 				gajim.log.debug(str('Error processing xhtml') + str(e))
 				gajim.log.debug(str('with |' + xhtml + '|'))
 
-		buffer = self.tv.get_buffer()
+		buffer_ = self.tv.get_buffer()
 		# /me is replaced by name if name is given
 		if name and (text.startswith('/me ') or text.startswith('/me\n')):
 			text = '* ' + name + text[3:]
@@ -1352,7 +1352,7 @@ class ConversationTextview:
 		index = self.detect_and_print_special_text(text, text_tags)
 
 		# add the rest of text located in the index and after
-		end_iter = buffer.get_end_iter()
-		buffer.insert_with_tags_by_name(end_iter, text[index:], *text_tags)
+		end_iter = buffer_.get_end_iter()
+		buffer_.insert_with_tags_by_name(end_iter, text[index:], *text_tags)
 
 # vim: se ts=3:
diff --git a/src/dataforms_widget.py b/src/dataforms_widget.py
index 0d45135433..84dc20c6a0 100644
--- a/src/dataforms_widget.py
+++ b/src/dataforms_widget.py
@@ -164,9 +164,9 @@ class DataFormWidget(gtk.Alignment, object):
 
 		# moving all data to model
 		for item in self._data_form.iter_records():
-			iter = self.multiplemodel.append()
+			iter_ = self.multiplemodel.append()
 			for field in item.iter_fields():
-				self.multiplemodel.set_value(iter, fieldvars.index(field.var),
+				self.multiplemodel.set_value(iter_, fieldvars.index(field.var),
 					field.value)
 
 		# constructing columns...
@@ -214,8 +214,8 @@ class DataFormWidget(gtk.Alignment, object):
 			self.remove_button.set_sensitive(True)
 			self.edit_button.set_sensitive(True)
 			_, (path,) = selection.get_selected_rows()
-			iter = model.get_iter(path)
-			if model.iter_next(iter) is None:
+			iter_ = model.get_iter(path)
+			if model.iter_next(iter_) is None:
 				self.up_button.set_sensitive(True)
 				self.down_button.set_sensitive(False)
 			elif path == (0, ):
@@ -252,19 +252,19 @@ class DataFormWidget(gtk.Alignment, object):
 	def on_up_button_clicked(self, widget):
 		selection = self.records_treeview.get_selection()
 		model, (path,) = selection.get_selected_rows()
-		iter = model.get_iter(path)
+		iter_ = model.get_iter(path)
 		# constructing path for previous iter
 		previter = model.get_iter((path[0]-1,))
-		model.swap(iter, previter)
+		model.swap(iter_, previter)
 
 		self.refresh_multiple_buttons()
 
 	def on_down_button_clicked(self, widget):
 		selection = self.records_treeview.get_selection()
 		model, (path,) = selection.get_selected_rows()
-		iter = model.get_iter(path)
-		nextiter = model.iter_next(iter)
-		model.swap(iter, nextiter)
+		iter_ = model.get_iter(path)
+		nextiter = model.iter_next(iter_)
+		model.swap(iter_, nextiter)
 
 		self.refresh_multiple_buttons()
 
@@ -356,10 +356,10 @@ class SingleForm(gtk.Table, object):
 				else:
 					# more than 5 options: show combobox
 					def on_list_single_combobox_changed(combobox, f):
-						iter = combobox.get_active_iter()
-						if iter:
+						iter_ = combobox.get_active_iter()
+						if iter_:
 							model = combobox.get_model()
-							f.value = model[iter][1]
+							f.value = model[iter_][1]
 						else:
 							f.value = ''
 					widget = gtkgui_helpers.create_combobox(field.options,
@@ -555,15 +555,15 @@ class SingleForm(gtk.Table, object):
 			while _('new%d@jabber.id') % i in field.values:
 				i += 1
 			jid = _('new%d@jabber.id') % i
-		iter = model.insert(999999, (jid,))
-		treeview.set_cursor(model.get_path(iter), treeview.get_column(0), True)
+		iter_ = model.insert(999999, (jid,))
+		treeview.set_cursor(model.get_path(iter_), treeview.get_column(0), True)
 		field.values = field.values + [jid]
 
 	def on_jid_multi_edit_button_clicked(self, widget, treeview):
-		model, iter = treeview.get_selection().get_selected()
-		assert iter is not None
+		model, iter_ = treeview.get_selection().get_selected()
+		assert iter_ is not None
 
-		treeview.set_cursor(model.get_path(iter), treeview.get_column(0), True)
+		treeview.set_cursor(model.get_path(iter_), treeview.get_column(0), True)
 
 	def on_jid_multi_remove_button_clicked(self, widget, treeview, field):
 		selection = treeview.get_selection()
diff --git a/src/dialogs.py b/src/dialogs.py
index b2b1b11b44..6c72ddfbb4 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -119,11 +119,11 @@ class EditGroupsDialog:
 			return
 		# check if it already exists
 		model = self.treeview.get_model()
-		iter = model.get_iter_root()
-		while iter:
-			if model.get_value(iter, 0).decode('utf-8') == group:
+		iter_ = model.get_iter_root()
+		while iter_:
+			if model.get_value(iter_, 0).decode('utf-8') == group:
 				return
-			iter = model.iter_next(iter)
+			iter_ = model.iter_next(iter_)
 		self.changes_made = True
 		model.append((group, True, False))
 		self.add_group(group)
@@ -173,17 +173,17 @@ class EditGroupsDialog:
 				group_list.append(group)
 		group_list.sort()
 		for group in group_list:
-			iter = store.append()
-			store.set(iter, 0, group) # Group name
+			iter_ = store.append()
+			store.set(iter_, 0, group) # Group name
 			if groups[group] == 0:
-				store.set(iter, 1, False)
+				store.set(iter_, 1, False)
 			else:
-				store.set(iter, 1, True)
+				store.set(iter_, 1, True)
 				if groups[group] == len(self.list_):
 					# all contacts are in this group
-					store.set(iter, 2, False)
+					store.set(iter_, 2, False)
 				else:
-					store.set(iter, 2, True)
+					store.set(iter_, 2, True)
 		column = gtk.TreeViewColumn(_('Group'))
 		column.set_expand(True)
 		self.treeview.append_column(column)
@@ -301,10 +301,10 @@ class ChooseGPGKeyDialog:
 
 	def on_dialog_response(self, dialog, response):
 		selection = self.keys_treeview.get_selection()
-		(model, iter) = selection.get_selected()
-		if iter and response == gtk.RESPONSE_OK:
-			keyID = [ model[iter][0].decode('utf-8'),
-				model[iter][1].decode('utf-8') ]
+		(model, iter_) = selection.get_selected()
+		if iter_ and response == gtk.RESPONSE_OK:
+			keyID = [ model[iter_][0].decode('utf-8'),
+				model[iter_][1].decode('utf-8') ]
 		else:
 			keyID = None
 		self.on_response(keyID)
@@ -788,25 +788,25 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 				self.uid_entry.set_text(uid.replace('%', '@', 1))
 			#set protocol_combobox
 			model = self.protocol_combobox.get_model()
-			iter = model.get_iter_first()
+			iter_ = model.get_iter_first()
 			i = 0
-			while iter:
-				if model[iter][2] == type_:
+			while iter_:
+				if model[iter_][2] == type_:
 					self.protocol_combobox.set_active(i)
 					break
-				iter = model.iter_next(iter)
+				iter_ = model.iter_next(iter_)
 				i += 1
 
 			# set protocol_jid_combobox
 			self.protocol_jid_combobox.set_active(0)
 			model = self.protocol_jid_combobox.get_model()
-			iter = model.get_iter_first()
+			iter_ = model.get_iter_first()
 			i = 0
-			while iter:
-				if model[iter][0] == transport:
+			while iter_:
+				if model[iter_][0] == transport:
 					self.protocol_jid_combobox.set_active(i)
 					break
-				iter = model.iter_next(iter)
+				iter_ = model.iter_next(iter_)
 				i += 1
 			if user_nick:
 				self.nickname_entry.set_text(user_nick)
@@ -864,8 +864,8 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 			return
 
 		model = self.protocol_combobox.get_model()
-		iter = self.protocol_combobox.get_active_iter()
-		type_ = model[iter][2]
+		iter_ = self.protocol_combobox.get_active_iter()
+		type_ = model[iter_][2]
 		if type_ != 'jabber':
 			transport = self.protocol_jid_combobox.get_active_text().decode(
 				'utf-8')
@@ -923,8 +923,8 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 
 	def on_protocol_combobox_changed(self, widget):
 		model = widget.get_model()
-		iter = widget.get_active_iter()
-		type_ = model[iter][2]
+		iter_ = widget.get_active_iter()
+		type_ = model[iter_][2]
 		model = self.protocol_jid_combobox.get_model()
 		model.clear()
 		if len(self.agents[type_]):
@@ -1841,8 +1841,8 @@ class SynchroniseSelectAccountDialog:
 			if remote_account == self.account:
 				# Do not show the account we're sync'ing
 				continue
-			iter = model.append()
-			model.set(iter, 0, remote_account, 1, gajim.get_hostname_from_account(
+			iter_ = model.append()
+			model.set(iter_, 0, remote_account, 1, gajim.get_hostname_from_account(
 				remote_account))
 
 	def on_cancel_button_clicked(self, widget):
@@ -1850,10 +1850,10 @@ class SynchroniseSelectAccountDialog:
 
 	def on_ok_button_clicked(self, widget):
 		sel = self.accounts_treeview.get_selection()
-		(model, iter) = sel.get_selected()
-		if not iter:
+		(model, iter_) = sel.get_selected()
+		if not iter_:
 			return
-		remote_account = model.get_value(iter, 0).decode('utf-8')
+		remote_account = model.get_value(iter_, 0).decode('utf-8')
 
 		if gajim.connections[remote_account].connected < 2:
 			ErrorDialog(_('This account is not connected to the server'),
@@ -1892,8 +1892,8 @@ class SynchroniseSelectContactsDialog:
 
 	def toggled_callback(self, cell, path):
 		model = self.contacts_treeview.get_model()
-		iter = model.get_iter(path)
-		model[iter][0] = not cell.get_active()
+		iter_ = model.get_iter(path)
+		model[iter_][0] = not cell.get_active()
 
 	def on_contacts_window_key_press_event(self, widget, event):
 		if event.keyval == gtk.keysyms.Escape:
@@ -1910,19 +1910,19 @@ class SynchroniseSelectContactsDialog:
 		remote_jid_list = gajim.contacts.get_jid_list(self.remote_account)
 		for remote_jid in remote_jid_list:
 			if remote_jid not in local_jid_list:
-				iter = model.append()
-				model.set(iter, 0, True, 1, remote_jid)
+				iter_ = model.append()
+				model.set(iter_, 0, True, 1, remote_jid)
 
 	def on_cancel_button_clicked(self, widget):
 		self.dialog.destroy()
 
 	def on_ok_button_clicked(self, widget):
 		model = self.contacts_treeview.get_model()
-		iter = model.get_iter_root()
-		while iter:
-			if model[iter][0]:
+		iter_ = model.get_iter_root()
+		while iter_:
+			if model[iter_][0]:
 				# it is selected
-				remote_jid = model[iter][1].decode('utf-8')
+				remote_jid = model[iter_][1].decode('utf-8')
 				message = 'I\'m synchronizing my contacts from my %s account, could you please add this address to your contact list?' % \
 					gajim.get_hostname_from_account(self.remote_account)
 				remote_contact = gajim.contacts.get_first_contact_from_jid(
@@ -1931,7 +1931,7 @@ class SynchroniseSelectContactsDialog:
 				gajim.interface.roster.req_sub(self, remote_jid, message,
 					self.local_account, groups = remote_contact.groups,
 					nickname = remote_contact.name, auto_auth = True)
-			iter = model.iter_next(iter)
+			iter_ = model.iter_next(iter_)
 		self.dialog.destroy()
 
 class NewChatDialog(InputDialog):
@@ -2413,14 +2413,14 @@ class XMLConsoleWindow:
 		self.input_textview = self.xml.get_widget('input_textview')
 		self.stanzas_log_textview = self.xml.get_widget('stanzas_log_textview')
 		self.input_tv_buffer = self.input_textview.get_buffer()
-		buffer = self.stanzas_log_textview.get_buffer()
-		end_iter = buffer.get_end_iter()
-		buffer.create_mark('end', end_iter, False)
+		buffer_ = self.stanzas_log_textview.get_buffer()
+		end_iter = buffer_.get_end_iter()
+		buffer_.create_mark('end', end_iter, False)
 
-		self.tagIn = buffer.create_tag('incoming')
+		self.tagIn = buffer_.create_tag('incoming')
 		color = gajim.config.get('inmsgcolor')
 		self.tagIn.set_property('foreground', color)
-		self.tagOut = buffer.create_tag('outgoing')
+		self.tagOut = buffer_.create_tag('outgoing')
 		color = gajim.config.get('outmsgcolor')
 		self.tagOut.set_property('foreground', color)
 
@@ -2444,16 +2444,16 @@ class XMLConsoleWindow:
 		return True # do NOT destroy the window
 
 	def on_clear_button_clicked(self, widget):
-		buffer = self.stanzas_log_textview.get_buffer()
-		buffer.set_text('')
+		buffer_ = self.stanzas_log_textview.get_buffer()
+		buffer_.set_text('')
 
 	def on_enable_checkbutton_toggled(self, widget):
 		self.enabled = widget.get_active()
 
 	def scroll_to_end(self, ):
 		parent = self.stanzas_log_textview.get_parent()
-		buffer = self.stanzas_log_textview.get_buffer()
-		end_mark = buffer.get_mark('end')
+		buffer_ = self.stanzas_log_textview.get_buffer()
+		end_mark = buffer_.get_mark('end')
 		if not end_mark:
 			return False
 		self.stanzas_log_textview.scroll_to_mark(end_mark, 0, True,	0, 1)
@@ -3030,16 +3030,16 @@ class SoundChooserDialog(FileChooserDialog):
 			on_response_ok = (on_ok, on_response_ok),
 			on_response_cancel = on_response_cancel)
 
-		filter = gtk.FileFilter()
-		filter.set_name(_('All files'))
-		filter.add_pattern('*')
-		self.add_filter(filter)
+		filter_ = gtk.FileFilter()
+		filter_.set_name(_('All files'))
+		filter_.add_pattern('*')
+		self.add_filter(filter_)
 
-		filter = gtk.FileFilter()
-		filter.set_name(_('Wav Sounds'))
-		filter.add_pattern('*.wav')
-		self.add_filter(filter)
-		self.set_filter(filter)
+		filter_ = gtk.FileFilter()
+		filter_.set_name(_('Wav Sounds'))
+		filter_.add_pattern('*.wav')
+		self.add_filter(filter_)
+		self.set_filter(filter_)
 
 		if path_to_snd_file:
 			self.set_filename(path_to_snd_file)
@@ -3081,21 +3081,21 @@ class ImageChooserDialog(FileChooserDialog):
 		if on_response_cancel:
 			self.connect('destroy', on_response_cancel)
 
-		filter = gtk.FileFilter()
-		filter.set_name(_('All files'))
-		filter.add_pattern('*')
-		self.add_filter(filter)
-
-		filter = gtk.FileFilter()
-		filter.set_name(_('Images'))
-		filter.add_mime_type('image/png')
-		filter.add_mime_type('image/jpeg')
-		filter.add_mime_type('image/gif')
-		filter.add_mime_type('image/tiff')
-		filter.add_mime_type('image/svg+xml')
-		filter.add_mime_type('image/x-xpixmap') # xpm
-		self.add_filter(filter)
-		self.set_filter(filter)
+		filter_ = gtk.FileFilter()
+		filter_.set_name(_('All files'))
+		filter_.add_pattern('*')
+		self.add_filter(filter_)
+
+		filter_ = gtk.FileFilter()
+		filter_.set_name(_('Images'))
+		filter_.add_mime_type('image/png')
+		filter_.add_mime_type('image/jpeg')
+		filter_.add_mime_type('image/gif')
+		filter_.add_mime_type('image/tiff')
+		filter_.add_mime_type('image/svg+xml')
+		filter_.add_mime_type('image/x-xpixmap') # xpm
+		self.add_filter(filter_)
+		self.set_filter(filter_)
 
 		if path_to_file:
 			self.set_filename(path_to_file)
@@ -3241,8 +3241,8 @@ class AdvancedNotificationsWindow:
 		# Fill conditions_treeview
 		num = 0
 		while gajim.config.get_per('notifications', str(num)):
-			iter = model.append((num, ''))
-			path = model.get_path(iter)
+			iter_ = model.append((num, ''))
+			path = model.get_path(iter_)
 			self.conditions_treeview.set_cursor(path)
 			self.active_num = num
 			self.initiate_rule_state()
@@ -3337,8 +3337,8 @@ class AdvancedNotificationsWindow:
 		self.urgency_hint_cb.set_active(value)
 
 	def set_treeview_string(self):
-		(model, iter) = self.conditions_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.conditions_treeview.get_selection().get_selected()
+		if not iter_:
 			return
 		event = self.event_combobox.get_active_text()
 		recipient_type = self.recipient_type_combobox.get_active_text()
@@ -3352,15 +3352,15 @@ class AdvancedNotificationsWindow:
 			for st in ('online', 'away', 'xa', 'dnd', 'invisible'):
 				if self.__dict__[st + '_cb'].get_active():
 					status += helpers.get_uf_show(st) + ' '
-		model[iter][1] = "When %s for %s %s %s" % (event, recipient_type,
+		model[iter_][1] = "When %s for %s %s %s" % (event, recipient_type,
 			recipient, status)
 
 	def on_conditions_treeview_cursor_changed(self, widget):
-		(model, iter) = widget.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = widget.get_selection().get_selected()
+		if not iter_:
 			self.active_num = -1
 			return
-		self.active_num = model[iter][0]
+		self.active_num = model[iter_][0]
 		if self.active_num == 0:
 			self.up_button.set_sensitive(False)
 		else:
@@ -3378,19 +3378,19 @@ class AdvancedNotificationsWindow:
 		model = self.conditions_treeview.get_model()
 		num = self.conditions_treeview.get_model().iter_n_children(None)
 		gajim.config.add_per('notifications', str(num))
-		iter = model.append((num, ''))
-		path = model.get_path(iter)
+		iter_ = model.append((num, ''))
+		path = model.get_path(iter_)
 		self.conditions_treeview.set_cursor(path)
 		self.active_num = num
 		self.set_treeview_string()
 		self.config_vbox.set_sensitive(True)
 
 	def on_delete_button_clicked(self, widget):
-		(model, iter) = self.conditions_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.conditions_treeview.get_selection().get_selected()
+		if not iter_:
 			return
 		# up all others
-		iter2 = model.iter_next(iter)
+		iter2 = model.iter_next(iter_)
 		num = self.active_num
 		while iter2:
 			num = model[iter2][0]
@@ -3399,7 +3399,7 @@ class AdvancedNotificationsWindow:
 				val = gajim.config.get_per('notifications', str(num), opt)
 				gajim.config.set_per('notifications', str(num - 1), opt, val)
 			iter2 = model.iter_next(iter2)
-		model.remove(iter)
+		model.remove(iter_)
 		gajim.config.del_per('notifications', str(num)) # delete latest
 		self.active_num = -1
 		self.config_vbox.set_sensitive(False)
@@ -3408,9 +3408,9 @@ class AdvancedNotificationsWindow:
 		self.down_button.set_sensitive(False)
 
 	def on_up_button_clicked(self, widget):
-		(model, iter) = self.conditions_treeview.get_selection().\
+		(model, iter_) = self.conditions_treeview.get_selection().\
 			get_selected()
-		if not iter:
+		if not iter_:
 			return
 		for opt in self.config_options:
 			val = gajim.config.get_per('notifications', str(self.active_num), opt)
@@ -3420,16 +3420,16 @@ class AdvancedNotificationsWindow:
 			gajim.config.set_per('notifications', str(self.active_num - 1), opt,
 				val)
 
-		model[iter][0] = self.active_num - 1
+		model[iter_][0] = self.active_num - 1
 		# get previous iter
-		path = model.get_path(iter)
-		iter = model.get_iter((path[0] - 1,))
-		model[iter][0] = self.active_num
+		path = model.get_path(iter_)
+		iter_ = model.get_iter((path[0] - 1,))
+		model[iter_][0] = self.active_num
 		self.on_conditions_treeview_cursor_changed(self.conditions_treeview)
 
 	def on_down_button_clicked(self, widget):
-		(model, iter) = self.conditions_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.conditions_treeview.get_selection().get_selected()
+		if not iter_:
 			return
 		for opt in self.config_options:
 			val = gajim.config.get_per('notifications', str(self.active_num), opt)
@@ -3439,9 +3439,9 @@ class AdvancedNotificationsWindow:
 			gajim.config.set_per('notifications', str(self.active_num + 1), opt,
 				val)
 
-		model[iter][0] = self.active_num + 1
-		iter = model.iter_next(iter)
-		model[iter][0] = self.active_num
+		model[iter_][0] = self.active_num + 1
+		iter_ = model.iter_next(iter_)
+		model[iter_][0] = self.active_num
 		self.on_conditions_treeview_cursor_changed(self.conditions_treeview)
 
 	def on_event_combobox_changed(self, widget):
@@ -3730,10 +3730,10 @@ class TransformChatToMUC:
 					name = contact.name
 					if name == '':
 						name = jid.split('@')[0]
-					iter = self.store.append([img.get_pixbuf(), name, jid])
+					iter_ = self.store.append([img.get_pixbuf(), name, jid])
 					# preselect treeview rows
 					if self.preselected_jids and jid in self.preselected_jids:
-						path = self.store.get_path(iter)
+						path = self.store.get_path(iter_)
 						self.guests_treeview.get_selection().\
 							select_path(path)
 
@@ -3759,8 +3759,8 @@ class TransformChatToMUC:
 		guest_list = []
 		guests = self.guests_treeview.get_selection().get_selected_rows()
 		for guest in guests[1]:
-			iter = self.store.get_iter(guest)
-			guest_list.append(self.store[iter][2].decode('utf-8'))
+			iter_ = self.store.get_iter(guest)
+			guest_list.append(self.store[iter_][2].decode('utf-8'))
 		for guest in self.auto_jids:
 			guest_list.append(guest)
 		room_jid = room_id + '@' + server
@@ -3821,7 +3821,7 @@ class ESessionInfoWindow:
 
 	def update_info(self):
 		labeltext = _('''Your chat session with <b>%(jid)s</b> is encrypted.\n\nThis session's Short Authentication String is <b>%(sas)s</b>.''') % {'jid': self.session.jid, 'sas': self.session.sas}
-		dir = os.path.join(gajim.DATA_DIR, 'pixmaps')
+		dir_ = os.path.join(gajim.DATA_DIR, 'pixmaps')
 
 		if self.session.verified_identity:
 			labeltext += '\n\n' + _('''You have already verified this contact's identity.''')
@@ -3855,7 +3855,7 @@ class ESessionInfoWindow:
 
 			self.button_label.set_text(_('Verify...'))
 
-		path = os.path.join(dir, security_image)
+		path = os.path.join(dir_, security_image)
 		filename = os.path.abspath(path)
 		self.security_image.set_from_file(filename)
 
@@ -3926,8 +3926,8 @@ class GPGInfoWindow:
 			verification_status)
 		info_label.set_markup(info)
 
-		dir = os.path.join(gajim.DATA_DIR, 'pixmaps')
-		path = os.path.join(dir, image)
+		dir_ = os.path.join(gajim.DATA_DIR, 'pixmaps')
+		path = os.path.join(dir_, image)
 		filename = os.path.abspath(path)
 		security_image.set_from_file(filename)
 
diff --git a/src/disco.py b/src/disco.py
index e09e63e531..944c0fc0ec 100644
--- a/src/disco.py
+++ b/src/disco.py
@@ -35,9 +35,9 @@
 # - def default_action(self)
 # - def _find_item(self, jid, node)
 # - def _add_item(self, jid, node, item, force)
-# - def _update_item(self, iter, jid, node, item)
-# - def _update_info(self, iter, jid, node, identities, features, data)
-# - def _update_error(self, iter, jid, node)
+# - def _update_item(self, iter_, jid, node, item)
+# - def _update_info(self, iter_, jid, node, identities, features, data)
+# - def _update_error(self, iter_, jid, node)
 #
 # * Should call the super class for this method.
 # All others do not have to call back to the super class. (but can if they want
@@ -258,8 +258,8 @@ class ServicesCache:
 		# Grab the first identity with an icon
 		for identity in identities:
 			try:
-				cat, type = identity['category'], identity['type']
-				info = _agent_type_info[(cat, type)]
+				cat, type_ = identity['category'], identity['type']
+				info = _agent_type_info[(cat, type_)]
 			except KeyError:
 				continue
 			filename = info[1]
@@ -267,7 +267,6 @@ class ServicesCache:
 				break
 		else:
 			# Loop fell through, default to unknown
-			cat = type = 0
 			info = _agent_type_info[(0, 0)]
 			filename = info[1]
 		if not filename: # we don't have an image to show for this type
@@ -865,12 +864,12 @@ class AgentBrowser:
 	def on_browse_button_clicked(self, widget = None):
 		'''When we want to browse an agent:
 		Open a new services window with a browser for the agent type.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][0].decode('utf-8')
+		jid = model[iter_][0].decode('utf-8')
 		if jid:
-			node = model[iter][1].decode('utf-8')
+			node = model[iter_][1].decode('utf-8')
 			self.window.open(jid, node)
 
 	def update_actions(self):
@@ -878,11 +877,11 @@ class AgentBrowser:
 		activate action buttons based on the agent's info.'''
 		if self.browse_button:
 			self.browse_button.set_sensitive(False)
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][0].decode('utf-8')
-		node = model[iter][1].decode('utf-8')
+		jid = model[iter_][0].decode('utf-8')
+		node = model[iter_][1].decode('utf-8')
 		if jid:
 			self.cache.get_info(jid, node, self._update_actions, nofetch = True)
 
@@ -897,11 +896,11 @@ class AgentBrowser:
 	def default_action(self):
 		'''When we double-click a row:
 		perform the default action on the selected item.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][0].decode('utf-8')
-		node = model[iter][1].decode('utf-8')
+		jid = model[iter_][0].decode('utf-8')
+		node = model[iter_][1].decode('utf-8')
 		if jid:
 			self.cache.get_info(jid, node, self._default_action, nofetch = True)
 
@@ -932,15 +931,15 @@ class AgentBrowser:
 	def _find_item(self, jid, node):
 		'''Check if an item is already in the treeview. Return an iter to it
 		if so, None otherwise.'''
-		iter = self.model.get_iter_root()
-		while iter:
-			cjid = self.model.get_value(iter, 0).decode('utf-8')
-			cnode = self.model.get_value(iter, 1).decode('utf-8')
+		iter_ = self.model.get_iter_root()
+		while iter_:
+			cjid = self.model.get_value(iter_, 0).decode('utf-8')
+			cnode = self.model.get_value(iter_, 1).decode('utf-8')
 			if jid == cjid and node == cnode:
 				break
-			iter = self.model.iter_next(iter)
-		if iter:
-			return iter
+			iter_ = self.model.iter_next(iter_)
+		if iter_:
+			return iter_
 		return None
 
 	def _agent_items(self, jid, node, items, force):
@@ -971,16 +970,16 @@ _('This service does not contain any items to browse.'))
 
 	def _agent_info(self, jid, node, identities, features, data):
 		'''Callback for when we receive info about an agent's item.'''
-		iter = self._find_item(jid, node)
-		if not iter:
+		iter_ = self._find_item(jid, node)
+		if not iter_:
 			# Not in the treeview, stop
 			return
 		if identities == 0:
 			# The server returned an error
-			self._update_error(iter, jid, node)
+			self._update_error(iter_, jid, node)
 		else:
 			# We got our info
-			self._update_info(iter, jid, node, identities, features, data)
+			self._update_info(iter_, jid, node, identities, features, data)
 		self.update_actions()
 
 	def _add_item(self, jid, node, item, force):
@@ -1101,14 +1100,14 @@ class ToplevelAgentBrowser(AgentBrowser):
 				self.tooltip.hide_tooltip()
 		if props:
 			row = props[0]
-			iter = None
+			iter_ = None
 			try:
-				iter = self.model.get_iter(row)
+				iter_ = self.model.get_iter(row)
 			except Exception:
 				self.tooltip.hide_tooltip()
 				return
-			jid = self.model[iter][0]
-			state = self.model[iter][4]
+			jid = self.model[iter_][0]
+			state = self.model[iter_][4]
 			# Not a category, and we have something to say about state
 			if jid and state > 0 and \
 					(self.tooltip.timeout == 0 or self.tooltip.id != props[0]):
@@ -1235,10 +1234,10 @@ class ToplevelAgentBrowser(AgentBrowser):
 	def on_search_button_clicked(self, widget = None):
 		'''When we want to search something:
 		open search window'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		service = model[iter][0].decode('utf-8')
+		service = model[iter_][0].decode('utf-8')
 		if service in gajim.interface.instances[self.account]['search']:
 			gajim.interface.instances[self.account]['search'][service].present()
 		else:
@@ -1259,20 +1258,20 @@ class ToplevelAgentBrowser(AgentBrowser):
 	def on_execute_button_clicked(self, widget = None):
 		'''When we want to execute a command:
 		open adhoc command window'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		service = model[iter][0].decode('utf-8')
+		service = model[iter_][0].decode('utf-8')
 		adhoc_commands.CommandWindow(self.account, service)
 
 	def on_register_button_clicked(self, widget = None):
 		'''When we want to register an agent:
 		request information about registering with the agent and close the
 		window.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][0].decode('utf-8')
+		jid = model[iter_][0].decode('utf-8')
 		if jid:
 			gajim.connections[self.account].request_register_agent_info(jid)
 			self.window.destroy(chain = True)
@@ -1280,10 +1279,10 @@ class ToplevelAgentBrowser(AgentBrowser):
 	def on_join_button_clicked(self, widget):
 		'''When we want to join an IRC room or create a new MUC room:
 		Opens the join_groupchat_window.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		service = model[iter][0].decode('utf-8')
+		service = model[iter_][0].decode('utf-8')
 		if 'join_gc' not in gajim.interface.instances[self.account]:
 			try:
 				dialogs.JoinGroupchatWindow(self.account, service)
@@ -1304,25 +1303,25 @@ class ToplevelAgentBrowser(AgentBrowser):
 			self.join_button.set_sensitive(False)
 		if self.search_button:
 			self.search_button.set_sensitive(False)
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		if not model[iter][0]:
+		if not model[iter_][0]:
 			# We're on a category row
 			return
-		if model[iter][4] != 0:
+		if model[iter_][4] != 0:
 			# We don't have the info (yet)
 			# It's either unknown or a transport, register button should be active
 			if self.register_button:
 				self.register_button.set_sensitive(True)
 			# Guess what kind of service we're dealing with
 			if self.browse_button:
-				jid = model[iter][0].decode('utf-8')
-				type = gajim.get_transport_name_from_jid(jid,
+				jid = model[iter_][0].decode('utf-8')
+				type_ = gajim.get_transport_name_from_jid(jid,
 							use_config_setting = False)
-				if type:
-					identity = {'category': '_jid', 'type': type}
+				if type_:
+					identity = {'category': '_jid', 'type': type_}
 					klass = self.cache.get_browser([identity])
 					if klass:
 						self.browse_button.set_sensitive(True)
@@ -1393,13 +1392,13 @@ class ToplevelAgentBrowser(AgentBrowser):
 			fraction = float(self._progress) / float(self._total_items)
 			if self._progress >= self._total_items:
 				# We show the progressbar for just a bit before hiding it.
-				id = gobject.timeout_add_seconds(2, self._hide_progressbar_cb)
-				self._progressbar_sourceid = id
+				id_ = gobject.timeout_add_seconds(2, self._hide_progressbar_cb)
+				self._progressbar_sourceid = id_
 			else:
 				self.window.progressbar.show()
 				# Hide the progressbar if we're timing out anyways. (20 secs)
-				id = gobject.timeout_add_seconds(20, self._hide_progressbar_cb)
-				self._progressbar_sourceid = id
+				id_ = gobject.timeout_add_seconds(20, self._hide_progressbar_cb)
+				self._progressbar_sourceid = id_
 		self.window.progressbar.set_fraction(fraction)
 
 	def _hide_progressbar_cb(self, *args):
@@ -1432,29 +1431,29 @@ class ToplevelAgentBrowser(AgentBrowser):
 	def _find_category(self, cat, type_=None):
 		'''Looks up a category row and returns the iterator to it, or None.'''
 		cat = self._friendly_category(cat, type_)[0]
-		iter = self.model.get_iter_root()
-		while iter:
-			if self.model.get_value(iter, 3).decode('utf-8') == cat:
+		iter_ = self.model.get_iter_root()
+		while iter_:
+			if self.model.get_value(iter_, 3).decode('utf-8') == cat:
 				break
-			iter = self.model.iter_next(iter)
-		if iter:
-			return iter
+			iter_ = self.model.iter_next(iter_)
+		if iter_:
+			return iter_
 		return None
 
 	def _find_item(self, jid, node):
-		iter = None
+		iter_ = None
 		cat_iter = self.model.get_iter_root()
-		while cat_iter and not iter:
-			iter = self.model.iter_children(cat_iter)
-			while iter:
-				cjid = self.model.get_value(iter, 0).decode('utf-8')
-				cnode = self.model.get_value(iter, 1).decode('utf-8')
+		while cat_iter and not iter_:
+			iter_ = self.model.iter_children(cat_iter)
+			while iter_:
+				cjid = self.model.get_value(iter_, 0).decode('utf-8')
+				cnode = self.model.get_value(iter_, 1).decode('utf-8')
 				if jid == cjid and node == cnode:
 					break
-				iter = self.model.iter_next(iter)
+				iter_ = self.model.iter_next(iter_)
 			cat_iter = self.model.iter_next(cat_iter)
-		if iter:
-			return iter
+		if iter_:
+			return iter_
 		return None
 
 	def _add_item(self, jid, node, item, force):
@@ -1466,12 +1465,12 @@ class ToplevelAgentBrowser(AgentBrowser):
 			descr = "<b>%s</b>" % addr
 		# Guess which kind of service this is
 		identities = []
-		type = gajim.get_transport_name_from_jid(jid,
+		type_ = gajim.get_transport_name_from_jid(jid,
 					use_config_setting = False)
-		if type:
-			identity = {'category': '_jid', 'type': type}
+		if type_:
+			identity = {'category': '_jid', 'type': type_}
 			identities.append(identity)
-			cat_args = ('_jid', type)
+			cat_args = ('_jid', type_)
 		else:
 			# Put it in the 'other' category for now
 			cat_args = ('other',)
@@ -1511,7 +1510,7 @@ class ToplevelAgentBrowser(AgentBrowser):
 		pix = self.cache.get_icon(identities)
 		for identity in identities:
 			try:
-				cat, type = identity['category'], identity['type']
+				cat, type_ = identity['category'], identity['type']
 			except KeyError:
 				continue
 			break
@@ -1534,9 +1533,9 @@ class ToplevelAgentBrowser(AgentBrowser):
 		if not self.model.iter_children(old_cat_iter):
 			self.model.remove(old_cat_iter)
 
-		cat_iter = self._find_category(cat, type)
+		cat_iter = self._find_category(cat, type_)
 		if not cat_iter:
-			cat_iter = self._create_category(cat, type)
+			cat_iter = self._create_category(cat, type_)
 		self.model.append(cat_iter, (jid, node, pix, descr, 0))
 		self._expand_all()
 
@@ -1628,11 +1627,11 @@ class MucBrowser(AgentBrowser):
 	def on_join_button_clicked(self, *args):
 		'''When we want to join a conference:
 		Ask specific informations about the selected agent and close the window'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		service = model[iter][0].decode('utf-8')
-		room = model[iter][1].decode('utf-8')
+		service = model[iter_][0].decode('utf-8')
+		room = model[iter_][1].decode('utf-8')
 		if 'join_gc' not in gajim.interface.instances[self.account]:
 			try:
 				dialogs.JoinGroupchatWindow(self.account, service)
@@ -1674,12 +1673,12 @@ class MucBrowser(AgentBrowser):
 		# We have to do this in a pygtk <2.8 compatible way :/
 		#start, end = self.window.services_treeview.get_visible_range()
 		rect = view.get_visible_rect()
-		iter = end = None
+		iter_ = end = None
 		# Top row
 		try:
 			sx, sy = view.tree_to_widget_coords(rect.x, rect.y)
 			spath = view.get_path_at_pos(sx, sy)[0]
-			iter = self.model.get_iter(spath)
+			iter_ = self.model.get_iter(spath)
 		except TypeError:
 			self._fetch_source = None
 			return
@@ -1694,14 +1693,14 @@ class MucBrowser(AgentBrowser):
 		except TypeError:
 			# We're at the end of the model, we can leave end=None though.
 			pass
-		while iter and self.model.get_path(iter) != end:
-			if not self.model.get_value(iter, 6):
-				jid = self.model.get_value(iter, 0).decode('utf-8')
-				node = self.model.get_value(iter, 1).decode('utf-8')
+		while iter_ and self.model.get_path(iter_) != end:
+			if not self.model.get_value(iter_, 6):
+				jid = self.model.get_value(iter_, 0).decode('utf-8')
+				node = self.model.get_value(iter_, 1).decode('utf-8')
 				self.cache.get_info(jid, node, self._agent_info)
 				self._fetch_source = True
 				return
-			iter = self.model.iter_next(iter)
+			iter_ = self.model.iter_next(iter_)
 		self._fetch_source = None
 
 	def _channel_altinfo(self, jid, node, items, name = None):
@@ -1722,13 +1721,13 @@ class MucBrowser(AgentBrowser):
 				self._fetch_source = None
 				return
 		else:
-			iter = self._find_item(jid, node)
-			if iter:
+			iter_ = self._find_item(jid, node)
+			if iter_:
 				if name:
-					self.model[iter][2] = name
-				self.model[iter][3] = len(items) # The number of users
-				self.model[iter][4] = str(len(items)) # The number of users
-				self.model[iter][6] = True
+					self.model[iter_][2] = name
+				self.model[iter_][3] = len(items) # The number of users
+				self.model[iter_][4] = str(len(items)) # The number of users
+				self.model[iter_][6] = True
 		self._fetch_source = None
 		self._query_visible()
 
@@ -1916,42 +1915,42 @@ class DiscussionGroupsBrowser(AgentBrowser):
 		# we have nothing to do if we don't have buttons...
 		if self.subscribe_button is None: return
 
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if not iter or self.subscriptions is None:
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if not iter_ or self.subscriptions is None:
 			# no item selected or no subscriptions info, all buttons are insensitive
 			self.post_button.set_sensitive(False)
 			self.subscribe_button.set_sensitive(False)
 			self.unsubscribe_button.set_sensitive(False)
 		else:
-			subscribed = model.get_value(iter, 4) # 4 = subscribed?
+			subscribed = model.get_value(iter_, 4) # 4 = subscribed?
 			self.post_button.set_sensitive(subscribed)
 			self.subscribe_button.set_sensitive(not subscribed)
 			self.unsubscribe_button.set_sensitive(subscribed)
 
 	def on_post_button_clicked(self, widget):
 		'''Called when 'post' button is pressed. Open window to create post'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if iter is None: return
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if iter_ is None: return
 
-		groupnode = model.get_value(iter, 1)	# 1 = groupnode
+		groupnode = model.get_value(iter_, 1)	# 1 = groupnode
 
 		groups.GroupsPostWindow(self.account, self.jid, groupnode)
 
 	def on_subscribe_button_clicked(self, widget):
 		'''Called when 'subscribe' button is pressed. Send subscribtion request.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if iter is None: return
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if iter_ is None: return
 
-		groupnode = model.get_value(iter, 1)	# 1 = groupnode
+		groupnode = model.get_value(iter_, 1)	# 1 = groupnode
 
 		gajim.connections[self.account].send_pb_subscribe(self.jid, groupnode, self._subscribeCB, groupnode)
 		
 	def on_unsubscribe_button_clicked(self, widget):
 		'''Called when 'unsubscribe' button is pressed. Send unsubscription request.'''
-		model, iter = self.window.services_treeview.get_selection().get_selected()
-		if iter is None: return
+		model, iter_ = self.window.services_treeview.get_selection().get_selected()
+		if iter_ is None: return
 
-		groupnode = model.get_value(iter, 1) # 1 = groupnode
+		groupnode = model.get_value(iter_, 1) # 1 = groupnode
 		
 		gajim.connections[self.account].send_pb_unsubscribe(self.jid, groupnode, self._unsubscribeCB, groupnode)
 
diff --git a/src/features_window.py b/src/features_window.py
index 2b862b3ef9..d3c9f7d423 100644
--- a/src/features_window.py
+++ b/src/features_window.py
@@ -268,10 +268,10 @@ class FeaturesWindow:
 		texstr += '\\begin{document}\\begin{large}\\begin{gather*}test'
 		texstr += '\\end{gather*}\\end{large}\\end{document}'
 
-		file = open(os.path.join(tmpfile + ".tex"), "w+")
-		file.write(texstr)
-		file.flush()
-		file.close()
+		file_ = open(os.path.join(tmpfile + ".tex"), "w+")
+		file_.write(texstr)
+		file_.flush()
+		file_.close()
 		try:
 			if os.name == 'nt':
 				# CREATE_NO_WINDOW
diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py
index f348f68b18..d1f184166c 100644
--- a/src/filetransfers_window.py
+++ b/src/filetransfers_window.py
@@ -395,17 +395,17 @@ _('Connection with peer cannot be established.'))
 
 	def set_status(self, typ, sid, status):
 		''' change the status of a transfer to state 'status' '''
-		iter = self.get_iter_by_sid(typ, sid)
-		if iter is None:
+		iter_ = self.get_iter_by_sid(typ, sid)
+		if iter_ is None:
 			return
-		sid = self.model[iter][C_SID].decode('utf-8')
+		sid = self.model[iter_][C_SID].decode('utf-8')
 		file_props = self.files_props[sid[0]][sid[1:]]
 		if status == 'stop':
 			file_props['stopped'] = True
 		elif status == 'ok':
 			file_props['completed'] = True
-		self.model.set(iter, C_IMAGE, self.get_icon(status))
-		path = self.model.get_path(iter)
+		self.model.set(iter_, C_IMAGE, self.get_icon(status))
+		path = self.model.get_path(iter_)
 		self.select_func(path)
 
 	def _format_percent(self, percent):
@@ -548,11 +548,11 @@ _('Connection with peer cannot be established.'))
 	def get_iter_by_sid(self, typ, sid):
 		'''returns iter to the row, which holds file transfer, identified by the
 		session id'''
-		iter = self.model.get_iter_root()
-		while iter:
-			if typ + sid == self.model[iter][C_SID].decode('utf-8'):
-				return iter
-			iter = self.model.iter_next(iter)
+		iter_ = self.model.get_iter_root()
+		while iter_:
+			if typ + sid == self.model[iter_][C_SID].decode('utf-8'):
+				return iter_
+			iter_ = self.model.iter_next(iter_)
 
 	def get_send_file_props(self, account, contact, file_path, file_name,
 	file_desc=''):
@@ -588,7 +588,7 @@ _('Connection with peer cannot be established.'))
 			return
 		file_props['elapsed-time'] = 0
 		self.files_props[file_props['type']][file_props['sid']] = file_props
-		iter = self.model.append()
+		iter_ = self.model.append()
 		text_labels = '<b>' + _('Name: ') + '</b>\n' 
 		if file_props['type'] == 'r':
 			text_labels += '<b>' + _('Sender: ') + '</b>' 
@@ -601,9 +601,9 @@ _('Connection with peer cannot be established.'))
 			file_name = file_props['name']
 		text_props = gobject.markup_escape_text(file_name) + '\n'
 		text_props += contact.get_shown_name()
-		self.model.set(iter, 1, text_labels, 2, text_props, C_SID,
+		self.model.set(iter_, 1, text_labels, 2, text_props, C_SID,
 			file_props['type'] + file_props['sid'])
-		self.set_progress(file_props['type'], file_props['sid'], 0, iter)
+		self.set_progress(file_props['type'], file_props['sid'], 0, iter_)
 		if 'started' in file_props and file_props['started'] is False:
 			status = 'waiting'
 		elif file_props['type'] == 'r':
@@ -624,13 +624,13 @@ _('Connection with peer cannot be established.'))
 				self.tooltip.hide_tooltip()
 		if props:
 			row = props[0]
-			iter = None
+			iter_ = None
 			try:
-				iter = self.model.get_iter(row)
+				iter_ = self.model.get_iter(row)
 			except Exception:
 				self.tooltip.hide_tooltip()
 				return
-			sid = self.model[iter][C_SID].decode('utf-8')
+			sid = self.model[iter_][C_SID].decode('utf-8')
 			file_props = self.files_props[sid[0]][sid[1:]]
 			if file_props is not None:
 				if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
@@ -767,11 +767,11 @@ _('Connection with peer cannot be established.'))
 	def on_cleanup_button_clicked(self, widget):
 		i = len(self.model) - 1
 		while i >= 0:
-			iter = self.model.get_iter((i))
-			sid = self.model[iter][C_SID].decode('utf-8')
+			iter_ = self.model.get_iter((i))
+			sid = self.model[iter_][C_SID].decode('utf-8')
 			file_props = self.files_props[sid[0]][sid[1:]]
 			if self.is_transfer_stopped(file_props):
-				self._remove_transfer(iter, sid, file_props)
+				self._remove_transfer(iter_, sid, file_props)
 			i -= 1
 		self.tree.get_selection().unselect_all()
 		self.set_all_insensitive()
@@ -844,8 +844,8 @@ _('Connection with peer cannot be established.'))
 		# check if the current pointer is at the same path
 		# as it was before setting the timeout
 		if props and self.tooltip.id == props[0]:
-			iter = self.model.get_iter(props[0])
-			sid = self.model[iter][C_SID].decode('utf-8')
+			iter_ = self.model.get_iter(props[0])
+			sid = self.model[iter_][C_SID].decode('utf-8')
 			file_props = self.files_props[sid[0]][sid[1:]]
 			# bounding rectangle of coordinates for the cell within the treeview
 			rect =  self.tree.get_cell_area(props[0],props[1])
@@ -883,18 +883,18 @@ _('Connection with peer cannot be established.'))
 	def on_transfers_list_key_press_event(self, widget, event):
 		'''when a key is pressed in the treeviews'''
 		self.tooltip.hide_tooltip()
-		iter = None
+		iter_ = None
 		try:
-			iter = self.tree.get_selection().get_selected()[1]
+			iter_ = self.tree.get_selection().get_selected()[1]
 		except TypeError:
 			self.tree.get_selection().unselect_all()
 
-		if iter is not None:
-			path = self.model.get_path(iter)
+		if iter_ is not None:
+			path = self.model.get_path(iter_)
 			self.tree.get_selection().select_path(path)
 
 		if event.keyval == gtk.keysyms.Menu:
-			self.show_context_menu(event, iter)
+			self.show_context_menu(event, iter_)
 			return True
 
 
@@ -914,7 +914,7 @@ _('Connection with peer cannot be established.'))
 	def on_transfers_list_button_press_event(self, widget, event):
 		# hide tooltip, no matter the button is pressed
 		self.tooltip.hide_tooltip()
-		path, iter = None, None
+		path, iter_ = None, None
 		try:
 			path = self.tree.get_path_at_pos(int(event.x), int(event.y))[0]
 		except TypeError:
@@ -922,8 +922,8 @@ _('Connection with peer cannot be established.'))
 		if event.button == 3: # Right click
 			if path is not None:
 				self.tree.get_selection().select_path(path)
-				iter = self.model.get_iter(path)
-			self.show_context_menu(event, iter)
+				iter_ = self.model.get_iter(path)
+			self.show_context_menu(event, iter_)
 			if path is not None:
 				return True
 
diff --git a/src/gajim-remote.py b/src/gajim-remote.py
index 413a9f27ae..e373a79257 100755
--- a/src/gajim-remote.py
+++ b/src/gajim-remote.py
@@ -387,54 +387,41 @@ class GajimRemote:
 	def make_arguments_row(self, args):
 		''' return arguments list. Mandatory arguments are enclosed with:
 		'<', '>', optional arguments - with '[', ']' '''
-		str = ''
-		for argument in args:
-			str += ' '
-			if argument[2]:
-				str += '<'
+		s = ''
+		for arg in args:
+			if arg[2]:
+				s += ' <' + arg[0] + '>'
 			else:
-				str += '['
-			str += argument[0]
-			if argument[2]:
-				str += '>'
-			else:
-				str += ']'
-		return str
+				s += ' [' + arg[0] + ']'
+		return s
 
 	def help_on_command(self, command):
 		''' return help message for a given command '''
 		if command in self.commands:
 			command_props = self.commands[command]
 			arguments_str = self.make_arguments_row(command_props[1])
-			str = _('Usage: %(basename)s %(command)s %(arguments)s \n\t %(help)s')\
+			str_ = _('Usage: %(basename)s %(command)s %(arguments)s \n\t %(help)s')\
 				% {'basename': BASENAME, 'command': command,
 				'arguments': arguments_str, 'help': command_props[0]}
 			if len(command_props[1]) > 0:
-				str += '\n\n' + _('Arguments:') + '\n'
+				str_ += '\n\n' + _('Arguments:') + '\n'
 				for argument in command_props[1]:
-					str += ' ' +  argument[0] + ' - ' + argument[1] + '\n'
-			return str
+					str_ += ' ' +  argument[0] + ' - ' + argument[1] + '\n'
+			return str_
 		send_error(_('%s not found') % command)
 
 	def compose_help(self):
 		''' print usage, and list available commands '''
-		str = _('Usage: %s command [arguments]\nCommand is one of:\n' ) % BASENAME
-		commands = sorted(self.commands.keys())
-		for command in commands:
-			str += '  ' + command
-			for argument in self.commands[command][1]:
-				str += ' '
-				if argument[2]:
-					str += '<'
-				else:
-					str += '['
-				str += argument[0]
-				if argument[2]:
-					str += '>'
+		s = _('Usage: %s command [arguments]\nCommand is one of:\n' ) % BASENAME
+		for command in sorted(self.commands):
+			s += '  ' + command
+			for arg in self.commands[command][1]:
+				if arg[2]:
+					s += ' <' + arg[0] + '>'
 				else:
-					str += ']'
-			str += '\n'
-		return str
+					s += ' [' + arg[0] + ']'
+			s += '\n'
+		return s
 
 	def print_info(self, level, prop_dict, encode_return = False):
 		''' return formated string from data structure '''
diff --git a/src/gajim.py b/src/gajim.py
index a305136dd4..bdbefa3607 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -584,13 +584,13 @@ class Interface:
 
 	def handle_event_error_answer(self, account, array):
 		#('ERROR_ANSWER', account, (id, jid_from, errmsg, errcode))
-		id, jid_from, errmsg, errcode = array
-		if unicode(errcode) in ('403', '406') and id:
+		id_, jid_from, errmsg, errcode = array
+		if unicode(errcode) in ('403', '406') and id_:
 			# show the error dialog
 			ft = self.instances['file_transfers']
-			sid = id
-			if len(id) > 3 and id[2] == '_':
-				sid = id[3:]
+			sid = id_
+			if len(id_) > 3 and id_[2] == '_':
+				sid = id_[3:]
 			if sid in ft.files_props['s']:
 				file_props = ft.files_props['s'][sid]
 				file_props['error'] = -4
@@ -601,9 +601,9 @@ class Interface:
 				return
 		elif unicode(errcode) == '404':
 			conn = gajim.connections[account]
-			sid = id
-			if len(id) > 3 and id[2] == '_':
-				sid = id[3:]
+			sid = id_
+			if len(id_) > 3 and id_[2] == '_':
+				sid = id_[3:]
 			if sid in conn.files_props:
 				file_props = conn.files_props[sid]
 				self.handle_event_file_send_error(account,
@@ -922,9 +922,9 @@ class Interface:
 				if not ctrl:
 					tv = gc_control.list_treeview
 					model = tv.get_model()
-					iter = gc_control.get_contact_iter(nick)
-					if iter:
-						show = model[iter][3]
+					iter_ = gc_control.get_contact_iter(nick)
+					if iter_:
+						show = model[iter_][3]
 					else:
 						show = 'offline'
 					gc_c = gajim.contacts.create_gc_contact(room_jid = jid,
@@ -2599,8 +2599,9 @@ class Interface:
 				emots = emoticons.emoticons
 				fd = open(os.path.join(path, 'emoticons.py'), 'w')
 				fd.write('emoticons = ')
-				pprint.pprint( dict([(file, [i for i in emots.keys() if emots[i] ==\
-					file]) for file in set(emots.values())]), fd)
+				pprint.pprint( dict([
+					(file_, [i for i in emots.keys() if emots[i] == file_])
+						for file_ in set(emots.values())]), fd)
 				fd.close()
 				del emoticons
 				self._init_emoticons(path, need_reload=True)
@@ -2934,11 +2935,11 @@ class Interface:
 				os.remove(path_to_original_file)
 		if local and photo:
 			pixbuf = photo
-			type = 'png'
+			typ = 'png'
 			extension = '_local.png' # save local avatars as png file
 		else:
 			pixbuf, typ = gtkgui_helpers.get_pixbuf_from_data(photo, want_type = True)
-			if  pixbuf is None:
+			if pixbuf is None:
 				return
 			extension = '.' + typ
 			if typ not in ('jpeg', 'png'):
diff --git a/src/gajim_themes_window.py b/src/gajim_themes_window.py
index e5c7802b47..0543f00ff1 100644
--- a/src/gajim_themes_window.py
+++ b/src/gajim_themes_window.py
@@ -87,8 +87,8 @@ class GajimThemesWindow:
 
 	def on_theme_cell_edited(self, cell, row, new_name):
 		model = self.themes_tree.get_model()
-		iter = model.get_iter_from_string(row)
-		old_name = model.get_value(iter, 0).decode('utf-8')
+		iter_ = model.get_iter_from_string(row)
+		old_name = model.get_value(iter_, 0).decode('utf-8')
 		new_name = new_name.decode('utf-8')
 		if old_name == new_name:
 			return
@@ -106,14 +106,14 @@ class GajimThemesWindow:
 		properties = ['textcolor', 'bgcolor', 'font', 'fontattrs']
 		gajim.config.add_per('themes', new_config_name)
 		for option in self.options:
-			for property in properties:
-				option_name = option + property
+			for property_ in properties:
+				option_name = option + property_
 				gajim.config.set_per('themes', new_config_name, option_name,
 					gajim.config.get_per('themes', old_config_name, option_name))
 		gajim.config.del_per('themes', old_config_name)
 		if old_config_name == gajim.config.get('roster_theme'):
 			gajim.config.set('roster_theme', new_config_name)
-		model.set_value(iter, 0, new_name)
+		model.set_value(iter_, 0, new_name)
 		self.current_theme = new_name
 
 	def fill_themes_treeview(self):
@@ -125,12 +125,12 @@ class GajimThemesWindow:
 
 	def select_active_theme(self):
 		model = self.themes_tree.get_model()
-		iter = model.get_iter_root()
+		iter_ = model.get_iter_root()
 		active_theme = gajim.config.get('roster_theme').replace('_', ' ')
-		while iter:
-			theme = model[iter][0]
+		while iter_:
+			theme = model[iter_][0]
 			if theme == active_theme:
-				self.themes_tree.get_selection().select_iter(iter)
+				self.themes_tree.get_selection().select_iter(iter_)
 				self.xml.get_widget('remove_button').set_sensitive(True)
 				self.theme_options_vbox.set_sensitive(True)
 				self.theme_options_table.set_sensitive(True)
@@ -143,16 +143,16 @@ class GajimThemesWindow:
 					self.theme_options_vbox.set_sensitive(True)
 					self.theme_options_table.set_sensitive(True)
 				break
-			iter = model.iter_next(iter)
+			iter_ = model.iter_next(iter_)
 
 	def selection_changed(self, widget = None):
-		(model, iter) = self.themes_tree.get_selection().get_selected()
+		(model, iter_) = self.themes_tree.get_selection().get_selected()
 		selected = self.themes_tree.get_selection().get_selected_rows()
-		if not iter or selected[1] == []:
+		if not iter_ or selected[1] == []:
 			self.theme_options_vbox.set_sensitive(False)
 			self.theme_options_table.set_sensitive(False)
 			return
-		self.current_theme = model.get_value(iter, 0).decode('utf-8')
+		self.current_theme = model.get_value(iter_, 0).decode('utf-8')
 		self.current_theme = self.current_theme.replace(' ', '_')
 		self.set_theme_options(self.current_theme)
 		if self.current_theme == 'default':
@@ -166,23 +166,23 @@ class GajimThemesWindow:
 
 	def on_add_button_clicked(self, widget):
 		model = self.themes_tree.get_model()
-		iter = model.append()
+		iter_ = model.append()
 		i = 0
 		# don't confuse translators
 		theme_name = _('theme name')
 		theme_name_ns = theme_name.replace(' ', '_')
 		while theme_name_ns + unicode(i) in gajim.config.get_per('themes'):
 			i += 1
-		model.set_value(iter, 0, theme_name + unicode(i))
+		model.set_value(iter_, 0, theme_name + unicode(i))
 		gajim.config.add_per('themes', theme_name_ns + unicode(i))
-		self.themes_tree.get_selection().select_iter(iter)
+		self.themes_tree.get_selection().select_iter(iter_)
 		col = self.themes_tree.get_column(0)
-		path = model.get_path(iter)
+		path = model.get_path(iter_)
 		self.themes_tree.set_cursor(path, col, True)
 
 	def on_remove_button_clicked(self, widget):
-		(model, iter) = self.themes_tree.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.themes_tree.get_selection().get_selected()
+		if not iter_:
 			return
 		if self.current_theme == gajim.config.get('roster_theme'):
 			dialogs.ErrorDialog(
@@ -193,7 +193,7 @@ class GajimThemesWindow:
 		self.theme_options_table.set_sensitive(False)
 		self.xml.get_widget('remove_button').set_sensitive(False)
 		gajim.config.del_per('themes', self.current_theme)
-		model.remove(iter)
+		model.remove(iter_)
 	
 	def set_theme_options(self, theme, option = 'account'):
 		self.no_update = True
diff --git a/src/groupchat_control.py b/src/groupchat_control.py
index 6217804f04..bfc8f23021 100644
--- a/src/groupchat_control.py
+++ b/src/groupchat_control.py
@@ -181,16 +181,17 @@ class GroupchatControl(ChatControlBase):
 		self.change_nick_dialog = None
 
 		self.actions_button = self.xml.get_widget('muc_window_actions_button')
-		id = self.actions_button.connect('clicked', self.on_actions_button_clicked)
-		self.handlers[id] = self.actions_button
+		id_ = self.actions_button.connect('clicked',
+			self.on_actions_button_clicked)
+		self.handlers[id_] = self.actions_button
 
 		widget = self.xml.get_widget('change_nick_button')
-		id = widget.connect('clicked', self._on_change_nick_menuitem_activate)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self._on_change_nick_menuitem_activate)
+		self.handlers[id_] = widget
 
 		widget = self.xml.get_widget('change_subject_button')
-		id = widget.connect('clicked', self._on_change_subject_menuitem_activate)
-		self.handlers[id] = widget
+		id_ = widget.connect('clicked', self._on_change_subject_menuitem_activate)
+		self.handlers[id_] = widget
 
 		widget = self.xml.get_widget('bookmark_button')
 		for bm in gajim.connections[self.account].bookmarks:
@@ -198,38 +199,38 @@ class GroupchatControl(ChatControlBase):
 				widget.hide()
 				break
 		else:
-			id = widget.connect('clicked',
+			id_ = widget.connect('clicked',
 				self._on_bookmark_room_menuitem_activate)
-			self.handlers[id] = widget
+			self.handlers[id_] = widget
 			widget.show()
 
 		widget = self.xml.get_widget('list_treeview')
-		id = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
-		self.handlers[id] = widget
+		id_ = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
+		self.handlers[id_] = widget
 
-		id = widget.connect('row_collapsed', 
+		id_ = widget.connect('row_collapsed', 
 			self.on_list_treeview_row_collapsed)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('row_activated', 
+		id_ = widget.connect('row_activated', 
 			self.on_list_treeview_row_activated)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('button_press_event', 
+		id_ = widget.connect('button_press_event', 
 			self.on_list_treeview_button_press_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('key_press_event', 
+		id_ = widget.connect('key_press_event', 
 			self.on_list_treeview_key_press_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('motion_notify_event', 
+		id_ = widget.connect('motion_notify_event', 
 			self.on_list_treeview_motion_notify_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
-		id = widget.connect('leave_notify_event', 
+		id_ = widget.connect('leave_notify_event', 
 			self.on_list_treeview_leave_notify_event)
-		self.handlers[id] = widget
+		self.handlers[id_] = widget
 
 		self.room_jid = self.contact.jid
 		self.nick = contact.name.decode('utf-8')
@@ -277,39 +278,39 @@ class GroupchatControl(ChatControlBase):
 		xm = gtkgui_helpers.get_glade('gc_control_popup_menu.glade')
 
 		self.bookmark_room_menuitem = xm.get_widget('bookmark_room_menuitem')
-		id = self.bookmark_room_menuitem.connect('activate',
+		id_ = self.bookmark_room_menuitem.connect('activate',
 			self._on_bookmark_room_menuitem_activate)
-		self.handlers[id] = self.bookmark_room_menuitem
+		self.handlers[id_] = self.bookmark_room_menuitem
 
 		self.change_nick_menuitem = xm.get_widget('change_nick_menuitem')
-		id = self.change_nick_menuitem.connect('activate',
+		id_ = self.change_nick_menuitem.connect('activate',
 			self._on_change_nick_menuitem_activate)
-		self.handlers[id] = self.change_nick_menuitem
+		self.handlers[id_] = self.change_nick_menuitem
 
 		self.configure_room_menuitem = xm.get_widget('configure_room_menuitem')
-		id = self.configure_room_menuitem.connect('activate',
+		id_ = self.configure_room_menuitem.connect('activate',
 			self._on_configure_room_menuitem_activate)
-		self.handlers[id] = self.configure_room_menuitem
+		self.handlers[id_] = self.configure_room_menuitem
 
 		self.destroy_room_menuitem = xm.get_widget('destroy_room_menuitem')
-		id = self.destroy_room_menuitem.connect('activate',
+		id_ = self.destroy_room_menuitem.connect('activate',
 			self._on_destroy_room_menuitem_activate)
-		self.handlers[id] = self.destroy_room_menuitem
+		self.handlers[id_] = self.destroy_room_menuitem
 
 		self.change_subject_menuitem = xm.get_widget('change_subject_menuitem')
-		id = self.change_subject_menuitem.connect('activate',
+		id_ = self.change_subject_menuitem.connect('activate',
 			self._on_change_subject_menuitem_activate)
-		self.handlers[id] = self.change_subject_menuitem
+		self.handlers[id_] = self.change_subject_menuitem
 
 		self.history_menuitem = xm.get_widget('history_menuitem')
-		id = self.history_menuitem.connect('activate',
+		id_ = self.history_menuitem.connect('activate',
 			self._on_history_menuitem_activate)
-		self.handlers[id] = self.history_menuitem
+		self.handlers[id_] = self.history_menuitem
 
 		self.minimize_menuitem = xm.get_widget('minimize_menuitem')
-		id = self.minimize_menuitem.connect('toggled',
+		id_ = self.minimize_menuitem.connect('toggled',
 			self.on_minimize_menuitem_toggled)
-		self.handlers[id] = self.minimize_menuitem
+		self.handlers[id_] = self.minimize_menuitem
 
 		self.bookmark_separator = xm.get_widget('bookmark_separator')
 		self.separatormenuitem2 = xm.get_widget('separatormenuitem2')
@@ -326,18 +327,18 @@ class GroupchatControl(ChatControlBase):
 
 		self.list_treeview = self.xml.get_widget('list_treeview')
 		selection = self.list_treeview.get_selection()
-		id = selection.connect('changed', 
+		id_ = selection.connect('changed', 
 				self.on_list_treeview_selection_changed)
-		self.handlers[id] = selection
-		id = self.list_treeview.connect('style-set',
+		self.handlers[id_] = selection
+		id_ = self.list_treeview.connect('style-set',
 			self.on_list_treeview_style_set)
-		self.handlers[id] = self.list_treeview
+		self.handlers[id_] = self.list_treeview
 		# we want to know when the the widget resizes, because that is
 		# an indication that the hpaned has moved...
 		# FIXME: Find a better indicator that the hpaned has moved.
-		id = self.list_treeview.connect('size-allocate',
+		id_ = self.list_treeview.connect('size-allocate',
 			self.on_treeview_size_allocate)
-		self.handlers[id] = self.list_treeview
+		self.handlers[id_] = self.list_treeview
 		#status_image, shown_nick, type, nickname, avatar
 		store = gtk.TreeStore(gtk.Image, str, str, str, gtk.gdk.Pixbuf)
 		store.set_sort_func(C_NICK, self.tree_compare_iters)
@@ -412,13 +413,13 @@ class GroupchatControl(ChatControlBase):
 				return -1
 			return 1
 		if type1 == 'contact':
-			gc_contact1 = gajim.contacts.get_gc_contact(self.account, self.room_jid,
-				nick1)
+			gc_contact1 = gajim.contacts.get_gc_contact(self.account,
+				self.room_jid, nick1)
 			if not gc_contact1:
 				return 0
 		if type2 == 'contact':
-			gc_contact2 = gajim.contacts.get_gc_contact(self.account, self.room_jid,
-				nick2)
+			gc_contact2 = gajim.contacts.get_gc_contact(self.account,
+				self.room_jid, nick2)
 			if not gc_contact2:
 				return 0
 		if type1 == 'contact' and type2 == 'contact' and \
@@ -456,8 +457,8 @@ class GroupchatControl(ChatControlBase):
 		self.room_jid)):
 			item = gtk.MenuItem(nick, use_underline = False)
 			submenu.append(item)
-			id = item.connect('activate', self.append_nick_in_msg_textview, nick)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.append_nick_in_msg_textview, nick)
+			self.handlers[id_] = item
 
 		menu.show_all()
 
@@ -728,8 +729,8 @@ class GroupchatControl(ChatControlBase):
 
 		autopopup = gajim.config.get('autopopup')
 		autopopupaway = gajim.config.get('autopopupaway')
-		iter = self.get_contact_iter(nick)
-		path = self.list_treeview.get_model().get_path(iter)
+		iter_ = self.get_contact_iter(nick)
+		path = self.list_treeview.get_model().get_path(iter_)
 		if not autopopup or (not autopopupaway and \
 		gajim.connections[self.account].connected > 2):
 			if no_queue: # We didn't have a queue: we change icons
@@ -738,7 +739,7 @@ class GroupchatControl(ChatControlBase):
 					gajim.interface.roster.get_appropriate_state_images(
 						self.room_jid, icon_name = 'event')
 				image = state_images['event']
-				model[iter][C_IMG] = image
+				model[iter_][C_IMG] = image
 			if self.parent_win:
 				self.parent_win.show_title()
 				self.parent_win.redraw_tab(self)
@@ -1031,8 +1032,8 @@ class GroupchatControl(ChatControlBase):
 			_on_send_files(gc_contact)
 
 	def draw_contact(self, nick, selected=False, focus=False):
-		iter = self.get_contact_iter(nick)
-		if not iter:
+		iter_ = self.get_contact_iter(nick)
+		if not iter_:
 			return
 		model = self.list_treeview.get_model()
 		gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
@@ -1057,15 +1058,15 @@ class GroupchatControl(ChatControlBase):
 				name += '\n' '<span size="small" style="italic" foreground="%s">%s</span>'\
 					% (colorstring, gobject.markup_escape_text(status))
 
-		model[iter][C_IMG] = image
-		model[iter][C_TEXT] = name
+		model[iter_][C_IMG] = image
+		model[iter_][C_TEXT] = name
 
 	def draw_avatar(self, nick):
 		if not gajim.config.get('show_avatars_in_roster'):
 			return
 		model = self.list_treeview.get_model()
-		iter = self.get_contact_iter(nick)
-		if not iter:
+		iter_ = self.get_contact_iter(nick)
+		if not iter_:
 			return
 		pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(self.room_jid + \
 			'/' + nick, True)
@@ -1073,7 +1074,7 @@ class GroupchatControl(ChatControlBase):
 			scaled_pixbuf = None
 		else:
 			scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
-		model[iter][C_AVATAR] = scaled_pixbuf
+		model[iter_][C_AVATAR] = scaled_pixbuf
 
 	def draw_role(self, role):
 		role_iter = self.get_role_iter(role)
@@ -1229,9 +1230,9 @@ class GroupchatControl(ChatControlBase):
 				if self.parent_win:
 					self.parent_win.redraw_tab(self)
 		else:
-			iter = self.get_contact_iter(nick)
-			if not iter:
-				iter = self.add_contact_to_roster(nick, show, role, affiliation,
+			iter_ = self.get_contact_iter(nick)
+			if not iter_:
+				iter_ = self.add_contact_to_roster(nick, show, role, affiliation,
 					status, jid)
 				newly_created = True
 				self.draw_all_roles()
@@ -1363,7 +1364,7 @@ class GroupchatControl(ChatControlBase):
 				(gajim.interface.jabber_state_images['16']['closed'], role, 
 				'role', role_name,  None))
 			self.draw_all_roles()
-		iter = model.append(role_iter, (None, nick, 'contact', name, None))
+		iter_ = model.append(role_iter, (None, nick, 'contact', name, None))
 		if not nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
 			gc_contact = gajim.contacts.create_gc_contact(room_jid = self.room_jid,
 				name = nick, show = show, status = status, role = role,
@@ -1390,35 +1391,35 @@ class GroupchatControl(ChatControlBase):
 		self.list_treeview.expand_row((model.get_path(role_iter)), False)
 		if self.is_continued:
 			self.draw_banner_text()
-		return iter
+		return iter_
 
 	def get_role_iter(self, role):
 		model = self.list_treeview.get_model()
 		fin = False
-		iter = model.get_iter_root()
-		if not iter:
+		iter_ = model.get_iter_root()
+		if not iter_:
 			return None
 		while not fin:
-			role_name = model[iter][C_NICK].decode('utf-8')
+			role_name = model[iter_][C_NICK].decode('utf-8')
 			if role == role_name:
-				return iter
-			iter = model.iter_next(iter)
-			if not iter:
+				return iter_
+			iter_ = model.iter_next(iter_)
+			if not iter_:
 				fin = True
 		return None
 
 	def remove_contact(self, nick):
 		'''Remove a user from the contacts_list'''
 		model = self.list_treeview.get_model()
-		iter = self.get_contact_iter(nick)
-		if not iter:
+		iter_ = self.get_contact_iter(nick)
+		if not iter_:
 			return
 		gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
 			nick)
 		if gc_contact:
 			gajim.contacts.remove_gc_contact(self.account, gc_contact)
-		parent_iter = model.iter_parent(iter)
-		model.remove(iter)
+		parent_iter = model.iter_parent(iter_)
+		model.remove(iter_)
 		if model.iter_n_children(parent_iter) == 0:
 			model.remove(parent_iter)
 
@@ -1808,8 +1809,8 @@ class GroupchatControl(ChatControlBase):
 			on_minimize(self)
 			return
 		if method == self.parent_win.CLOSE_ESC:
-			iter = self.list_treeview.get_selection().get_selected()[1]
-			if iter:
+			iter_ = self.list_treeview.get_selection().get_selected()[1]
+			if iter_:
 				self.list_treeview.get_selection().unselect_all()
 				on_no(self)
 				return
@@ -1924,9 +1925,9 @@ class GroupchatControl(ChatControlBase):
 			return
 		data = selection.data
 		path = treeview.get_selection().get_selected_rows()[1][0]
-		iter = model.get_iter(path)
-		type = model[iter][2]
-		if type != 'contact': # source is not a contact
+		iter_ = model.get_iter(path)
+		type_ = model[iter_][2]
+		if type_ != 'contact': # source is not a contact
 			return
 		contact_jid = data.decode('utf-8')
 		gajim.connections[self.account].send_invite(self.room_jid, contact_jid)
@@ -2053,8 +2054,8 @@ class GroupchatControl(ChatControlBase):
 	def on_list_treeview_key_press_event(self, widget, event):
 		if event.keyval == gtk.keysyms.Escape:
 			selection = widget.get_selection()
-			iter = selection.get_selected()[1]
-			if iter:
+			iter_ = selection.get_selected()[1]
+			if iter_:
 				widget.get_selection().unselect_all()
 				return True
 
@@ -2106,8 +2107,8 @@ class GroupchatControl(ChatControlBase):
 		'owner')) or (user_affiliation == 'none' and target_affiliation != \
 		'none'):
 			item.set_sensitive(False)
-		id = item.connect('activate', self.kick, nick)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.kick, nick)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('voice_checkmenuitem')
 		item.set_active(target_role != 'visitor')
@@ -2116,69 +2117,69 @@ class GroupchatControl(ChatControlBase):
 		(user_affiliation=='member' and target_affiliation!='none') or \
 		target_affiliation in ('admin', 'owner'):
 			item.set_sensitive(False)
-		id = item.connect('activate', self.on_voice_checkmenuitem_activate, 
+		id_ = item.connect('activate', self.on_voice_checkmenuitem_activate, 
 			nick)
-		self.handlers[id] = item
+		self.handlers[id_] = item
 
 		item = xml.get_widget('moderator_checkmenuitem')
 		item.set_active(target_role == 'moderator')
 		if not user_affiliation in ('admin', 'owner') or \
 		target_affiliation in ('admin', 'owner'):
 			item.set_sensitive(False)
-		id = item.connect('activate', self.on_moderator_checkmenuitem_activate,
+		id_ = item.connect('activate', self.on_moderator_checkmenuitem_activate,
 					nick)
-		self.handlers[id] = item
+		self.handlers[id_] = item
 	
 		item = xml.get_widget('ban_menuitem')
 		if not user_affiliation in ('admin', 'owner') or \
 		(target_affiliation in ('admin', 'owner') and\
 		user_affiliation != 'owner'):
 			item.set_sensitive(False)
-		id = item.connect('activate', self.ban, jid)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.ban, jid)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('member_checkmenuitem')
 		item.set_active(target_affiliation != 'none')
 		if not user_affiliation in ('admin', 'owner') or \
 		(user_affiliation != 'owner' and target_affiliation in ('admin','owner')):
 			item.set_sensitive(False)
-		id = item.connect('activate', self.on_member_checkmenuitem_activate, 
+		id_ = item.connect('activate', self.on_member_checkmenuitem_activate, 
 					jid)
-		self.handlers[id] = item
+		self.handlers[id_] = item
 	
 		item = xml.get_widget('admin_checkmenuitem')
 		item.set_active(target_affiliation in ('admin', 'owner'))
 		if not user_affiliation == 'owner':
 			item.set_sensitive(False)
-		id = item.connect('activate', self.on_admin_checkmenuitem_activate, jid)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.on_admin_checkmenuitem_activate, jid)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('owner_checkmenuitem')
 		item.set_active(target_affiliation == 'owner')
 		if not user_affiliation == 'owner':
 			item.set_sensitive(False)
-		id = item.connect('activate', self.on_owner_checkmenuitem_activate, jid)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.on_owner_checkmenuitem_activate, jid)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('information_menuitem')
-		id = item.connect('activate', self.on_info, nick)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.on_info, nick)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('history_menuitem')
-		id = item.connect('activate', self.on_history, nick)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.on_history, nick)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('add_to_roster_menuitem')
 		our_jid = gajim.get_jid_from_account(self.account)
 		if not jid or jid == our_jid:
 			item.set_sensitive(False)
 		else:
-			id = item.connect('activate', self.on_add_to_roster, jid)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.on_add_to_roster, jid)
+			self.handlers[id_] = item
 
 		item = xml.get_widget('send_private_message_menuitem')
-		id = item.connect('activate', self.on_send_pm, model, iter_)
-		self.handlers[id] = item
+		id_ = item.connect('activate', self.on_send_pm, model, iter_)
+		self.handlers[id_] = item
 
 		item = xml.get_widget('send_file_menuitem')
 		# add a special img for send file menuitem
@@ -2190,8 +2191,8 @@ class GroupchatControl(ChatControlBase):
 		if not c.resource:
 			item.set_sensitive(False)
 		else:
-			id = item.connect('activate', self.on_send_file, c)
-			self.handlers[id] = item
+			id_ = item.connect('activate', self.on_send_file, c)
+			self.handlers[id_] = item
 
 		# show the popup now!
 		menu = xml.get_widget('gc_occupants_menu')
@@ -2242,17 +2243,17 @@ class GroupchatControl(ChatControlBase):
 		if event.button == 3: # right click
 			widget.get_selection().select_path(path)
 			model = widget.get_model()
-			iter = model.get_iter(path)
+			iter_ = model.get_iter(path)
 			if len(path) == 2:
-				self.mk_menu(event, iter)
+				self.mk_menu(event, iter_)
 			return True
 
 		elif event.button == 2: # middle click
 			widget.get_selection().select_path(path)
 			model = widget.get_model()
-			iter = model.get_iter(path)
+			iter_ = model.get_iter(path)
 			if len(path) == 2:
-				nick = model[iter][C_NICK].decode('utf-8')
+				nick = model[iter_][C_NICK].decode('utf-8')
 				self._start_private_message(nick)
 			return True
 
@@ -2262,8 +2263,8 @@ class GroupchatControl(ChatControlBase):
 				return True
 			else:
 				model = widget.get_model()
-				iter = model.get_iter(path)
-				nick = model[iter][C_NICK].decode('utf-8')
+				iter_ = model.get_iter(path)
+				nick = model[iter_][C_NICK].decode('utf-8')
 				if not nick in gajim.contacts.get_nick_list(self.account,
 				self.room_jid):
 					# it's a group
@@ -2301,19 +2302,19 @@ class GroupchatControl(ChatControlBase):
 				self.tooltip.hide_tooltip()
 		if props:
 			[row, col, x, y] = props
-			iter = None
+			iter_ = None
 			try:
-				iter = model.get_iter(row)
+				iter_ = model.get_iter(row)
 			except Exception:
 				self.tooltip.hide_tooltip()
 				return
-			typ = model[iter][C_TYPE].decode('utf-8')
+			typ = model[iter_][C_TYPE].decode('utf-8')
 			if typ == 'contact':
 				account = self.account
 
 				if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
 					self.tooltip.id = row
-					nick = model[iter][C_NICK].decode('utf-8')
+					nick = model[iter_][C_NICK].decode('utf-8')
 					self.tooltip.timeout = gobject.timeout_add(500,
 						self.show_tooltip, gajim.contacts.get_gc_contact(account,
 						self.room_jid, nick))
diff --git a/src/groups.py b/src/groups.py
index 604c73efb8..1b78f57080 100644
--- a/src/groups.py
+++ b/src/groups.py
@@ -56,8 +56,8 @@ class GroupsPostWindow:
 		item.addChild('title', {}, [self.subject_entry.get_text()])
 		item.addChild('id', {}, ['0'])
 
-		buffer = self.contents_textview.get_buffer()
-		item.addChild('content', {}, [buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())])
+		buf = self.contents_textview.get_buffer()
+		item.addChild('content', {}, [buf.get_text(buf.get_start_iter(), buf.get_end_iter())])
 
 		# publish it to node
 		gajim.connections[self.account].send_pb_publish(self.servicejid, self.groupid, item, '0')
diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py
index f5979ff375..6fadb53b1c 100644
--- a/src/gtkgui_helpers.py
+++ b/src/gtkgui_helpers.py
@@ -371,7 +371,7 @@ def get_abspath_for_script(scriptname, want_type = False):
 	'''checks if we are svn or normal user and returns abspath to asked script
 	if want_type is True we return 'svn' or 'install' '''
 	if os.path.isdir('.svn'): # we are svn user
-		type = 'svn'
+		type_ = 'svn'
 		cwd = os.getcwd() # it's always ending with src
 
 		if scriptname == 'gajim-remote':
@@ -397,13 +397,13 @@ def get_abspath_for_script(scriptname, want_type = False):
 				print >> sys.stderr, s
 
 	else: # normal user (not svn user)
-		type = 'install'
+		type_ = 'install'
 		# always make it like '/usr/local/bin/gajim'
 		path_to_script = helpers.is_in_path(scriptname, True)
 		
 	
 	if want_type:
-		return path_to_script, type
+		return path_to_script, type_
 	else:
 		return path_to_script
 
@@ -873,16 +873,16 @@ def load_iconset(path, pixbuf2 = None, transport = False):
 	pixbuf2 on top left of each static images'''
 	path += '/'
 	if transport:
-		list = ('online', 'chat', 'away', 'xa', 'dnd', 'offline',
+		list_ = ('online', 'chat', 'away', 'xa', 'dnd', 'offline',
 			'not in roster')
 	else:
-		list = ('connecting', 'online', 'chat', 'away', 'xa', 'dnd',
+		list_ = ('connecting', 'online', 'chat', 'away', 'xa', 'dnd',
 			'invisible', 'offline', 'error', 'requested', 'event', 'opened',
 			'closed', 'not in roster', 'muc_active', 'muc_inactive')
 		if pixbuf2:
-			list = ('connecting', 'online', 'chat', 'away', 'xa', 'dnd',
+			list_ = ('connecting', 'online', 'chat', 'away', 'xa', 'dnd',
 				'offline', 'error', 'requested', 'event', 'not in roster')
-	return _load_icon_list(list, path, pixbuf2)
+	return _load_icon_list(list_, path, pixbuf2)
 
 def load_icon(icon_name):
 	'''load an icon from the iconset in 16x16'''
@@ -944,9 +944,9 @@ def _load_icon_list(icons_list, path, pixbuf2 = None):
 		image = gtk.Image()
 		image.show()
 		imgs[icon] = image
-		for file in files: # loop seeking for either gif or png
-			if os.path.exists(file):
-				image.set_from_file(file)
+		for file_ in files: # loop seeking for either gif or png
+			if os.path.exists(file_):
+				image.set_from_file(file_)
 				if pixbuf2 and image.get_storage_type() == gtk.IMAGE_PIXBUF:
 					# add pixbuf2 on top-left corner of image
 					pixbuf1 = image.get_pixbuf()
diff --git a/src/htmltextview.py b/src/htmltextview.py
index 957ef3591a..cb0fc97a4f 100644
--- a/src/htmltextview.py
+++ b/src/htmltextview.py
@@ -988,8 +988,8 @@ class HtmlTextView(gtk.TextView):
 		return False
 
 	def display_html(self, html):
-		buffer = self.get_buffer()
-		eob = buffer.get_end_iter()
+		buffer_ = self.get_buffer()
+		eob = buffer_.get_end_iter()
 		## this works too if libxml2 is not available
 		# parser = xml.sax.make_parser(['drv_libxml2'])
 		# parser.setFeature(xml.sax.handler.feature_validation, True)
@@ -999,7 +999,7 @@ class HtmlTextView(gtk.TextView):
 		
 		# too much space after :)
 		#if not eob.starts_line():
-		#    buffer.insert(eob, '\n')
+		#    buffer_.insert(eob, '\n')
 
 
 
diff --git a/src/ipython_view.py b/src/ipython_view.py
index cec10667da..a4ef8ca702 100644
--- a/src/ipython_view.py
+++ b/src/ipython_view.py
@@ -248,10 +248,10 @@ class IterableIPShell:
     if verbose or debug: print header+cmd
     # flush stdout so we don't mangle python's buffering
     if not debug:
-      input, output = os.popen4(cmd)
+      input_, output = os.popen4(cmd)
       print output.read()
       output.close()
-      input.close()
+      input_.close()
 
 class ConsoleView(gtk.TextView):
   '''
@@ -359,9 +359,9 @@ class ConsoleView(gtk.TextView):
     @param text: Text to use as replacement.
     @type text: string
     '''
-    iter = self.text_buffer.get_iter_at_mark(self.line_start)
-    iter.forward_to_line_end()
-    self.text_buffer.delete(self.text_buffer.get_iter_at_mark(self.line_start), iter)
+    iter_ = self.text_buffer.get_iter_at_mark(self.line_start)
+    iter_.forward_to_line_end()
+    self.text_buffer.delete(self.text_buffer.get_iter_at_mark(self.line_start), iter_)
     self._write(text, True)
 
   def getCurrentLine(self):
@@ -386,12 +386,12 @@ class ConsoleView(gtk.TextView):
     @param text: Text to show.
     @type text: string
     '''
-    iter = self.text_buffer.get_iter_at_mark(self.line_start)
-    iter.forward_to_line_end()
+    iter_ = self.text_buffer.get_iter_at_mark(self.line_start)
+    iter_.forward_to_line_end()
     self.text_buffer.apply_tag_by_name(
       'notouch', 
       self.text_buffer.get_iter_at_mark(self.line_start),
-      iter)
+      iter_)
     self._write('\n'+text)
     if text:
       self._write('\n')
@@ -515,12 +515,12 @@ class IPythonView(ConsoleView, IterableIPShell):
         return False
       completed, possibilities = self.complete(self.getCurrentLine())
       if len(possibilities) > 1:
-        slice = self.getCurrentLine()
+        slice_ = self.getCurrentLine()
         self.write('\n')
         for symbol in possibilities:
           self.write(symbol+'\n')
         self.showPrompt(self.prompt)
-      self.changeLine(completed or slice)
+      self.changeLine(completed or slice_)
       return True
 
   def _processLine(self):
diff --git a/src/message_textview.py b/src/message_textview.py
index 445bc85153..d885890be7 100644
--- a/src/message_textview.py
+++ b/src/message_textview.py
@@ -289,9 +289,9 @@ class MessageTextView(gtk.TextView):
 
 	def clear(self, widget = None):
 		'''clear text in the textview'''
-		buffer = self.get_buffer()
-		start, end = buffer.get_bounds()
-		buffer.delete(start, end)
+		buffer_ = self.get_buffer()
+		start, end = buffer_.get_bounds()
+		buffer_.delete(start, end)
 
 
 # We register depending on keysym and modifier some bindings
diff --git a/src/message_window.py b/src/message_window.py
index 2409f7aea9..1d8d5a28ed 100644
--- a/src/message_window.py
+++ b/src/message_window.py
@@ -91,12 +91,12 @@ class MessageWindow(object):
 		# MessageWindow._on_window_delete, which manually destroys window
 		# through win.destroy() - this means no additional handlers for
 		# 'delete-event' are called.
-		id = self.window.connect_after('delete-event', self._on_window_delete)
-		self.handlers[id] = self.window
-		id = self.window.connect('destroy', self._on_window_destroy)
-		self.handlers[id] = self.window
-		id = self.window.connect('focus-in-event', self._on_window_focus)
-		self.handlers[id] = self.window
+		id_ = self.window.connect_after('delete-event', self._on_window_delete)
+		self.handlers[id_] = self.window
+		id_ = self.window.connect('destroy', self._on_window_destroy)
+		self.handlers[id_] = self.window
+		id_ = self.window.connect('focus-in-event', self._on_window_focus)
+		self.handlers[id_] = self.window
 
 		keys=['<Control>f', '<Control>g', '<Control>h', '<Control>i',
 			'<Control>l', '<Control>L', '<Control>n', '<Control>u', '<Control>v',
@@ -116,12 +116,12 @@ class MessageWindow(object):
 		self.window.add_events(gtk.gdk.POINTER_MOTION_MASK)
 		self.alignment = self.xml.get_widget('alignment')
 
-		id = self.notebook.connect('switch-page',
+		id_ = self.notebook.connect('switch-page',
 			self._on_notebook_switch_page)
-		self.handlers[id] = self.notebook
-		id = self.notebook.connect('key-press-event',
+		self.handlers[id_] = self.notebook
+		id_ = self.notebook.connect('key-press-event',
 			self._on_notebook_key_press)
-		self.handlers[id] = self.notebook
+		self.handlers[id_] = self.notebook
 
 		# Remove the glade pages
 		while self.notebook.get_n_pages():
@@ -166,10 +166,7 @@ class MessageWindow(object):
 			self.account = new_name
 
 	def get_num_controls(self):
-		n = 0
-		for dict in self._controls.values():
-			n += len(dict)
-		return n
+		return sum(len(d) for d in self._controls.values())
 
 	def resize(self, width, height):
 		gtkgui_helpers.resize_window(self.window, width, height)
@@ -256,12 +253,12 @@ class MessageWindow(object):
 		xml = gtkgui_helpers.get_glade('message_window.glade', 'chat_tab_ebox')
 		tab_label_box = xml.get_widget('chat_tab_ebox')
 		widget = xml.get_widget('tab_close_button')
-		id = widget.connect('clicked', self._on_close_button_clicked, control)
-		control.handlers[id] = widget
+		id_ = widget.connect('clicked', self._on_close_button_clicked, control)
+		control.handlers[id_] = widget
 
-		id = tab_label_box.connect('button-press-event', self.on_tab_eventbox_button_press_event,
+		id_ = tab_label_box.connect('button-press-event', self.on_tab_eventbox_button_press_event,
 					control.widget)
-		control.handlers[id] = tab_label_box
+		control.handlers[id_] = tab_label_box
 		self.notebook.append_page(control.widget, tab_label_box)
 
 		# If GTK+ version >= 2.10, use gtk native way to reorder tabs
diff --git a/src/search_window.py b/src/search_window.py
index 4039b88d59..80315b9da7 100644
--- a/src/search_window.py
+++ b/src/search_window.py
@@ -96,17 +96,17 @@ class SearchWindow:
 		self.search_button.hide()
 
 	def on_add_contact_button_clicked(self, widget):
-		(model, iter) = self.result_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.result_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][self.jid_column]
+		jid = model[iter_][self.jid_column]
 		dialogs.AddNewContactWindow(self.account, jid)
 	
 	def on_information_button_clicked(self, widget):
-		(model, iter) = self.result_treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = self.result_treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		jid = model[iter][self.jid_column]
+		jid = model[iter_][self.jid_column]
 		if jid in gajim.interface.instances[self.account]['infos']:
 			gajim.interface.instances[self.account]['infos'][jid].window.present()
 		else:
@@ -146,10 +146,10 @@ class SearchWindow:
 	def on_result_treeview_cursor_changed(self, treeview):
 		if self.jid_column == -1:
 			return
-		(model, iter) = treeview.get_selection().get_selected()
-		if not iter:
+		(model, iter_) = treeview.get_selection().get_selected()
+		if not iter_:
 			return
-		if model[iter][self.jid_column]:
+		if model[iter_][self.jid_column]:
 			self.add_contact_button.set_sensitive(True)
 			self.information_button.set_sensitive(True)
 		else:
diff --git a/src/tooltips.py b/src/tooltips.py
index 4b00fba0b8..c8fe0b51cd 100644
--- a/src/tooltips.py
+++ b/src/tooltips.py
@@ -211,9 +211,9 @@ class StatusTable:
 		files.append(os.path.join(file_path, state_file + '.gif'))
 		image = gtk.Image()
 		image.set_from_pixbuf(None)
-		for file in files:
-			if os.path.exists(file):
-				image.set_from_file(file)
+		for f in files:
+			if os.path.exists(f):
+				image.set_from_file(f)
 				break
 		spacer = gtk.Label(self.spacer_label)
 		image.set_alignment(1, 0.5)
@@ -339,36 +339,36 @@ class GCTooltip(BaseTooltip):
 		# Add avatar
 		puny_name = helpers.sanitize_filename(contact.name)
 		puny_room = helpers.sanitize_filename(contact.room_jid)
-		file = helpers.get_avatar_path(os.path.join(gajim.AVATAR_PATH, puny_room,
+		file_ = helpers.get_avatar_path(os.path.join(gajim.AVATAR_PATH, puny_room,
 			puny_name))
-		if file:
-			self.avatar_image.set_from_file(file)
+		if file_:
+			_self.avatar_image.set_from_file(file_)
 			pix = self.avatar_image.get_pixbuf()
 			pix = gtkgui_helpers.get_scaled_pixbuf(pix, 'tooltip')
 			self.avatar_image.set_from_pixbuf(pix)
 		else:
 			self.avatar_image.set_from_pixbuf(None)
 		while properties:
-			property = properties.pop(0)
+			property_ = properties.pop(0)
 			vcard_current_row += 1
 			vertical_fill = gtk.FILL
 			if not properties:
 				vertical_fill |= gtk.EXPAND
 			label = gtk.Label()
 			label.set_alignment(0, 0)
-			if property[1]:
-				label.set_markup(property[0])
+			if property_[1]:
+				label.set_markup(property_[0])
 				vcard_table.attach(label, 1, 2, vcard_current_row,
 					vcard_current_row + 1, gtk.FILL, vertical_fill, 0, 0)
 				label = gtk.Label()
 				label.set_alignment(0, 0)
-				label.set_markup(property[1])
+				label.set_markup(property_[1])
 				label.set_line_wrap(True)
 				vcard_table.attach(label, 2, 3, vcard_current_row,
 					vcard_current_row + 1, gtk.EXPAND | gtk.FILL,
 					vertical_fill, 0, 0)
 			else:
-				label.set_markup(property[0])
+				label.set_markup(property_[0])
 				label.set_line_wrap(True)
 				vcard_table.attach(label, 1, 3, vcard_current_row,
 					vcard_current_row + 1, gtk.FILL, vertical_fill, 0)
@@ -409,9 +409,9 @@ class RosterTooltip(NotificationAreaTooltip):
 		puny_jid = helpers.sanitize_filename(prim_contact.jid)
 		table_size = 3
 
-		file = helpers.get_avatar_path(os.path.join(gajim.AVATAR_PATH, puny_jid))
-		if file:
-			self.avatar_image.set_from_file(file)
+		file_ = helpers.get_avatar_path(os.path.join(gajim.AVATAR_PATH, puny_jid))
+		if file_:
+			self.avatar_image.set_from_file(file_)
 			pix = self.avatar_image.get_pixbuf()
 			pix = gtkgui_helpers.get_scaled_pixbuf(pix, 'tooltip')
 			self.avatar_image.set_from_pixbuf(pix)
@@ -543,30 +543,30 @@ class RosterTooltip(NotificationAreaTooltip):
 					gobject.markup_escape_text(keyID)))
 		
 		while properties:
-			property = properties.pop(0)
+			property_ = properties.pop(0)
 			vcard_current_row += 1
 			vertical_fill = gtk.FILL
 			if not properties and table_size == 4:
 				vertical_fill |= gtk.EXPAND
 			label = gtk.Label()
 			label.set_alignment(0, 0)
-			if property[1]:
-				label.set_markup(property[0])
+			if property_[1]:
+				label.set_markup(property_[0])
 				vcard_table.attach(label, 1, 2, vcard_current_row,
 					vcard_current_row + 1, gtk.FILL, vertical_fill, 0, 0)
 				label = gtk.Label()
 				label.set_alignment(0, 0)
-				label.set_markup(property[1])
+				label.set_markup(property_[1])
 				label.set_line_wrap(True)
 				vcard_table.attach(label, 2, 3, vcard_current_row,
 					vcard_current_row + 1, gtk.EXPAND | gtk.FILL,
 						vertical_fill, 0, 0)
 			else:
-				if isinstance(property[0], (unicode, str)): #FIXME: rm unicode?
-					label.set_markup(property[0]) 
+				if isinstance(property_[0], (unicode, str)): #FIXME: rm unicode?
+					label.set_markup(property_[0]) 
 					label.set_line_wrap(True)
 				else:
-					label = property[0]
+					label = property_[0]
 				vcard_table.attach(label, 1, 3, vcard_current_row,
 					vcard_current_row + 1, gtk.FILL, vertical_fill, 0)
 		self.avatar_image.set_alignment(0, 0)
@@ -661,20 +661,20 @@ class FileTransfersTooltip(BaseTooltip):
 		properties.append((_('Name: '), 
 			gobject.markup_escape_text(file_name)))
 		if file_props['type'] == 'r':
-			type = _('Download')
+			type_ = _('Download')
 			actor = _('Sender: ') 
 			sender = unicode(file_props['sender']).split('/')[0]
 			name = gajim.contacts.get_first_contact_from_jid( 
 				file_props['tt_account'], sender).get_shown_name()
 		else:
-			type = _('Upload')
+			type_ = _('Upload')
 			actor = _('Recipient: ')
 			receiver = file_props['receiver']
 			if hasattr(receiver, 'name'):
 				name = receiver.get_shown_name()
 			else:
 				name = receiver.split('/')[0]
-		properties.append((_('Type: '), type))
+		properties.append((_('Type: '), type_))
 		properties.append((actor, gobject.markup_escape_text(name)))
 		
 		transfered_len = file_props.get('received-len', 0)
@@ -709,17 +709,17 @@ class FileTransfersTooltip(BaseTooltip):
 			properties.append((_('Description: '), gobject.markup_escape_text(
 				file_desc)))
 		while properties:
-			property = properties.pop(0)
+			property_ = properties.pop(0)
 			current_row += 1
 			label = gtk.Label()
 			label.set_alignment(0, 0)
-			label.set_markup(property[0])
+			label.set_markup(property_[0])
 			ft_table.attach(label, 1, 2, current_row, current_row + 1, 
 				gtk.FILL, gtk.FILL, 0, 0)
 			label = gtk.Label()
 			label.set_alignment(0, 0)
 			label.set_line_wrap(True)
-			label.set_markup(property[1])
+			label.set_markup(property_[1])
 			ft_table.attach(label, 2, 3, current_row, current_row + 1, 
 				gtk.EXPAND | gtk.FILL, gtk.FILL, 0, 0)
 		
diff --git a/src/vcard.py b/src/vcard.py
index f3351f6d56..3ff6b75966 100644
--- a/src/vcard.py
+++ b/src/vcard.py
@@ -118,8 +118,8 @@ class VcardWindow:
 		self.fill_jabber_page()
 		annotations = gajim.connections[self.account].annotations
 		if self.contact.jid in annotations:
-			buffer = self.xml.get_widget('textview_annotation').get_buffer()
-			buffer.set_text(annotations[self.contact.jid])
+			buffer_ = self.xml.get_widget('textview_annotation').get_buffer()
+			buffer_.set_text(annotations[self.contact.jid])
 
 		self.xml.signal_autoconnect(self)
 		self.window.show_all()
@@ -133,9 +133,9 @@ class VcardWindow:
 		if self.update_progressbar_timeout_id is not None:
 			gobject.source_remove(self.update_progressbar_timeout_id)
 		del gajim.interface.instances[self.account]['infos'][self.contact.jid]
-		buffer = self.xml.get_widget('textview_annotation').get_buffer()
-		annotation = buffer.get_text(buffer.get_start_iter(),
-			buffer.get_end_iter())
+		buffer_ = self.xml.get_widget('textview_annotation').get_buffer()
+		annotation = buffer_.get_text(buffer_.get_start_iter(),
+			buffer_.get_end_iter())
 		connection = gajim.connections[self.account]
 		if annotation != connection.annotations.get(self.contact.jid, ''):
 			connection.annotations[self.contact.jid] = annotation
-- 
GitLab