当前位置: 首页>>代码示例>>Python>>正文


Python weechat.config_option_set函数代码示例

本文整理汇总了Python中weechat.config_option_set函数的典型用法代码示例。如果您正苦于以下问题:Python config_option_set函数的具体用法?Python config_option_set怎么用?Python config_option_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了config_option_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: jmh_cmd

def jmh_cmd(data, buffer, args=None):
    """ Command /jabber_message_handler """
    if args:
        argv = args.split(None, 1)
        if len(argv) > 0:
            if argv[0] == "on":
                weechat.config_option_set(
                        jmh_config_option["enabled"], "on", 1)
            elif argv[0] == "off":
                weechat.config_option_set(
                        jmh_config_option["enabled"], "off", 1)
            elif argv[0] == "verbose":
                if len(argv) > 1:
                    weechat.config_option_set(
                            jmh_config_option["verbose"], argv[1], 1)
                else:
                    weechat.config_option_set(
                            jmh_config_option["verbose"], "toggle", 1)
            elif argv[0] == "log":
                if len(argv) > 1:
                    weechat.config_option_set(
                            jmh_config_option["log"], argv[1], 1)
            else:
                weechat.prnt("", "jabber_message_handler: unknown action")

    print_settings()
    return weechat.WEECHAT_RC_OK
开发者ID:zsw,项目名称:dotfiles,代码行数:27,代码来源:jabber_message_handler.py

示例2: fish_secure_key_cb

def fish_secure_key_cb(data, option, value):
    global fish_secure_key, fish_secure_cipher

    fish_secure_key = weechat.config_string(
        weechat.config_get("fish.secure.key")
    )

    if fish_secure_key == "":
        fish_secure_cipher = None
        return weechat.WEECHAT_RC_OK

    if fish_secure_key[:6] == "${sec.":
        decrypted = weechat.string_eval_expression(
            fish_secure_key, {}, {}, {}
        )
        if decrypted:
            fish_secure_cipher = Blowfish(decrypted)
            return weechat.WEECHAT_RC_OK
        else:
            weechat.config_option_set(fish_config_option["key"], "", 0)
            weechat.prnt("", "Decrypt sec.conf first\n")
            return weechat.WEECHAT_RC_OK

    if fish_secure_key != "":
        fish_secure_cipher = Blowfish(fish_secure_key)

    return weechat.WEECHAT_RC_OK
开发者ID:oakkitten,项目名称:scripts,代码行数:27,代码来源:fish.py

示例3: shutdown_cb

def shutdown_cb():
    # write back default options to original options, then quit...
    for option in OPTIONS.keys():
        option = option.split('.')
        default_plugin = weechat.config_get_plugin('default.%s' % option[1])
        config_pnt = weechat.config_get('weechat.bar.%s.items' % option[1])
        weechat.config_option_set(config_pnt,default_plugin,1)
    return weechat.WEECHAT_RC_OK
开发者ID:FiXato,项目名称:weechat-scripts,代码行数:8,代码来源:customize_bar.py

示例4: remove_from_nick_colours

def remove_from_nick_colours(colour):
    colours = nick_colours()
    if not colour in colours:
        weechat.prnt(
            weechat.current_buffer(),
            '%sThe colour "%s" is not present in weechat.color.chat_nick_colors' % (weechat.prefix("error"), colour),
        )
        return
    colours.remove(colour)
    wc_nick_colours = ",".join(colours)
    weechat.config_option_set(wc_nick_colours_pointer(), wc_nick_colours, 1)
    load_buffer_items()
开发者ID:FiXato,项目名称:weechat_scripts,代码行数:12,代码来源:nick_colours.py

示例5: add_to_nick_colours

def add_to_nick_colours(colour):
    colours = nick_colours()
    if colour in colours:
        weechat.prnt(
            weechat.current_buffer(),
            '%sThe colour "%s" is already present in weechat.color.chat_nick_colors'
            % (weechat.prefix("error"), colour),
        )
        return
    colours.append(colour)
    wc_nick_colours = ",".join(colours)
    weechat.config_option_set(wc_nick_colours_pointer(), wc_nick_colours, 1)
    load_buffer_items()
开发者ID:FiXato,项目名称:weechat_scripts,代码行数:13,代码来源:nick_colours.py

示例6: ircrypt_check_binary

def ircrypt_check_binary():
	'''If binary is not set, try to determine it automatically
	'''
	cfg_option = weechat.config_get('ircrypt.general.binary')
	gnupg = weechat.config_string(cfg_option)
	if not gnupg:
		(gnupg, version) = ircrypt_find_gpg_binary(('gpg','gpg2'))
		if not gnupg:
			ircrypt_error('Automatic detection of the GnuPG binary failed and '
					'nothing is set manually. You wont be able to use IRCrypt like '
					'this. Please install GnuPG or set the path to the binary to '
					'use.', '')
		else:
			ircrypt_info('Found %s' % version, '')
			weechat.config_option_set(cfg_option, gnupg, 1)
开发者ID:petvoigt,项目名称:ircrypt-weechat,代码行数:15,代码来源:ircrypt.py

示例7: fish_secure_genkey

def fish_secure_genkey(buffer):
    global fish_secure_cipher, fish_config_option

    newKey = blowcrypt_b64encode(urandom(32))

    # test to see if sec.conf decrypted
    weechat.command(buffer, "/secure set fish test")
    decrypted = weechat.string_eval_expression(
        "${sec.data.fish}", {}, {}, {}
    )

    if decrypted == "test":
        weechat.config_option_set(fish_config_option["key"],
                                  "${sec.data.fish}", 0)
        fish_secure_cipher = Blowfish(newKey)
        weechat.command(buffer, "/secure set fish %s" % newKey)
开发者ID:oakkitten,项目名称:scripts,代码行数:16,代码来源:fish.py

示例8: install

 def install(self):
     try:
         numset = 0
         numerrors = 0
         for name in self.options:
             option = weechat.config_get(name)
             if option:
                 rc = weechat.config_option_set(option,
                                                self.options[name], 1)
                 if rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
                     self.prnt_error('Error setting option "{0}" to value '
                                     '"{1}" (running an old WeeChat?)'
                                     ''.format(name, self.options[name]))
                     numerrors += 1
                 else:
                     numset += 1
             else:
                 self.prnt('Warning: option not found: "{0}" '
                           '(running an old WeeChat?)'.format(name))
                 numerrors += 1
         errors = ''
         if numerrors > 0:
             errors = ', {0} error(s)'.format(numerrors)
         if self.filename:
             self.prnt('Theme "{0}" installed ({1} options set{2})'
                       ''.format(self.filename, numset, errors))
         else:
             self.prnt('Theme installed ({0} options set{1})'
                       ''.format(numset, errors))
     except:
         if self.filename:
             self.prnt_error('Failed to install theme "{0}"'
                             ''.format(self.filename))
         else:
             self.prnt_error('Failed to install theme')
开发者ID:MatthewCox,项目名称:dotfiles,代码行数:35,代码来源:theme.py

示例9: install

 def install(self):
     try:
         numset = 0
         numerrors = 0
         for name in self.options:
             option = weechat.config_get(name)
             if option:
                 if weechat.config_option_set(option, self.options[name], 1) == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
                     self.prnt_error('Error setting option "%s" to value "%s" (running an old WeeChat?)' % (name, self.options[name]))
                     numerrors += 1
                 else:
                     numset += 1
             else:
                 self.prnt('Warning: option not found: "%s" (running an old WeeChat?)' % name)
                 numerrors += 1
         errors = ''
         if numerrors > 0:
             errors = ', %d error(s)' % numerrors
         if self.filename:
             self.prnt('Theme "%s" installed (%d options set%s)' % (self.filename, numset, errors))
         else:
             self.prnt('Theme installed (%d options set%s)' % (numset, errors))
     except:
         if self.filename:
             self.prnt_error('Failed to install theme "%s"' % self.filename)
         else:
             self.prnt_error('Failed to install theme')
开发者ID:archSeer,项目名称:dotfiles-old,代码行数:27,代码来源:theme.py

示例10: add_to_nick_list

 def add_to_nick_list(self, *logins):
     contact_list = {
         True: [],
         False: self.get_option('contacts').replace(' ', '').split(',')
     }[self.get_option('contacts').replace(' ', '') == '']
     new_contacts = []
     for login in logins:
         if login in self.contacts:
             continue
         contact_list.append(login)
         new_contacts.append(login)
         self.contacts[login] = {}
         weechat.nicklist_add_group(self.buffer, '', login, 'lightcyan', 1)
     self._ns_user_cmd_who('{%s}' % ','.join(new_contacts))
     self._ns_user_cmd_watch_log_user(','.join(contact_list))
     weechat.config_option_set(self.options['contacts'],
                               ','.join(contact_list), 0)
开发者ID:DarkDefender,项目名称:scripts,代码行数:17,代码来源:weenetsoul.py

示例11: bas_config_buffer_create_option_cb

def bas_config_buffer_create_option_cb(data, config_file, section, option_name, value):
    option = weechat.config_search_option(config_file, section, option_name)
    if option:
        return weechat.config_option_set(option, value, 1)
    else:
        option = weechat.config_new_option(
            config_file, section, option_name, "string", "", "", 0, 0, "", value, 0, "", "", "", "", "", ""
        )
        if not option:
            return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR
        return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
开发者ID:holomorph,项目名称:scripts,代码行数:11,代码来源:buffer_autoset.py

示例12: buffer_switch

def buffer_switch(data, signal, signal_data):
    full_name = weechat.buffer_get_string(signal_data,'full_name')                      # get full_name of current buffer
    if full_name == '':                                                                 # upps, something totally wrong!
        return weechat.WEECHAT_RC_OK

    for option in OPTIONS.keys():
        option = option.split('.')
        customize_plugin = weechat.config_get_plugin('%s.%s' % (option[1], full_name))  # for example: title.irc.freenode.#weechat
        if customize_plugin:                                                            # option exists
            config_pnt = weechat.config_get('weechat.bar.%s.items' % option[1])
#            current_bar = weechat.config_string(weechat.config_get('weechat.bar.%s.items' % option[1]))
            weechat.config_option_set(config_pnt,customize_plugin,1)                    # set customize_bar
        else:
            current_bar = weechat.config_string(weechat.config_get('weechat.bar.%s.items' % option[1]))
            default_plugin = weechat.config_get_plugin('default.%s' % option[1])        # option we are looking for
            if default_plugin == '':                                                    # default_plugin removed by user?
                weechat.config_set_plugin('default.%s' % option[1],DEFAULT_OPTION[option[1]]) # set default_plugin again!
            if current_bar != default_plugin:
                config_pnt = weechat.config_get('weechat.bar.%s.items' % option[1])
                weechat.config_option_set(config_pnt,default_plugin,1)                  # set customize_bar

    return weechat.WEECHAT_RC_OK
开发者ID:FiXato,项目名称:weechat-scripts,代码行数:22,代码来源:customize_bar.py

示例13: set_autojoin_list

def set_autojoin_list(server,list_of_channels, list_of_keys):
    ptr_config_autojoin = weechat.config_get('irc.server.%s.autojoin' % server)
    if not ptr_config_autojoin:
        return 0

    if OPTIONS['sorted'].lower() == 'on' and not list_of_keys:
        # no keys, sort the channel-list
        channels = '%s' % ','.join(sorted(list_of_channels))
    else:
        # don't sort channel-list with given key
        channels = '%s' % ','.join(list_of_channels)

    # strip leading ','
    if channels[0] == ',':
        channels = channels.lstrip(',')

    # add keys to list of channels
    if list_of_keys:
        channels = '%s %s' % (channels,list_of_keys)

    rc = weechat.config_option_set(ptr_config_autojoin,channels,1)
    if not rc:
        return 0
    return 1
开发者ID:DarkDefender,项目名称:scripts,代码行数:24,代码来源:autojoinem.py

示例14: set_autojoin_list

def set_autojoin_list(server, list_of_channels, list_of_keys):
    ptr_config_autojoin = weechat.config_get("irc.server.%s.autojoin" % server)
    if not ptr_config_autojoin:
        return 0

    if OPTIONS["sorted"].lower() == "on" and not list_of_keys:
        # no keys, sort the channel-list
        channels = "%s" % ",".join(sorted(list_of_channels))
    else:
        # don't sort channel-list with given key
        channels = "%s" % ",".join(list_of_channels)

    # strip leading ','
    if channels[0] == ",":
        channels = channels.lstrip(",")

    # add keys to list of channels
    if list_of_keys:
        channels = "%s %s" % (channels, list_of_keys)

    rc = weechat.config_option_set(ptr_config_autojoin, channels, 1)
    if not rc:
        return 0
    return 1
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:24,代码来源:autojoinem.py

示例15: save_helpers

	def save_helpers(self, run_callback = True):
		''' Save the current helpers to the configuration. '''
		weechat.config_option_set(self.__helpers, json.dumps(self.helpers), run_callback)
开发者ID:ASKobayashi,项目名称:dotFiles,代码行数:3,代码来源:autosort.py


注:本文中的weechat.config_option_set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。