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]); } }
void cmd_ctest(char **args) { if (strcmp(args[0], "consalert") == 0) { create_win(); prof_win_focus(plugin_win); prof_cons_alert(); prof_win_show(plugin_win, "called -> prof_cons_alert"); } else if (strcmp(args[0], "consshow") == 0) { if (args[1]) { create_win(); prof_win_focus(plugin_win); prof_cons_show(args[1]); char *str = "called -> prof_cons_show: "; char buf[strlen(str) + strlen(args[1])]; sprintf(buf, "%s%s", str, args[1]); prof_win_show(plugin_win, buf); } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "consshow_t") == 0) { if (args[1] == NULL || args[2] == NULL || args[3] == NULL || args[4] == NULL) { prof_cons_bad_cmd_usage("/c-test"); } else { char *group = strcmp(args[1], "none") == 0 ? NULL : args[1]; char *key = strcmp(args[2], "none") == 0 ? NULL : args[2]; char *def = strcmp(args[3], "none") == 0 ? NULL : args[3]; char *message = args[4]; create_win(); prof_win_focus(plugin_win); prof_cons_show_themed(group, key, def, message); char *str = "called -> prof_cons_show_themed: "; char buf[strlen(str) + strlen(args[1]) + 2 + strlen(args[2]) + 2 + strlen(args[3]) + 2 + strlen(args[4])]; sprintf(buf, "%s%s, %s, %s, %s", str, args[1], args[2], args[3], args[4]); prof_win_show(plugin_win, buf); } } else if (strcmp(args[0], "constest") == 0) { int res = prof_current_win_is_console(); create_win(); prof_win_focus(plugin_win); if (res) { prof_win_show(plugin_win, "called -> prof_current_win_is_console: true"); } else { prof_win_show(plugin_win, "called -> prof_current_win_is_console: false"); } } else if (strcmp(args[0], "winshow") == 0) { if (args[1]) { create_win(); prof_win_focus(plugin_win); prof_win_show(plugin_win, args[1]); char *str = "called -> prof_win_show: "; char buf[strlen(str) + strlen(args[1])]; sprintf(buf, "%s%s", str, args[1]); prof_win_show(plugin_win, buf); } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "winshow_t") == 0) { if (args[1] == NULL || args[2] == NULL || args[3] == NULL || args[4] == NULL) { prof_cons_bad_cmd_usage("/c-test"); } else { char *group = strcmp(args[1], "none") == 0 ? NULL : args[1]; char *key = strcmp(args[2], "none") == 0 ? NULL : args[2]; char *def = strcmp(args[3], "none") == 0 ? NULL : args[3]; char *message = args[4]; create_win(); prof_win_focus(plugin_win); prof_win_show_themed(plugin_win, group, key, def, message); char *str = "called -> prof_win_show_themed: "; char buf[strlen(str) + strlen(args[1]) + 2 + strlen(args[2]) + 2 + strlen(args[3]) + 2 + strlen(args[4])]; sprintf(buf, "%s%s, %s, %s, %s", str, args[1], args[2], args[3], args[4]); prof_win_show(plugin_win, buf); } } else if (strcmp(args[0], "sendline") == 0) { if (args[1]) { create_win(); prof_win_focus(plugin_win); prof_send_line(args[1]); char *str = "called -> prof_send_line: "; char buf[strlen(str) + strlen(args[1])]; sprintf(buf, "%s%s", str, args[1]); prof_win_show(plugin_win, buf); } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "notify") == 0) { if (args[1]) { create_win(); prof_win_focus(plugin_win); prof_notify(args[1], 5000, "c-test plugin"); char *str = "called -> prof_notify: "; char buf[strlen(str) + strlen(args[1])]; sprintf(buf, "%s%s", str, args[1]); prof_win_show(plugin_win, buf); } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "get") == 0) { if (!args[1]) { prof_cons_bad_cmd_usage("/c-test"); } else if (strcmp(args[1], "recipient") == 0) { create_win(); char *recipient = prof_get_current_recipient(); if (recipient) { prof_win_focus(plugin_win); char *str = "called -> prof_get_current_recipient: "; char buf[strlen(str) + strlen(recipient)]; sprintf(buf, "%s%s", str, recipient); prof_win_show(plugin_win, buf); } else { prof_win_focus(plugin_win); prof_win_show(plugin_win, "called -> prof_get_current_recipient: <none>"); } } else if (strcmp(args[1], "room") == 0) { create_win(); char *room = prof_get_current_muc(); if (room) { prof_win_focus(plugin_win); char *str = "called -> prof_get_current_muc: "; char buf[strlen(str) + strlen(room)]; sprintf(buf, "%s%s", str, room); prof_win_show(plugin_win, buf); } else { prof_win_focus(plugin_win); prof_win_show(plugin_win, "called -> prof_get_current_muc: <none>"); } } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "log") == 0) { if (!args[1]) { prof_cons_bad_cmd_usage("/c-test"); } else if (strcmp(args[1], "debug") == 0) { if (!args[2]) { prof_cons_bad_cmd_usage("/c-test"); } else { create_win(); prof_win_focus(plugin_win); prof_log_debug(args[2]); char *str = "called -> prof_log_debug: "; char buf[strlen(str) + strlen(args[2])]; sprintf(buf, "%s%s", str, args[2]); prof_win_show(plugin_win, buf); } } else if (strcmp(args[1], "info") == 0) { if (!args[2]) { prof_cons_bad_cmd_usage("/c-test"); } else { create_win(); prof_win_focus(plugin_win); prof_log_info(args[2]); char *str = "called -> prof_log_info: "; char buf[strlen(str) + strlen(args[2])]; sprintf(buf, "%s%s", str, args[2]); prof_win_show(plugin_win, buf); } } else if (strcmp(args[1], "warning") == 0) { if (!args[2]) { prof_cons_bad_cmd_usage("/c-test"); } else { create_win(); prof_win_focus(plugin_win); prof_log_warning(args[2]); char *str = "called -> prof_log_warning: "; char buf[strlen(str) + strlen(args[2])]; sprintf(buf, "%s%s", str, args[2]); prof_win_show(plugin_win, buf); } } else if (strcmp(args[1], "error") == 0) { if (!args[2]) { prof_cons_bad_cmd_usage("/c-test"); } else { create_win(); prof_win_focus(plugin_win); prof_log_error(args[2]); char *str = "called -> prof_log_error: "; char buf[strlen(str) + strlen(args[2])]; sprintf(buf, "%s%s", str, args[2]); prof_win_show(plugin_win, buf); } } else { prof_cons_bad_cmd_usage("/c-test"); } } else if (strcmp(args[0], "count") == 0) { create_win(); prof_win_focus(plugin_win); char buf[100]; sprintf(buf, "Count: %d", count); prof_win_show(plugin_win, buf); } else { prof_cons_bad_cmd_usage("/c-test"); } }