new option implementation : gajim can now ask a status message when we go online / offline.
(code in preferences window is still needed)
This commit is contained in:
		
							parent
							
								
									fb42a00add
								
							
						
					
					
						commit
						4cdda8995c
					
				
					 1 changed files with 28 additions and 25 deletions
				
			
		|  | @ -1969,12 +1969,12 @@ class roster_window: | ||||||
| 				self.plugin.systray.set_status('connecting') | 				self.plugin.systray.set_status('connecting') | ||||||
| 
 | 
 | ||||||
| 			save_pass = 0 | 			save_pass = 0 | ||||||
| 			if self.plugin.accounts[account].has_key("savepass"): | 			if self.plugin.accounts[account].has_key('savepass'): | ||||||
| 				save_pass = self.plugin.accounts[account]["savepass"] | 				save_pass = self.plugin.accounts[account]['savepass'] | ||||||
| 			if not save_pass and not self.plugin.connected[account]: | 			if not save_pass and not self.plugin.connected[account]: | ||||||
| 				passphrase = '' | 				passphrase = '' | ||||||
| 				w = passphrase_dialog('Enter your password for account %s' %account,\ | 				w = passphrase_dialog('Enter your password for account %s' \ | ||||||
| 					'Save password', autoconnect) | 					% account, 'Save password', autoconnect) | ||||||
| 				if autoconnect: | 				if autoconnect: | ||||||
| 					gtk.main() | 					gtk.main() | ||||||
| 					passphrase, save = w.get_pass() | 					passphrase, save = w.get_pass() | ||||||
|  | @ -1992,10 +1992,10 @@ class roster_window: | ||||||
| 
 | 
 | ||||||
| 			keyid = None | 			keyid = None | ||||||
| 			save_gpg_pass = 0 | 			save_gpg_pass = 0 | ||||||
| 			if self.plugin.accounts[account].has_key("savegpgpass"): | 			if self.plugin.accounts[account].has_key('savegpgpass'): | ||||||
| 				save_gpg_pass = self.plugin.accounts[account]["savegpgpass"] | 				save_gpg_pass = self.plugin.accounts[account]['savegpgpass'] | ||||||
| 			if self.plugin.accounts[account].has_key("keyid"): | 			if self.plugin.accounts[account].has_key('keyid'): | ||||||
| 				keyid = self.plugin.accounts[account]["keyid"] | 				keyid = self.plugin.accounts[account]['keyid'] | ||||||
| 			if keyid and not self.plugin.connected[account] and \ | 			if keyid and not self.plugin.connected[account] and \ | ||||||
| 				self.plugin.config['usegpg']: | 				self.plugin.config['usegpg']: | ||||||
| 				if save_gpg_pass: | 				if save_gpg_pass: | ||||||
|  | @ -2022,15 +2022,20 @@ class roster_window: | ||||||
| 		else: | 		else: | ||||||
| 			self.plugin.sleeper_state[account] = 0 | 			self.plugin.sleeper_state[account] = 0 | ||||||
| 
 | 
 | ||||||
| 	def change_status(self, widget, account, status): | 	def get_status_message(self, status): | ||||||
| 		if status != 'online' and status != 'offline': | 		if (status == 'online' and not self.plugin.config['ask_online_status']) \ | ||||||
|  | 			or (status == 'offline' and not \ | ||||||
|  | 			self.plugin.config['ask_offline_status']): | ||||||
|  | 			return status | ||||||
| 		w = away_message_dialog(self.plugin) | 		w = away_message_dialog(self.plugin) | ||||||
| 			txt = w.run() | 		message = w.run() | ||||||
| 			if txt == -1: | 		return message | ||||||
|  | 
 | ||||||
|  | 	def change_status(self, widget, account, status): | ||||||
|  | 		message = self.get_status_message(status) | ||||||
|  | 		if message == -1: | ||||||
| 			return | 			return | ||||||
| 		else: | 		self.send_status(account, status, message) | ||||||
| 			txt = status |  | ||||||
| 		self.send_status(account, status, txt) |  | ||||||
| 
 | 
 | ||||||
| 	def on_cb_changed(self, widget): | 	def on_cb_changed(self, widget): | ||||||
| 		"""When we change our status""" | 		"""When we change our status""" | ||||||
|  | @ -2044,19 +2049,15 @@ class roster_window: | ||||||
| 			self.set_cb() | 			self.set_cb() | ||||||
| 			return | 			return | ||||||
| 		status = model[active][0] | 		status = model[active][0] | ||||||
| 		if status != 'online' and status != 'offline': | 		message = self.get_status_message(status) | ||||||
| 			w = away_message_dialog(self.plugin) | 		if message == -1: | ||||||
| 			txt = w.run() |  | ||||||
| 			if txt == -1: |  | ||||||
| 			self.set_cb() | 			self.set_cb() | ||||||
| 			return | 			return | ||||||
| 		else: |  | ||||||
| 			txt = status |  | ||||||
| 		for acct in accounts: | 		for acct in accounts: | ||||||
| 			if self.plugin.accounts[acct].has_key('active'): | 			if self.plugin.accounts[acct].has_key('active'): | ||||||
| 				if not self.plugin.accounts[acct]['active']: | 				if not self.plugin.accounts[acct]['active']: | ||||||
| 					continue | 					continue | ||||||
| 			self.send_status(acct, status, txt) | 			self.send_status(acct, status, message) | ||||||
| 	 | 	 | ||||||
| 	def set_cb(self): | 	def set_cb(self): | ||||||
| 		#table to change index in plugin.connected to index in combobox | 		#table to change index in plugin.connected to index in combobox | ||||||
|  | @ -3263,6 +3264,8 @@ class plugin: | ||||||
| 			'autoawaytime':10,\ | 			'autoawaytime':10,\ | ||||||
| 			'autoxa':1,\ | 			'autoxa':1,\ | ||||||
| 			'autoxatime':20,\ | 			'autoxatime':20,\ | ||||||
|  | 			'ask_online_status':0,\ | ||||||
|  | 			'ask_offline_status':0,\ | ||||||
| 			'last_msg':'',\ | 			'last_msg':'',\ | ||||||
| 			'msg0_name':'Brb',\ | 			'msg0_name':'Brb',\ | ||||||
| 			'msg0':'Back in some minutes.',\ | 			'msg0':'Back in some minutes.',\ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue