int relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { /* make C compiler happy */ (void) data; (void) buffer; (void) argv_eol; if ((argc > 1) && (weechat_strcasecmp (argv[1], "list") == 0)) { relay_command_client_list (0); return WEECHAT_RC_OK; } if ((argc > 1) && (weechat_strcasecmp (argv[1], "listfull") == 0)) { relay_command_client_list (1); return WEECHAT_RC_OK; } if (!relay_buffer) relay_buffer_open (); if (relay_buffer) { weechat_buffer_set (relay_buffer, "display", "1"); if (argc > 1) { if (strcmp (argv[1], "up") == 0) { if (relay_buffer_selected_line > 0) relay_buffer_selected_line--; } else if (strcmp (argv[1], "down") == 0) { if (relay_buffer_selected_line < relay_client_count - 1) relay_buffer_selected_line++; } } } relay_buffer_refresh (NULL); return WEECHAT_RC_OK; }
int relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { struct t_relay_server *ptr_server; struct t_config_option *ptr_option; int port; /* make C compiler happy */ (void) data; (void) buffer; if (argc > 1) { if (weechat_strcasecmp (argv[1], "list") == 0) { relay_command_client_list (0); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "listfull") == 0) { relay_command_client_list (1); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "listrelay") == 0) { relay_command_server_list (); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "add") == 0) { if (argc >= 4) { if (relay_config_create_option_port (NULL, relay_config_file, relay_config_section_port, argv[2], argv_eol[3]) != WEECHAT_CONFIG_OPTION_SET_ERROR) { weechat_printf (NULL, _("%s: relay \"%s\" (port %s) added"), RELAY_PLUGIN_NAME, argv[2], argv_eol[3]); } } else { weechat_printf (NULL, _("%s%s: missing arguments for \"%s\" " "command"), weechat_prefix ("error"), RELAY_PLUGIN_NAME, "relay add"); } return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "del") == 0) { if (argc >= 3) { ptr_server = relay_server_search (argv_eol[2]); if (ptr_server) { port = ptr_server->port; relay_server_free (ptr_server); ptr_option = weechat_config_search_option (relay_config_file, relay_config_section_port, argv_eol[2]); if (ptr_option) weechat_config_option_free (ptr_option); weechat_printf (NULL, _("%s: relay \"%s\" (port %d) removed"), RELAY_PLUGIN_NAME, argv[2], port); } else { weechat_printf (NULL, _("%s%s: relay \"%s\" not found"), weechat_prefix ("error"), RELAY_PLUGIN_NAME, argv_eol[2]); } } else { weechat_printf (NULL, _("%s%s: missing arguments for \"%s\" " "command"), weechat_prefix ("error"), RELAY_PLUGIN_NAME, "relay del"); } return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "raw") == 0) { relay_raw_open (1); return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "sslcertkey") == 0) { relay_network_set_ssl_cert_key (1); return WEECHAT_RC_OK; } } if (!relay_buffer) relay_buffer_open (); if (relay_buffer) { weechat_buffer_set (relay_buffer, "display", "1"); if (argc > 1) { if (strcmp (argv[1], "up") == 0) { if (relay_buffer_selected_line > 0) relay_buffer_selected_line--; } else if (strcmp (argv[1], "down") == 0) { if (relay_buffer_selected_line < relay_client_count - 1) relay_buffer_selected_line++; } } } relay_buffer_refresh (NULL); return WEECHAT_RC_OK; }