コード例 #1
0
def main():
    weechat.hook_modifier("irc_in_notice", "modifier_cb", "")
    weechat.hook_completion("bitlbee", "bitlbee completion",
                            "bitlbee_completion", "")

    weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
    weechat.hook_print('', 'irc_topic', '', 1, 'print_332', '')
    find_buffer()
コード例 #2
0
def main():
    weechat.hook_modifier("irc_in_notice", "modifier_cb", "")
    weechat.hook_completion("bitlbee", "bitlbee completion",
                            "bitlbee_completion", "")

    weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
    weechat.hook_print('', 'irc_topic', '', 1, 'print_332', '')
    find_buffer()
コード例 #3
0
ファイル: emojis.py プロジェクト: flowbish/weechat-emojis
def main():
    """ Entry point, initializes everything  """

    weechat.register(
        SCRIPT_NAME,
        SCRIPT_AUTHOR,
        SCRIPT_VERSION,
        SCRIPT_LICENSE,
        SCRIPT_DESCRIPTION,
        "", # Shutdown callback function
        "", # Charset (blank for utf-8)
    )

    # Default values for settings
    default_settings = {
        'dbfile': os.path.join(
            weechat.info_get("weechat_dir", ""), "emojis-db.dat")
    }

    # Apply default configuration values if anything is unset
    for option, default in default_settings.items():
        if not weechat.config_is_set_plugin(option):
            weechat.config_set_plugin(option, default)

    # Hook callbacks
    weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
        "configuration_cb", "")
    weechat.hook_command_run("/input return", "transform_cb", "")
    weechat.hook_command_run("/input complete*", "complete_cb", "")
    #weechat.hook_modifier("input_text_display", "collapse_cb", "")

    # Command callbacks
    weechat.hook_command(  # command name
                           SCRIPT_NAME,
                           # description
                           " display :common_name: with its emoji equivalent",
                           # arguments
                           "reload"
                           " || add <name> <emoji>"
                           " || show <emoji>",
                           # description of arguments
                           " name: emoji name, sans colons\n"
                           "emoji: text that replaces :name:\n",
                           # completions
                           "reload || add || show %(emoji_name)", "emojis_cb", "")
    weechat.hook_completion("emoji_name", "Emoji name", "emoji_name_completion_cb", "")

    dbfile = weechat.config_get_plugin("dbfile")

    weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))

    try:
        load_emojis(dbfile)
    except IOError as e:
        weechat.prnt("",
            "%s%s: Database file %s is missing or inaccessible." \
                    % (weechat.prefix("error"), SCRIPT_NAME, dbfile))
        raise e # TODO: handle this better instead of brutally aborting
コード例 #4
0
def main():
    check_config()
    weechat.hook_modifier("irc_in_notice", "modifier_cb", "")
    weechat.hook_completion(TEMPLATE_NAME, "TAB completion to bitlbee",
                            "completion_cb", "")

    weechat.hook_print('', 'irc_332', '', 1, 'print_cb', '')
    weechat.hook_print('', 'irc_topic', '', 1, 'print_cb', '')
    find_buffer()
コード例 #5
0
ファイル: replacer.py プロジェクト: elig0n/weechat-replacer
def main():
    """Main entry"""

    weechat.register(NAME, AUTHOR, VERSION, LICENSE, DESC, '', '')
    weechat.hook_completion('replacer_plugin', 'Try to match last word with '
                            'those in replacement map keys, and replace it '
                            'with value.', 'replace_cb', '')
    weechat.hook_completion('completion_cb', 'Complete replacement map keys',
                            'completion_cb', '')

    weechat.hook_command(COMMAND, DESC, "[add <word> <text>|del <word>]",
                         __doc__ % {"command": COMMAND},
                         'add|del %(completion_cb)', 'replace_cmd', '')
コード例 #6
0
ファイル: replacer.py プロジェクト: gryf/weechat-replacer
def main():
    """Main entry"""

    weechat.register(NAME, AUTHOR, VERSION, LICENSE, DESC, '', '')
    weechat.hook_completion('replacer_plugin', 'Try to match last word with '
                            'those in replacement map keys, and replace it '
                            'with value.', 'replace_cb', '')
    weechat.hook_completion('completion_cb', 'Complete replacement map keys',
                            'completion_cb', '')

    weechat.hook_command(COMMAND, DESC, "[add <word> <text>|del <word>]",
                         __doc__ % {"command": COMMAND},
                         'add|del %(completion_cb)', 'replace_cmd', '')
コード例 #7
0
def main():
    at_config('load')
    # hook our config
    weechat.hook_config(STRIP_VAR+'*','at_config','')
    # hook the nick complete
    weechat.hook_command_run('/input complete_next', 'at_completion', '')
    # hook the /atcomplete
    weechat.hook_command('atcomplete','manage @nick completion plugin',
        '[enable|disable|toggle] '
        ' | [servers [list | add name | del name]]'
        ' | [buffers [list | add name | del name]]',
        'args desc',
        'status %-'
        ' || enable %-'
        ' || disable %-'
        ' || toggle %-'
        ' || server list|add|del %(buffers_names)'
        ' || buffer list|add|del %(buffers_names)'
        ,
        'at_control','')
    # hook the completetion for /atcomplete
    weechat.hook_completion('plugin_at_completion','@nick completion','at_complete','')
コード例 #8
0
ファイル: hipchat.py プロジェクト: recht/weechat-plugins
def main():
    if not weechat.register('hipchat', 'Joakim Recht <*****@*****.**>', '1.0',
                            'MIT', 'Hipchat utilities',
                            '', ''):
        return

    rooms_set_default_settings()
    rooms_reset_stored_sort_order()
    get_token()

    weechat.hook_command(
        'hipchat', 'Hipchat utilities',
        '[rooms | autojoin | whois <user> | fullnames | nicks [<pattern>]]',
        'rooms: List rooms\nautojoin: List autojoin rooms\nwhois <user>: Get information '
        'about a specific user - either @mention or email\nfullnames: Force populate full '
        'names in nicklists in all channels\nnicks <pattern>: List users, optionally by pattern. '
        'Use * in pattern as wildcard match.\n',
        'rooms|autojoin|whois|fullnames|nicks', 'hipchat_cmd', '')
    weechat.hook_completion('hipchat_mentions', 'Mentions', 'complete_mention', '')

    if weechat.config_get_plugin('enable_fullnames') == 'on':
        nicklist_download()
    weechat.hook_signal('nicklist_nick_added', 'update_fullname_join', '')
    weechat.hook_signal('hipchat_nicks_downloaded', 'show_nicks_cb', '')
コード例 #9
0
def jmh_hook_commands_and_completions():
    """ Hook commands and completions. """
    # prototype: hook = weechat.hook_command(command, description, args, args_description,
    #   completion, callback, callback_data)
    weechat.hook_command(SCRIPT_COMMAND, SCRIPT_DESC,
        "[ on | off | log | verbose [on|off]",
        "     on: enable jabber_message_handler\n"
        "    off: disable jabber_message_handler\n"
        "    log: name of events log file\n"
        "verbose: toggle verbose on/off\n"
        "\n"
        "Without an argument, current settings are displayed.\n"
        "\n"
        "Examples:\n"
        "List settings: /jabber_message_handler\n"
        "      Enable : /jabber_message_handler on\n"
        "     Disable : /jabber_message_handler off\n"
        "      Set log: /jabber_message_handler log /path/to/events.log\n"
        "   Verbose on: /jabber_message_handler verbose on\n"
        "  Verbose off: /jabber_message_handler verbose off\n",
        "log "
        " || off"
        " || on"
        " || verbose on|off",
        "jmh_cmd", "")

    weechat.hook_command('clr', 'Clear jabber events log.',
            '', "Usage: /clr", '', 'jmh_cmd_clr', '');

    weechat.hook_command('jabber_echo_message',
            'Echo message in jabber buffer.',
            '', "Usage: /jabber_echo_message server message",
            '%(jabber_servers)', 'jmh_cmd_jabber_echo_message', '');

    weechat.hook_completion("jabber_servers", "list of jabber servers",
                            "jmh_completion_servers", "")
コード例 #10
0
ファイル: testapi.py プロジェクト: weechat/weechat
def test_hooks():
    """Test function hook_command."""
    # hook_completion / hook_completion_args / and hook_command
    hook_cmplt = weechat.hook_completion('SCRIPT_NAME', 'description',
                                         'completion_cb', 'completion_data')
    hook_cmd = weechat.hook_command('cmd' + 'SCRIPT_NAME', 'description',
                                    'arguments', 'description arguments',
                                    '%(' + 'SCRIPT_NAME' + ')',
                                    'command_cb', 'command_data')
    weechat.command('', '/input insert /cmd' + 'SCRIPT_NAME' + ' w')
    weechat.command('', '/input complete_next')
    # hook_command_run
    hook_cmd_run = weechat.hook_command_run('/cmd' + 'SCRIPT_NAME' + '*',
                                            'command_run_cb', 'command_run_data')
    weechat.command('', '/input return')
    weechat.unhook(hook_cmd_run)
    weechat.unhook(hook_cmd)
    weechat.unhook(hook_cmplt)
コード例 #11
0
ファイル: testapi.py プロジェクト: bsmr/weechat-weechat
def test_hooks():
    """Test function hook_command."""
    # hook_completion / hook_completion_args / and hook_command
    hook_cmplt = weechat.hook_completion('SCRIPT_NAME', 'description',
                                         'completion_cb', 'completion_data')
    hook_cmd = weechat.hook_command('cmd' + 'SCRIPT_NAME', 'description',
                                    'arguments', 'description arguments',
                                    '%(' + 'SCRIPT_NAME' + ')',
                                    'command_cb', 'command_data')
    weechat.command('', '/input insert /cmd' + 'SCRIPT_NAME' + ' w')
    weechat.command('', '/input complete_next')
    # hook_command_run
    hook_cmd_run = weechat.hook_command_run('/cmd' + 'SCRIPT_NAME' + '*',
                                            'command_run_cb', 'command_run_data')
    weechat.command('', '/input return')
    weechat.unhook(hook_cmd_run)
    weechat.unhook(hook_cmd)
    weechat.unhook(hook_cmplt)
コード例 #12
0
ファイル: weenetsoul.py プロジェクト: DarkDefender/scripts
             'desc': "<login>...",
             'compl': '%(ns_send) %-'}),
    ('add_contact', {'cb': wee_ns_hook_cmd_add_contact,
                     'desc': "<login>...",
                     'compl': '%-'}),
])

######################################
# Main
######################################

if __name__ == "__main__":
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, '',
                        'wee_ns_script_unload_cb'):
        weechat.hook_completion('ns_send', 'login completion',
                                'wee_ns_hook_completion_send', '')
        weechat.hook_command('ns', 'weeNetsoul: A netsoul plugin for weechat',
                             ' | '.join("%s%s" % (k, "" if 'desc' not in v
                                                  else " " + v['desc'])
                                        for k, v in hook_cmd_ns.items()),
                             '\n'.join("%s: %s" % (k, v['cb'].__doc__)
                                       for k, v in hook_cmd_ns.items()),
                             ' || '.join("%s%s" % (k, "" if 'compl' not in v
                                                   else " " + v['compl'])
                                         for k, v in hook_cmd_ns.items()),
                             'wee_ns_hook_cmd_ns', '')
        wee_ns_config_file = weechat.config_new(SCRIPT_NAME, '', '')
        wee_ns_conf_serv_sect = weechat.config_new_section(wee_ns_config_file,
                                                           'server', 0, 0,
                                                           ('wee_ns_serv_'
                                                            'sect_read_cb'),
コード例 #13
0
            "add <server> [<channel1>[ <channel2>...]] | [-key <channelkey> [<channelkey>...]] ||"
            "del <server> [<channel1>[ <channel2>...]]",
            "add <server> <channel>: add channel to irc.server.<servername>.autojoin\n"
            "     -key <channelkey>: name of channelkey\n"
            "del <server> <channel>: del channel from irc.server.<servername>.autojoin\n"
            "\n"
            "Examples:\n"
            " add current channel to corresponding server option:\n"
            "  /" + SCRIPT_NAME + " add\n"
            " add all channels from all server to corresponding server option:\n"
            "  /allchan /" + SCRIPT_NAME + " add\n"
            " add channel #weechat to autojoin option on server freenode:\n"
            "  /" + SCRIPT_NAME + " add freenode #weechat\n"
            " add channel #weechat and #weechat-de to autojoin option on server freenode, with channel key for channel #weechat:\n"
            "  /" + SCRIPT_NAME + " add freenode #weechat #weechat-de -key my_channel_key\n"
            " del channels #weechat and #weechat-de from autojoin option on server freenode:\n"
            "  /" + SCRIPT_NAME + " del freenode #weechat #weechat-de",
            "add %(irc_servers) %(irc_server_channels)|%*||" "del %(irc_servers) %(plugin_autojoinem)|%*",
            "add_autojoin_cmd_cb",
            "",
        )

        init_options()
        weechat.hook_completion("plugin_autojoinem", "autojoin_completion", "autojoinem_completion_cb", "")
        weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "toggle_refresh", "")

#        if int(version) >= 0x00030600:
#        else:
#            weechat.prnt("","%s%s %s" % (weechat.prefix("error"),SCRIPT_NAME,": needs version 0.3.6 or higher"))
#            weechat.command("","/wait 1ms /python unload %s" % SCRIPT_NAME)
コード例 #14
0
ファイル: buffer_autoset.py プロジェクト: benmezger/dotfiles
                "    /" + SCRIPT_COMMAND + " add irc.libera.#savannah "
                "highlight_words_add weechat\n"
                "  disable highlights from nick \"mike\" on libera server, "
                "channel #weechat (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.libera.#weechat "
                "hotlist_max_level_nicks_add mike:2\n"
                "  disable hotlist changes for nick \"bot\" on libera "
                "server (all channels) (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.libera.* "
                "hotlist_max_level_nicks_add bot:-1",
                "add %(buffers_plugins_names)|"
                "%(buffer_autoset_current_buffer) "
                "%(buffer_properties_set)"
                " || del %(buffer_autoset_options)", "bas_cmd", "")
            weechat.hook_completion("buffer_autoset_current_buffer",
                                    "current buffer name for buffer_autoset",
                                    "bas_completion_current_buffer_cb", "")
            weechat.hook_completion("buffer_autoset_options",
                                    "list of options for buffer_autoset",
                                    "bas_completion_options_cb", "")
            weechat.hook_signal("9000|buffer_opened",
                                "bas_signal_buffer_opened_cb", "")
            weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME,
                                "bas_config_option_cb", "")

            # apply settings to all already opened buffers
            buffers = weechat.infolist_get("buffer", "", "")
            if buffers:
                while weechat.infolist_next(buffers):
                    buffer = weechat.infolist_pointer(buffers, "pointer")
                    bas_signal_buffer_opened_cb("", "", buffer)
コード例 #15
0
ファイル: undernet_totp.py プロジェクト: DarkDefender/scripts
                             "  /uotp list\n"+
                             "  /uotp add freenode 4c6fdb7d0659bae2a16d23bab99678462b9f7897\n"+
                             "  /uotp add freenode jrx5 w7ig lg5o filn eo5l tfty iyvz 66ex\n"+
                             "  /uotp remove freenode\n"+
                             "  /uotp enable freenode\n"+
                             "  /uotp disable freenode",
                             "otp %(irc_servers)"
                             " || list"
                             " || add %(irc_servers)"
                             " || remove %(configured_servers)"
                             " || enable %(irc_servers)"
                             " || disable %(disabled_servers)",
                             "options_cb", "")
        weechat.hook_signal("irc_server_connecting", "signal_cb", "")
        weechat.hook_signal("irc_server_disconnected", "signal_cb", "")
        weechat.hook_config("plugins.var.python.undernet_totp.otp_server_names", "config_update_cb", "")
        weechat.hook_completion("configured_servers", "list of otp configured servers", "server_completion_cb", "configured_servers")
        weechat.hook_completion("disabled_servers", "list of disabled servers", "server_completion_cb", "enabled_servers")
        weechat.hook_modifier("input_text_display", "hide_secret_cb", "")

        for option, default_value in SETTINGS.items():
            if weechat.config_get_plugin(option) == "":
                weechat.config_set_plugin(option, default_value[0])
            weechat.config_set_desc_plugin(option, '%s (default: %s)' % (default_value[1], default_value[0]))

        # For now we enable the hooks until it's possible to force script plugins to
        # load before the irc plugin on weechat startup, otherwise the irc_server_connecting signal
        # get missed.
        for server in enabled_servers():
            hook_all(server)
コード例 #16
0
ファイル: cron.py プロジェクト: kevr/scripts
def cron_unload():
    """ Called when script is unloaded. """
    if weechat.config_get_plugin("auto_save") == "on":
        cron_save()
    return weechat.WEECHAT_RC_OK

if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC,
                        "cron_unload", ""):
        # set default settings
        for option, default_value in cron_settings.items():
            if not weechat.config_is_set_plugin(option):
                weechat.config_set_plugin(option, default_value)
        # completions for commands
        weechat.hook_completion("cron_time", "cron time", "cron_completion_time_cb", "")
        weechat.hook_completion("cron_repeat", "cron repeat", "cron_completion_repeat_cb", "")
        weechat.hook_completion("cron_buffer", "cron buffer", "cron_completion_buffer_cb", "")
        weechat.hook_completion("cron_keyword", "cron keyword", "cron_completion_keyword_cb", "")
        weechat.hook_completion("cron_commands", "cron commands", "cron_completion_commands_cb", "")
        weechat.hook_completion("cron_number", "cron number", "cron_completion_number_cb", "")
        weechat.hook_completion("at_time", "at time", "cron_completion_at_time_cb", "")
        # commands /cron and /at
        str_buffer = "  buffer: buffer where command is executed\n" \
            "          (\"current\" for current buffer, \"core.weechat\" for WeeChat core buffer)\n"
        str_commands = " command: a keyword, followed by arguments:\n"
        for cmd in sorted(cron_commands.keys()):
            str_commands += "          - " + cmd + ": " + cron_commands[cmd] + "\n";
        weechat.hook_command("cron",
                             "Manage jobs in crontab",
                             "list || add <minute> <hour> <monthday> <month> <weekday> <repeat> <buffer> <command> || "
コード例 #17
0
        weechat.hook_command(SCRIPT_NAME,SCRIPT_DESC,
                             'add <server> [<channel1>[ <channel2>...]] | [-key <channelkey> [<channelkey>...]] ||'
                             'del <server> [<channel1>[ <channel2>...]]',
                             'add <server> <channel>: add channel to irc.server.<servername>.autojoin\n'
                             '     -key <channelkey>: name of channelkey\n'
                             'del <server> <channel>: del channel from irc.server.<servername>.autojoin\n'
                             '\n'
                             'Examples:\n'
                             ' add current channel to corresponding server option:\n'
                             '  /' + SCRIPT_NAME + ' add\n'
                             ' add all channels from all server to corresponding server option:\n'
                             '  /allchan /' + SCRIPT_NAME + ' add\n'
                             ' add channel #weechat to autojoin option on server freenode:\n'
                             '  /' + SCRIPT_NAME + ' add freenode #weechat\n'
                             ' add channel #weechat and #weechat-de to autojoin option on server freenode, with channel key for channel #weechat:\n'
                             '  /' + SCRIPT_NAME + ' add freenode #weechat #weechat-de -key my_channel_key\n'
                             ' del channels #weechat and #weechat-de from autojoin option on server freenode:\n'
                             '  /' + SCRIPT_NAME + ' del freenode #weechat #weechat-de',
                             'add %(irc_servers) %(irc_server_channels)|%*||'
                             'del %(irc_servers) %(plugin_autojoinem)|%*',
                             'add_autojoin_cmd_cb', '')

        init_options()
        weechat.hook_completion('plugin_autojoinem', 'autojoin_completion', 'autojoinem_completion_cb', '')
        weechat.hook_config('plugins.var.python.' + SCRIPT_NAME + '.*', 'toggle_refresh', '')

#        if int(version) >= 0x00030600:
#        else:
#            weechat.prnt("","%s%s %s" % (weechat.prefix("error"),SCRIPT_NAME,": needs version 0.3.6 or higher"))
#            weechat.command("","/wait 1ms /python unload %s" % SCRIPT_NAME)
コード例 #18
0
ファイル: infos.py プロジェクト: norrs/weechat-plugins
        SCRIPT_NAME,
        COLOR_CHAT_DELIMITERS,
        COLOR_RESET,
    )

    weechat.hook_command(
        "infos",
        "View and use WeeChat infos",
        "show [<info_name>] || get <info_name> [<arguments>]",
        "show: Shows information about all infos or info <info_name>.\n" " get: Get info <info_name>.",
        "get|show %(infos_info_list)",
        "cmd_infos",
        "",
    )

    weechat.hook_completion("infos_info_list", "List of info names", "cmpl_infos_list", "")

    # -------------------------------------------------------------------------
    # Debug

    if weechat.config_get_plugin("debug"):
        try:
            # custom debug module I use, allows me to inspect script's objects.
            import pybuffer

            debug = pybuffer.debugBuffer(globals(), "%s_debug" % SCRIPT_NAME)
        except ImportError:

            def debug(s, *args):
                if not isinstance(s, basestring):
                    s = str(s)
コード例 #19
0
    weechat.hook_modifier('irc_in_privmsg', 'message_in_cb', '')
    weechat.hook_modifier('irc_out_privmsg', 'message_out_cb', '')

    weechat.hook_command(
        SCRIPT_NAME, SCRIPT_HELP,
        'start [NICK SERVER] || '
        'finish [NICK SERVER] || '
        'smp ask NICK SERVER SECRET [QUESTION] || '
        'smp respond NICK SERVER SECRET || '
        'trust [NICK SERVER] || '
        'policy [POLICY on|off]',
        '',
        'start %(nick) %(irc_servers) %-||'
        'finish %(nick) %(irc_servers) %-||'
        'smp ask|respond %(nick) %(irc_servers) %-||'
        'trust %(nick) %(irc_servers) %-||'
        'policy %(otr_policy) on|off %-||',
        'command_cb',
        '')

    weechat.hook_completion(
        'otr_policy', 'OTR policies', 'policy_completion_cb', '')

    weechat.hook_config('logger.level.irc.*', 'logger_level_update_cb', '')

    weechat.hook_signal('buffer_switch', 'buffer_switch_cb', '')

    OTR_STATUSBAR = weechat.bar_item_new(SCRIPT_NAME, 'otr_statusbar_cb', '')
    weechat.bar_item_update(SCRIPT_NAME)
コード例 #20
0
ファイル: infos.py プロジェクト: tampakrap/weechat-scripts
    COLOR_CHAT_BUFFER = weechat.color('chat_buffer')
    COLOR_CYAN = weechat.color('cyan')

    # pretty [SCRIPT_NAME]
    script_nick = '%s[%s%s%s]%s' % (COLOR_CHAT_DELIMITERS, COLOR_CHAT_NICK,
                                    SCRIPT_NAME, COLOR_CHAT_DELIMITERS,
                                    COLOR_RESET)

    weechat.hook_command("infos", "View and use WeeChat infos",
                         "show [<info_name>] || get <info_name> [<arguments>]",
                         "show: Shows information about all infos or info <info_name>.\n"\
                         " get: Get info <info_name>.",
                         "get|show %(infos_info_list)",
                         "cmd_infos", "")

    weechat.hook_completion('infos_info_list', 'List of info names',
                            'cmpl_infos_list', '')

    # -------------------------------------------------------------------------
    # Debug

    if weechat.config_get_plugin('debug'):
        try:
            # custom debug module I use, allows me to inspect script's objects.
            import pybuffer
            debug = pybuffer.debugBuffer(globals(), '%s_debug' % SCRIPT_NAME)
        except ImportError:

            def debug(s, *args):
                if not isinstance(s, str):
                    s = str(s)
                if args:
コード例 #21
0
                             "  " + str_unknown   + "  unknown script\n"
                             "  " + str_running   + "  script is running (loaded)\n"
                             "  " + str_obsolete  + "  script is obsolete (new version available)\n\n"
                             "Examples:\n"
                             "  /" + SCRIPT_COMMAND + " list             => list all scripts\n"
                             "  /" + SCRIPT_COMMAND + " list game        => list all scripts with text/tag \"game\"\n"
                             "  /" + SCRIPT_COMMAND + " install beep.pl  => install script beep.pl\n"
                             "  /" + SCRIPT_COMMAND + " remove beep.pl   => remove script beep.pl",
                             "list %(weeget_scripts_tags)"
                             " || listinstalled %(weeget_scripts_tags)"
                             " || show %(weeget_scripts)"
                             " || install %(weeget_scripts)|%*"
                             " || remove %(weeget_scripts_installed)|%*"
                             " || check"
                             " || update"
                             " || upgrade",
                             "wg_cmd", "")
        weechat.hook_completion("weeget_scripts", "list of scripts in repository",
                                "wg_completion_scripts_cb", "")
        weechat.hook_completion("weeget_scripts_installed", "list of scripts installed",
                                "wg_completion_scripts_installed_cb", "")
        weechat.hook_completion("weeget_scripts_tags", "tags of scripts in repository",
                                "wg_completion_scripts_tags_cb", "")

# ==================================[ end ]===================================

def wg_unload_script():
    """ Function called when script is unloaded. """
    wg_config_write()
    return weechat.WEECHAT_RC_OK
コード例 #22
0
ファイル: signal.py プロジェクト: rxcomm/signal-weechat
    try:
        if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                            SCRIPT_LICENSE, SCRIPT_DESC, 'shutdown', ''):
            weechat.hook_config('plugins.var.python.%s.*' % SCRIPT_NAME,
                                'config_changed', '')
            init_config()
            set_log_level()
            smsg_help = [
                "number: the full e164 number (including country code) for the contact",
            ]
            signal_help = [
                "contacts: list all contact names and numbers",
                "groups: list all group names",
            ]
            logger.debug("Registering command...")
            weechat.hook_completion('signal_contact_or_group',
                                    'Script to complete numbers',
                                    'completion_cb', '')
            weechat.hook_command(
                "smsg",
                "Open a buffer to message someone (or some group) on signal",
                "[<number or group name>]", "\n".join(smsg_help), "%(number)",
                "smsg_cmd_cb", "")
            weechat.hook_command("signal", "List contacts or group names",
                                 "list [contacts | groups]",
                                 "\n".join(signal_help), "%(list)",
                                 "signal_cmd_cb", "")
            init_socket()
    except Exception:
        logger.exception("Failed to initialize plugin.")
コード例 #23
0
ファイル: emojis.py プロジェクト: flowbish/weechat-emojis
def main():
    """ Entry point, initializes everything  """

    weechat.register(
        SCRIPT_NAME,
        SCRIPT_AUTHOR,
        SCRIPT_VERSION,
        SCRIPT_LICENSE,
        SCRIPT_DESCRIPTION,
        "",  # Shutdown callback function
        "",  # Charset (blank for utf-8)
    )

    # Default values for settings
    default_settings = {
        'dbfile':
        os.path.join(weechat.info_get("weechat_dir", ""), "emojis-db.dat")
    }

    # Apply default configuration values if anything is unset
    for option, default in default_settings.items():
        if not weechat.config_is_set_plugin(option):
            weechat.config_set_plugin(option, default)

    # Hook callbacks
    weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
                        "configuration_cb", "")
    weechat.hook_command_run("/input return", "transform_cb", "")
    weechat.hook_command_run("/input complete*", "complete_cb", "")
    #weechat.hook_modifier("input_text_display", "collapse_cb", "")

    # Command callbacks
    weechat.hook_command(  # command name
        SCRIPT_NAME,
        # description
        " display :common_name: with its emoji equivalent",
        # arguments
        "reload"
        " || add <name> <emoji>"
        " || show <emoji>",
        # description of arguments
        " name: emoji name, sans colons\n"
        "emoji: text that replaces :name:\n",
        # completions
        "reload || add || show %(emoji_name)",
        "emojis_cb",
        "")
    weechat.hook_completion("emoji_name", "Emoji name",
                            "emoji_name_completion_cb", "")

    dbfile = weechat.config_get_plugin("dbfile")

    weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))

    try:
        load_emojis(dbfile)
    except IOError as e:
        weechat.prnt("",
            "%s%s: Database file %s is missing or inaccessible." \
                    % (weechat.prefix("error"), SCRIPT_NAME, dbfile))
        raise e  # TODO: handle this better instead of brutally aborting
コード例 #24
0
            "          remove: remove settings for responsive layout\n"
            "            list: list current configuration\n"
            "        terminal: list current terminal width and height\n"
            "           debug: print script debug output\n\n"
            "To get current layout and terminal dimensions in your bar, use 'rlayout' bar item.",
            "size %(layouts_names)"
            " || nicklist %(layouts_names) %(rlayout_bool_value)"
            " || default_nicklist %(rlayout_bool_value)"
            " || remove %(rlayouts_names)"
            " || list"
            " || terminal"
            " || debug %(rlayout_bool_value)", "rlayout_cmd_cb", "")

        # Default settings
        for option, default_value in SETTINGS.items():
            if weechat.config_get_plugin(option) == "":
                weechat.config_set_plugin(option, default_value[0])
            weechat.config_set_desc_plugin(
                option,
                '%s (default: %s)' % (default_value[1], default_value[0]))

        weechat.hook_completion("rlayout_bool_value", "list of bool values",
                                "rlayout_completion_bool_cb", "")
        weechat.hook_completion("rlayouts_names", "list of rlayouts",
                                "rlayout_completion_layout_list_cb", "")
        weechat.hook_config("plugins.var.python.responsive_layout.layout.*",
                            "config_cb", "")
        weechat.bar_item_new("rlayout", "rlayout_bar_cb", "")
        update_layout_list()
        hook = weechat.hook_signal("signal_sigwinch", "responsive_cb", "")
コード例 #25
0
ファイル: identica.py プロジェクト: ktsamis/scripts-1
    weechat.hook_modifier('irc_out_privmsg', 'parse_out', '')

    # /sn
    weechat.hook_command(
        'sn', 'StatusNet manager',
        'whois | subscribe | unsubscribe | block | unblock | updates | groups <username> || group | join | leave <group>',
        '        whois: retrieves profile information from <username>'
        "\n"
        '    subscribe: subscribes to <username>'
        "\n"
        '  unsubscribe: unsubscribes from <username>'
        "\n"
        '        block: blocks <username>'
        "\n"
        '      unblock: unblocks <username>'
        "\n"
        '      updates: recent updates from <username> <quantity (<20)>'
        "\n"
        '         join: joins group <group>'
        "\n"
        '        leave: leaves group <group>'
        "\n"
        '       groups: groups (<username>) you or a specified username is subscribed'
        "\n"
        '        group: shows info about <group>',
        'whois %(sn_nicks) || subscribe %(sn_nicks) || unsubscribe %(sn_nicks) || block %(sn_nicks) || unblock %(sn_nicks) || updates %(sn_nicks) || join || leave || group || groups',
        'sn', '')

    # Completion for /sn commands
    weechat.hook_completion('sn_nicks', 'list of SN users', 'nicklist', '')
コード例 #26
0
    OTR_DIR = os.path.join(info_get('weechat_dir', ''), OTR_DIR_NAME)
    create_dir()

    ACCOUNTS = AccountDict()

    weechat.hook_modifier('irc_in_privmsg', 'message_in_cb', '')
    weechat.hook_modifier('irc_out_privmsg', 'message_out_cb', '')

    weechat.hook_command(
        SCRIPT_NAME, SCRIPT_HELP, 'start [NICK SERVER] || '
        'finish [NICK SERVER] || '
        'smp ask NICK SERVER SECRET [QUESTION] || '
        'smp respond NICK SERVER SECRET || '
        'trust [NICK SERVER] || '
        'policy [POLICY on|off]', '', 'start %(nick) %(irc_servers) %-||'
        'finish %(nick) %(irc_servers) %-||'
        'smp ask|respond %(nick) %(irc_servers) %-||'
        'trust %(nick) %(irc_servers) %-||'
        'policy %(otr_policy) on|off %-||', 'command_cb', '')

    weechat.hook_completion('otr_policy', 'OTR policies',
                            'policy_completion_cb', '')

    weechat.hook_config('logger.level.irc.*', 'logger_level_update_cb', '')

    weechat.hook_signal('buffer_switch', 'buffer_switch_cb', '')

    OTR_STATUSBAR = weechat.bar_item_new(SCRIPT_NAME, 'otr_statusbar_cb', '')
    weechat.bar_item_update(SCRIPT_NAME)
コード例 #27
0
ファイル: weeget.py プロジェクト: nyulacska/vim-dotfiles
            "  " + str_running + "  script is running (loaded)\n"
            "  " + str_obsolete +
            "  script is obsolete (new version available)\n\n"
            "Examples:\n"
            "  /" + SCRIPT_COMMAND + " list            => list all scripts\n"
            "  /" + SCRIPT_COMMAND +
            " list game       => list all scripts with text/tag \"game\"\n"
            "  /" + SCRIPT_COMMAND +
            " install weetris => install script weetris.pl\n"
            "  /" + SCRIPT_COMMAND +
            " remove weetris  => remove script weetris.pl",
            "list %(weeget_scripts)"
            " || listinstalled %(weeget_scripts)"
            " || show %(weeget_scripts)"
            " || install %(weeget_scripts)|%*"
            " || check"
            " || update"
            " || upgrade"
            " || remove %(weeget_scripts)|%*", "wg_cmd", "")
        weechat.hook_completion("weeget_scripts",
                                "list of scripts in repository",
                                "wg_completion_scripts_cb", "")

# ==================================[ end ]===================================


def wg_unload_script():
    """ Function called when script is unloaded. """
    wg_config_write()
    return weechat.WEECHAT_RC_OK
コード例 #28
0
ファイル: weeget.py プロジェクト: sitaktif/weechat-scripts
            "  /" + SCRIPT_COMMAND + " list             => list all scripts\n"
            "  /" + SCRIPT_COMMAND + ' list game        => list all scripts with text/tag "game"\n'
            "  /" + SCRIPT_COMMAND + " install beep.pl  => install script beep.pl\n"
            "  /" + SCRIPT_COMMAND + " remove beep.pl   => remove script beep.pl",
            "list %(weeget_scripts_tags)"
            " || listinstalled %(weeget_scripts_tags)"
            " || show %(weeget_scripts)"
            " || install %(weeget_scripts)|%*"
            " || remove %(weeget_scripts_installed)|%*"
            " || check"
            " || update"
            " || upgrade",
            "wg_cmd",
            "",
        )
        weechat.hook_completion("weeget_scripts", "list of scripts in repository", "wg_completion_scripts_cb", "")
        weechat.hook_completion(
            "weeget_scripts_installed", "list of scripts installed", "wg_completion_scripts_installed_cb", ""
        )
        weechat.hook_completion(
            "weeget_scripts_tags", "tags of scripts in repository", "wg_completion_scripts_tags_cb", ""
        )

# ==================================[ end ]===================================


def wg_unload_script():
    """ Function called when script is unloaded. """
    wg_config_write()
    return weechat.WEECHAT_RC_OK
コード例 #29
0
ファイル: buffer_autoset.py プロジェクト: AndyHoang/dotfiles
                "highlight_words_add weechat\n"
                "  disable highlights from nick \"mike\" on freenode server, "
                "channel #weechat (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.freenode.#weechat "
                "hotlist_max_level_nicks_add mike:2\n"
                "  disable hotlist changes for nick \"bot\" on freenode "
                "server (all channels) (requires WeeChat >= 0.3.4):\n"
                "    /" + SCRIPT_COMMAND + " add irc.freenode.* "
                "hotlist_max_level_nicks_add bot:-1",
                "add %(buffers_plugins_names)|"
                "%(buffer_autoset_current_buffer) "
                "%(buffer_properties_set)"
                " || del %(buffer_autoset_options)",
                "bas_cmd", "")
            weechat.hook_completion(
                "buffer_autoset_current_buffer",
                "current buffer name for buffer_autoset",
                "bas_completion_current_buffer_cb", "")
            weechat.hook_completion(
                "buffer_autoset_options",
                "list of options for buffer_autoset",
                "bas_completion_options_cb", "")
            weechat.hook_signal("9000|buffer_opened",
                                "bas_signal_buffer_opened_cb", "")
            weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME,
                                "bas_config_option_cb", "")

            # apply settings to all already opened buffers
            buffers = weechat.infolist_get("buffer", "", "")
            if buffers:
                while weechat.infolist_next(buffers):
                    buffer = weechat.infolist_pointer(buffers, "pointer")
コード例 #30
0
ファイル: nameday.py プロジェクト: ktsamis/scripts-1
def nameday_config_cb(data, option, value):
    """Called each time an option is changed."""
    nameday_load_config()
    nameday_build_item()
    weechat.bar_item_update('nameday')
    return weechat.WEECHAT_RC_OK

if __name__ == '__main__' and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC,
                        '', ''):
        # load config
        nameday_load_config()

        # new command
        weechat.hook_completion('namedays', 'list of name days',
                                'nameday_completion_namedays_cb', '')
        weechat.hook_command(SCRIPT_COMMAND,
                             'Display name days',
                             '[* | number | date | name | !]',
                             '     *: display list of name days in a new buffer\n'
                             'number: display name day for today and <number> days in future\n'
                             '  date: display name day for this date, format is day/month (for example: 31/01)\n'
                             '  name: display date for this name\n'
                             '     !: display reminder dates for names defined in option "reminder"\n\n'
                             'A bar item "nameday" can be used in a bar.\n\n'
                             'Examples:\n'
                             '  /nameday *          display list of name days in a new buffer\n'
                             '  /nameday            display name day for today and tomorrow\n'
                             '  /nameday 2          display name day for today, tomorrow, and after tomorrow\n'
                             '  /nameday 20/01      display name day for january, 20th\n'
                             '  /nameday sébastien  display day for name "sébastien"',
コード例 #31
0
def cmd_cb(data, buffer, args):
    args = args.split()
    if not args:
        return weechat.WEECHAT_RC_ERROR
    changes = get_config_json('changes')
    if args[0] == 'set':
        changes[args[1]] = args[2]
        set_config_json('changes', changes)
        weechat.prnt('', 'replacement for %s set' % args[1])
    elif args[0] == 'unset':
        del changes[args[1]]
    elif args[0] == 'list':
        weechat.prnt('', '%d replacements set:' % len(changes))
        for old, new in changes.items():
            weechat.prnt('', "  %s    %s" % (old, new))
    else:
        weechat.prnt('', 'Invalid subcommand: %s' % args[0])
        return weechat.WEECHAT_RC_ERROR
    return weechat.WEECHAT_RC_OK

weechat.hook_modifier('irc_in_privmsg', 'change_nick', '')
weechat.hook_command('nickreplacer', "Set replacement for nick",
                     '[list] | [set old new] | [unset old]',
                     'Use any subcommand',
                     'set old new'
                     'unset old',
                     'cmd_cb', '')
weechat.hook_completion('replacednicks', "Words in completion list.",
                        'complete', '')
コード例 #32
0
ファイル: kwfactoids.py プロジェクト: Kwpolska/scripts
    elif len(args) == 2:
        msg = u": ".join((args[1], ftext))
    else:
        msg = ftext
    weechat.command(buffer, msg.encode("utf-8"))
    return weechat.WEECHAT_RC_OK


def command_factreload(data, buffer, args):
    """Reload factoids."""
    return load_factoids()


def kwfactoids_completion_cb(data, completion_item, buffer, completion):
    """Add completion for factoids."""
    for factoid in FACTOIDS:
        weechat.hook_completion_list_add(completion, factoid, 0, weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK

load_factoids()

weechat.hook_command("factoid", "Send a factoid to channel.", "[factoid] [user]",
                     "factoid is name of factoid, user (optional) is user to direct the factoid at.",
                     "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("f", "Send a factoid to channel.", "[factoid] [user]",
                     "factoid is name of factoid, user (optional) is user to direct the factoid at.",
                     "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("factreload", "Reload factoids.", "", "", "", "command_factreload", "")
weechat.hook_completion("kwfactoidsc", "Factoid completion", "kwfactoids_completion_cb", "")
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
コード例 #33
0
ファイル: urlbar.py プロジェクト: DarkDefender/scripts
        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'))


if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
                        SCRIPT_DESC, "", ""):
        # Set default settings
        for option, default_value in settings.iteritems():
            if not weechat.config_is_set_plugin(option):
                weechat.config_set_plugin(option, default_value)

        weechat.hook_command(SCRIPT_COMMAND,
                             "URL bar control",
                             "[list | hide | show | toggle | url URL]",
                             "   list: list all URL and show URL bar\n"
                             "   hide: hide URL bar\n"
                             "   show: show URL bar\n"
                             "   toggle: toggle showing of URL bar\n",
                             "list || hide || show || toggle || url %(urlbar_urls)",
                             "urlbar_cmd", "")
        weechat.hook_completion("urlbar_urls", "list of URLs",
                                "urlbar_completion_urls_cb", "")
        weechat.bar_item_new("urlbar_urls", "urlbar_item_cb", "");
        weechat.bar_new("urlbar", "on", "0", "root", "", "top", "horizontal",
                        "vertical", "0", "0", "default", "default", "default", "0",
                        "urlbar_urls");
        weechat.hook_print("", "", "://", 1, "urlbar_print_cb", "")
コード例 #34
0
ファイル: tweetim.py プロジェクト: s5unty/dotfiles
    # /sn
    weechat.hook_command('sn',
                         'StatusNet manager',
                         'whois | subscribe | unsubscribe | block | unblock | updates | groups <username> || group | join | leave <group>',
                         '        whois: retrieves profile information from <username>'
                         "\n"
                         '    subscribe: subscribes to <username>'
                         "\n"
                         '  unsubscribe: unsubscribes from <username>'
                         "\n"
                         '        block: blocks <username>'
                         "\n"
                         '      unblock: unblocks <username>'
                         "\n"
                         '      updates: recent updates from <username> <quantity (<20)>'
                         "\n"
                         '         join: joins group <group>'
                         "\n"
                         '        leave: leaves group <group>'
                         "\n"
                         '       groups: groups (<username>) you or a specified username is subscribed'
                         "\n"
                         '        group: shows info about <group>',
                         'whois %(sn_nicks) || subscribe %(sn_nicks) || unsubscribe %(sn_nicks) || block %(sn_nicks) || unblock %(sn_nicks) || updates %(sn_nicks) || join || leave || group || groups',
                         'sn',
                         '')

    # Completion for /sn commands
    weechat.hook_completion('sn_nicks', 'list of SN users', 'nicklist', '')

コード例 #35
0
            SCRIPT_COMMAND,
            "Manage the whitelist",
            # OPTION ARGUMENTS
            "list"
            " || add <type> <arg>"
            " || del <type> <arg>",
            # ARGUMENT DESCRIPTIONS
            "      list: lists whitelists and their contents\n"
            "       add: add an entry to a given whitelist\n"
            "       del: delete an entry from a given whitelist\n"
            "\n"
            "Examples:\n"
            "  Add entries to whitelist:\n"
            "    /whitelist add net[work] Freenode\n"
            "    /whitelist add host *!buddy@*.isp.com\n"
            "  Delete entries from whitelist:\n"
            "    /whitelist del nick Someguy\n"
            "    /whitelist del chan[nel] #weechat\n",
            # COMPLETIONS
            "list %(whitelist_args)"
            " || add %(whitelist_args)"
            " || del %(whitelist_args)",
            # COMMAND TO CALL + USERDATA
            "whitelist_cmd",
            "")
        weechat.hook_completion(
            "whitelist_args",
            "list of whitelist arguments",
            "whitelist_completion_sections",
            "")
コード例 #36
0
ファイル: automode.py プロジェクト: wuurrd/dotfiles
    # pretty [automode]
    script_nick = '%s[%s%s%s]%s' % (color_chat_delimiters, color_chat_nick,
                                    SCRIPT_NAME, color_chat_delimiters,
                                    color_reset)

    for opt, val in settings.iteritems():
        if not weechat.config_is_set_plugin(opt):
            weechat.config_set_plugin(opt, val)

    global join_hook
    if get_config_boolean('enabled'):
        join_hook = weechat.hook_signal('*,irc_in_join', 'join_cb', '')
    else:
        join_hook = ''

    weechat.hook_completion('automode_patterns', 'automode patterns',
                            'completer', '')
    weechat.hook_command(SCRIPT_NAME, SCRIPT_DESC ,
            "[ (add|del) <type> <nick|expression> | list | disable | enable ]",
            "       add: Adds a new automode for current channel. If a nick is given instead of an"
            " expression, it will use nick's exact usermask.\n"
            "       del: Removes an automode in current channel.\n"
            "      type: Specifies the user mode, it should be either 'op', 'halfop' or 'voice'.\n"
            "expression: Case insensible expression for match users when they join current channel."
            " It should be of the format 'nick!user@host', wildcards '?', '*', and character groups"
            " are allowed.\n"
            "      list: List automodes for current channel, or all automodes if current buffer"
            " isn't an IRC channel. This is the default action if no option is given.\n"
            "   disable: Disables the script.\n"
            "    enable: Enables the script.\n"
            "\n"
            "Be careful with the expressions you use, they must be specific and match only one"
コード例 #37
0
            "  /uotp add freenode 4c6fdb7d0659bae2a16d23bab99678462b9f7897\n" +
            "  /uotp add freenode jrx5 w7ig lg5o filn eo5l tfty iyvz 66ex\n" +
            "  /uotp remove freenode\n" + "  /uotp enable freenode\n" +
            "  /uotp disable freenode", "otp %(irc_servers)"
            " || list"
            " || add %(irc_servers)"
            " || remove %(configured_servers)"
            " || enable %(irc_servers)"
            " || disable %(disabled_servers)", "options_cb", "")
        weechat.hook_signal("irc_server_connecting", "signal_cb", "")
        weechat.hook_signal("irc_server_disconnected", "signal_cb", "")
        weechat.hook_config(
            "plugins.var.python.undernet_totp.otp_server_names",
            "config_update_cb", "")
        weechat.hook_completion("configured_servers",
                                "list of otp configured servers",
                                "server_completion_cb", "configured_servers")
        weechat.hook_completion("disabled_servers", "list of disabled servers",
                                "server_completion_cb", "enabled_servers")
        weechat.hook_modifier("input_text_display", "hide_secret_cb", "")

        for option, default_value in SETTINGS.items():
            if weechat.config_get_plugin(option) == "":
                weechat.config_set_plugin(option, default_value[0])
            weechat.config_set_desc_plugin(
                option,
                '%s (default: %s)' % (default_value[1], default_value[0]))

        # For now we enable the hooks until it's possible to force script plugins to
        # load before the irc plugin on weechat startup, otherwise the irc_server_connecting signal
        # get missed.
コード例 #38
0
            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


# ================================[ main ]===============================
if __name__ == "__main__":
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, 'shutdown_cb', ''):
        version = weechat.info_get('version_number', '') or 0
        weechat.hook_command(
            SCRIPT_NAME, SCRIPT_DESC,
            'add <title|status|input> || del <title|status|input>',
            'add <title|status|input>: add a (default) customize bar for current buffer\n'
            'del <title|status|input>: delete customize bar for current buffer\n\n'
            'Options:\n'
            '  plugins.var.python.customize_bar.default.title : stores the default items from weechat title bar.\n'
            '  plugins.var.python.customize_bar.default.status: stores the default items from weechat status bar.\n'
            '  plugins.var.python.customize_bar.default.input : stores the default items from weechat input bar.\n'
            '  plugins.var.python.customize_bar.(title|status|input).<full_buffer_name> : stores the customize bar items for this buffer\n\n'
            'HINT: Do not delete options \"plugins.var.python.customize_bar.default.*\" as long as script is running...\n',
            'add %(plugin_customize_bar) %-|| del %(plugin_customize_bar) %-',
            'customize_cmd_cb', '')
        init_options()
        weechat.hook_signal('buffer_switch', 'buffer_switch', '')
        weechat.hook_completion('plugin_customize_bar',
                                'customize_bar_completion',
                                'customize_bar_completion_cb', '')
        weechat.command('', '/window refresh')
コード例 #39
0
ファイル: weeget.py プロジェクト: zachwlewis/dotfiles
                             "      upgrade: upgrade all local scripts if they are obsolete\n"
                             "       remove: remove script(s)\n\n"
                             "Indicators in lists (first column):\n"
                             "  " + str_installed + "  script is installed\n"
                             "  " + str_unknown   + "  unknown script\n"
                             "  " + str_running   + "  script is running (loaded)\n"
                             "  " + str_obsolete  + "  script is obsolete (new version available)\n\n"
                             "Examples:\n"
                             "  /" + SCRIPT_COMMAND + " list            => list all scripts\n"
                             "  /" + SCRIPT_COMMAND + " list game       => list all scripts with text/tag \"game\"\n"
                             "  /" + SCRIPT_COMMAND + " install weetris => install script weetris.pl\n"
                             "  /" + SCRIPT_COMMAND + " remove weetris  => remove script weetris.pl",
                             "list %(weeget_scripts)"
                             " || listinstalled %(weeget_scripts)"
                             " || show %(weeget_scripts)"
                             " || install %(weeget_scripts)|%*"
                             " || check"
                             " || update"
                             " || upgrade"
                             " || remove %(weeget_scripts)|%*",
                             "wg_cmd", "")
        weechat.hook_completion("weeget_scripts", "list of scripts in repository",
                                "wg_completion_scripts_cb", "")

# ==================================[ end ]===================================

def wg_unload_script():
    """ Function called when script is unloaded. """
    wg_config_write()
    return weechat.WEECHAT_RC_OK
コード例 #40
0
ファイル: completion.py プロジェクト: Brijen/dotfiles-6
    script_nick = '%s[%s%s%s]%s' %(color_delimiter, color_script_nick, 'cmpl', color_delimiter,
            color_reset)

    version = weechat.info_get('version', '')
    if version == '0.3.0':
        error('WeeChat 0.3.1 or newer is required for this script.')
    else:
        # settings
        for opt, val in settings.iteritems():
            if not weechat.config_is_set_plugin(opt):
                weechat.config_set_plugin(opt, val)

        load_replace_table()

        completion_template = 'completion_script'
        weechat.hook_completion(completion_template,
                "Replaces last word in input by its configured value.", 'completion_replacer', '')
        weechat.hook_completion('completion_keys', "Words in completion list.", 'completion_keys', '')

        weechat.hook_command(SCRIPT_COMMAND, SCRIPT_DESC , "[add <word> <text>|del <word>]",
"""
add: adds a new completion, <word> => <text>.
del: deletes a completion.
Without arguments it displays current completions.

<word> will be replaced by <text> when pressing tab in input line,
where <word> is any word currently behind the cursor.

Setup:
For this script to work, you must add the template
%%(%(completion)s) to the default completion template, use:
/set weechat.completion.default_template "%%(nicks)|%%(irc_channels)|%%(%(completion)s)"
コード例 #41
0
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
        # Set default settings
        for option, default_value in settings.items():
            if not weechat.config_is_set_plugin(option):
                weechat.config_set_plugin(option, default_value)

        weechat.hook_command(
            SCRIPT_COMMAND, "URL bar control",
            "[list | hide | show | toggle | url URL]",
            "   list: list all URL and show URL bar\n"
            "   hide: hide URL bar\n"
            "   show: show URL bar\n"
            "   toggle: toggle showing of URL bar\n",
            "list || hide || show || toggle || url %(urlbar_urls)",
            "urlbar_cmd", "")
        weechat.hook_completion("urlbar_urls", "list of URLs",
                                "urlbar_completion_urls_cb", "")
        weechat.bar_item_new("urlbar_urls", "urlbar_item_cb", "")
        version = int(weechat.info_get('version_number', '')) or 0
        if version >= 0x02090000:
            weechat.bar_new("urlbar", "on", "0", "root", "", "top",
                            "horizontal", "vertical", "0", "0", "default",
                            "default", "default", "default", "0",
                            "urlbar_urls")
        else:
            weechat.bar_new("urlbar", "on", "0", "root", "", "top",
                            "horizontal", "vertical", "0", "0", "default",
                            "default", "default", "0", "urlbar_urls")
        weechat.hook_print("", "", "://", 1, "urlbar_print_cb", "")
コード例 #42
0
		'default':  weechat.color('default'),
		'reset':    weechat.color('reset'),
		'black':    weechat.color('black'),
		'red':      weechat.color('red'),
		'green':    weechat.color('green'),
		'brown':    weechat.color('brown'),
		'yellow':   weechat.color('yellow'),
		'blue':     weechat.color('blue'),
		'magenta':  weechat.color('magenta'),
		'cyan':     weechat.color('cyan'),
		'white':    weechat.color('white'),
		'*default': weechat.color('*default'),
		'*black':   weechat.color('*black'),
		'*red':     weechat.color('*red'),
		'*green':   weechat.color('*green'),
		'*brown':   weechat.color('*brown'),
		'*yellow':  weechat.color('*yellow'),
		'*blue':    weechat.color('*blue'),
		'*magenta': weechat.color('*magenta'),
		'*cyan':    weechat.color('*cyan'),
		'*white':   weechat.color('*white'),
	}

	weechat.hook_config('autosort.*', 'on_config_changed',  '')
	weechat.hook_completion('plugin_autosort', '', 'on_autosort_complete', '')
	weechat.hook_command('autosort', command_description.format(**colors), '', '', command_completion, 'on_autosort_command', '')
	weechat.hook_info('autosort_replace', info_replace_description, info_replace_arguments, 'on_info_replace', '')
	weechat.hook_info('autosort_order',   info_order_description,   info_order_arguments,   'on_info_order',   '')

	apply_config()
コード例 #43
0
def ug_unload_script():
    """ Function called when script is unloaded. """
    global urlGrabSettings
    weechat.config_write(urlGrabSettings.config_file)
    return weechat.WEECHAT_RC_OK

#Main stuff
if ( import_ok and 
    weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
        SCRIPT_LICENSE,SCRIPT_DESC, "ug_unload_script", "") ):
    urlgrab_buffer = None
    current_line = 0
    max_buffer_length = 0
    urlGrabSettings = UrlGrabSettings()
    urlGrab = UrlGrabber( urlGrabSettings['historysize'])
    weechat.hook_print("", "", "", 1, "urlGrabCheck", "")
    weechat.hook_command(SCRIPT_COMMAND,
                             "Url Grabber",
                             "[open <url> | <url> | show | copy [n] | [n] | list]",
                             "open or <url>: opens the url\n"
                             "show: Opens the select buffer to allow for url selection\n"
                             "copy: Copies the nth url to the system clipboard\n"
                             "list: Lists the urls in the current buffer\n",
                             "open %(urlgrab_urls) || %(urlgrab_urls) || "
                             "copy || show || list",
                             "urlGrabMain", "")
    weechat.hook_completion("urlgrab_urls", "list of URLs",
                                "completion_urls_cb", "")
else:
    print "failed to load weechat"
コード例 #44
0
ファイル: egrep.py プロジェクト: nyulacska/vim-dotfiles
        "  --all, --count, --tail, --head, --hilight, --matchcase and --exact switches are "
        "toggleable\n\n"
        "see http://docs.python.org/lib/re-syntax.html for documentation about python regular expressions.\n",
        # completion template
        "buffer %(buffers_names) %(egrep_arguments)|%*"
        "||log %(egrep_log_files) %(egrep_arguments)|%*"
        "||%(egrep_arguments)|%*",
        'cmd_grep',
        '')
    weechat.hook_command(
        'logs', cmd_logs.__doc__, "[-s|--size] [<filter>]",
        "-s|--size: Sort logs by size.\n"
        " <filter>: Only show logs that match <filter>. Use '*' and '?' as jokers.",
        '--size', 'cmd_logs', '')

    weechat.hook_completion('egrep_log_files', "list of log files",
                            'completion_log_files', '')
    weechat.hook_completion('egrep_arguments', "list of arguments",
                            'completion_egrep_args', '')

    # settings
    for opt, val in settings.iteritems():
        if not weechat.config_is_set_plugin(opt):
            weechat.config_set_plugin(opt, val)

    # colors
    color_date = weechat.color('brown')
    color_script_nick = weechat.color('lightgreen')
    color_info = weechat.color('cyan')
    color_hilight = weechat.color('lightred')
    color_reset = weechat.color('reset')
    color_title = weechat.color('yellow')
コード例 #45
0
def command_factreload(data, buffer, args):
    """Reload factoids."""
    return load_factoids()


def kwfactoids_completion_cb(data, completion_item, buffer, completion):
    """Add completion for factoids."""
    for factoid in FACTOIDS:
        weechat.hook_completion_list_add(completion, factoid, 0,
                                         weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK


load_factoids()

weechat.hook_command(
    "factoid", "Send a factoid to channel.", "[factoid] [user]",
    "factoid is name of factoid, user (optional) is user to direct the factoid at.",
    "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command(
    "f", "Send a factoid to channel.", "[factoid] [user]",
    "factoid is name of factoid, user (optional) is user to direct the factoid at.",
    "%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("factreload", "Reload factoids.", "", "", "",
                     "command_factreload", "")
weechat.hook_completion("kwfactoidsc", "Factoid completion",
                        "kwfactoids_completion_cb", "")
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb",
                    "")
コード例 #46
0
ファイル: docgen.py プロジェクト: Georgiy-Tugai/weechat
                               num_files_updated['hdata'],
                               num_files_updated['completions']))
    weechat.prnt('',
                 'docgen: total: {0} files, {1} updated'
                 ''.format(num_files['total2'], num_files_updated['total2']))
    return weechat.WEECHAT_RC_OK


def docgen_completion_cb(data, completion_item, buf, completion):
    """Callback for completion."""
    for locale in LOCALE_LIST:
        weechat.hook_completion_list_add(completion, locale, 0,
                                         weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK


if __name__ == '__main__' and IMPORT_OK:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
        weechat.hook_command(SCRIPT_COMMAND,
                             'Documentation generator.',
                             '[locales]',
                             'locales: list of locales to build (by default '
                             'build all locales)',
                             '%(docgen_locales)|%*',
                             'docgen_cmd_cb', '')
        weechat.hook_completion('docgen_locales', 'locales for docgen',
                                'docgen_completion_cb', '')
        if not weechat.config_is_set_plugin('path'):
            weechat.config_set_plugin('path', DEFAULT_PATH)
コード例 #47
0
ファイル: automode.py プロジェクト: qguv/config
                                   color_chat_nick,
                                   SCRIPT_NAME,
                                   color_chat_delimiters,
                                   color_reset)

    for opt, val in list(settings.items()):
        if not weechat.config_is_set_plugin(opt):
                weechat.config_set_plugin(opt, val)

    global join_hook
    if get_config_boolean('enabled'):
        join_hook = weechat.hook_signal('*,irc_in_join', 'join_cb', '')
    else:
        join_hook = ''

    weechat.hook_completion('automode_patterns', 'automode patterns', 'completer', '')
    weechat.hook_command(SCRIPT_NAME, SCRIPT_DESC ,
            "[ (add|del) <type> <nick|expression> | list | disable | enable ]",
            "       add: Adds a new automode for current channel. If a nick is given instead of an"
            " expression, it will use nick's exact usermask.\n"
            "       del: Removes an automode in current channel.\n"
            "      type: Specifies the user mode, it should be either 'op', 'halfop' or 'voice'.\n"
            "expression: Case insensible expression for match users when they join current channel."
            " It should be of the format 'nick!user@host', wildcards '?', '*', and character groups"
            " are allowed.\n"
            "      list: List automodes for current channel, or all automodes if current buffer"
            " isn't an IRC channel. This is the default action if no option is given.\n"
            "   disable: Disables the script.\n"
            "    enable: Enables the script.\n"
            "\n"
            "Be careful with the expressions you use, they must be specific and match only one"
コード例 #48
0
ファイル: docgen.py プロジェクト: raspbeguy/weechat
        # write counters
        weechat.prnt(
            '', 'docgen: {0}: {1} files, {2} updated'
            ''.format(locale, num_files['total1'],
                      num_files_updated['total1']))
    weechat.prnt(
        '', 'docgen: total: {0} files, {1} updated'
        ''.format(num_files['total2'], num_files_updated['total2']))
    return weechat.WEECHAT_RC_OK


def docgen_completion_cb(data, completion_item, buf, completion):
    """Callback for completion."""
    for locale in LOCALE_LIST:
        weechat.hook_completion_list_add(completion, locale, 0,
                                         weechat.WEECHAT_LIST_POS_SORT)
    return weechat.WEECHAT_RC_OK


if __name__ == '__main__' and IMPORT_OK:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
        weechat.hook_command(
            SCRIPT_COMMAND, 'Documentation generator.', '[locales]',
            'locales: list of locales to build (by default '
            'build all locales)', '%(docgen_locales)|%*', 'docgen_cmd_cb', '')
        weechat.hook_completion('docgen_locales', 'locales for docgen',
                                'docgen_completion_cb', '')
        if not weechat.config_is_set_plugin('path'):
            weechat.config_set_plugin('path', DEFAULT_PATH)
コード例 #49
0
    state = Bunch(used = False, curTypo = '', curRepl = -1, suggestions = [])

    # Use ctypes to access the apsell library
    aspell = ctypes.CDLL(ctypes.util.find_library('aspell'))
    speller = 0

    # Regex to remove unwanted characters
    re_remove_chars = re.compile('[,.;:?!\)\(\\\/\"\^]')

    # Load configuration
    load_config()

    template = 'correction_completion'

    # Register completion hook
    w.hook_completion(template, "Completes after 's/' with words from buffer",
            'completion', '')

    # Register hook to update config when option is changed with /set
    w.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "load_config", "")

    # Register help command
    w.hook_command(SCRIPT_COMMAND, SCRIPT_DESC, "",
"""Usage:
If you want to correct yourself, you often do this using the
expression 's/typo/correct'. This plugin allows you to complete the
first part (the typo) by pressing *Tab*. The words from the actual
buffer are used to complet this part. If the word can be perfectly
matched the next word in alphabetical order is shown.

The second part (the correction) can also be completed. Just press
*Tab* after the slash and the best correction for the typo is fetched from aspell.
コード例 #50
0
ファイル: warn.py プロジェクト: 9ary/weechat-scripts
            weechat.config_set_plugin(opt, val)

    # hook signals
    weechat.hook_signal('*,irc_in_join', 'join_cb', '')
    if get_config_boolean('autowarn_bans'):
        weechat.hook_signal('*,chanop_mode_*', 'banmask_cb', '')

    ignoreForwards = Ignores('ignore_autowarn_forwards')
    ignoreJoins = Ignores('ignore_channels')

    # hook config
    weechat.hook_config('plugins.var.python.%s.ignore_*' % SCRIPT_NAME,
                        'ignore_update', '')

    # hook completer
    weechat.hook_completion('warn_patterns', '', 'warn_cmpl', '')

    # hook commands
    Warn().hook()

    # -------------------------------------------------------------------------
    # Debug

    if weechat.config_get_plugin('debug'):
        try:
            # custom debug module I use, allows me to inspect script's objects.
            import pybuffer
            debug = pybuffer.debugBuffer(globals(), '%s_debug' % SCRIPT_NAME)
        except:

            def debug(s, *args):
コード例 #51
0
ファイル: cron.py プロジェクト: sitaktif/weechat-scripts
def cron_unload():
    """ Called when script is unloaded. """
    if weechat.config_get_plugin("auto_save") == "on":
        cron_save()
    return weechat.WEECHAT_RC_OK

if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
                        SCRIPT_LICENSE, SCRIPT_DESC,
                        "cron_unload", ""):
        # set default settings
        for option, default_value in cron_settings.iteritems():
            if not weechat.config_is_set_plugin(option):
                weechat.config_set_plugin(option, default_value)
        # completions for commands
        weechat.hook_completion("cron_time", "cron time", "cron_completion_time_cb", "")
        weechat.hook_completion("cron_repeat", "cron repeat", "cron_completion_repeat_cb", "")
        weechat.hook_completion("cron_buffer", "cron buffer", "cron_completion_buffer_cb", "")
        weechat.hook_completion("cron_keyword", "cron keyword", "cron_completion_keyword_cb", "")
        weechat.hook_completion("cron_commands", "cron commands", "cron_completion_commands_cb", "")
        weechat.hook_completion("cron_number", "cron number", "cron_completion_number_cb", "")
        weechat.hook_completion("at_time", "at time", "cron_completion_at_time_cb", "")
        # commands /cron and /at
        str_buffer = "  buffer: buffer where command is executed\n" \
            "          (\"current\" for current buffer, \"core.weechat\" for WeeChat core buffer)\n"
        str_commands = " command: a keyword, followed by arguments:\n"
        for cmd in sorted(cron_commands.keys()):
            str_commands += "          - " + cmd + ": " + cron_commands[cmd] + "\n";
        weechat.hook_command("cron",
                             "Manage jobs in crontab",
                             "list || add <minute> <hour> <monthday> <month> <weekday> <repeat> <buffer> <command> || "
コード例 #52
0
ファイル: weemoji.py プロジェクト: kattrali/weemoji
    return weechat.WEECHAT_RC_OK


def replace_emoji(match):
    text = match.group(0)
    codepoint = EMOJI.get(text[1:-1])
    if codepoint:
        raw = "\\U%08x" % int(codepoint, 16)
        return raw.decode("unicode-escape").encode("utf-8")
    return text


if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
        weechat.hook_modifier("weechat_print", "interpolate_emoji_cb", "")
        weechat.hook_completion("emoji_names", "complete colon :emoji:", "emoji_completion_cb", "")


# Emoji mapping is modified from
# https://github.com/iamcal/emoji-data/blob/master/emoji.json
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Cal Henderson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
コード例 #53
0
ファイル: completion.py プロジェクト: rubarb-app/dotfiles
                                    color_delimiter, color_reset)

    version = weechat.info_get('version', '')
    if version == '0.3.0':
        error('WeeChat 0.3.1 or newer is required for this script.')
    else:
        # settings
        for opt, val in settings.iteritems():
            if not weechat.config_is_set_plugin(opt):
                weechat.config_set_plugin(opt, val)

        load_replace_table()

        completion_template = 'completion_script'
        weechat.hook_completion(
            completion_template,
            "Replaces last word in input by its configured value.",
            'completion_replacer', '')
        weechat.hook_completion('completion_keys', "Words in completion list.",
                                'completion_keys', '')

        weechat.hook_command(
            SCRIPT_COMMAND, SCRIPT_DESC, "[add <word> <text>|del <word>]", """
add: adds a new completion, <word> => <text>.
del: deletes a completion.
Without arguments it displays current completions.

<word> will be replaced by <text> when pressing tab in input line,
where <word> is any word currently behind the cursor.

Setup:
For this script to work, you must add the template
コード例 #54
0
    state = Bunch(used=False, curTypo='', curRepl=-1, suggestions=[])

    # Use ctypes to access the apsell library
    aspell = ctypes.CDLL(ctypes.util.find_library('aspell'))
    speller = 0

    # Regex to remove unwanted characters
    re_remove_chars = re.compile('[,.;:?!\)\(\\\/\"\^]')

    # Load configuration
    load_config()

    template = 'correction_completion'

    # Register completion hook
    w.hook_completion(template, "Completes after 's/' with words from buffer",
                      'completion', '')

    # Register hook to update config when option is changed with /set
    w.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "load_config",
                  "")

    # Register help command
    w.hook_command(
        SCRIPT_COMMAND, SCRIPT_DESC, "", """Usage:
If you want to correct yourself, you often do this using the
expression 's/typo/correct'. This plugin allows you to complete the
first part (the typo) by pressing *Tab*. The words from the actual
buffer are used to complet this part. If the word can be perfectly
matched the next word in alphabetical order is shown.

The second part (the correction) can also be completed. Just press
コード例 #55
0
ファイル: quick_force_color.py プロジェクト: vmindru/scripts
                colored_nicks.setdefault(nick,color_fg+':'+color_bg)

# ================================[ main ]===============================
if __name__ == "__main__":
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', ''):
        version = weechat.info_get('version_number', '') or 0
        if int(version) >= 0x00030400:
            weechat.hook_command(SCRIPT_NAME,SCRIPT_DESC,
            'add <nick> <color> || del <nick> <color> || list [<nick>]',
            'add <nick> <color>: add a nick with its color to nick_color_force\n'
            'del <nick>        : delete given nick with its color from nick_color_force\n'
            'list [<nick>]     : list all forced nicks with its assigned color or optional from one nick\n\n'
            'Examples:\n'
            ' add nick nils_2 with color red:\n'
            '  /' + SCRIPT_NAME + ' add nils_2 red\n'
            ' recolor nick nils_2 with foreground color yellow and background color blue:\n'
            '  /' + SCRIPT_NAME + ' add nils_2 yellow:blue\n'
            ' delete nick nils_2:\n'
            '  /' + SCRIPT_NAME + ' del nils_2\n',
            'add %(nick) %(plugin_nick_colors) %-||'
            'del %(plugin_force_nick) %-||'
            'list %(plugin_force_nick) %-',
            'nick_colors_cmd_cb', '')
            nick_option = nick_option_old
            if int(version) >= 0x01050000:
                nick_option = nick_option_new
            weechat.hook_completion('plugin_nick_colors', 'nick_colors_completion', 'nick_colors_completion_cb', '')
            weechat.hook_completion('plugin_force_nick', 'force_nick_colors_completion', 'force_nick_colors_completion_cb', '')
        else:
            weechat.prnt("","%s%s %s" % (weechat.prefix("error"),SCRIPT_NAME,": needs version 0.3.4 or higher"))