Пример #1
0
def matrix_server_command_completion_cb(data, completion_item, buffer,
                                        completion):
    buffer_input = W.buffer_get_string(buffer, "input").split()

    args = buffer_input[1:]
    commands = ["add", "delete", "list", "listfull"]

    def complete_commands():
        for command in commands:
            W.hook_completion_list_add(completion, command, 0,
                                       W.WEECHAT_LIST_POS_SORT)

    if len(args) == 1:
        complete_commands()

    elif len(args) == 2:
        if args[1] not in commands:
            complete_commands()
        else:
            if args[1] == "delete" or args[1] == "listfull":
                add_servers_to_completion(completion)

    elif len(args) == 3:
        if args[1] == "delete" or args[1] == "listfull":
            if args[2] not in SERVERS:
                add_servers_to_completion(completion)

    return W.WEECHAT_RC_OK
Пример #2
0
def room_close_cb(data, buffer):
    W.prnt("",
           "Buffer '%s' will be closed!" % W.buffer_get_string(buffer, "name"))
    return W.WEECHAT_RC_OK