summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/commands/cmd_whowas.h4
-rw-r--r--src/cmd_stats.cpp2
-rw-r--r--src/cmd_whowas.cpp3
3 files changed, 7 insertions, 2 deletions
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index 2568a0986..e2bab7a0f 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -67,6 +67,10 @@ class cmd_whowas : public command_t
*/
whowas_users_fifo whowas_fifo;
+ /* String holding stats so it can be collected
+ */
+ std::string stats;
+
public:
cmd_whowas(InspIRCd* Instance);
CmdResult Handle(const char** parameters, int pcnt, userrec *user);
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 5a22a2b4c..c44042e51 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -190,7 +190,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user,
whowas_command->HandleInternal(WHOWAS_STATS, params);
if (whowas_stats.GetExt("stats"))
{
- char* stats = NULL;
+ char* stats;
whowas_stats.GetExt("stats", stats);
results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(stats));
}
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index 7f78a22ac..10643680c 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -129,7 +129,8 @@ void cmd_whowas::GetStats(Extensible* ext)
whowas_bytes += (sizeof(whowas_set) + ( sizeof(WhoWasGroup) * n->size() ) );
}
}
- ext->Extend("stats", std::string("Whowas(MAPSETS) " +ConvToStr(whowas_size)+" ("+ConvToStr(whowas_bytes)+" bytes)").c_str());
+ stats.assign("Whowas(MAPSETS) " +ConvToStr(whowas_size)+" ("+ConvToStr(whowas_bytes)+" bytes)");
+ ext->Extend("stats", stats.c_str());
}
void cmd_whowas::AddToWhoWas(userrec* user)