• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python weechat.config_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: customize_part_cb

def customize_part_cb(data, modifier, modifier_data, string):
    message = weechat.config_get_plugin('part_message')
    if message == '':
        return string

    parsed = get_hashtable(string)
    if parsed['nick'] == own_nick(modifier_data):
        return string

    parsed['kicked_nick'] = ''                  # dummy. no irc_KICK here
    message = create_output(message,parsed,'part')

    if OPTIONS['debug'] == 'on':
        weechat.prnt("","debug mode: irc_part")
        weechat.prnt("","string: %s" % string)
        weechat.prnt("",parsed['channel'])
        weechat.prnt("",parsed['message'])

    buf_pointer = weechat.buffer_search('irc',"%s.%s" % (modifier_data,parsed['channel']))

    prefix = weechat.config_string(weechat.config_get('weechat.look.prefix_quit'))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get('weechat.color.chat_prefix_quit')))
    prefix = substitute_colors(prefix)
    message_tags = ''

    if weechat.config_get_plugin('no_log').lower() == 'on':
        message_tags = 'no_log'
    weechat.prnt_date_tags(buf_pointer,0,message_tags,'%s%s\t%s' % (prefix_color,prefix,message))
        
    return string
开发者ID:pix0r,项目名称:weechat-scripts,代码行数:30,代码来源:customize_irc_messages.py


示例2: print_as_list

def print_as_list(target, matches, data, limit, total):
    """Prints the output as a comma-separated list of nicks."""

    col = w.color(w.info_get("irc_nick_color_name", data["setter"]))
    pf = fmt_prefix(data).replace("_target_", "")

    s = "{}\tThe following {} {}"
    if data["mode"] == "special":
        w.prnt(target, s.format(pf, "nick matches" if total == 1 else "nicks match", fmt_banmask(data["mask"])))
    else:
        w.prnt(target, (s + ", {} by {}{}{}").format(
           pf, "nick matches" if total == 1 else "nicks match",
           fmt_banmask(data["mask"]), fmt_mode_char(data["mode"]), col,
           data["setter"], w.color("reset")
        ))

    nicks = []
    remainder = len(matches) - limit
    i = 0
    for name in matches:
       nicks.append("{}{}{}".format(w.color(w.info_get("irc_nick_color_name", name)), name, w.color("reset")))
       i += 1

       if i >= limit:
           break

    if w.config_string(w.config_get("weechat.look.prefix_same_nick")):
        pf = (w.color(w.config_get_plugin("prefix_color")) +
          w.config_string(w.config_get("weechat.look.prefix_same_nick")) +
          w.color("reset"))

    printstr = "{}\t{}".format(pf, ", ".join(nicks))
    if remainder > 0:
        printstr += ", and {} more..".format(remainder)
    w.prnt(target, printstr)
开发者ID:DarkDefender,项目名称:scripts,代码行数:35,代码来源:maskmatch.py


示例3: customize_join_cb

def customize_join_cb(data, modifier, modifier_data, string):
    message = weechat.config_get_plugin("join_message")
    if message == "":
        return string

    parsed = get_hashtable(string)
    if parsed["nick"] == own_nick(modifier_data):
        return string

    parsed["message"] = ""  # dummy. no message for irc_JOIN
    parsed["kicked_nick"] = ""  # dummy. no irc_KICK here
    message = create_output(message, parsed, "join")

    if OPTIONS["debug"] == "on":
        weechat.prnt("", string)
        weechat.prnt("", parsed["channel"])
        weechat.prnt("", parsed["message"])

    buffer_ptr = weechat.buffer_search("irc", "%s.%s" % (modifier_data, parsed["channel"]))

    prefix = weechat.config_string(weechat.config_get("weechat.look.prefix_join"))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get("weechat.color.chat_prefix_join")))
    prefix = substitute_colors(prefix)
    message_tags = ""

    if weechat.config_get_plugin("no_log").lower() == "on":
        message_tags = "no_log"
    weechat.prnt_date_tags(buffer_ptr, 0, message_tags, "%s%s\t%s" % (prefix_color, prefix, message))

    return string
开发者ID:Ratler,项目名称:weechatter-weechat-scripts,代码行数:30,代码来源:customize_irc_messages.py


示例4: customize_kick_cb

def customize_kick_cb(data, modifier, modifier_data, string):
    message = weechat.config_get_plugin("kick_message")
    if message == "":
        return string

    parsed = get_hashtable(string)
    try:
        parsed["kicked_nick"] = parsed["arguments"].split(" ", 1)[1]
        parsed["kicked_nick"] = parsed["kicked_nick"].split(" :", 1)[0]
    except:
        parsed["kicked_nick"] = ""

    message = create_output(message, parsed, "kick")

    if OPTIONS["debug"] == "on":
        weechat.prnt("", string)
        weechat.prnt("", parsed["channel"])
        weechat.prnt("", parsed["message"])

    buffer_ptr = weechat.buffer_search("irc", "%s.%s" % (modifier_data, parsed["channel"]))
    if not (buffer_ptr):
        return string

    prefix = weechat.config_string(weechat.config_get("weechat.look.prefix_quit"))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get("weechat.color.chat_prefix_quit")))
    message_tags = ""

    if weechat.config_get_plugin("no_log").lower() == "on":
        message_tags = "no_log"
    weechat.prnt_date_tags(buffer_ptr, 0, message_tags, "%s%s\t%s" % (prefix_color, prefix, message))

    return string
开发者ID:Ratler,项目名称:weechatter-weechat-scripts,代码行数:32,代码来源:customize_irc_messages.py


示例5: customize_join_cb_signal

def customize_join_cb_signal(data, signal, signal_data):
    weechat.prnt("", "data: %s   signal: %s  signal_data: %s" % (data, signal, signal_data))
    message = weechat.config_get_plugin("join_message")
    if message == "":
        return weechat.WEECHAT_RC_OK

    parsed = get_hashtable(signal_data)
    if parsed["nick"] == own_nick(signal.split(",", 1)[0]):
        return weechat.WEECHAT_RC_OK

    parsed["message"] = ""  # dummy. no message for JOIN
    parsed["kicked_nick"] = ""  # dummy. no KICK here
    message = create_output(message, parsed, "join")

    buffer_ptr = weechat.buffer_search("irc", "%s.%s" % (signal.split(",", 1)[0], parsed["channel"]))

    prefix = weechat.config_string(weechat.config_get("weechat.look.prefix_join"))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get("weechat.color.chat_prefix_join")))
    message_tags = ""

    if weechat.config_get_plugin("no_log").lower() == "on":
        message_tags = "no_log"
    weechat.prnt_date_tags(buffer_ptr, 0, message_tags, "%s%s\t%s" % (prefix_color, prefix, message))

    return weechat.WEECHAT_RC_OK
开发者ID:Ratler,项目名称:weechatter-weechat-scripts,代码行数:25,代码来源:customize_irc_messages.py


示例6: customize_join_cb_signal

def customize_join_cb_signal(data, signal, signal_data):
    weechat.prnt("","data: %s   signal: %s  signal_data: %s" % (data,signal,signal_data))
    message = weechat.config_get_plugin('join_message')
    if message == '':
        return weechat.WEECHAT_RC_OK

    parsed = get_hashtable(signal_data)
    if parsed['nick'] == own_nick(signal.split(',', 1)[0]):
        return weechat.WEECHAT_RC_OK

    parsed['message'] = "" # dummy. no message for JOIN
    parsed['kicked_nick'] = '' # dummy. no KICK here
    message = create_output(message,parsed,'join')

    buf_pointer = weechat.buffer_search('irc',"%s.%s" % (signal.split(',', 1)[0],parsed['channel']))

    prefix = weechat.config_string(weechat.config_get('weechat.look.prefix_join'))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get('weechat.color.chat_prefix_join')))
    message_tags = ''

    if weechat.config_get_plugin('no_log').lower() == 'on':
        message_tags = 'no_log'
    weechat.prnt_date_tags(buf_pointer,0,message_tags,'%s%s\t%s' % (prefix_color,prefix,message))

    return weechat.WEECHAT_RC_OK
开发者ID:pix0r,项目名称:weechat-scripts,代码行数:25,代码来源:customize_irc_messages.py


示例7: customize_kick_cb

def customize_kick_cb(data, modifier, modifier_data, string):
    message = weechat.config_get_plugin('kick_message')
    if message == '':
        return string

    parsed = get_hashtable(string)
    try:
        parsed['kicked_nick'] = parsed['arguments'].split(' ', 1)[1]
        parsed['kicked_nick'] = parsed['kicked_nick'].split(' :', 1)[0]
    except:
        parsed['kicked_nick'] = ''

    message = create_output(message,parsed,'kick')

    if OPTIONS['debug'] == 'on':
        weechat.prnt("",string)
        weechat.prnt("",parsed['channel'])
        weechat.prnt("",parsed['message'])

    buf_pointer = weechat.buffer_search('irc',"%s.%s" % (modifier_data,parsed['channel']))

    prefix = weechat.config_string(weechat.config_get('weechat.look.prefix_quit'))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get('weechat.color.chat_prefix_quit')))
    message_tags = ''

    if weechat.config_get_plugin('no_log').lower() == 'on':
        message_tags = 'no_log'
    weechat.prnt_date_tags(buf_pointer,0,message_tags,'%s%s\t%s' % (prefix_color,prefix,message))

    return string
开发者ID:pix0r,项目名称:weechat-scripts,代码行数:30,代码来源:customize_irc_messages.py


示例8: customize_privmsg_cb

def customize_privmsg_cb(data, modifier, modifier_data, string):
    weechat.prnt("",data)
    weechat.prnt("",modifier)
    weechat.prnt("",modifier_data)
    weechat.prnt("",string)
    parsed = get_hashtable(string)
    message = parsed['message'].strip()
    # Filter out non-CTCP messages and non ACTION messages
    if not message or ord(message[0]) != 1 or not message[1:].startswith("ACTION"):
        return string
    text = message[8:-1]

    parsed['kicked_nick'] = ''                  # dummy. no irc_KICK here
    parsed['message'] = text
    message = create_output("${*blue}%N %M",parsed,'action')

    buffer_ptr = weechat.buffer_search('irc',"%s.%s" % (modifier_data,parsed['channel']))

    prefix = weechat.config_string(weechat.config_get('weechat.look.prefix_action'))
    prefix_color = weechat.color(weechat.config_color(weechat.config_get('weechat.color.chat_prefix_action')))
    prefix = substitute_colors(prefix)
    message_tags = ''

    if weechat.config_get_plugin('no_log').lower() == 'on':
        message_tags = 'no_log'
    weechat.prnt_date_tags(buffer_ptr,0,message_tags,'%s%s\t%s' % (prefix_color,prefix,message))
    return string
开发者ID:pix0r,项目名称:weechat-scripts,代码行数:27,代码来源:customize_irc_messages.py


示例9: irc_nick_find_color

def irc_nick_find_color(nick):

    color = weechat.info_get('irc_nick_color', nick)
    if not color:
        # probably we're in WeeChat 0.3.0
        color %= weechat.config_integer(weechat.config_get("weechat.look.color_nicks_number"))
        color = weechat.config_get('weechat.color.chat_nick_color%02d' %(color+1))
        color = weechat.color(weechat.config_string(color))
    return '%s%s%s' %(color, nick, weechat.color('reset'))
开发者ID:FiXato,项目名称:weechat-scripts-xt,代码行数:9,代码来源:urlbar.py


示例10: init_options

def init_options():
    # check out if a default item bar exists
    for option,value in OPTIONS.items():
        if not weechat.config_get_plugin(option):
            default_bar = weechat.config_string(weechat.config_get(value))# get original option
            weechat.config_set_plugin(option, default_bar)
            default_option = option.split('.')
            default_bar_value = weechat.config_string(weechat.config_get('weechat.bar.%s.items' % default_option[1]))
            DEFAULT_OPTION[default_option[1]] = default_bar_value
        else:
            default_option = option.split('.')
            default_bar_value = weechat.config_string(weechat.config_get('weechat.bar.%s.items' % default_option[1]))
            DEFAULT_OPTION[default_option[1]] = default_bar_value
开发者ID:FiXato,项目名称:weechat-scripts,代码行数:13,代码来源:customize_bar.py


示例11: getPolicy

    def getPolicy(self, key):
        """Get the value of a policy option for this context."""
        option = weechat.config_get(self.policy_config_option(key))

        if option == '':
            option = weechat.config_get(
                config_prefix('policy.default.%s' % key.lower()))

        result = bool(weechat.config_boolean(option))

        debug(('getPolicy', key, result))

        return result
开发者ID:ObiWahn,项目名称:weechat-otr,代码行数:13,代码来源:weechat_otr.py


示例12: irc_nick_find_color

def irc_nick_find_color(nick, bgcolor='default'):

    color = weechat.info_get('irc_nick_color', nick)
    if not color:
        # probably we're in WeeChat 0.3.0
        color = 0
        for char in nick:
            color += ord(char)

        color %= w.config_integer(w.config_get("weechat.look.color_nicks_number"))
        color = w.config_get('weechat.color.chat_nick_color%02d' %(color+1))
        color = w.config_string(color)
    return '%s%s%s' %(w.color('%s,%s' %(color, bgcolor)), nick, w.color('reset'))
开发者ID:FiXato,项目名称:weechat-scripts-xt,代码行数:13,代码来源:imap.py


示例13: irc_nick_find_color

def irc_nick_find_color(nick):
    if not nick: # nick (actually prefix) is empty, irc_nick_color returns None on empty input
        return ''

    color = weechat.info_get('irc_nick_color', nick)
    if not color:
        # probably we're in WeeChat 0.3.0
        color = 0
        for char in nick:
            color += ord(char)
        
        color %= weechat.config_integer(weechat.config_get("weechat.look.color_nicks_number"))
        color = weechat.config_get('weechat.color.chat_nick_color%02d' %(color+1))
        color = w.color(weechat.config_string(color))
    return '%s%s%s' %(color, nick, weechat.color('reset'))
开发者ID:DarkDefender,项目名称:scripts,代码行数:15,代码来源:urlbar.py


示例14: obtain_fmuser

def obtain_fmuser(who = None, network = None):
    api_key = weechat.config_string(weechat.config_get(CONF_PREFIX
        + CONFKEY_APIKEY))
    username = weechat.config_string(weechat.config_get(CONF_PREFIX
        + CONFKEY_USER))

    timeout_begin()
    if not network:
        network = pylast.LastFMNetwork(api_key = api_key)
    if who:
        user = network.get_user(who)
    else:
        user = network.get_user(username)
    timeout_end()
    return (network, user)
开发者ID:i7c,项目名称:lastfmnp,代码行数:15,代码来源:lastfmnp.py


示例15: teknik_command

def teknik_command(data, buffer, args):
  args = args.strip()
  if args == "":
    weechat.prnt("", "Error: You must specify a command")
  else:
    argv = args.split(" ")
    command = argv[0].lower()
    
    # Upload a File
    if command == 'upload':
      if len(argv) < 2:
        weechat.prnt("", "Error: You must specify a file")
      else:
        # Get current config values
        apiUrl = weechat.config_string(weechat.config_get('plugins.var.python.teknik.api_url'))
        apiUsername = weechat.config_string(weechat.config_get('plugins.var.python.teknik.username'))
        apiToken = weechat.config_string(weechat.config_get('plugins.var.python.teknik.token'))
        
        data = {'file': argv[1], 'apiUrl': apiUrl, 'apiUsername': apiUsername, 'apiToken': apiToken}
        hook = weechat.hook_process('func:upload_file', 0, "process_upload", json.dumps(data))
        
    # Set a config option
    elif command == 'set':
      if len(argv) < 2:
        weechat.prnt("", "Error: You must specify the option to set")
      else:
        option = argv[1].lower()
        if option == 'username':
          if len(argv) < 3:
            weechat.prnt("", "Error: You must specify a username")
          else:
            teknik_set_username(argv[2])
        elif option == 'token':
          if len(argv) < 3:
            weechat.prnt("", "Error: You must specify an auth token")
          else:
            teknik_set_token(argv[2])
        elif option == 'url':
          if len(argv) < 3:
            weechat.prnt("", "Error: You must specify an api url")
          else:
            teknik_set_url(argv[2])
        else:
          weechat.prnt("", "Error: Unrecognized Option")
    else:
      weechat.prnt("", "Error: Unrecognized Command")
  
  return weechat.WEECHAT_RC_OK
开发者ID:DarkDefender,项目名称:scripts,代码行数:48,代码来源:teknik.py


示例16: 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


示例17: get_autojoin_list

def get_autojoin_list(server):
    ptr_config_autojoin = weechat.config_get("irc.server.%s.autojoin" % server)

    # option not found! server does not exist
    if not ptr_config_autojoin:
        weechat.prnt(buffer, "%s%s: server '%s' does not exist." % (weechat.prefix("error"), SCRIPT_NAME, server))
        return weechat.WEECHAT_RC_OK

    # get value from autojoin option
    channels = weechat.config_string(ptr_config_autojoin)
    if not channels:
        return 1, 1

    # check for keys
    if len(re.findall(r" ", channels)) == 0:
        list_of_channels = channels.split(",")
        list_of_keys = []
    elif len(re.findall(r" ", channels)) == 1:
        list_of_channels2, list_of_keys = channels.split(" ")
        list_of_channels = list_of_channels2.split(",")
    else:
        weechat.prnt("", "%s%s: irc.server.%s.autojoin not valid..." % (weechat.prefix("error"), SCRIPT_NAME, server))
        return 0, 0

    return list_of_channels, list_of_keys
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:25,代码来源:autojoinem.py


示例18: bas_config_option_cb

def bas_config_option_cb(data, option, value):
    if not weechat.config_boolean(bas_options["look_instant"]):
        return weechat.WEECHAT_RC_OK

    if not weechat.config_get(option):  # option was deleted
        return weechat.WEECHAT_RC_OK

    option = option[len("%s.buffer." % CONFIG_FILE_NAME):]

    pos = option.rfind(".")
    if pos > 0:
        buffer_mask = option[0:pos]
        property = option[pos+1:]
        if buffer_mask and property:
            buffers = weechat.infolist_get("buffer", "", buffer_mask)

            if not buffers:
                return weechat.WEECHAT_RC_OK

            while weechat.infolist_next(buffers):
                buffer = weechat.infolist_pointer(buffers, "pointer")
                weechat.buffer_set(buffer, property, value)

            weechat.infolist_free(buffers)

    return weechat.WEECHAT_RC_OK
开发者ID:AndyHoang,项目名称:dotfiles,代码行数:26,代码来源:buffer_autoset.py


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python weechat.config_get_plugin函数代码示例发布时间:2022-05-26
下一篇:
Python weechat.command函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap