Пример #1
0
void
create_win(void)
{
    if (!prof_win_exists(plugin_win)) {
        prof_win_create(plugin_win, handle_win_input);
    }
}
Пример #2
0
void
prof_init(const char * const version, const char * const status)
{
    pthread_create(&worker_thread, NULL, inc_counter, NULL);

    prof_win_create(plugin_win, handle_win_input);

    const char *synopsis[] = {
        "/c-test consalert",
        "/c-test consshow <message>",
        "/c-test consshow_t <group> <key> <default> <message>",
        "/c-test constest",
        "/c-test winshow <message>",
        "/c-test winshow_t <group> <key> <default> <message>",
        "/c-test notify <message>",
        "/c-test sendline <line>",
        "/c-test get recipient|room",
        "/c-test log debug|info|warning|error <message>",
        "/c-test count",
        NULL
    };
    const char *description = "C test plugin. All commands focus the plugin window.";
    const char *args[][2] = {
        { "consalert",                                      "Highlight the console window in the status bar" },
        { "consshow <message>",                             "Show the message in the console window" },
        { "consshow_t <group> <key> <default> <message>",   "Show the themed message in the console window. " },
        { "constest",                                       "Show whether the command was run in the console." },
        { "winshow <message>",                              "Show the message in the plugin window" },
        { "winshow_t <group> <key> <default> <message>",    "Show the themed message in the plugin window. " },
        { "notify <message>",                               "Send a desktop notification with message" },
        { "sendline <line>",                                "Pass line to profanity to process" },
        { "get recipient",                                  "Show the current chat recipient, if in a chat window" },
        { "get room",                                       "Show the current room JID, if in a chat room" },
        { "log debug|info|warning|error <message>",         "Log a message at the specified level" },
        { "count",                                          "Show the counter, incremented every 5 seconds by a worker thread" },
        { NULL, NULL }
    };

    const char *examples[] = {
        "/c-test sendline /about",
        "/c-test log debug \"Test debug message\"",
        "/c-test consshow_t c-test cons.show none \"This is themed\"",
        "/c-test consshow_t none none bold_cyan \"This is bold_cyan\"",
        NULL
    };

    prof_register_command("/c-test", 1, 5, synopsis, description, args, examples, cmd_ctest);

    char *cmd_ac[] = { "consalert", "consshow", "consshow_t", "constest", "winshow", "winshow_t", "notify", "sendline", "get", "log", "count", NULL };
    prof_register_ac("/c-test", cmd_ac);

    char *get_ac[] = { "recipient", "room", NULL };
    prof_register_ac("/c-test get", get_ac);

    char *log_ac[] = { "debug", "info", "warning", "error", NULL };
    prof_register_ac("/c-test log", log_ac);

    prof_register_timed(timed_callback, 30);
}
Пример #3
0
void
cmd_reverse(char **args)
{
    if (!prof_win_exists(echo_win)) {
        prof_win_create(echo_win, handle_reverse);
    }

    prof_win_focus(echo_win);
    if (args[0] != NULL) {
        handle_reverse(echo_win, args[0]);
    }
}