summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-26 22:35:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-26 22:35:39 +0000
commit005ba1bf25510ea0dc83291fa60145aac1c2e21d (patch)
treeef6e55219b5c1eeb4dd64d8140169e860dc82cc7
parent3926fcf5051d77798419096fc2e09df730df5bc9 (diff)
Fixed and implemented /modules debug <glob>
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2673 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/cmd_modules.cpp31
-rw-r--r--src/inspircd.cpp10
2 files changed, 37 insertions, 4 deletions
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index ac25f1888..e9483ea65 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -98,11 +98,34 @@ void cmd_modules::Handle (char **parameters, int pcnt, userrec *user)
strlcpy(modulename,Config->module_names[i].c_str(),256);
if (strchr(user->modes,'o'))
{
- if ((pcnt > 0) && (!strcasecmp(parameters[0],"debug")))
+ if ((pcnt >= 2) && (!strcasecmp(parameters[0],"debug")))
{
- WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
- for (int it = 0; itab[it]; it++)
- WriteServ(user->fd,"900 %s :%s [%s = %d]",user->nick,CleanFilename(modulename),itab[it],Config->implement_lists[i]);
+ if (match(Config->module_names[i].c_str(),parameters[1]))
+ {
+ WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
+ for (int it = 0; itab[it];)
+ {
+ char data[MAXBUF];
+ char dlist[MAXBUF];
+ *dlist = 0;
+ for (int v = 0; v < 4; v++)
+ {
+ if (itab[it])
+ {
+ snprintf(data,MAXBUF,"%s=>%c ",itab[it],(Config->implement_lists[i][it] ? '1' : '0'));
+ strncat(dlist,data,MAXBUF);
+ it++;
+ }
+ }
+ if (*dlist)
+ WriteServ(user->fd,"900 %s :%s [ %s]",user->nick,CleanFilename(modulename),dlist);
+ }
+ WriteServ(user->fd,"900 %s :=== DEBUG: Implementation counts ===",user->nick);
+ for (int it = 0; itab[it]; it++)
+ {
+ WriteServ(user->fd,"900 %s :%s: %d times",user->nick, itab[it],(int)Config->global_implementation[it]);
+ }
+ }
}
else
{
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 24effa62a..b68f4934e 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -196,6 +196,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
for(int t = 0; t < 255; t++)
Config->global_implementation[t] = 0;
+ memset(&Config->implement_lists,0,sizeof(Config->implement_lists));
+
printf("\n");
if (!Config->nofork)
{
@@ -299,7 +301,9 @@ bool InspIRCd::UnloadModule(const char* filename)
}
for(int t = 0; t < 255; t++)
+ {
Config->global_implementation[t] -= Config->implement_lists[j][t];
+ }
FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(modules[j],Config->module_names[j]));
// found the module
@@ -374,7 +378,13 @@ bool InspIRCd::LoadModule(const char* filename)
modules[MODCOUNT+1]->Implements(x);
for(int t = 0; t < 255; t++)
+ {
Config->global_implementation[t] += Config->implement_lists[MODCOUNT+1][t];
+ if (Config->implement_lists[MODCOUNT+1][t])
+ {
+ log(DEBUG,"Add global implementation: %d %d => %d",MODCOUNT+1,t,Config->global_implementation[t]);
+ }
+ }
}
else
{