Exemplo n.º 1
0
def _on_py_command(word, word_eol, userdata):
    subcmd = __decode(ffi.string(word[2])).lower()

    if subcmd == 'exec':
        python = __decode(ffi.string(word_eol[3]))
        exec_in_interp(python)

    elif subcmd == 'load':
        filename = __decode(ffi.string(word[3]))
        load_filename(filename)

    elif subcmd == 'unload':
        name = __decode(ffi.string(word[3]))
        if not unload_name(name):
            lib.hexchat_print(lib.ph, b'Can\'t find a python plugin with that name')

    elif subcmd == 'reload':
        name = __decode(ffi.string(word[3]))
        if not reload_name(name):
            lib.hexchat_print(lib.ph, b'Can\'t find a python plugin with that name')

    elif subcmd == 'console':
        lib.hexchat_command(lib.ph, b'QUERY >>python<<')

    elif subcmd == 'list':
        list_plugins()

    elif subcmd == 'about':
        lib.hexchat_print(lib.ph, b'HexChat Python interface version ' + VERSION)

    else:
        lib.hexchat_command(lib.ph, b'HELP PY')

    return 3
Exemplo n.º 2
0
def _on_py_command(word, word_eol, userdata):
    subcmd = __decode(ffi.string(word[2])).lower()

    if subcmd == 'exec':
        python = __decode(ffi.string(word_eol[3]))
        exec_in_interp(python)
    elif subcmd == 'load':
        filename = __decode(ffi.string(word[3]))
        load_filename(filename)
    elif subcmd == 'unload':
        name = __decode(ffi.string(word[3]))
        if not unload_name(name):
            lib.hexchat_print(lib.ph,
                              b'Can\'t find a python plugin with that name')
    elif subcmd == 'reload':
        name = __decode(ffi.string(word[3]))
        if not reload_name(name):
            lib.hexchat_print(lib.ph,
                              b'Can\'t find a python plugin with that name')
    elif subcmd == 'console':
        lib.hexchat_command(lib.ph, b'QUERY >>python<<')
    elif subcmd == 'list':
        list_plugins()
    elif subcmd == 'about':
        lib.hexchat_print(lib.ph,
                          b'HexChat Python interface version ' + VERSION)
    else:
        lib.hexchat_command(lib.ph, b'HELP PY')

    return 3
Exemplo n.º 3
0
def command(command):
    lib.hexchat_command(lib.ph, command.encode())
Exemplo n.º 4
0
def command(command):
    lib.hexchat_command(lib.ph, command.encode())