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


Python weechat.infolist_next函数代码示例

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


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

示例1: find_channels

def find_channels():
    """Return list of servers and channels"""
    #@TODO: make it return a dict with more options like "nicks_count etc."
    items = {}
    infolist = w.infolist_get('irc_server', '', '')
    # populate servers
    while w.infolist_next(infolist):
        items[w.infolist_string(infolist, 'name')] = ''

    w.infolist_free(infolist)

    # populate channels per server
    for server in items.keys():
        items[server] = '' #init if connected but no channels
        infolist = w.infolist_get('irc_channel', '',  server)
        while w.infolist_next(infolist):
            if w.infolist_integer(infolist, 'nicks_count') == 0:
                #parted but still open in a buffer: bit hackish
                continue
            if w.infolist_integer(infolist, 'type') == 0:
                channel = w.infolist_string(infolist, "buffer_short_name")
                items[server] += '%s,' %channel
        w.infolist_free(infolist)

    return items
开发者ID:sitaktif,项目名称:weechat-scripts,代码行数:25,代码来源:autojoin.py

示例2: servernicks

def servernicks(servername):
    infolist = weechat.infolist_get('irc_server','',servername)
    weechat.infolist_next(infolist)
    nicks = weechat.infolist_string(infolist, 'nicks')
    weechat.infolist_free(infolist)
    servernicks = nicks.split(',')
    return servernicks
开发者ID:megalithic,项目名称:dotfiles,代码行数:7,代码来源:keepnick.py

示例3: buffer_opened_closed_cb

def buffer_opened_closed_cb(data, signal, signal_data):
    global OPTIONS

    # localvar not set in this moment? :-(
#    server = weechat.buffer_get_string(signal_data, 'localvar_server')          # get internal servername
    infolist = weechat.infolist_get('buffer', signal_data, '')
    weechat.infolist_next(infolist)
    plugin_name = weechat.infolist_string(infolist, 'plugin_name')
    name = weechat.infolist_string(infolist, 'name')
    weechat.infolist_free(infolist)

    # TODO how about matrix script or other non-irc channel buffer? no idea! help is welcome
    if plugin_name != "irc":                                                    # for example /fset, /color etc.pp buffer
        return weechat.WEECHAT_RC_OK

    if OPTIONS['activity'].lower() == 'no' or OPTIONS['activity'].lower() == 'off' or OPTIONS['activity'].lower() == '0':
        weechat.command('','/allchan -exclude=%s /buffer hide' % OPTIONS['channel_exclude'])
        if not signal_data:                                                     # signal_data available?
            weechat.command(signal_data,'/allchan -current /buffer unhide')
        else:                                                                   # signal_data empty!
            weechat.command('','/allchan /buffer hide')
        exclude_server('')
        single_channel_exclude()
    else:
        weechat.command('','/allchan /buffer hide')
    exclude_hotlist()
    return weechat.WEECHAT_RC_OK
开发者ID:weechatter,项目名称:weechat-scripts,代码行数:27,代码来源:collapse_channel.py

示例4: find_channels

def find_channels():
    """Return list of servers and channels"""
    #@TODO: make it return a dict with more options like "nicks_count etc."
    items = {}
    infolist = w.infolist_get('irc_server', '', '')
    # populate servers
    while w.infolist_next(infolist):
        items[w.infolist_string(infolist, 'name')] = ''

    w.infolist_free(infolist)

    # populate channels per server
    for server in items.keys():
        keys = []
        keyed_channels = []
        unkeyed_channels = []
        items[server] = '' #init if connected but no channels
        infolist = w.infolist_get('irc_channel', '',  server)
        while w.infolist_next(infolist):
            if w.infolist_integer(infolist, 'nicks_count') == 0:
                #parted but still open in a buffer: bit hackish
                continue
            if w.infolist_integer(infolist, 'type') == 0:
                key = w.infolist_string(infolist, "key")
                if len(key) > 0:
                    keys.append(key)
                    keyed_channels.append(w.infolist_string(infolist, "name"))
                else :
                    unkeyed_channels.append(w.infolist_string(infolist, "name"))
        items[server] = ','.join(keyed_channels + unkeyed_channels)
        if len(keys) > 0:
            items[server] += ' %s' % ','.join(keys)
        w.infolist_free(infolist)

    return items
开发者ID:AlanSherman,项目名称:.weechat,代码行数:35,代码来源:autojoin.py

示例5: command_main

def command_main(data, buffer, args):
  infolist = w.infolist_get("buffer", "", "")
  buffer_groups = {}
  results = []
  buffer_count = 0
  merge_count = 0
  numbers = set()
  while w.infolist_next(infolist):
    bplugin = w.infolist_string(infolist, "plugin_name")
    bname = w.infolist_string(infolist, "name")
    bpointer = w.infolist_pointer(infolist, "pointer")
    bnumber = w.infolist_integer(infolist, "number")
    btype = w.buffer_get_string(bpointer, 'localvar_type')
    if not bnumber in numbers:
      numbers.add(bnumber)
    else:
      merge_count += 1

    if btype == 'server':
      bdesc = 'servers'
    elif btype == 'channel':
      bdesc = 'channels'
    elif btype == 'private':
      bdesc = 'queries'
    else:
      bdesc = bplugin

    buffer_groups.setdefault(bdesc,[]).append({'name': bname, 'pointer': bpointer})

  w.infolist_free(infolist)

  infolist = w.infolist_get("window", "", "")
  windows_v = set()
  windows_h = set()
  windows = set()
  while w.infolist_next(infolist):
    window = w.infolist_pointer(infolist, "pointer")
    window_w = w.infolist_integer(infolist, "width_pct")
    window_h = w.infolist_integer(infolist, "height_pct")
    windows.add(window)
    if window_h == 100 and window_w != 100:
      windows_v.add(window)
    elif window_w == 100 and window_h != 100:
      windows_h.add(window)
    #else: #both 100%, thus no splits
  w.infolist_free(infolist)

  window_count = len(windows)

  for desc, buffers in buffer_groups.iteritems():
    buffer_count += len(buffers)
    results.append('%i %s' % (len(buffers), desc))

  buffer_stats = ', '.join(sorted(results, key = lambda item: (int(item.partition(' ')[0]) if item[0].isdigit() else float('inf'), item),reverse=True)) # descending numerical sort of strings
  stats_string = '%i buffers (%i merged): %s; %i windows' % (buffer_count, merge_count, buffer_stats, window_count)
  if '-split' in args:
    stats_string += ": %i vertically / %i horizontally split" % (len(windows_v), len(windows_h))
  w.command("", "/input insert %s" % stats_string)
  return w.WEECHAT_RC_OK
开发者ID:DarkDefender,项目名称:scripts,代码行数:59,代码来源:weestats.py

示例6: xfer_end_do

def xfer_end_do(data, signal, signal_data):
    wc.infolist_next(signal_data)
    status = wc.infolist_string(signal_data, 'status_string')
    filename = wc.infolist_string(signal_data, 'filename')
    local = wc.infolist_string(signal_data, 'local_filename')
    if status == "done":
        os.popen('eiyfs "%s"' % local, 'r', 0)
    return wc.WEECHAT_RC_OK
开发者ID:jollywho,项目名称:Yaya-tan,代码行数:8,代码来源:yqs_xfer.py

示例7: infolist_get_first_entry_from_hotlist

def infolist_get_first_entry_from_hotlist():
    infolist = weechat.infolist_get('hotlist', '', '')
    if infolist:
        weechat.infolist_next(infolist)         # go to first entry in hotlist
        buffer_name = weechat.infolist_string(infolist, 'buffer_name')
        buffer_number = weechat.infolist_integer(infolist, 'buffer_number')
        ptr_buffer = weechat.infolist_pointer(infolist, 'buffer_pointer')
        weechat.infolist_free(infolist)
    return buffer_name, ptr_buffer, buffer_number
开发者ID:DarkDefender,项目名称:scripts,代码行数:9,代码来源:stick_buffer.py

示例8: command_main

def command_main(data, buffer, args):
  infolist = w.infolist_get("buffer", "", "")
  buffer_groups = {}
  results = []
  buffer_count = 0
  merge_count = 0
  numbers = set()
  while w.infolist_next(infolist):
    bplugin = w.infolist_string(infolist, "plugin_name")
    bname = w.infolist_string(infolist, "name")
    bpointer = w.infolist_pointer(infolist, "pointer")
    bnumber = w.infolist_integer(infolist, "number")
    if not bnumber in numbers:
      numbers.add(bnumber)
    else:
      merge_count += 1
    btype = bplugin
    if bplugin == 'irc':
      if  'server.' in bname:
        btype = '%s servers' % btype
      elif '#' in bname:
        btype = '%s channels' % btype
      else:
        btype = '%s queries' % btype
      
    buffer_groups.setdefault(btype,[]).append({'name': bname, 'pointer': bpointer})

  w.infolist_free(infolist)

  infolist = w.infolist_get("window", "", "")
  windows_v = set()
  windows_h = set()
  windows = set()
  while w.infolist_next(infolist):
    window = w.infolist_pointer(infolist, "pointer")
    window_w = w.infolist_integer(infolist, "width_pct")
    window_h = w.infolist_integer(infolist, "height_pct")
    windows.add(window)
    if window_h == 100 and window_w != 100:
      windows_v.add(window)
    elif window_w == 100 and window_h != 100:
      windows_h.add(window)
    #else: #both 100%, thus no splits
  w.infolist_free(infolist)
    
  window_count = len(windows)

  for bplugin, buffers in buffer_groups.iteritems():
    buffer_count += len(buffers)
    results.append('%i %s' % (len(buffers), bplugin))

  buffer_stats = ', '.join(sorted(results))
  stats_string = '%i windows used (%i vertically / %i horizontally split). %i (of which %i merged) buffers open: %s' % (window_count, len(windows_v), len(windows_h), buffer_count, merge_count, buffer_stats)
  w.command("", "/input insert %s" % stats_string)
  return w.WEECHAT_RC_OK
开发者ID:idk,项目名称:moo-skel,代码行数:55,代码来源:weestats.py

示例9: walk_nicklist

def walk_nicklist(nicklist,word):
    weechat.infolist_reset_item_cursor(nicklist)
    ni = weechat.infolist_next(nicklist)
    while ni :
        type = weechat.infolist_string(nicklist,'type')
        if type == 'nick':
            nick = weechat.infolist_string(nicklist,'name')
            if nick.lower().startswith(word):
                return nick
        ni = weechat.infolist_next(nicklist)
    return ''
开发者ID:WarheadsSE,项目名称:weechat-atcompletion,代码行数:11,代码来源:at_completion.py

示例10: xfer_ended_signal_cb

def xfer_ended_signal_cb(data, signal, signal_data):
    weechat.infolist_next(signal_data)
    status_string, filename, local_filename = weechat.infolist_string(signal_data, 'status_string'), weechat.infolist_string(signal_data, 'filename'), weechat.infolist_string(signal_data, 'local_filename')

    if status_string == "done":
        for pattern in patterns.keys():
            if re.match(pattern, filename):
                scp_file(local_filename, patterns[pattern])
                return weechat.WEECHAT_RC_OK
        # check for a defualt dir and send there since for loop completed without returning
    return weechat.WEECHAT_RC_OK
开发者ID:Ratler,项目名称:weechat-scripts,代码行数:11,代码来源:xfer_scp.py

示例11: other_nicks

def other_nicks(channel_name, server_name):
    nicks = []
    infolist = weechat.infolist_get("irc_nick", "",
                                    server_name + "," + channel_name)
    rc = weechat.infolist_next(infolist)
    while rc:
        nick = weechat.infolist_string(infolist, "name")
        if nick != my_nick(server_name):
            nicks.append(nick)
        rc = weechat.infolist_next(infolist)

    return nicks
开发者ID:igs-awilliams,项目名称:weecrypt,代码行数:12,代码来源:weecrypt.py

示例12: hide_buffer_cb

def hide_buffer_cb(data, signal, signal_data):
    """Hide the previous IRC buffer when switching buffers.

    If configuration option ``hide_private`` is enabled,
    private buffers will become hidden as well.

    If the previous buffer name matches any of the exemptions defined in ``exemptions``,
    it will not become hidden.

    :param data: Pointer
    :param signal: Signal sent by Weechat
    :param signal_data: Data sent with signal
    :returns: callback return value expected by Weechat.
    """
    global CURRENT_BUFFER

    previous_buffer = CURRENT_BUFFER
    CURRENT_BUFFER = weechat.current_buffer()

    plugin = weechat.buffer_get_string(previous_buffer, "plugin")
    full_name = weechat.buffer_get_string(previous_buffer, "full_name")
    server = weechat.buffer_get_string(previous_buffer, "localvar_server")
    channel = weechat.buffer_get_string(previous_buffer, "localvar_channel")

    if full_name.startswith("irc.server"):
        return WEECHAT_RC_OK

    buffer_type = weechat.buffer_get_string(
        weechat.info_get("irc_buffer", "{},{}".format(server, channel)),
        "localvar_type")

    if (buffer_type == "private"
            and weechat.config_get_plugin("hide_private") == "off"):
        return WEECHAT_RC_OK

    if weechat.config_get_plugin("hide_inactive") == "off":
        nicks_count = 0
        infolist = weechat.infolist_get(
            "irc_channel", "", "{},{}".format(server, channel))
        if infolist:
            weechat.infolist_next(infolist)
            nicks_count = weechat.infolist_integer(infolist, "nicks_count")
        weechat.infolist_free(infolist)
        if nicks_count == 0:
            return WEECHAT_RC_OK

    for entry in list_exemptions():
        if entry in full_name:
            return WEECHAT_RC_OK

    weechat.buffer_set(previous_buffer, "hidden", "1")
    return WEECHAT_RC_OK
开发者ID:oakkitten,项目名称:scripts,代码行数:52,代码来源:buffer_autohide.py

示例13: cb_hats

def cb_hats(data, item, window):
    buf = weechat.current_buffer()
    plugin = weechat.buffer_get_string(buf, "localvar_plugin")
    if plugin == "irc":
        server = weechat.buffer_get_string(buf, "localvar_server")
        channel = weechat.buffer_get_string(buf, "localvar_channel")
        nick = weechat.buffer_get_string(buf, "localvar_nick")
        nicks = weechat.infolist_get("irc_nick", "", "{},{},{}".format(
            server, channel, nick))
        weechat.infolist_next(nicks)
        hats = weechat.infolist_string(nicks, "prefixes")
        weechat.infolist_free(nicks)
        return hats.replace(" ", "")
    return ""
开发者ID:DarkDefender,项目名称:scripts,代码行数:14,代码来源:hatwidget.py

示例14: relay_attached

def relay_attached():
    '''Returns True if relay is attached else False'''
    # get infolist for relay
    infolist = w.infolist_get('relay', '', '')

    # only need to look at the first status (current or most recent)
    w.infolist_next(infolist)

    # status can be connected connecting or disconnected
    connected = w.infolist_string(infolist, 'status_string') == 'connected'

    # have to free infolist since it isn't done automatically
    w.infolist_free(infolist)

    return connected
开发者ID:jmeridth,项目名称:weechat_scripts,代码行数:15,代码来源:screen_away.py

示例15: init_weechat

 def init_weechat(self):
     """
     Initialize theme using current WeeChat options (aliases are
     replaced with their values from palette).
     """
     # get palette options
     self.palette = {}
     infolist = weechat.infolist_get('option', '', 'weechat.palette.*')
     while weechat.infolist_next(infolist):
         option_name = weechat.infolist_string(infolist, 'option_name')
         value = weechat.infolist_string(infolist, 'value')
         self.palette[value] = option_name
     weechat.infolist_free(infolist)
     # get color options (replace aliases by values from palette)
     self.options = {}
     infolist = weechat.infolist_get('option', '', '')
     while weechat.infolist_next(infolist):
         full_name = weechat.infolist_string(infolist, 'full_name')
         if self._option_is_used(full_name):
             value = weechat.infolist_string(infolist, 'value')
             self.options[full_name] = self._get_color_without_alias(value)
     weechat.infolist_free(infolist)
     # replace aliases in chat_nick_colors
     option = 'weechat.color.chat_nick_colors'
     colors = []
     for color in self.options.get(option, '').split(','):
         colors.append(self._get_color_without_alias(color))
     if colors:
         self.options[option] = ','.join(colors)
     # replace aliases in buffer_time_format
     option = 'weechat.look.buffer_time_format'
     if option in self.options:
         value = re.compile(r'\$\{color:[^\}]+\}').sub(
             self._replace_color_alias, self.options[option])
         if value:
             self.options[option] = value
     # build dict with nick prefixes (and replace alisases)
     prefixes = []
     option = 'irc.color.nick_prefixes'
     for prefix in self.options.get(option, '').split(';'):
         values = prefix.split(':', 1)
         if len(values) == 2:
             prefixes.append(values[0] + ':' +
                             self._get_color_without_alias(values[1]))
     if prefixes:
         self.options[option] = ';'.join(prefixes)
     # delete palette
     del self.palette
开发者ID:MatthewCox,项目名称:dotfiles,代码行数:48,代码来源:theme.py


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