Commit e634f34b authored by stettberger's avatar stettberger

* commands

- list
- info
- stats
parent 953cf2eb
......@@ -205,10 +205,9 @@ void proc_channels_input(Channel *c, char *buf) {
silc_client_command_call(silc_client->client, silc_client->conn, NULL, "JOIN", lower(&buf[3]), NULL);
}
/* Leave */
else if (buf[1]=='l') {
else if (buf[1]=='l' && ( buf[2] == ' ' || strlen(buf)==2)) {
DEBUG("Input: LEAVE");
if ( buf[2] == ' ') {
DEBUG(&buf[3]);
silc_client_command_call(silc_client->client, silc_client->conn, NULL, "LEAVE", &buf[3], NULL);
}
else if(strlen(buf)==2)
......@@ -709,7 +708,6 @@ int run(void)
/* }}} */
/* {{{ silc_channel_message */
static void
silc_channel_message(SilcClient client, SilcClientConnection conn,
......@@ -752,12 +750,13 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
SilcCommand command, SilcStatus status, ...)
{
va_list va;
SilcUInt32 mode;
SilcUInt32 mode, count;
SilcChannelEntry channel;
SilcClientEntry sender;
SilcHashTableList ch;
SilcChannelUser cuser;
Channel *c;
char *str, *str2;
/* If error occurred in client library with our command, print the error */
if (SILC_STATUS_IS_ERROR(status)) {
print_out("", "-!- Error %s: %s",
......@@ -900,6 +899,76 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
}
print_out("", "");
}
else if(command==SILC_COMMAND_LIST) {
channel=va_arg(va, SilcChannelEntry);
if (!channel){
print_out("", "-!- Error: There is no such channel on the Network");
return;
}
(void)va_arg(va, void *);
str=va_arg(va, char *);
count=va_arg(va, SilcUInt32);
DEBUG("Status: %d", status);
if(status==SILC_STATUS_LIST_START || status==0 )
print_out("", "Channel Users Topic");
print_out("", "%-25s %-15d %s", channel->channel_name, count, str?str:"");
}
else if(command==SILC_COMMAND_INFO) {
(void)va_arg(va, void *);
str=va_arg(va, char *);
str2=va_arg(va, char *);
print_out("","-!- Info: %s %s", str, str2);
}
else if(command==SILC_COMMAND_STATS) {
SilcUInt32 starttime, uptime, my_clients, my_channels, my_server_ops,
my_router_ops, cell_clients, cell_channels, cell_servers,
clients, channels, servers, routers, server_ops, router_ops;
SilcBufferStruct buf;
const char *tmptime;
int days, hours, mins, secs;
str=(char *)va_arg(va, unsigned char *);
count=va_arg(va, SilcUInt32);
silc_buffer_set(&buf, (unsigned char *)str, count);
silc_buffer_unformat(&buf,
SILC_STR_UI_INT(&starttime),
SILC_STR_UI_INT(&uptime),
SILC_STR_UI_INT(&my_clients),
SILC_STR_UI_INT(&my_channels),
SILC_STR_UI_INT(&my_server_ops),
SILC_STR_UI_INT(&my_router_ops),
SILC_STR_UI_INT(&cell_clients),
SILC_STR_UI_INT(&cell_channels),
SILC_STR_UI_INT(&cell_servers),
SILC_STR_UI_INT(&clients),
SILC_STR_UI_INT(&channels),
SILC_STR_UI_INT(&servers),
SILC_STR_UI_INT(&routers),
SILC_STR_UI_INT(&server_ops),
SILC_STR_UI_INT(&router_ops),
SILC_STR_END);
tmptime = silc_get_time(starttime);
days = uptime / (24 * 60 * 60);
uptime -= days * (24 * 60 * 60);
hours = uptime / (60 * 60);
uptime -= hours * (60 * 60);
mins = uptime / 60;
uptime -= mins * 60;
secs = uptime;
/* Output */
print_out("", "Starttime: %-20s Uptime: %d days %d hours %d minutes %d seconds", tmptime, days, hours, mins, secs);
print_out("", "Local Clients: %-5d Local Channels: %-5d", my_clients, my_channels);
print_out("", "Local Server Operators: %-5d Local Router Operators: %-5d", my_server_ops, my_router_ops);
print_out("", "Cell Clients: %-5d Cell Channels: %-5d Cell Servers: %-5d", cell_clients, cell_channels, cell_servers);
print_out("", "Total Clients: %-5d Total Channels: %-5d", clients, channels);
print_out("", "Total Servers: %-5d Total Routers: %-5d", servers, routers);
print_out("", "Total Server Operators: %-5d Total Router Operators: %-5d", server_ops, router_ops);
}
va_end(va);
}
/* }}} */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment