diff options
-rw-r--r-- | include/inspircd.h | 1 | ||||
-rw-r--r-- | src/cmd_die.cpp | 3 | ||||
-rw-r--r-- | src/cmd_who.cpp | 4 | ||||
-rw-r--r-- | src/commands.cpp | 38 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 3 | ||||
-rw-r--r-- | 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<userrec*> local_users; + std::vector<userrec*> 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<userrec*> 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<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*>::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<userrec*> 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<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*>::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<userrec*> 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<userrec*> 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<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*>::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<userrec*> all_opers; extern InspIRCd* ServerInstance; typedef std::map<irc::string,int> StatsHash; @@ -113,7 +112,7 @@ class ModuleHttpStats : public Module data << "<table>"; data << "<tr><td>Users</td><td>" << ServerInstance->clientlist.size() << "</td></tr>"; data << "<tr><td>Channels</td><td>" << ServerInstance->chanlist.size() << "</td></tr>"; - data << "<tr><td>Opers</td><td>" << all_opers.size() << "</td></tr>"; + data << "<tr><td>Opers</td><td>" << ServerInstance->all_opers.size() << "</td></tr>"; data << "<tr><td>Sockets</td><td>" << (ServerInstance->SE->GetMaxFds() - ServerInstance->SE->GetRemainingFds()) << " (Max: " << ServerInstance->SE->GetMaxFds() << " via socket engine '" << ServerInstance->SE->GetName() << "')</td></tr>"; data << "</table>"; data << "</div>"; 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<userrec*> all_opers; typedef std::map<irc::string,char*> 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<userrec*>::iterator a = all_opers.begin(); a < all_opers.end(); a++) + for (std::vector<userrec*>::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; } } |