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); }
void prof_init(const char * const version, const char * const status) { char *start = "c-test: init. "; char buf[strlen(start) + strlen(version) + 2 + strlen(status) + 1]; sprintf(buf, "%s%s, %s", start, version, status); prof_cons_show(buf); prof_register_command("/c", 0, 1, "/c", "c test", "c test", cmd_c); prof_register_command("/reverse", 0, 1, "/reverse", "Reverse input string", "Reverse input string", cmd_reverse); char *arg_ac[] = { "one", "two", "three", NULL }; prof_register_ac("/ccomplete", arg_ac); char *arg_one_ac[] = { "james", "bob", "jenny", "steven", NULL }; prof_register_ac("/ccomplete one", arg_one_ac); prof_register_command("/ccomplete", 0, 2, "/ccomplete", "C completion", "C completion", cmd_reverse); prof_register_timed(timer_test, 10); }