restore autoconnect_as option. Correctly use 80 char width
This commit is contained in:
		
							parent
							
								
									49ea574c7d
								
							
						
					
					
						commit
						676b91731d
					
				
					 3 changed files with 22 additions and 14 deletions
				
			
		| 
						 | 
					@ -277,7 +277,8 @@ class Config:
 | 
				
			||||||
			'autopriority_dnd': [ opt_int, 20],
 | 
								'autopriority_dnd': [ opt_int, 20],
 | 
				
			||||||
			'autopriority_invisible': [ opt_int, 10],
 | 
								'autopriority_invisible': [ opt_int, 10],
 | 
				
			||||||
			'autoconnect': [ opt_bool, False, '', True ],
 | 
								'autoconnect': [ opt_bool, False, '', True ],
 | 
				
			||||||
			'dont_restore_last_status': [ opt_bool, False, _('If enabled, don\'t restore the last status that was used.') ],
 | 
								'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True ],
 | 
				
			||||||
 | 
								'restore_last_status': [ opt_bool, False, _('If enabled, restore the last status that was used.') ],
 | 
				
			||||||
			'autoreconnect': [ opt_bool, True ],
 | 
								'autoreconnect': [ opt_bool, True ],
 | 
				
			||||||
			'active': [ opt_bool, True],
 | 
								'active': [ opt_bool, True],
 | 
				
			||||||
			'proxy': [ opt_str, '', '', True ],
 | 
								'proxy': [ opt_str, '', '', True ],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								src/gajim.py
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								src/gajim.py
									
										
									
									
									
								
							| 
						 | 
					@ -2775,18 +2775,27 @@ class Interface:
 | 
				
			||||||
	def autoconnect(self):
 | 
						def autoconnect(self):
 | 
				
			||||||
		'''auto connect at startup'''
 | 
							'''auto connect at startup'''
 | 
				
			||||||
		# dict of account that want to connect sorted by status
 | 
							# dict of account that want to connect sorted by status
 | 
				
			||||||
 | 
							shows = {}
 | 
				
			||||||
		for a in gajim.connections:
 | 
							for a in gajim.connections:
 | 
				
			||||||
			if gajim.config.get_per('accounts', a, 'autoconnect'):
 | 
								if gajim.config.get_per('accounts', a, 'autoconnect'):
 | 
				
			||||||
				if not gajim.config.get_per('accounts', a,
 | 
									if gajim.config.get_per('accounts', a, 'restore_last_status'):
 | 
				
			||||||
				'dont_restore_last_status'):
 | 
										self.roster.send_status(a, gajim.config.get_per('accounts', a,
 | 
				
			||||||
					self.roster.send_status(a,
 | 
											'last_status'), helpers.from_one_line(gajim.config.get_per(
 | 
				
			||||||
						gajim.config.get_per('accounts',
 | 
											'accounts', a, 'last_status_msg')))
 | 
				
			||||||
						a, 'last_status'),
 | 
										continue
 | 
				
			||||||
						helpers.from_one_line(
 | 
									show = gajim.config.get_per('accounts', a, 'autoconnect_as')
 | 
				
			||||||
						gajim.config.get_per('accounts',
 | 
									if not show in gajim.SHOW_LIST:
 | 
				
			||||||
						a, 'last_status_msg')))
 | 
										continue
 | 
				
			||||||
 | 
									if not show in shows:
 | 
				
			||||||
 | 
										shows[show] = [a]
 | 
				
			||||||
				else:
 | 
									else:
 | 
				
			||||||
					self.roster.send_status(a, 'online', '')
 | 
										shows[show].append(a)
 | 
				
			||||||
 | 
							for show in shows:
 | 
				
			||||||
 | 
								message = self.roster.get_status_message(show)
 | 
				
			||||||
 | 
								if message is None:
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								for a in shows[show]:
 | 
				
			||||||
 | 
									self.roster.send_status(a, show, message)
 | 
				
			||||||
		return False
 | 
							return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def show_systray(self):
 | 
						def show_systray(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1936,10 +1936,8 @@ class RosterWindow:
 | 
				
			||||||
		child_iterA = self._get_account_iter(account, self.model)
 | 
							child_iterA = self._get_account_iter(account, self.model)
 | 
				
			||||||
		if status != 'offline':
 | 
							if status != 'offline':
 | 
				
			||||||
			if to is None:
 | 
								if to is None:
 | 
				
			||||||
				gajim.config.set_per('accounts', account,
 | 
									gajim.config.set_per('accounts', account, 'last_status', status)
 | 
				
			||||||
					'last_status', status)
 | 
									gajim.config.set_per('accounts', account, 'last_status_msg',
 | 
				
			||||||
				gajim.config.set_per('accounts', account,
 | 
					 | 
				
			||||||
					'last_status_msg',
 | 
					 | 
				
			||||||
					helpers.to_one_line(txt))
 | 
										helpers.to_one_line(txt))
 | 
				
			||||||
			if gajim.connections[account].connected < 2:
 | 
								if gajim.connections[account].connected < 2:
 | 
				
			||||||
				self.set_connecting_state(account)
 | 
									self.set_connecting_state(account)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue