From 24b1fbeec8e61e9636daaf606778c324d3ae3042 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 10 Aug 2006 21:39:57 +0000 Subject: Move all_opers into class InspIRCd git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4857 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 1 + src/cmd_die.cpp | 3 +-- src/cmd_who.cpp | 4 +--- src/commands.cpp | 38 -------------------------------------- src/helperfuncs.cpp | 3 +-- src/modules/m_httpd_stats.cpp | 3 +-- src/users.cpp | 7 +++---- 7 files changed, 8 insertions(+), 51 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index fd7cd3da9..42072919e 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -122,6 +122,7 @@ class InspIRCd : public classbase user_hash clientlist; chan_hash chanlist; std::vector local_users; + std::vector all_opers; DNS* Res; TimerManager* Timers; diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp index b0a826b6d..e561acefc 100644 --- a/src/cmd_die.cpp +++ b/src/cmd_die.cpp @@ -24,7 +24,6 @@ #include "commands/cmd_die.h" extern InspIRCd* ServerInstance; -extern std::vector all_opers; void cmd_die::Handle (const char** parameters, int pcnt, userrec *user) { @@ -36,7 +35,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user) * so we iterate the oper list, writing the message and immediately trying to flush their write buffer. */ - for (std::vector::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) { userrec* a = *i; diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 7601a1069..e5b6c60cd 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -23,8 +23,6 @@ #include "commands/cmd_who.h" extern InspIRCd* ServerInstance; -extern chan_hash chanlist; -extern std::vector all_opers; /* get the last 'visible' chan of a user */ static char *getlastchanname(userrec *u) @@ -160,7 +158,7 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user) if (opt_viewopersonly) { /* Showing only opers */ - for (std::vector::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) { userrec* oper = *i; diff --git a/src/commands.cpp b/src/commands.cpp index 9fe677d70..48d0745d5 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -59,44 +59,6 @@ const long duration_d = duration_h * 24; const long duration_w = duration_d * 7; const long duration_y = duration_w * 52; -extern std::vector all_opers; - -void split_chlist(userrec* user, userrec* dest, const std::string &cl) -{ - std::string line; - std::ostringstream prefix; - std::string::size_type start, pos, length; - - prefix << ":" << ServerInstance->Config->ServerName << " 319 " << user->nick << " " << dest->nick << " :"; - line = prefix.str(); - - for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1) - { - length = (pos == std::string::npos) ? cl.length() : pos; - - if (line.length() + length - start > 510) - { - user->Write(line); - line = prefix.str(); - } - - if(pos == std::string::npos) - { - line += cl.substr(start, length - start); - break; - } - else - { - line += cl.substr(start, length - start + 1); - } - } - - if (line.length()) - { - user->Write(line); - } -} - /* XXX - these really belong in helperfuncs perhaps -- w00t */ bool is_uline(const char* server) { diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index dc6c3e00d..50d9b0631 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -44,7 +44,6 @@ #include "inspircd.h" extern time_t TIME; -extern std::vector all_opers; static char TIMESTR[26]; static time_t LAST = 0; @@ -135,7 +134,7 @@ void InspIRCd::WriteOpers(const char* text, ...) void InspIRCd::WriteOpers(const std::string &text) { - for (std::vector::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector::iterator i = this->all_opers.begin(); i != this->all_opers.end(); i++) { userrec* a = *i; if (IS_LOCAL(a) && a->modes[UM_SERVERNOTICE]) diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 27548c91c..a813660c9 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -28,7 +28,6 @@ using namespace std; /* $ModDesc: Provides statistics over HTTP via m_httpd.so */ -extern std::vector all_opers; extern InspIRCd* ServerInstance; typedef std::map StatsHash; @@ -113,7 +112,7 @@ class ModuleHttpStats : public Module data << ""; data << ""; data << ""; - data << ""; + data << ""; data << ""; data << "
Users" << ServerInstance->clientlist.size() << "
Channels" << ServerInstance->chanlist.size() << "
Opers" << all_opers.size() << "
Opers" << ServerInstance->all_opers.size() << "
Sockets" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << " (Max: " << ServerInstance->SE->GetMaxFds() << " via socket engine '" << ServerInstance->SE->GetName() << "')
"; data << ""; diff --git a/src/users.cpp b/src/users.cpp index 63cc1763d..1a8e52fee 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -36,7 +36,6 @@ extern Server* MyServer; irc::whowas::whowas_users whowas; static unsigned long already_sent[MAX_DESCRIPTORS] = {0}; -std::vector all_opers; typedef std::map opertype_t; typedef opertype_t operclass_t; @@ -614,7 +613,7 @@ void userrec::Oper(const std::string &opertype) FOREACH_MOD(I_OnOper, OnOper(this, opertype)); log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str()); strlcpy(this->oper, opertype.c_str(), NICKMAX - 1); - all_opers.push_back(this); + ServerInstance->all_opers.push_back(this); FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype)); } @@ -624,12 +623,12 @@ void userrec::UnOper() { *this->oper = 0; this->modes[UM_OPERATOR] = 0; - for (std::vector::iterator a = all_opers.begin(); a < all_opers.end(); a++) + for (std::vector::iterator a = ServerInstance->all_opers.begin(); a < ServerInstance->all_opers.end(); a++) { if (*a == this) { log(DEBUG,"Oper removed from optimization list"); - all_opers.erase(a); + ServerInstance->all_opers.erase(a); return; } } -- cgit v1.2.3