Changeset 5309:91102861071a in roaraudio


Ignore:
Timestamp:
11/29/11 00:11:46 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for lusers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/roard/protocol-irc.c

    r5308 r5309  
    3333static int on_quit(int client, const char * cmd, char * args, char * text); 
    3434static int on_ping(int client, const char * cmd, char * args, char * text); 
     35static int on_lusers(int client, const char * cmd, char * args, char * text); 
    3536static int on_whois(int client, const char * cmd, char * args, char * text); 
    3637static int on_privmsg(int client, const char * cmd, char * args, char * text); 
     
    7576 {"QUIT", on_quit}, 
    7677 {"PING", on_ping}, 
     78 {"LUSERS", on_lusers}, 
    7779 {"WHOIS", on_whois}, 
    7880 {"PRIVMSG", on_privmsg}, 
     
    499501 ); 
    500502 
     503 on_lusers(client, NULL, NULL, NULL); 
     504 
    501505 return 0; 
    502506} 
     
    621625} 
    622626 
     627static int on_lusers(int client, const char * cmd, char * args, char * text) { 
     628 const char * clientnick = get_nick(client); 
     629 size_t i; 
     630 size_t numchans = 0; 
     631 
     632 (void)cmd, (void)args, (void)text; 
     633 
     634/* 
     635:v0.fellig.org 251 nick :There are 9 users and 11 invisible on 1 servers 
     636 
     637:v0.fellig.org 252 nick 1 :operator(s) online 
     638 
     639:v0.fellig.org 254 nick 16 :channels formed 
     640:v0.fellig.org 255 nick :I have 20 clients and 0 servers 
     641:v0.fellig.org 265 nick :Current Local Users: 20  Max: 52 
     642:v0.fellig.org 266 nick :Current Global Users: 20  Max: 22 
     643*/ 
     644 
     645 for (i = 0; i < MAX_CHANNELS; i++) { 
     646  if ( !g_channels[i].client_count ) 
     647   continue; 
     648  numchans++; 
     649 } 
     650 
     651 put_printf(client, ":%s 251 %s :There are %zu users and 0 invisible on 1 servers\n", 
     652            server_name, clientnick, counters_get(cur, clients)); 
     653 put_printf(client, ":%s 254 %s %zu :channels formed\n", 
     654            server_name, clientnick, numchans); 
     655 put_printf(client, ":%s 255 %s :I have %zu clients and 0 servers\n", 
     656            server_name, clientnick, counters_get(cur, clients)); 
     657 put_printf(client, ":%s 265 %s :Current Local Users: %zu  Max: <unknown>\n", 
     658            server_name, clientnick, counters_get(cur, clients)); 
     659 put_printf(client, ":%s 266 %s :Current Global Users: %zu  Max: <unknown>\n", 
     660            server_name, clientnick, counters_get(cur, clients)); 
     661 
     662 return 0; 
     663} 
     664 
    623665static int on_whois(int client, const char * cmd, char * args, char * text) { 
    624666 const char * clientnick = get_nick(client); 
Note: See TracChangeset for help on using the changeset viewer.