diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cull_list.cpp | 5 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_blockcaps.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_dccallow.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_foobar.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_safelist.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_services_account.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_silence.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_silence_ext.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 19 | ||||
-rw-r--r-- | src/modules/m_swhois.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 18 |
20 files changed, 65 insertions, 19 deletions
diff --git a/src/cull_list.cpp b/src/cull_list.cpp index ce5827337..4578b2a76 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -87,8 +87,9 @@ int CullList::Apply() user_hash::iterator iter = ServerInstance->clientlist->find(a->GetUser()->nick); std::map<userrec*, userrec*>::iterator exemptiter = exempt.find(a->GetUser()); + const char* preset_reason = a->GetUser()->GetOperQuit(); std::string reason = a->GetReason(); - std::string oper_reason = a->GetOperReason(); + std::string oper_reason = *preset_reason ? preset_reason : a->GetOperReason(); if (reason.length() > MAXQUIT - 1) reason.resize(MAXQUIT - 1); @@ -110,7 +111,7 @@ int CullList::Apply() { a->GetUser()->PurgeEmptyChannels(); a->GetUser()->WriteCommonQuit(reason, oper_reason); - FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(), reason)); + FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(), reason, oper_reason)); } FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(a->GetUser())); diff --git a/src/modules.cpp b/src/modules.cpp index 46272a2bd..aa2d5f82a 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -104,7 +104,7 @@ std::string Event::GetEventID() Module::Module(InspIRCd* Me) : ServerInstance(Me) { } Module::~Module() { } void Module::OnUserConnect(userrec* user) { } -void Module::OnUserQuit(userrec* user, const std::string& message) { } +void Module::OnUserQuit(userrec* user, const std::string& message, const std::string &oper_message) { } void Module::OnUserDisconnect(userrec* user) { } void Module::OnUserJoin(userrec* user, chanrec* channel) { } void Module::OnPostJoin(userrec* user, chanrec* channel) { } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 1202ac2d3..3ebd6c0f3 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -291,7 +291,7 @@ class ModuleSQLLog : public Module AddLogEntry(LT_CONNECT,user->nick,user->host,user->server); } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { AddLogEntry(LT_DISCONNECT,user->nick,user->host,user->server); } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index c1edcfd04..662bdc865 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -77,6 +77,7 @@ public: virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { + ServerInstance->Log(DEBUG, "*** " + ConvToStr( ( 20 * 100 / 26) )); if (target_type == TYPE_CHANNEL) { if ((!IS_LOCAL(user)) || (text.length() < minlen)) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 96ac66f14..04a56b1fa 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -235,7 +235,7 @@ public: } } - virtual void OnUserQuit(userrec* user, const std::string &message) + virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { OnCleanup(TYPE_USER, user); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index bed359e3c..d92aeed82 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -272,7 +272,7 @@ class ModuleDCCAllow : public Module Conf = new ConfigReader(ServerInstance); } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { dccallowlist* dl; diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index b353d71c7..deb4c1229 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -66,7 +66,7 @@ class ModuleFoobar : public Module ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b); } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { // method called when a user disconnects diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 961885677..ac49fccf8 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -203,7 +203,7 @@ class ModuleHttpStats : public Module this->changed = true; } - void OnUserQuit(userrec* user, const std::string &message) + void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++) { diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 5b7e78faf..509b565ca 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -136,7 +136,7 @@ class ModuleNickLock : public Module return 0; } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { user->Shrink("nick_locked"); } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 11bfe6721..53d3e08f6 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -233,7 +233,7 @@ class ModuleSafeList : public Module output.append(" SAFELIST"); } - virtual void OnUserQuit(userrec* user, const std::string &message) + virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { this->OnCleanup(TYPE_USER,user); } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 54a61d4df..1f9daf452 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -243,7 +243,7 @@ class ModuleServicesAccount : public Module } // when a user quits, tidy up their metadata - virtual void OnUserQuit(userrec* user, const std::string &message) + virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { std::string* account; user->GetExt("accountname", account); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 2bc58821d..5c8e5fdef 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -142,7 +142,7 @@ class ModuleSilence : public Module List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnUserPreNotice] = List[I_OnUserPreMessage] = 1; } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { // when the user quits tidy up any silence list they might have just to keep things tidy // and to prevent a HONKING BIG MEMORY LEAK! diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp index 5acd9e22d..ba76abc29 100644 --- a/src/modules/m_silence_ext.cpp +++ b/src/modules/m_silence_ext.cpp @@ -253,7 +253,7 @@ class ModuleSilence : public Module List[I_OnBuildExemptList] = List[I_OnUserQuit] = List[I_On005Numeric] = List[I_OnUserPreNotice] = List[I_OnUserPreMessage] = List[I_OnUserPreInvite] = 1; } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { // when the user quits tidy up any silence list they might have just to keep things tidy silencelist* sl; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 31f8a1f10..1f2509d4e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -904,11 +904,18 @@ void ModuleSpanningTree::OnUserConnect(userrec* user) } } -void ModuleSpanningTree::OnUserQuit(userrec* user, const std::string &reason) +void ModuleSpanningTree::OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { if ((IS_LOCAL(user)) && (user->registered == REG_ALL)) { std::deque<std::string> params; + + if (oper_message != reason) + { + params.push_back(":"+oper_message); + Utils->DoOneToMany(user->nick,"OPERQUIT",params); + } + params.clear(); params.push_back(":"+reason); Utils->DoOneToMany(user->nick,"QUIT",params); } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index da0860eac..4bf11ddd7 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -13,7 +13,7 @@ * Failure to document your protocol changes will result in a painfully * painful death by pain. You have been warned. */ -const long ProtocolVersion = 1104; +const long ProtocolVersion = 1105; /** Forward declarations */ @@ -137,7 +137,7 @@ class ModuleSpanningTree : public Module virtual void OnChangeName(userrec* user, const std::string &gecos); virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage); virtual void OnUserConnect(userrec* user); - virtual void OnUserQuit(userrec* user, const std::string &reason); + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message); virtual void OnUserPostNick(userrec* user, const std::string &oldnick); virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason); virtual void OnRemoteKill(userrec* source, userrec* dest, const std::string &reason); diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 52496a4ef..5a5ec52f8 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -240,6 +240,8 @@ class TreeSocket : public InspSocket */ bool ForceNick(const std::string &prefix, std::deque<std::string> ¶ms); + bool OperQuit(const std::string &prefix, std::deque<std::string> ¶ms); + /** Remote SQUIT (RSQUIT). Routing works similar to SVSNICK: Route it to the server that the target is connected to locally, * then let that server do the dirty work (squit it!). Example: * A -> B -> C -> D: oper on A squits D, A routes to B, B routes to C, C notices D connected locally, kills it. -- w00t diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index fe56ea1bf..8bb404a45 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -207,6 +207,21 @@ bool TreeSocket::ForceNick(const std::string &prefix, std::deque<std::string> &p return true; } +bool TreeSocket::OperQuit(const std::string &prefix, std::deque<std::string> ¶ms) +{ + if (params.size() < 1) + return true; + + userrec* u = this->Instance->FindNick(prefix); + + if (u) + { + Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix); + u->SetOperQuit(params[0]); + } + return true; +} + /* * Remote SQUIT (RSQUIT). Routing works similar to SVSNICK: Route it to the server that the target is connected to locally, * then let that server do the dirty work (squit it!). Example: @@ -1157,6 +1172,10 @@ bool TreeSocket::ProcessLine(std::string &line) } return this->ForceNick(prefix,params); } + else if (command == "OPERQUIT") + { + return this->OperQuit(prefix,params); + } else if (command == "RSQUIT") { return this->RemoteSquit(prefix, params); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index d4432a0d6..3dcdb10f2 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -141,7 +141,7 @@ class ModuleSWhois : public Module } // when a user quits, tidy up their metadata - virtual void OnUserQuit(userrec* user, const std::string &message) + virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { std::string* swhois; user->GetExt("swhois", swhois); diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index f1cef7bf0..28c809d5b 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -306,7 +306,7 @@ class Modulewatch : public Module List[I_OnGarbageCollect] = List[I_OnCleanup] = List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1; } - virtual void OnUserQuit(userrec* user, const std::string &reason) + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { watchentries::iterator x = whos_watching_me->find(user->nick); if (x != whos_watching_me->end()) diff --git a/src/users.cpp b/src/users.cpp index 9f54975b4..48260bd1f 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -331,13 +331,15 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance) memset(modes,0,sizeof(modes)); memset(snomasks,0,sizeof(snomasks)); /* Invalidate cache */ - cached_fullhost = cached_hostip = cached_makehost = cached_fullrealhost = NULL; + operquit = cached_fullhost = cached_hostip = cached_makehost = cached_fullrealhost = NULL; } userrec::~userrec() { this->InvalidateCache(); this->DecrementModes(); + if (operquit) + free(operquit); if (ip) { clonemap::iterator x = ServerInstance->local_clones.find(this->GetIPString()); @@ -1914,3 +1916,17 @@ void userrec::HandleEvent(EventType et, int errornum) } } +void userrec::SetOperQuit(const std::string &oquit) +{ + if (operquit) + return; + + operquit = strdup(oquit.c_str()); +} + +const char* userrec::GetOperQuit() +{ + return operquit ? operquit : ""; +} + + |