typos all over and " --> '
This commit is contained in:
		
							parent
							
								
									ab8a846f66
								
							
						
					
					
						commit
						00b13f2eff
					
				
					 4 changed files with 161 additions and 161 deletions
				
			
		| 
						 | 
				
			
			@ -681,7 +681,7 @@ class connection:
 | 
			
		|||
		p = common.jabber.Presence(to = agent, type = ptype)
 | 
			
		||||
		self.connection.send(p)
 | 
			
		||||
 | 
			
		||||
	def join_gc(self, nick, room, server, passwd):
 | 
			
		||||
	def join_gc(self, nick, room, server, password):
 | 
			
		||||
		if not self.connection:
 | 
			
		||||
			return
 | 
			
		||||
		p = common.jabber.Presence(to = '%s@%s/%s' % (room, server, password))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										140
									
								
								src/config.py
									
										
									
									
									
								
							
							
						
						
									
										140
									
								
								src/config.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -37,7 +37,7 @@ GTKGUI_GLADE='gtkgui.glade'
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Preferences_window:
 | 
			
		||||
	"""Class for Preferences window"""
 | 
			
		||||
	'''Class for Preferences window'''
 | 
			
		||||
	
 | 
			
		||||
	def on_preferences_window_delete_event(self, widget, event):
 | 
			
		||||
		self.window.hide()
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
		
 | 
			
		||||
	def on_account_text_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Account Text"""
 | 
			
		||||
		'''Take The Color For The Account Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_group_text_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Group Text"""
 | 
			
		||||
		'''Take The Color For The Group Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
 | 
			
		||||
	def on_user_text_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The User Text"""
 | 
			
		||||
		'''Take The Color For The User Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -133,7 +133,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
 | 
			
		||||
	def on_account_text_bg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Background Of Account Text"""
 | 
			
		||||
		'''Take The Color For The Background Of Account Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_group_text_bg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Background Of Group Text"""
 | 
			
		||||
		'''Take The Color For The Background Of Group Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +151,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_user_text_bg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Background Of User Text"""
 | 
			
		||||
		'''Take The Color For The Background Of User Text'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -160,21 +160,21 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_account_text_fontbutton_font_set(self, widget):
 | 
			
		||||
		"""Take The Font For The User Text"""
 | 
			
		||||
		'''Take The Font For The User Text'''
 | 
			
		||||
		font_string = widget.get_font_name()
 | 
			
		||||
		gajim.config.set('accountfont', font_string)
 | 
			
		||||
		self.plugin.roster.draw_roster()
 | 
			
		||||
		self.plugin.save_config()
 | 
			
		||||
 | 
			
		||||
	def on_group_text_fontbutton_font_set(self, widget):
 | 
			
		||||
		"""Take The Font For The Group Text"""
 | 
			
		||||
		'''Take The Font For The Group Text'''
 | 
			
		||||
		font_string = widget.get_font_name()
 | 
			
		||||
		gajim.config.set('groupfont', font_string)
 | 
			
		||||
		self.plugin.roster.draw_roster()
 | 
			
		||||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_user_text_fontbutton_font_set(self, widget):
 | 
			
		||||
		"""Take The Font For The User Text"""
 | 
			
		||||
		'''Take The Font For The User Text'''
 | 
			
		||||
		font_string = widget.get_font_name()
 | 
			
		||||
		gajim.config.set('userfont', font_string)
 | 
			
		||||
		self.plugin.roster.draw_roster()
 | 
			
		||||
| 
						 | 
				
			
			@ -271,7 +271,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def update_print_time(self):
 | 
			
		||||
		"""Update time in Opened Chat Windows"""
 | 
			
		||||
		'''Update time in Opened Chat Windows'''
 | 
			
		||||
		for a in gajim.connections:
 | 
			
		||||
			if self.plugin.windows[a]['chats'].has_key('tabbed'):
 | 
			
		||||
				self.plugin.windows[a]['chats']['tabbed'].update_print_time()
 | 
			
		||||
| 
						 | 
				
			
			@ -314,7 +314,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
 | 
			
		||||
	def update_text_tags(self):
 | 
			
		||||
		"""Update color tags in Opened Chat Windows"""
 | 
			
		||||
		'''Update color tags in Opened Chat Windows'''
 | 
			
		||||
		for a in gajim.connections:
 | 
			
		||||
			if self.plugin.windows[a]['chats'].has_key('tabbed'):
 | 
			
		||||
				self.plugin.windows[a]['chats']['tabbed'].update_tags()
 | 
			
		||||
| 
						 | 
				
			
			@ -323,7 +323,7 @@ class Preferences_window:
 | 
			
		|||
					self.plugin.windows[a]['chats'][jid].update_tags()
 | 
			
		||||
	
 | 
			
		||||
	def on_incoming_msg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Incoming Messages"""
 | 
			
		||||
		'''Take The Color For The Incoming Messages'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -332,7 +332,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
		
 | 
			
		||||
	def on_outgoing_msg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Outgoing Messages"""
 | 
			
		||||
		'''Take The Color For The Outgoing Messages'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -341,7 +341,7 @@ class Preferences_window:
 | 
			
		|||
		self.plugin.save_config()
 | 
			
		||||
	
 | 
			
		||||
	def on_status_msg_colorbutton_color_set(self, widget):
 | 
			
		||||
		"""Take The Color For The Status Messages"""
 | 
			
		||||
		'''Take The Color For The Status Messages'''
 | 
			
		||||
		color = widget.get_color()
 | 
			
		||||
		color_string = '#' + (hex(color.red) + '0')[2:4] + \
 | 
			
		||||
			(hex(color.green) + '0')[2:4] + (hex(color.blue) + '0')[2:4]
 | 
			
		||||
| 
						 | 
				
			
			@ -607,7 +607,7 @@ class Preferences_window:
 | 
			
		|||
			model.set_value(iter, 1, 1)
 | 
			
		||||
 | 
			
		||||
	def __init__(self, plugin):
 | 
			
		||||
		"""Initialize Preferences window"""
 | 
			
		||||
		'''Initialize Preferences window'''
 | 
			
		||||
		self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP)
 | 
			
		||||
		self.window = self.xml.get_widget('preferences_window')
 | 
			
		||||
		self.plugin = plugin
 | 
			
		||||
| 
						 | 
				
			
			@ -894,16 +894,16 @@ class Preferences_window:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Account_modification_window:
 | 
			
		||||
	"""Class for account informations"""
 | 
			
		||||
	'''Class for account informations'''
 | 
			
		||||
	def on_account_modification_window_destroy(self, widget):
 | 
			
		||||
		"""close window"""
 | 
			
		||||
		'''close window'''
 | 
			
		||||
		del self.plugin.windows[self.account]['account_modification']
 | 
			
		||||
	
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def on_checkbutton_toggled(self, widget, widgets):
 | 
			
		||||
		"""set or unset sensitivity of widgets when widget is toggled"""
 | 
			
		||||
		'''set or unset sensitivity of widgets when widget is toggled'''
 | 
			
		||||
		for w in widgets:
 | 
			
		||||
			w.set_sensitive(widget.get_active())
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -913,7 +913,7 @@ class Account_modification_window:
 | 
			
		|||
		self.on_checkbutton_toggled(widget, [proxyhost_entry, proxyport_entry])
 | 
			
		||||
 | 
			
		||||
	def init_account(self):
 | 
			
		||||
		"""Initialize window with defaults values"""
 | 
			
		||||
		'''Initialize window with defaults values'''
 | 
			
		||||
		self.xml.get_widget('name_entry').set_text(self.account)
 | 
			
		||||
		jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
 | 
			
		||||
			gajim.config.get_per('accounts', self.account, 'hostname')
 | 
			
		||||
| 
						 | 
				
			
			@ -975,7 +975,7 @@ class Account_modification_window:
 | 
			
		|||
			self.xml.get_widget('log_history_checkbutton').set_active(0)
 | 
			
		||||
 | 
			
		||||
	def on_save_button_clicked(self, widget):
 | 
			
		||||
		"""When save button is clicked: Save information in config file"""
 | 
			
		||||
		'''When save button is clicked: Save information in config file'''
 | 
			
		||||
		save_password = 0
 | 
			
		||||
		if self.xml.get_widget('save_password_checkbutton').get_active():
 | 
			
		||||
			save_password = 1
 | 
			
		||||
| 
						 | 
				
			
			@ -1177,7 +1177,7 @@ class Account_modification_window:
 | 
			
		|||
				self.xml.get_widget('password_entry').set_text(new_password)
 | 
			
		||||
 | 
			
		||||
	def account_is_ok(self, acct):
 | 
			
		||||
		"""When the account has been created with sucess"""
 | 
			
		||||
		'''When the account has been created with sucess'''
 | 
			
		||||
		self.xml.get_widget('new_account_checkbutton').set_active(False)
 | 
			
		||||
		self.modify = True
 | 
			
		||||
		self.account = acct
 | 
			
		||||
| 
						 | 
				
			
			@ -1317,7 +1317,7 @@ class Account_modification_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
class Accounts_window:
 | 
			
		||||
	"""Class for accounts window: lists of accounts"""
 | 
			
		||||
	'''Class for accounts window: lists of accounts'''
 | 
			
		||||
	def on_accounts_window_destroy(self, widget):
 | 
			
		||||
		del self.plugin.windows['accounts'] 
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1325,7 +1325,7 @@ class Accounts_window:
 | 
			
		|||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def init_accounts(self):
 | 
			
		||||
		"""initialize listStore with existing accounts"""
 | 
			
		||||
		'''initialize listStore with existing accounts'''
 | 
			
		||||
		self.modify_button.set_sensitive(False)
 | 
			
		||||
		self.delete_button.set_sensitive(False)
 | 
			
		||||
		model = self.accounts_treeview.get_model()
 | 
			
		||||
| 
						 | 
				
			
			@ -1336,12 +1336,12 @@ class Accounts_window:
 | 
			
		|||
				account, 'hostname'))
 | 
			
		||||
 | 
			
		||||
	def on_accounts_treeview_cursor_changed(self, widget):
 | 
			
		||||
		"""Activate delete and modify buttons when a row is selected"""
 | 
			
		||||
		'''Activate delete and modify buttons when a row is selected'''
 | 
			
		||||
		self.modify_button.set_sensitive(True)
 | 
			
		||||
		self.delete_button.set_sensitive(True)
 | 
			
		||||
 | 
			
		||||
	def on_new_button_clicked(self, widget):
 | 
			
		||||
		"""When new button is clicked : open an account information window"""
 | 
			
		||||
		'''When new button is clicked : open an account information window'''
 | 
			
		||||
		if self.plugin.windows.has_key('account_modification'):
 | 
			
		||||
			self.plugin.windows['account_modification'].window.present()			
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			@ -1350,8 +1350,8 @@ class Accounts_window:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
	def on_delete_button_clicked(self, widget):
 | 
			
		||||
		"""When delete button is clicked :
 | 
			
		||||
		Remove an account from the listStore and from the config file"""
 | 
			
		||||
		'''When delete button is clicked :
 | 
			
		||||
		Remove an account from the listStore and from the config file'''
 | 
			
		||||
		sel = self.accounts_treeview.get_selection()
 | 
			
		||||
		(model, iter) = sel.get_selected()
 | 
			
		||||
		if not iter: return
 | 
			
		||||
| 
						 | 
				
			
			@ -1372,8 +1372,8 @@ class Accounts_window:
 | 
			
		|||
			self.init_accounts()
 | 
			
		||||
 | 
			
		||||
	def on_modify_button_clicked(self, widget):
 | 
			
		||||
		"""When modify button is clicked:
 | 
			
		||||
		open/show the account modification window for this account"""
 | 
			
		||||
		'''When modify button is clicked:
 | 
			
		||||
		open/show the account modification window for this account'''
 | 
			
		||||
		sel = self.accounts_treeview.get_selection()
 | 
			
		||||
		(model, iter) = sel.get_selected()
 | 
			
		||||
		if not iter: return
 | 
			
		||||
| 
						 | 
				
			
			@ -1414,14 +1414,14 @@ class Accounts_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
class Service_registration_window:
 | 
			
		||||
	"""Class for Service registration window:
 | 
			
		||||
	Window that appears when we want to subscribe to a service"""
 | 
			
		||||
	'''Class for Service registration window:
 | 
			
		||||
	Window that appears when we want to subscribe to a service'''
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		"""When Cancel button is clicked"""
 | 
			
		||||
		'''When Cancel button is clicked'''
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
		
 | 
			
		||||
	def draw_table(self):
 | 
			
		||||
		"""Draw the table in the window"""
 | 
			
		||||
		'''Draw the table in the window'''
 | 
			
		||||
		nbrow = 0
 | 
			
		||||
		table = self.xml.get_widget('table')
 | 
			
		||||
		for name in self.infos.keys():
 | 
			
		||||
| 
						 | 
				
			
			@ -1439,8 +1439,8 @@ class Service_registration_window:
 | 
			
		|||
		table.show_all()
 | 
			
		||||
	
 | 
			
		||||
	def on_ok_button_clicked(self, widget):
 | 
			
		||||
		"""When Ok button is clicked :
 | 
			
		||||
		send registration info to the core"""
 | 
			
		||||
		'''When Ok button is clicked :
 | 
			
		||||
		send registration info to the core'''
 | 
			
		||||
		for name in self.entries.keys():
 | 
			
		||||
			self.infos[name] = self.entries[name].get_text()
 | 
			
		||||
		user1 = gtkgui.User(self.service, self.service, ['Agents'], 'offline', \
 | 
			
		||||
| 
						 | 
				
			
			@ -1456,8 +1456,8 @@ class Service_registration_window:
 | 
			
		|||
		self.infos = infos
 | 
			
		||||
		self.plugin = plugin
 | 
			
		||||
		self.account = account
 | 
			
		||||
		window = self.xml.get_widget('service_registration_window')
 | 
			
		||||
		window.set_title(_('Register to %s') % service)
 | 
			
		||||
		self.window = self.xml.get_widget('service_registration_window')
 | 
			
		||||
		self.window.set_title(_('Register to %s') % service)
 | 
			
		||||
		self.xml.get_widget('label').set_text(infos['instructions'])
 | 
			
		||||
		self.entries = {}
 | 
			
		||||
		self.draw_table()
 | 
			
		||||
| 
						 | 
				
			
			@ -1563,27 +1563,27 @@ class Add_remove_emoticons_window:
 | 
			
		|||
		if not iter:
 | 
			
		||||
			return
 | 
			
		||||
		file = model.get_value(iter, 1)
 | 
			
		||||
		dialog = gtk.FileChooserDialog("Choose image",
 | 
			
		||||
		dialog = gtk.FileChooserDialog('Choose image',
 | 
			
		||||
							None,
 | 
			
		||||
							gtk.FILE_CHOOSER_ACTION_OPEN,
 | 
			
		||||
							(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
 | 
			
		||||
							gtk.STOCK_OPEN, gtk.RESPONSE_OK))
 | 
			
		||||
		dialog.set_default_response(gtk.RESPONSE_OK)
 | 
			
		||||
		filter = gtk.FileFilter()
 | 
			
		||||
		filter.set_name("All files")
 | 
			
		||||
		filter.add_pattern("*")
 | 
			
		||||
		filter.set_name('All files')
 | 
			
		||||
		filter.add_pattern('*')
 | 
			
		||||
		dialog.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_pattern("*.png")
 | 
			
		||||
		filter.add_pattern("*.jpg")
 | 
			
		||||
		filter.add_pattern("*.gif")
 | 
			
		||||
		filter.add_pattern("*.tif")
 | 
			
		||||
		filter.add_pattern("*.xpm")
 | 
			
		||||
		filter.set_name('Images')
 | 
			
		||||
		filter.add_mime_type('image/png')
 | 
			
		||||
		filter.add_mime_type('image/jpeg')
 | 
			
		||||
		filter.add_mime_type('image/gif')
 | 
			
		||||
		filter.add_pattern('*.png')
 | 
			
		||||
		filter.add_pattern('*.jpg')
 | 
			
		||||
		filter.add_pattern('*.gif')
 | 
			
		||||
		filter.add_pattern('*.tif')
 | 
			
		||||
		filter.add_pattern('*.xpm')
 | 
			
		||||
		dialog.add_filter(filter)
 | 
			
		||||
		dialog.set_filter(filter)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1631,10 +1631,10 @@ class Add_remove_emoticons_window:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Service_discovery_window:
 | 
			
		||||
	"""Class for Service Discovery Window:
 | 
			
		||||
	to know the services on a server"""
 | 
			
		||||
	'''Class for Service Discovery Window:
 | 
			
		||||
	to know the services on a server'''
 | 
			
		||||
	def on_service_discovery_window_destroy(self, widget):
 | 
			
		||||
		"""close window"""
 | 
			
		||||
		'''close window'''
 | 
			
		||||
		del self.plugin.windows[self.account]['disco']
 | 
			
		||||
 | 
			
		||||
	def on_close_button_clicked(self, widget):
 | 
			
		||||
| 
						 | 
				
			
			@ -1642,7 +1642,7 @@ class Service_discovery_window:
 | 
			
		|||
 | 
			
		||||
	def __init__(self, plugin, account):
 | 
			
		||||
		if gajim.connections[account].connected < 2:
 | 
			
		||||
			dialog.Error_dialog(_('You must be connected to browse services'))
 | 
			
		||||
			dialogs.Error_dialog(_('You must be connected to browse services'))
 | 
			
		||||
			return
 | 
			
		||||
		xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
 | 
			
		||||
		self.window = xml.get_widget('service_discovery_window')
 | 
			
		||||
| 
						 | 
				
			
			@ -1692,7 +1692,7 @@ class Service_discovery_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
		
 | 
			
		||||
	def browse(self, jid):
 | 
			
		||||
		"""Send a request to the core to know the available services"""
 | 
			
		||||
		'''Send a request to the core to know the available services'''
 | 
			
		||||
		model = self.services_treeview.get_model()
 | 
			
		||||
		if not model.get_iter_first():
 | 
			
		||||
			# we begin to fill the treevier with the first line
 | 
			
		||||
| 
						 | 
				
			
			@ -1701,8 +1701,8 @@ class Service_discovery_window:
 | 
			
		|||
		gajim.connections[self.account].request_agents(jid)
 | 
			
		||||
	
 | 
			
		||||
	def agents(self, agents):
 | 
			
		||||
		"""When list of available agent arrive :
 | 
			
		||||
		Fill the treeview with it"""
 | 
			
		||||
		'''When list of available agent arrive :
 | 
			
		||||
		Fill the treeview with it'''
 | 
			
		||||
		model = self.services_treeview.get_model()
 | 
			
		||||
		for agent in agents:
 | 
			
		||||
			iter = model.append(None, (agent['name'], agent['jid']))
 | 
			
		||||
| 
						 | 
				
			
			@ -1731,11 +1731,11 @@ class Service_discovery_window:
 | 
			
		|||
			child = model.iter_next(child)
 | 
			
		||||
	
 | 
			
		||||
	def agent_info_info(self, agent, identities, features):
 | 
			
		||||
		"""When we recieve informations about an agent, but not its items"""
 | 
			
		||||
		'''When we recieve informations about an agent, but not its items'''
 | 
			
		||||
		self.agent_info(agent, identities, features, [])
 | 
			
		||||
 | 
			
		||||
	def agent_info_items(self, agent, items):
 | 
			
		||||
		"""When we recieve items about an agent"""
 | 
			
		||||
		'''When we recieve items about an agent'''
 | 
			
		||||
		model = self.services_treeview.get_model()
 | 
			
		||||
		iter = model.get_iter_root()
 | 
			
		||||
		# We look if this agent is in the treeview
 | 
			
		||||
| 
						 | 
				
			
			@ -1773,7 +1773,7 @@ class Service_discovery_window:
 | 
			
		|||
			self.services_treeview.expand_row((model.get_path(iter)), False)
 | 
			
		||||
 | 
			
		||||
	def agent_info(self, agent, identities, features, items):
 | 
			
		||||
		"""When we recieve informations about an agent"""
 | 
			
		||||
		'''When we recieve informations about an agent'''
 | 
			
		||||
		model = self.services_treeview.get_model()
 | 
			
		||||
		iter = model.get_iter_root()
 | 
			
		||||
		# We look if this agent is in the treeview
 | 
			
		||||
| 
						 | 
				
			
			@ -1810,7 +1810,7 @@ class Service_discovery_window:
 | 
			
		|||
				self.browse(item['jid'])
 | 
			
		||||
 | 
			
		||||
	def on_refresh_button_clicked(self, widget):
 | 
			
		||||
		"""When refresh button is clicked: refresh list: clear and rerequest it"""
 | 
			
		||||
		'''When refresh button is clicked: refresh list: clear and rerequest it'''
 | 
			
		||||
		self.services_treeview.get_model().clear()
 | 
			
		||||
		jid = self.address_comboboxentry.child.get_text()
 | 
			
		||||
		self.browse(jid)
 | 
			
		||||
| 
						 | 
				
			
			@ -1827,7 +1827,7 @@ class Service_discovery_window:
 | 
			
		|||
			pass
 | 
			
		||||
 | 
			
		||||
	def on_services_treeview_row_activated(self, widget, path, col=0):
 | 
			
		||||
		"""When a row is activated: Register or join the selected agent"""
 | 
			
		||||
		'''When a row is activated: Register or join the selected agent'''
 | 
			
		||||
		#if both buttons are sensitive, it will register [default]
 | 
			
		||||
		if self.register_button.get_property('sensitive'):
 | 
			
		||||
			self.on_register_button_clicked(widget)
 | 
			
		||||
| 
						 | 
				
			
			@ -1835,8 +1835,8 @@ class Service_discovery_window:
 | 
			
		|||
			self.on_join_button_clicked(widget)
 | 
			
		||||
 | 
			
		||||
	def on_join_button_clicked(self, widget):
 | 
			
		||||
		"""When we want to join a conference:
 | 
			
		||||
		Ask specific informations about the selected agent and close the window"""
 | 
			
		||||
		'''When we want to join a conference:
 | 
			
		||||
		Ask specific informations about the selected agent and close the window'''
 | 
			
		||||
		model, iter = self.services_treeview.get_selection().get_selected()
 | 
			
		||||
		if not iter:
 | 
			
		||||
			return
 | 
			
		||||
| 
						 | 
				
			
			@ -1847,27 +1847,27 @@ class Service_discovery_window:
 | 
			
		|||
			room = services[0]
 | 
			
		||||
			service = services[1]
 | 
			
		||||
		if not self.plugin.windows[self.account].has_key('join_gc'):
 | 
			
		||||
			dialog.Join_groupchat_window(self.plugin, self.account, service, room)
 | 
			
		||||
			dialogs.Join_groupchat_window(self.plugin, self.account, service, room)
 | 
			
		||||
		else:
 | 
			
		||||
			self.plugin.windows[self.account]['join_gc'].window.present()
 | 
			
		||||
 | 
			
		||||
	def on_register_button_clicked(self, widget):
 | 
			
		||||
		"""When we want to register an agent :
 | 
			
		||||
		Ask specific informations about the selected agent and close the window"""
 | 
			
		||||
		'''When we want to register an agent :
 | 
			
		||||
		Ask specific informations about the selected agent and close the window'''
 | 
			
		||||
		model, iter = self.services_treeview.get_selection().get_selected()
 | 
			
		||||
		if not iter :
 | 
			
		||||
			return
 | 
			
		||||
		service = model.get_value(iter, 1)
 | 
			
		||||
		infos = gajim.connections[self.account].ask_register_agent_info(service)
 | 
			
		||||
		if not infos.has_key('instructions'):
 | 
			
		||||
			dialog.Error_dialog(_('error contacting %s') % service)
 | 
			
		||||
			dialogs.Error_dialog(_('error contacting %s') % service)
 | 
			
		||||
		else:
 | 
			
		||||
			Service_registration_window(service, infos, self.plugin, self.account)
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
	
 | 
			
		||||
	def on_services_treeview_cursor_changed(self, widget):
 | 
			
		||||
		"""When we select a row :
 | 
			
		||||
		activate buttons if needed"""
 | 
			
		||||
		'''When we select a row :
 | 
			
		||||
		activate buttons if needed'''
 | 
			
		||||
		self.join_button.set_sensitive(False)
 | 
			
		||||
		self.register_button.set_sensitive(False)
 | 
			
		||||
		model, iter = self.services_treeview.get_selection().get_selected()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,9 +32,9 @@ import gtkgui
 | 
			
		|||
GTKGUI_GLADE='gtkgui.glade'
 | 
			
		||||
 | 
			
		||||
class Vcard_information_window:
 | 
			
		||||
	"""Class for user's information window"""
 | 
			
		||||
	'''Class for user's information window'''
 | 
			
		||||
	def on_user_information_window_destroy(self, widget=None):
 | 
			
		||||
		"""close window"""
 | 
			
		||||
		'''close window'''
 | 
			
		||||
		del self.plugin.windows[self.account]['infos'][self.jid]
 | 
			
		||||
 | 
			
		||||
	def on_vcard_information_window_key_press_event(self, widget, event):
 | 
			
		||||
| 
						 | 
				
			
			@ -42,11 +42,11 @@ class Vcard_information_window:
 | 
			
		|||
			self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def on_close_button_clicked(self, widget):
 | 
			
		||||
		"""Save user's informations and update the roster on the Jabber server"""
 | 
			
		||||
		'''Save user's informations and update the roster on the Jabber server'''
 | 
			
		||||
		if self.vcard:
 | 
			
		||||
			self.window.destroy()
 | 
			
		||||
			return
 | 
			
		||||
		#update user.name if it's not ""
 | 
			
		||||
		#update user.name if it's not ''
 | 
			
		||||
		name_entry = self.xml.get_widget('nickname_entry')
 | 
			
		||||
		new_name = name_entry.get_text()
 | 
			
		||||
		if new_name != self.user.name and new_name != '':
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ class Vcard_information_window:
 | 
			
		|||
			self.user.resource)
 | 
			
		||||
 | 
			
		||||
	def add_to_vcard(self, vcard, entry, txt):
 | 
			
		||||
		"""Add an information to the vCard dictionary"""
 | 
			
		||||
		'''Add an information to the vCard dictionary'''
 | 
			
		||||
		entries = entry.split('_')
 | 
			
		||||
		loc = vcard
 | 
			
		||||
		while len(entries) > 1:
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ class Vcard_information_window:
 | 
			
		|||
		return vcard
 | 
			
		||||
 | 
			
		||||
	def make_vcard(self):
 | 
			
		||||
		"""make the vCard dictionary"""
 | 
			
		||||
		'''make the vCard dictionary'''
 | 
			
		||||
		entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_USERID', 'URL', 'TEL_NUMBER',\
 | 
			
		||||
			'ADR_STREET', 'ADR_EXTADR', 'ADR_LOCALITY', 'ADR_REGION', 'ADR_PCODE',\
 | 
			
		||||
			'ADR_CTRY', 'ORG_ORGNAME', 'ORG_ORGUNIT', 'TITLE', 'ROLE'] 
 | 
			
		||||
| 
						 | 
				
			
			@ -232,7 +232,7 @@ class Vcard_information_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
class Edit_groups_dialog:
 | 
			
		||||
	"""Class for the edit group dialog window"""
 | 
			
		||||
	'''Class for the edit group dialog window'''
 | 
			
		||||
	def __init__(self, user, account, plugin):
 | 
			
		||||
		self.xml = gtk.glade.XML(GTKGUI_GLADE, 'edit_groups_dialog', APP)
 | 
			
		||||
		self.dialog = self.xml.get_widget('edit_groups_dialog')
 | 
			
		||||
| 
						 | 
				
			
			@ -314,9 +314,9 @@ class Edit_groups_dialog:
 | 
			
		|||
		column.set_attributes(renderer, active=1)
 | 
			
		||||
 | 
			
		||||
class Passphrase_dialog:
 | 
			
		||||
	"""Class for Passphrase dialog"""
 | 
			
		||||
	'''Class for Passphrase dialog'''
 | 
			
		||||
	def run(self):
 | 
			
		||||
		"""Wait for OK button to be pressed and return passphrase/password"""
 | 
			
		||||
		'''Wait for OK button to be pressed and return passphrase/password'''
 | 
			
		||||
		if self.autoconnect:
 | 
			
		||||
			gtk.gdk.threads_enter()
 | 
			
		||||
		rep = self.window.run()
 | 
			
		||||
| 
						 | 
				
			
			@ -343,9 +343,9 @@ class Passphrase_dialog:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
class choose_gpg_key_dialog:
 | 
			
		||||
	"""Class for GPG key dialog"""
 | 
			
		||||
	'''Class for GPG key dialog'''
 | 
			
		||||
	def run(self):
 | 
			
		||||
		"""Wait for Ok button to be pressed and return the selected key"""
 | 
			
		||||
		'''Wait for Ok button to be pressed and return the selected key'''
 | 
			
		||||
		rep = self.window.run()
 | 
			
		||||
		if rep == gtk.RESPONSE_OK:
 | 
			
		||||
			selection = self.keys_treeview.get_selection()
 | 
			
		||||
| 
						 | 
				
			
			@ -402,7 +402,7 @@ class Change_status_message_dialog:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	def run(self):
 | 
			
		||||
		"""Wait for OK button to be pressed and return away messsage"""
 | 
			
		||||
		'''Wait for OK button to be pressed and return away messsage'''
 | 
			
		||||
		if self.autoconnect:
 | 
			
		||||
			gtk.gdk.threads_enter()
 | 
			
		||||
		rep = self.window.run()
 | 
			
		||||
| 
						 | 
				
			
			@ -432,7 +432,7 @@ class Change_status_message_dialog:
 | 
			
		|||
				self.window.response(gtk.RESPONSE_OK)
 | 
			
		||||
 | 
			
		||||
class Add_new_contact_window:
 | 
			
		||||
	"""Class for Add_new_contact_window"""
 | 
			
		||||
	'''Class for Add_new_contact_window'''
 | 
			
		||||
	def __init__(self, plugin, account, jid=None):
 | 
			
		||||
		if gajim.connections[account].connected < 2:
 | 
			
		||||
			Error_dialog(_('You must be connected to add a contact'))
 | 
			
		||||
| 
						 | 
				
			
			@ -485,17 +485,17 @@ class Add_new_contact_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		"""When Cancel button is clicked"""
 | 
			
		||||
		'''When Cancel button is clicked'''
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def on_subscribe_button_clicked(self, widget):
 | 
			
		||||
		"""When Subscribe button is clicked"""
 | 
			
		||||
		'''When Subscribe button is clicked'''
 | 
			
		||||
		jid = self.xml.get_widget('jid_entry').get_text()
 | 
			
		||||
		nickname = self.xml.get_widget('nickname_entry').get_text()
 | 
			
		||||
		if not jid:
 | 
			
		||||
			return
 | 
			
		||||
		if jid.find('@') < 0:
 | 
			
		||||
			Error_dialog(_("The contact's name must be something like login@hostname"))
 | 
			
		||||
			Error_dialog(_('The contact\'s name must be something like login@hostname'))
 | 
			
		||||
			return
 | 
			
		||||
		message_buffer = self.xml.get_widget('message_textview').get_buffer()
 | 
			
		||||
		start_iter = message_buffer.get_start_iter()
 | 
			
		||||
| 
						 | 
				
			
			@ -553,7 +553,7 @@ class Add_new_contact_window:
 | 
			
		|||
		self.old_uid_value = uid.split('@')[0]
 | 
			
		||||
 | 
			
		||||
class About_dialog:
 | 
			
		||||
	"""Class for about dialog"""
 | 
			
		||||
	'''Class for about dialog'''
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
		if gtk.pygtk_version < (2, 6, 0):
 | 
			
		||||
			Information_dialog(_('Gajim - A GTK jabber client'))
 | 
			
		||||
| 
						 | 
				
			
			@ -579,7 +579,7 @@ class About_dialog:
 | 
			
		|||
		dlg.destroy()
 | 
			
		||||
 | 
			
		||||
class Confirmation_dialog:
 | 
			
		||||
	"""Class for confirmation dialog"""
 | 
			
		||||
	'''Class for confirmation dialog'''
 | 
			
		||||
	def get_response(self):
 | 
			
		||||
		response = self.dialog.run()
 | 
			
		||||
		self.dialog.destroy()
 | 
			
		||||
| 
						 | 
				
			
			@ -591,7 +591,7 @@ class Confirmation_dialog:
 | 
			
		|||
			gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label)
 | 
			
		||||
 | 
			
		||||
class Warning_dialog:
 | 
			
		||||
	"""Class for warning dialog"""
 | 
			
		||||
	'''Class for warning dialog'''
 | 
			
		||||
	def on_response(self, dialog, response_id):
 | 
			
		||||
		dialog.destroy()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -603,7 +603,7 @@ class Warning_dialog:
 | 
			
		|||
		dialog.show()
 | 
			
		||||
 | 
			
		||||
class Information_dialog:
 | 
			
		||||
	"""Class for information dialog"""
 | 
			
		||||
	'''Class for information dialog'''
 | 
			
		||||
	def on_response(self, dialog, response_id):
 | 
			
		||||
		dialog.destroy()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -615,7 +615,7 @@ class Information_dialog:
 | 
			
		|||
		dialog.show()
 | 
			
		||||
 | 
			
		||||
class Error_dialog:
 | 
			
		||||
	"""Class for error dialog"""
 | 
			
		||||
	'''Class for error dialog'''
 | 
			
		||||
	def on_response(self, dialog, response_id):
 | 
			
		||||
		dialog.destroy()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -639,21 +639,21 @@ class subscription_request_window:
 | 
			
		|||
		xml.signal_autoconnect(self)
 | 
			
		||||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	"""Class for authorization window :
 | 
			
		||||
	window that appears when a user wants to add us to his/her roster"""
 | 
			
		||||
	'''Class for authorization window :
 | 
			
		||||
	window that appears when a user wants to add us to his/her roster'''
 | 
			
		||||
	def on_close_button_clicked(self, widget):
 | 
			
		||||
		"""When Close button is clicked"""
 | 
			
		||||
		'''When Close button is clicked'''
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
		
 | 
			
		||||
	def on_authorize_button_clicked(self, widget):
 | 
			
		||||
		"""Accept the request"""
 | 
			
		||||
		'''Accept the request'''
 | 
			
		||||
		gajim.connections[self.account].send_authorization(self.jid)
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
		if not self.plugin.roster.contacts[self.account].has_key(self.jid):
 | 
			
		||||
			Add_new_contact_window(self.plugin, self.account, self.jid)
 | 
			
		||||
	
 | 
			
		||||
	def on_deny_button_clicked(self, widget):
 | 
			
		||||
		"""refuse the request"""
 | 
			
		||||
		'''refuse the request'''
 | 
			
		||||
		gajim.connections[self.account].refuse_authorization(self.jid)
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -686,7 +686,7 @@ class Join_groupchat_window:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	def on_join_groupchat_window_destroy(self, widget):
 | 
			
		||||
		"""close window"""
 | 
			
		||||
		'''close window'''
 | 
			
		||||
		del self.plugin.windows[self.account]['join_gc'] # remove us from open windows
 | 
			
		||||
 | 
			
		||||
	def on_join_groupchat_window_key_press_event(self, widget, event):
 | 
			
		||||
| 
						 | 
				
			
			@ -701,11 +701,11 @@ class Join_groupchat_window:
 | 
			
		|||
		self.xml.get_widget('server_entry').set_text(gid.split('@')[1])
 | 
			
		||||
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		"""When Cancel button is clicked"""
 | 
			
		||||
		'''When Cancel button is clicked'''
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def on_join_button_clicked(self, widget):
 | 
			
		||||
		"""When Join button is clicked"""
 | 
			
		||||
		'''When Join button is clicked'''
 | 
			
		||||
		nickname = self.xml.get_widget('nickname_entry').get_text()
 | 
			
		||||
		room = self.xml.get_widget('room_entry').get_text()
 | 
			
		||||
		server = self.xml.get_widget('server_entry').get_text()
 | 
			
		||||
| 
						 | 
				
			
			@ -745,15 +745,15 @@ class New_message_dialog:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	def on_delete_event(self, widget, event):
 | 
			
		||||
		"""close window"""
 | 
			
		||||
		'''close window'''
 | 
			
		||||
		del self.plugin.windows['new_message']
 | 
			
		||||
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		"""When Cancel button is clicked"""
 | 
			
		||||
		'''When Cancel button is clicked'''
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
	def on_chat_button_clicked(self, widget):
 | 
			
		||||
		"""When Chat button is clicked"""
 | 
			
		||||
		'''When Chat button is clicked'''
 | 
			
		||||
		jid = self.jid_entry.get_text()
 | 
			
		||||
		if jid.find('@') == -1: # if no @ was given
 | 
			
		||||
			Error_dialog(_('User ID is not valid'))
 | 
			
		||||
| 
						 | 
				
			
			@ -790,7 +790,7 @@ class Change_password_dialog:
 | 
			
		|||
		self.window.show_all()
 | 
			
		||||
 | 
			
		||||
	def run(self):
 | 
			
		||||
		"""Wait for OK button to be pressed and return new password"""
 | 
			
		||||
		'''Wait for OK button to be pressed and return new password'''
 | 
			
		||||
		end = False
 | 
			
		||||
		while not end:
 | 
			
		||||
			rep = self.dialog.run()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ gtk.glade.textdomain(APP)
 | 
			
		|||
GTKGUI_GLADE='gtkgui.glade'
 | 
			
		||||
 | 
			
		||||
class Roster_window:
 | 
			
		||||
	"""Class for main window of gtkgui plugin"""
 | 
			
		||||
	'''Class for main window of gtkgui plugin'''
 | 
			
		||||
 | 
			
		||||
	def get_account_iter(self, name):
 | 
			
		||||
		if self.regroup:
 | 
			
		||||
| 
						 | 
				
			
			@ -120,13 +120,13 @@ class Roster_window:
 | 
			
		|||
			self.redraw_jid(jid, account)
 | 
			
		||||
 | 
			
		||||
	def add_user_to_roster(self, jid, account):
 | 
			
		||||
		"""Add a user to the roster and add groups if they aren't in roster"""
 | 
			
		||||
		'''Add a user to the roster and add groups if they aren't in roster'''
 | 
			
		||||
		showOffline = gajim.config.get('showoffline')
 | 
			
		||||
		if not self.contacts[account].has_key(jid):
 | 
			
		||||
			return
 | 
			
		||||
		users = self.contacts[account][jid]
 | 
			
		||||
		user = users[0]
 | 
			
		||||
		if user.jid.find("@") <= 0:
 | 
			
		||||
		if user.jid.find('@') <= 0:
 | 
			
		||||
			user.groups = ['Agents']
 | 
			
		||||
		elif user.groups == []:
 | 
			
		||||
			user.groups.append('General')
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ class Roster_window:
 | 
			
		|||
		self.remove_user(user, account)
 | 
			
		||||
	
 | 
			
		||||
	def remove_user(self, user, account):
 | 
			
		||||
		"""Remove a user from the roster"""
 | 
			
		||||
		'''Remove a user from the roster'''
 | 
			
		||||
		if user.jid in self.to_be_removed[account]:
 | 
			
		||||
			return
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +190,7 @@ class Roster_window:
 | 
			
		|||
					del self.groups[account][group]
 | 
			
		||||
 | 
			
		||||
	def redraw_jid(self, jid, account):
 | 
			
		||||
		"""draw the correct pixbuf and name"""
 | 
			
		||||
		'''draw the correct pixbuf and name'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		iters = self.get_user_iter(jid, account)
 | 
			
		||||
		if len(iters) == 0:
 | 
			
		||||
| 
						 | 
				
			
			@ -198,7 +198,7 @@ class Roster_window:
 | 
			
		|||
		users = self.contacts[account][jid]
 | 
			
		||||
		name = users[0].name
 | 
			
		||||
		if len(users) > 1:
 | 
			
		||||
			name += " (" + str(len(users)) + ")"
 | 
			
		||||
			name += ' (' + str(len(users)) + ')'
 | 
			
		||||
		prio = 0
 | 
			
		||||
		user = users[0]
 | 
			
		||||
		for u in users:
 | 
			
		||||
| 
						 | 
				
			
			@ -206,7 +206,7 @@ class Roster_window:
 | 
			
		|||
				prio = u.priority
 | 
			
		||||
				user = u
 | 
			
		||||
		for iter in iters:
 | 
			
		||||
			if jid.find("@") <= 0: # It's an agent
 | 
			
		||||
			if jid.find('@') <= 0: # It's an agent
 | 
			
		||||
				img = self.pixbufs[user.show]
 | 
			
		||||
			elif self.plugin.queues[account].has_key(jid):
 | 
			
		||||
				img = self.pixbufs['message']
 | 
			
		||||
| 
						 | 
				
			
			@ -222,7 +222,7 @@ class Roster_window:
 | 
			
		|||
			model.set_value(iter, 1, name)
 | 
			
		||||
	
 | 
			
		||||
	def make_menu(self):
 | 
			
		||||
		"""create the main_window's menus"""
 | 
			
		||||
		'''create the main_window's menus'''
 | 
			
		||||
		# try to avoid WIDGET_REALIZED_FOR_EVENT failed which freezes gajim
 | 
			
		||||
		new_message_menuitem = self.xml.get_widget('new_message_menuitem')
 | 
			
		||||
		join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +322,7 @@ class Roster_window:
 | 
			
		|||
					gajim.connections.keys()[0])
 | 
			
		||||
 | 
			
		||||
	def draw_roster(self):
 | 
			
		||||
		"""Clear and draw roster"""
 | 
			
		||||
		'''Clear and draw roster'''
 | 
			
		||||
		self.make_menu()
 | 
			
		||||
		self.tree.get_model().clear()
 | 
			
		||||
		for acct in gajim.connections:
 | 
			
		||||
| 
						 | 
				
			
			@ -331,7 +331,7 @@ class Roster_window:
 | 
			
		|||
				self.add_user_to_roster(jid, acct)
 | 
			
		||||
	
 | 
			
		||||
	def mklists(self, array, account):
 | 
			
		||||
		"""fill self.contacts and self.groups"""
 | 
			
		||||
		'''fill self.contacts and self.groups'''
 | 
			
		||||
		if not self.contacts.has_key(account):
 | 
			
		||||
			self.contacts[account] = {}
 | 
			
		||||
		if not self.groups.has_key(account):
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +347,7 @@ class Roster_window:
 | 
			
		|||
			#get name
 | 
			
		||||
			name = array[jid]['name']
 | 
			
		||||
			if not name:
 | 
			
		||||
				if ji.find("@") <= 0:
 | 
			
		||||
				if ji.find('@') <= 0:
 | 
			
		||||
					name = ji
 | 
			
		||||
				else:
 | 
			
		||||
					name = jid.split('@')[0]
 | 
			
		||||
| 
						 | 
				
			
			@ -370,7 +370,7 @@ class Roster_window:
 | 
			
		|||
						self.groups[account][g] = {'expand': True}
 | 
			
		||||
 | 
			
		||||
	def chg_user_status(self, user, show, status, account):
 | 
			
		||||
		"""When a user change his status"""
 | 
			
		||||
		'''When a user change his status'''
 | 
			
		||||
		showOffline = gajim.config.get('showoffline')
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		luser = self.contacts[account][user.jid]
 | 
			
		||||
| 
						 | 
				
			
			@ -396,10 +396,10 @@ class Roster_window:
 | 
			
		|||
			if user.resource != '':
 | 
			
		||||
				name += '/'+user.resource
 | 
			
		||||
			self.plugin.windows[account]['chats'][user.jid].print_conversation(\
 | 
			
		||||
				_("%s is now %s (%s)") % (name, show, status), user.jid, 'status')
 | 
			
		||||
				_('%s is now %s (%s)') % (name, show, status), user.jid, 'status')
 | 
			
		||||
 | 
			
		||||
	def on_info(self, widget, user, account):
 | 
			
		||||
		"""Call vcard_information_window class to display user's information"""
 | 
			
		||||
		'''Call vcard_information_window class to display user's information'''
 | 
			
		||||
		if self.plugin.windows[account]['infos'].has_key(user.jid):
 | 
			
		||||
			self.plugin.windows[account]['infos'][user.jid].window.present()
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			@ -407,11 +407,11 @@ class Roster_window:
 | 
			
		|||
				dialogs.Vcard_information_window(user, self.plugin, account)
 | 
			
		||||
 | 
			
		||||
	def on_agent_logging(self, widget, jid, state, account):
 | 
			
		||||
		"""When an agent is requested to log in or off"""
 | 
			
		||||
		'''When an agent is requested to log in or off'''
 | 
			
		||||
		gajim.connections[account].send_agent_status(jid, state)
 | 
			
		||||
 | 
			
		||||
	def on_remove_agent(self, widget, jid, account):
 | 
			
		||||
		"""When an agent is requested to log in or off"""
 | 
			
		||||
		'''When an agent is requested to log in or off'''
 | 
			
		||||
		window = dialogs.Confirmation_dialog(_('Are you sure you want to remove the agent %s from your roster?') % jid)
 | 
			
		||||
		if window.get_response() == gtk.RESPONSE_YES:
 | 
			
		||||
			gajim.connections[account].unsubscribe_agent(jid)
 | 
			
		||||
| 
						 | 
				
			
			@ -429,13 +429,13 @@ class Roster_window:
 | 
			
		|||
		dlg.run()
 | 
			
		||||
		
 | 
			
		||||
	def on_history(self, widget, user):
 | 
			
		||||
		"""When history button is pressed : call log window"""
 | 
			
		||||
		'''When history button is pressed : call log window'''
 | 
			
		||||
		if not self.plugin.windows['logs'].has_key(user.jid):
 | 
			
		||||
			self.plugin.windows['logs'][user.jid] = history_window.\
 | 
			
		||||
				History_window(self.plugin, user.jid)
 | 
			
		||||
	
 | 
			
		||||
	def mk_menu_user(self, event, iter):
 | 
			
		||||
		"""Make user's popup menu"""
 | 
			
		||||
		'''Make user's popup menu'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		jid = model.get_value(iter, 3)
 | 
			
		||||
		path = model.get_path(iter)
 | 
			
		||||
| 
						 | 
				
			
			@ -486,7 +486,7 @@ class Roster_window:
 | 
			
		|||
		menu.reposition()
 | 
			
		||||
 | 
			
		||||
	def mk_menu_g(self, event, iter):
 | 
			
		||||
		"""Make group's popup menu"""
 | 
			
		||||
		'''Make group's popup menu'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		path = model.get_path(iter)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -499,7 +499,7 @@ class Roster_window:
 | 
			
		|||
		menu.reposition()
 | 
			
		||||
	
 | 
			
		||||
	def mk_menu_agent(self, event, iter):
 | 
			
		||||
		"""Make agent's popup menu"""
 | 
			
		||||
		'''Make agent's popup menu'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		jid = model.get_value(iter, 3)
 | 
			
		||||
		path = model.get_path(iter)
 | 
			
		||||
| 
						 | 
				
			
			@ -537,7 +537,7 @@ class Roster_window:
 | 
			
		|||
				config.Account_modification_window(self.plugin, account)
 | 
			
		||||
 | 
			
		||||
	def mk_menu_account(self, event, iter):
 | 
			
		||||
		"""Make account's popup menu"""
 | 
			
		||||
		'''Make account's popup menu'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		account = model.get_value(iter, 3)
 | 
			
		||||
		
 | 
			
		||||
| 
						 | 
				
			
			@ -592,11 +592,11 @@ class Roster_window:
 | 
			
		|||
		menu.reposition()
 | 
			
		||||
	
 | 
			
		||||
	def authorize(self, widget, jid, account):
 | 
			
		||||
		"""Authorize a user"""
 | 
			
		||||
		'''Authorize a user'''
 | 
			
		||||
		gajim.connections[account].send_authorization(jid)
 | 
			
		||||
 | 
			
		||||
	def req_sub(self, widget, jid, txt, account, group=None, pseudo=None):
 | 
			
		||||
		"""Request subscription to a user"""
 | 
			
		||||
		'''Request subscription to a user'''
 | 
			
		||||
		if not pseudo:
 | 
			
		||||
			pseudo = jid
 | 
			
		||||
		gajim.connections[account].request_subscription(jid, txt)
 | 
			
		||||
| 
						 | 
				
			
			@ -609,7 +609,7 @@ class Roster_window:
 | 
			
		|||
			self.add_user_to_roster(jid, account)
 | 
			
		||||
 | 
			
		||||
	def on_roster_treeview_key_press_event(self, widget, event):
 | 
			
		||||
		"""when a key is pressed in the treeviews"""
 | 
			
		||||
		'''when a key is pressed in the treeviews'''
 | 
			
		||||
		if event.keyval == gtk.keysyms.Escape:
 | 
			
		||||
			self.tree.get_selection().unselect_all()
 | 
			
		||||
		if event.keyval == gtk.keysyms.F2:
 | 
			
		||||
| 
						 | 
				
			
			@ -638,7 +638,7 @@ class Roster_window:
 | 
			
		|||
		return False
 | 
			
		||||
	
 | 
			
		||||
	def on_roster_treeview_button_press_event(self, widget, event):
 | 
			
		||||
		"""popup contact's , group's or agent's menu"""
 | 
			
		||||
		'''popup contact's , group's or agent's menu'''
 | 
			
		||||
		if event.type == gtk.gdk.BUTTON_PRESS:
 | 
			
		||||
			if event.button == 3: # Right click
 | 
			
		||||
				try:
 | 
			
		||||
| 
						 | 
				
			
			@ -679,8 +679,8 @@ class Roster_window:
 | 
			
		|||
		return False
 | 
			
		||||
 | 
			
		||||
	def on_req_usub(self, widget, user, account):
 | 
			
		||||
		"""Remove a user"""
 | 
			
		||||
		window = dialogs.Confirmation_dialog(_("Are you sure you want to remove %s (%s) from your roster?") % (user.name, user.jid))
 | 
			
		||||
		'''Remove a user'''
 | 
			
		||||
		window = dialogs.Confirmation_dialog(_('Are you sure you want to remove %s (%s) from your roster?') % (user.name, user.jid))
 | 
			
		||||
		if window.get_response() == gtk.RESPONSE_YES:
 | 
			
		||||
			gajim.connections[account].unsubscribe(user.jid)
 | 
			
		||||
			for u in self.contacts[account][user.jid]:
 | 
			
		||||
| 
						 | 
				
			
			@ -767,7 +767,7 @@ class Roster_window:
 | 
			
		|||
		self.send_status(account, status, message)
 | 
			
		||||
 | 
			
		||||
	def on_status_combobox_changed(self, widget):
 | 
			
		||||
		"""When we change our status"""
 | 
			
		||||
		'''When we change our status'''
 | 
			
		||||
		model = self.status_combobox.get_model()
 | 
			
		||||
		active = self.status_combobox.get_active()
 | 
			
		||||
		if active < 0:
 | 
			
		||||
| 
						 | 
				
			
			@ -812,7 +812,7 @@ class Roster_window:
 | 
			
		|||
			self.window.set_icon(image.get_pixbuf())
 | 
			
		||||
 | 
			
		||||
	def on_status_changed(self, account, status):
 | 
			
		||||
		"""the core tells us that our status has changed"""
 | 
			
		||||
		'''the core tells us that our status has changed'''
 | 
			
		||||
		if not self.contacts.has_key(account):
 | 
			
		||||
			return
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
| 
						 | 
				
			
			@ -865,7 +865,7 @@ class Roster_window:
 | 
			
		|||
				groupchat_window.Groupchat_window(jid, nick, self.plugin, account)
 | 
			
		||||
 | 
			
		||||
	def on_message(self, jid, msg, tim, account):
 | 
			
		||||
		"""when we receive a message"""
 | 
			
		||||
		'''when we receive a message'''
 | 
			
		||||
		if not self.contacts[account].has_key(jid):
 | 
			
		||||
			user1 = User(jid, jid, ['not in the roster'], \
 | 
			
		||||
				'not in the roster', 'not in the roster', 'none', None, '', 0, '')
 | 
			
		||||
| 
						 | 
				
			
			@ -938,7 +938,7 @@ class Roster_window:
 | 
			
		|||
			self.plugin.windows['accounts'] = config.Accounts_window(self.plugin) 
 | 
			
		||||
 | 
			
		||||
	def close_all(self, dic):
 | 
			
		||||
		"""close all the windows in the given dictionary"""
 | 
			
		||||
		'''close all the windows in the given dictionary'''
 | 
			
		||||
		for w in dic.values():
 | 
			
		||||
			if type(w) == type({}):
 | 
			
		||||
				self.close_all(w)
 | 
			
		||||
| 
						 | 
				
			
			@ -946,7 +946,7 @@ class Roster_window:
 | 
			
		|||
				w.window.destroy()
 | 
			
		||||
	
 | 
			
		||||
	def on_roster_window_delete_event(self, widget, event):
 | 
			
		||||
		"""When we want to close the window"""
 | 
			
		||||
		'''When we want to close the window'''
 | 
			
		||||
		if self.plugin.systray_enabled:
 | 
			
		||||
			self.window.hide()
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			@ -967,8 +967,8 @@ class Roster_window:
 | 
			
		|||
		return True # do NOT destory the window
 | 
			
		||||
 | 
			
		||||
	def quit_gtkgui_plugin(self):
 | 
			
		||||
		"""When we quit the gtk plugin :
 | 
			
		||||
		tell that to the core and exit gtk"""
 | 
			
		||||
		'''When we quit the gtk plugin :
 | 
			
		||||
		tell that to the core and exit gtk'''
 | 
			
		||||
		if gajim.config.get('saveposition'):
 | 
			
		||||
			x, y = self.window.get_position()
 | 
			
		||||
			gajim.config.set('x-position', x)
 | 
			
		||||
| 
						 | 
				
			
			@ -1002,8 +1002,8 @@ class Roster_window:
 | 
			
		|||
		self.quit_gtkgui_plugin()
 | 
			
		||||
 | 
			
		||||
	def on_roster_treeview_row_activated(self, widget, path, col=0):
 | 
			
		||||
		"""When an iter is dubble clicked :
 | 
			
		||||
		open the chat window"""
 | 
			
		||||
		'''When an iter is dubble clicked :
 | 
			
		||||
		open the chat window'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		iter = model.get_iter(path)
 | 
			
		||||
		account = model.get_value(iter, 4)
 | 
			
		||||
| 
						 | 
				
			
			@ -1024,7 +1024,7 @@ class Roster_window:
 | 
			
		|||
				self.plugin.windows[account]['chats'][jid].active_tab(jid)
 | 
			
		||||
 | 
			
		||||
	def on_roster_treeview_row_expanded(self, widget, iter, path):
 | 
			
		||||
		"""When a row is expanded change the icon of the arrow"""
 | 
			
		||||
		'''When a row is expanded change the icon of the arrow'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		account = model.get_value(iter, 4)
 | 
			
		||||
		type = model.get_value(iter, 2)
 | 
			
		||||
| 
						 | 
				
			
			@ -1045,8 +1045,8 @@ class Roster_window:
 | 
			
		|||
			
 | 
			
		||||
	
 | 
			
		||||
	def on_roster_treeview_row_collapsed(self, widget, iter, path):
 | 
			
		||||
		"""When a row is collapsed :
 | 
			
		||||
		change the icon of the arrow"""
 | 
			
		||||
		'''When a row is collapsed :
 | 
			
		||||
		change the icon of the arrow'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		account = model.get_value(iter, 4)
 | 
			
		||||
		type = model.get_value(iter, 2)
 | 
			
		||||
| 
						 | 
				
			
			@ -1061,14 +1061,14 @@ class Roster_window:
 | 
			
		|||
				self.hidden_lines.append(account)
 | 
			
		||||
 | 
			
		||||
	def on_editing_canceled (self, cell):
 | 
			
		||||
		"""editing has been canceled"""
 | 
			
		||||
		'''editing has been canceled'''
 | 
			
		||||
		#TODO: get iter
 | 
			
		||||
		#model.set_value(iter, 5, False)
 | 
			
		||||
		pass
 | 
			
		||||
 | 
			
		||||
	def on_cell_edited (self, cell, row, new_text):
 | 
			
		||||
		"""When an iter is editer :
 | 
			
		||||
		if text has changed, rename the user"""
 | 
			
		||||
		'''When an iter is editer :
 | 
			
		||||
		if text has changed, rename the user'''
 | 
			
		||||
		model = self.tree.get_model()
 | 
			
		||||
		iter = model.get_iter_from_string(row)
 | 
			
		||||
		path = model.get_path(iter)
 | 
			
		||||
| 
						 | 
				
			
			@ -1098,8 +1098,8 @@ class Roster_window:
 | 
			
		|||
		model.set_value(iter, 5, False)
 | 
			
		||||
		
 | 
			
		||||
	def on_service_disco_menuitem_activate(self, widget, account):
 | 
			
		||||
		"""When Service Discovery is selected:
 | 
			
		||||
		Call browse class"""
 | 
			
		||||
		'''When Service Discovery is selected:
 | 
			
		||||
		Call browse class'''
 | 
			
		||||
		if self.plugin.windows[account].has_key('disco'):
 | 
			
		||||
			self.plugin.windows[account]['disco'].window.present()
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			@ -1107,7 +1107,7 @@ class Roster_window:
 | 
			
		|||
				config.Service_discovery_window(self.plugin, account)
 | 
			
		||||
 | 
			
		||||
	def mkpixbufs(self):
 | 
			
		||||
		"""initialise pixbufs array"""
 | 
			
		||||
		'''initialise pixbufs array'''
 | 
			
		||||
		iconset = gajim.config.get('iconset')
 | 
			
		||||
		if not iconset:
 | 
			
		||||
			iconset = 'sun'
 | 
			
		||||
| 
						 | 
				
			
			@ -1164,13 +1164,13 @@ class Roster_window:
 | 
			
		|||
		self.update_status_comboxbox()
 | 
			
		||||
 | 
			
		||||
	def on_show_offline_contacts_menuitem_activate(self, widget):
 | 
			
		||||
		"""when show offline option is changed:
 | 
			
		||||
		redraw the treeview"""
 | 
			
		||||
		'''when show offline option is changed:
 | 
			
		||||
		redraw the treeview'''
 | 
			
		||||
		gajim.config.set('showoffline', 1 - gajim.config.get('showoffline'))
 | 
			
		||||
		self.draw_roster()
 | 
			
		||||
 | 
			
		||||
	def iconCellDataFunc(self, column, renderer, model, iter, data=None):
 | 
			
		||||
		"""When a row is added, set properties for icon renderer"""
 | 
			
		||||
		'''When a row is added, set properties for icon renderer'''
 | 
			
		||||
		if model.get_value(iter, 2) == 'account':
 | 
			
		||||
			renderer.set_property('cell-background', \
 | 
			
		||||
				gajim.config.get('accountbgcolor'))
 | 
			
		||||
| 
						 | 
				
			
			@ -1193,7 +1193,7 @@ class Roster_window:
 | 
			
		|||
		renderer.set_property('width', 20)
 | 
			
		||||
	
 | 
			
		||||
	def nameCellDataFunc(self, column, renderer, model, iter, data=None):
 | 
			
		||||
		"""When a row is added, set properties for name renderer"""
 | 
			
		||||
		'''When a row is added, set properties for name renderer'''
 | 
			
		||||
		if model.get_value(iter, 2) == 'account':
 | 
			
		||||
			renderer.set_property('foreground', \
 | 
			
		||||
				gajim.config.get('accounttextcolor'))
 | 
			
		||||
| 
						 | 
				
			
			@ -1224,7 +1224,7 @@ class Roster_window:
 | 
			
		|||
			renderer.set_property('xpad', 8)
 | 
			
		||||
 | 
			
		||||
	def compareIters(self, model, iter1, iter2, data = None):
 | 
			
		||||
		"""Compare two iters to sort them"""
 | 
			
		||||
		'''Compare two iters to sort them'''
 | 
			
		||||
		name1 = model.get_value(iter1, 1)
 | 
			
		||||
		name2 = model.get_value(iter2, 1)
 | 
			
		||||
		if not name1 or not name2:
 | 
			
		||||
| 
						 | 
				
			
			@ -1245,7 +1245,7 @@ class Roster_window:
 | 
			
		|||
		treeselection = treeview.get_selection()
 | 
			
		||||
		model, iter = treeselection.get_selected()
 | 
			
		||||
		path = model.get_path(iter)
 | 
			
		||||
		data = ""
 | 
			
		||||
		data = ''
 | 
			
		||||
		if len(path) == 3:
 | 
			
		||||
			data = model.get_value(iter, 3)
 | 
			
		||||
		selection.set(selection.target, 8, data)
 | 
			
		||||
| 
						 | 
				
			
			@ -1311,12 +1311,12 @@ class Roster_window:
 | 
			
		|||
		return
 | 
			
		||||
 | 
			
		||||
	def show_title(self):
 | 
			
		||||
		start = ""
 | 
			
		||||
		start = ''
 | 
			
		||||
		if self.nb_unread > 1:
 | 
			
		||||
			start = "[" + str(self.nb_unread) + "] "
 | 
			
		||||
			start = '[' + str(self.nb_unread) + ']  '
 | 
			
		||||
		elif self.nb_unread == 1:
 | 
			
		||||
			start = "* "
 | 
			
		||||
		self.window.set_title(start + " Gajim")
 | 
			
		||||
			start = '*  '
 | 
			
		||||
		self.window.set_title(start + 'Gajim')
 | 
			
		||||
 | 
			
		||||
	def __init__(self, plugin):
 | 
			
		||||
		self.xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_window', APP)
 | 
			
		||||
| 
						 | 
				
			
			@ -1412,8 +1412,8 @@ class Roster_window:
 | 
			
		|||
		self.tree.enable_model_drag_source( gtk.gdk.BUTTON1_MASK, TARGETS,
 | 
			
		||||
			gtk.gdk.ACTION_DEFAULT| gtk.gdk.ACTION_MOVE)
 | 
			
		||||
		self.tree.enable_model_drag_dest(TARGETS, gtk.gdk.ACTION_DEFAULT)
 | 
			
		||||
		self.tree.connect("drag_data_get", self.drag_data_get_data)
 | 
			
		||||
		self.tree.connect("drag_data_received", self.drag_data_received_data)
 | 
			
		||||
		self.tree.connect('drag_data_get', self.drag_data_get_data)
 | 
			
		||||
		self.tree.connect('drag_data_received', self.drag_data_received_data)
 | 
			
		||||
		self.xml.signal_autoconnect(self)
 | 
			
		||||
		self.id_signal_cb = self.status_combobox.connect('changed',\
 | 
			
		||||
														self.on_status_combobox_changed)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue