How to use the common.gajim.config.set_per function in common

To help you get started, we’ve selected a few common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gajim / gajim / src / config.py View on Github external
else:
			self.xml.get_widget('log_history_checkbutton2').set_active(1)

		st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
			'sync_with_global_status')
		self.xml.get_widget('sync_with_global_status_checkbutton2').set_active(st)

		st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
			'use_custom_host')
		self.xml.get_widget('custom_port_checkbutton2').set_active(st)
		self.xml.get_widget('custom_port_entry2').set_sensitive(st)

		st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
			'custom_port')
		if not st:
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME,
				'custom_port', '5298')
			st = '5298'
		self.xml.get_widget('custom_port_entry2').set_text(str(st))

		# Personal tab
		gpg_key_label = self.xml.get_widget('gpg_key_label2')
		if gajim.connections.has_key(gajim.ZEROCONF_ACC_NAME) and \
		gajim.connections[gajim.ZEROCONF_ACC_NAME].gpg:
			self.xml.get_widget('gpg_choose_button2').set_sensitive(True)
			self.init_account_gpg()
		else:
			gpg_key_label.set_text(_('OpenPGP is not usable in this computer'))
			self.xml.get_widget('gpg_choose_button2').set_sensitive(False)

		for opt in ('first_name', 'last_name', 'jabber_id', 'email'):
			st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
github sgala / gajim / src / config.py View on Github external
else:
			wiget_name_ext = '1'
		checkbutton = self.xml.get_widget('gpg_save_password_checkbutton' + \
			wiget_name_ext)
		gpg_key_label = self.xml.get_widget('gpg_key_label' + wiget_name_ext)
		gpg_name_label = self.xml.get_widget('gpg_name_label' + wiget_name_ext)
		gpg_password_entry = self.xml.get_widget('gpg_password_entry' + \
			wiget_name_ext)
		if keyID[0] == _('None'):
			gpg_key_label.set_text(_('No key selected'))
			gpg_name_label.set_text('')
			checkbutton.set_sensitive(False)
			gpg_password_entry.set_sensitive(False)
			if self.option_changed('keyid', ''):
				self.need_relogin = True
			gajim.config.set_per('accounts', self.current_account, 'keyname', '')
			gajim.config.set_per('accounts', self.current_account, 'keyid', '')
		else:
			gpg_key_label.set_text(keyID[0])
			gpg_name_label.set_text(keyID[1])
			checkbutton.set_sensitive(True)
			if self.option_changed('keyid', keyID[0]):
				self.need_relogin = True
			gajim.config.set_per('accounts', self.current_account, 'keyname',
				keyID[1])
			gajim.config.set_per('accounts', self.current_account, 'keyid',
				keyID[0])
		gajim.config.set_per('accounts', self.current_account, 'savegpgpass',
			False)
		gajim.config.set_per('accounts', self.current_account, 'gpgpassword', '')
		checkbutton.set_active(False)
		gpg_password_entry.set_text('')
github gajim / gajim / src / config.py View on Github external
del gajim.gc_connected[old_name]
			del gajim.automatic_rooms[old_name]
			del gajim.newly_added[old_name]
			del gajim.to_be_removed[old_name]
			del gajim.sleeper_state[old_name]
			del gajim.encrypted_chats[old_name]
			del gajim.last_message_time[old_name]
			del gajim.status_before_autoaway[old_name]
			del gajim.transport_avatar[old_name]
			gajim.connections[old_name].name = new_name
			gajim.connections[new_name] = gajim.connections[old_name]
			del gajim.connections[old_name]
			gajim.config.add_per('accounts', new_name)
			old_config = gajim.config.get_per('accounts', old_name)
			for opt in old_config:
				gajim.config.set_per('accounts', new_name, opt, old_config[opt][1])
			gajim.config.del_per('accounts', old_name)
			if self.current_account == old_name:
				self.current_account = new_name
			# refresh roster
			gajim.interface.roster.draw_roster()
			self.init_accounts()
			self.select_account(new_name)
github gajim / gajim / src / common / zeroconf / connection_zeroconf.py View on Github external
def get_config_values_or_default(self):
		''' get name, host, port from config, or 
		create zeroconf account with default values'''
		
		if not gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'name'):
			gajim.log.debug('Creating zeroconf account')
			gajim.config.add_per('accounts', gajim.ZEROCONF_ACC_NAME)
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'autoconnect', True)
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'no_log_for', '')
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'password', 'zeroconf')
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'sync_with_global_status', True)

			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'custom_port', 5298)
			gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'is_zeroconf', True)
		#XXX make sure host is US-ASCII
		self.host = unicode(socket.gethostname())
		gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'hostname', self.host)
		self.port = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'custom_port')
		self.autoconnect = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'autoconnect')
		self.sync_with_global_status = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'sync_with_global_status')
		self.no_log_for = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'no_log_for')
		self.first = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_first_name')
		self.last = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_last_name')
		self.jabber_id = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_jabber_id')
github gajim / gajim / src / roster_window.py View on Github external
w = dialogs.PassphraseDialog(
					_('Password Required'),
					_('Enter your password for account %s') % account,
					_('Save password'))
				passphrase, save = w.run()
				if passphrase == -1:
					if accountIter:
						model[accountIter][0] =	self.jabber_state_images['16']['offline']
					if gajim.interface.systray_enabled:
						gajim.interface.systray.change_status('offline')
					self.update_status_combobox()
					return
				gajim.connections[account].password = passphrase
				if save:
					gajim.config.set_per('accounts', account, 'savepass', True)
					gajim.config.set_per('accounts', account, 'password', passphrase)

			keyid = None
			use_gpg_agent = gajim.config.get('use_gpg_agent')
			# we don't need to bother with the passphrase if we use the agent
			if use_gpg_agent:
				save_gpg_pass = False
			else:
				save_gpg_pass = gajim.config.get_per('accounts', account,
					'savegpgpass')
			keyid = gajim.config.get_per('accounts', account, 'keyid')
			if keyid and gajim.connections[account].connected < 2 and \
				gajim.config.get('usegpg'):

				if use_gpg_agent:
					self.gpg_passphrase[keyid] = None
				else:
github sgala / gajim / src / common / optparser.py View on Github external
gajim.config.set('always_compact_view_chat',
				self.old_values['always_compact_view'])
			gajim.config.set('always_compact_view_gc',
				self.old_values['always_compact_view'])
		# new theme: grocery, plain
		d = ['accounttextcolor', 'accountbgcolor', 'accountfont',
			'accountfontattrs', 'grouptextcolor', 'groupbgcolor', 'groupfont',
			'groupfontattrs', 'contacttextcolor', 'contactbgcolor', 'contactfont',
			'contactfontattrs', 'bannertextcolor', 'bannerbgcolor', 'bannerfont', 
			'bannerfontattrs']
		for theme_name in (_('grocery'), _('default')):
			if theme_name not in gajim.config.get_per('themes'):
				gajim.config.add_per('themes', theme_name)
				theme = gajim.config.themes_default[theme_name]
				for o in d:
					gajim.config.set_per('themes', theme_name, o, theme[d.index(o)])
		# Remove cyan theme if it's not the current theme
		if 'cyan' in gajim.config.get_per('themes'):
			gajim.config.del_per('themes', 'cyan')
		if _('cyan') in gajim.config.get_per('themes'):
			gajim.config.del_per('themes', _('cyan'))
		# If we removed our roster_theme, choose the default green one or another
		# one if doesn't exists in config
		if gajim.config.get('roster_theme') not in gajim.config.get_per('themes'):
			theme = _('green')
			if theme not in gajim.config.get_per('themes'):
				theme = gajim.config.get_per('themes')[0]
			gajim.config.set('roster_theme', theme)
		# new proxies in accounts.name.file_transfer_proxies
		for account in gajim.config.get_per('accounts'):
			proxies = gajim.config.get_per('accounts', account,
				'file_transfer_proxies')
github gajim / gajim / src / config.py View on Github external
def on_proxypass_entry_changed(self, widget):
		value = widget.get_text().decode('utf-8')
		proxy = self.proxyname_entry.get_text().decode('utf-8')
		gajim.config.set_per('proxies', proxy, 'pass', value)
github gajim / gajim / src / config.py View on Github external
def on_default_msg_treemodel_row_changed(self, model, path, iter_):
		status = model[iter_][0]
		message = model[iter_][2].decode('utf-8')
		gajim.config.set_per('defaultstatusmsg', status, 'enabled',
			model[iter_][3])
		gajim.config.set_per('defaultstatusmsg', status, 'message', message)
github sgala / gajim / src / common / optparser.py View on Github external
def update_config_to_01016(self):
		'''#2494 : Now we play gc_received_message sound even if 
		notify_on_all_muc_messages is false. Keep precedent behaviour.'''
		if 'notify_on_all_muc_messages' in self.old_values and \
		self.old_values['notify_on_all_muc_messages'] == 'False' and \
		gajim.config.get_per('soundevents', 'muc_message_received', 'enabled'):
			gajim.config.set_per('soundevents',\
				'muc_message_received', 'enabled', False)
		gajim.config.set('version', '0.10.1.6')