#include "../lib/base64.h"
#include "../core/modules.h"
#include "../lib/version.h"
-#include "../core/nsmalloc.h"
#include "control.h"
#include <stdio.h>
int controlstatus(void *sender, int cargc, char **cargv) {
unsigned long level=5;
- char buf[1024];
hooknick=(nick *)sender;
if (cargc>0) {
registerhook(HOOK_CORE_STATSREPLY,&handlestats);
- if (level >= 50) {
- int i;
- unsigned long count;
- size_t size;
-
- for(i=0;;i++) {
- if(!nspoolstats(i, &size, &count))
- break;
-
- if (count == 0)
- continue;
-
- snprintf(buf, sizeof(buf), "NSMalloc: pool %2d: %luKb, %lu items", i, size / 1024, count);
- triggerhook(HOOK_CORE_STATSREPLY, buf);
- }
- }
-
triggerhook(HOOK_CORE_STATSREQUEST,(void *)level);
deregisterhook(HOOK_CORE_STATSREPLY,&handlestats);
return CMD_OK;
controlreply((nick *)sender,"AccountTS : %ld",target->accountts);
if (target->auth)
controlreply((nick *)sender,"UserID : %ld",target->auth->userid);
+ if (target->accountflags)
+ controlreply((nick *)sender,"AccFlags : %s",printflags(target->accountflags,accountflags));
}
hooknick=(nick *)sender;
return CMD_USAGE;
}
- controlwall(0,0,"DIE from %s: %s",((nick *)sender)->nick, cargv[0]);
+ controlwall(NO_OPER,NL_OPERATIONS,"DIE from %s: %s",((nick *)sender)->nick, cargv[0]);
newserv_shutdown_pending=1;
chanban *cbp;
char buf[BUFSIZE];
char buf2[12];
- int i,j;
+ int i,j, ops=0, voice=0;
char timebuf[30];
if (cargc<1)
controlreply((nick *)sender,"Topic : %s",cp->topic->content);
strftime(timebuf, 30, "%d/%m/%y %H:%M", localtime(&(cp->topictime)));
controlreply((nick *)sender,"T-time : %ld [%s]",cp->topictime,timebuf);
+ } else {
+ controlreply((nick *)sender,"Topic : (none)");
}
controlreply((nick *)sender,"Mode(s) : %s %s%s%s",printflags(cp->flags,cmodeflags),IsLimit(cp)?buf2:"",
IsLimit(cp)?" ":"",IsKey(cp)?cp->key->content:"");
break;
}
if (cp->users->content[j]!=nouser) {
+ if (cp->users->content[j]&CUMODE_OP)
+ ops++;
+ else if (cp->users->content[j]&CUMODE_VOICE)
+ voice++;
np=getnickbynumeric(cp->users->content[j]);
sprintf(&buf[i*18],"%c%c%-15s ",cp->users->content[j]&CUMODE_VOICE?'+':' ',
cp->users->content[j]&CUMODE_OP?'@':' ', np?np->nick:"!BUG-NONICK!");
buf[i*18]=' ';
}
}
-
+ controlreply((nick *)sender, "Users : Opped: %d, Voiced: %d", ops,voice);
for (cbp=cp->bans;cbp;cbp=cbp->next) {
controlreply((nick *)sender,"Ban : %s",bantostringdebug(cbp));
}
if (IsOper(np))
controlnotice(np, "%s", broadcast);
}
+
+void controlnswall(int noticelevel, char *format, ...) {
+ char broadcast[512];
+ va_list va;
+
+ va_start(va, format);
+ vsnprintf(broadcast, sizeof(broadcast), format, va);
+ va_end(va);
+
+ controlwall(NO_OPER, noticelevel, "%s", broadcast);
+}
+