diff options
-rw-r--r-- | include/snomasks.h | 1 | ||||
-rw-r--r-- | src/mode.cpp | 4 | ||||
-rw-r--r-- | src/modes/umode_n.cpp | 6 | ||||
-rw-r--r-- | src/snomasks.cpp | 15 | ||||
-rw-r--r-- | src/users.cpp | 7 |
5 files changed, 30 insertions, 3 deletions
diff --git a/include/snomasks.h b/include/snomasks.h index a6ee0d050..c1578e2d0 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -30,6 +30,7 @@ class SnomaskManager : public Extensible private: InspIRCd* ServerInstance; SnoList SnoMasks; + void SetupDefaults(); public: SnomaskManager(InspIRCd* Instance); ~SnomaskManager(); diff --git a/src/mode.cpp b/src/mode.cpp index 5ae457b68..23cbe5ccb 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -496,7 +496,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } else { - targetuser->WriteServ("MODE %s %s",targetuser->nick,output_sequence.c_str()); + targetuser->WriteServ("MODE %s %s%s",targetuser->nick,output_sequence.c_str(), parameter_list.str().c_str()); } } else @@ -509,7 +509,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool } else { - user->WriteTo(targetuser,"MODE %s %s",targetuser->nick,output_sequence.c_str()); + user->WriteTo(targetuser,"MODE %s %s%s",targetuser->nick,output_sequence.c_str(), parameter_list.str().c_str()); FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence)); } } diff --git a/src/modes/umode_n.cpp b/src/modes/umode_n.cpp index 7bb8dbbf0..f2c838454 100644 --- a/src/modes/umode_n.cpp +++ b/src/modes/umode_n.cpp @@ -18,6 +18,12 @@ ModeAction ModeUserServerNoticeMask::OnModeChange(userrec* source, userrec* dest if (adding) { parameter = dest->ProcessNoticeMasks(parameter.c_str()); + dest->modes[UM_SNOMASK] = true; + if (!dest->modes[UM_SERVERNOTICE]) + { + const char* newmodes[] = { dest->nick, "+s" }; + ServerInstance->Modes->Process(newmodes, 2, source, true); + } return MODEACTION_ALLOW; } else if (dest->modes[UM_SNOMASK] != false) diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 650403a53..e465b2ec8 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -27,6 +27,7 @@ SnomaskManager::SnomaskManager(InspIRCd* Instance) : ServerInstance(Instance) { SnoMasks.clear(); + this->SetupDefaults(); } SnomaskManager::~SnomaskManager() @@ -90,3 +91,17 @@ bool SnomaskManager::IsEnabled(char letter) return (SnoMasks.find(letter) != SnoMasks.end()); } +void SnomaskManager::SetupDefaults() +{ + this->EnableSnomask('c',"CONNECT"); /* Local connect notices */ + this->EnableSnomask('C',"REMOTECONNECT"); /* Remote connect notices */ + this->EnableSnomask('q',"QUIT"); /* Local quit notices */ + this->EnableSnomask('Q',"REMOTEQUIT"); /* Remote quit notices */ + this->EnableSnomask('k',"KILL"); /* Kill notices */ + this->EnableSnomask('n',"NICK"); /* Nickchange notices */ + this->EnableSnomask('l',"LINK"); /* Link notices */ + this->EnableSnomask('o',"OPER"); /* Oper up/down notices */ + this->EnableSnomask('d',"DEBUG"); /* Debug notices */ + this->EnableSnomask('x',"XLINE"); /* Xline notice (g/z/q/k/e) */ +} + diff --git a/src/users.cpp b/src/users.cpp index 27eb0a1f6..7be073bd6 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -98,8 +98,12 @@ std::string userrec::ProcessNoticeMasks(const char *sm) const char *c = sm; std::string output = ""; + ServerInstance->Log(DEBUG,"Process notice masks"); + while (c && *c) { + ServerInstance->Log(DEBUG,"Process notice mask %c",*c); + switch (*c) { case '+': @@ -111,7 +115,7 @@ std::string userrec::ProcessNoticeMasks(const char *sm) default: if ((*c >= 'A') && (*c <= 'z') && (ServerInstance->SNO->IsEnabled(*c))) { - if ((IsNoticeMaskSet(*c) && adding) || (!IsNoticeMaskSet(*c) && !adding)) + if ((!IsNoticeMaskSet(*c) && adding) || (IsNoticeMaskSet(*c) && !adding)) { if ((oldadding != adding) || (sm == c)) output += (adding ? '+' : '-'); @@ -287,6 +291,7 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance) invites.clear(); chans.resize(MAXCHANS); memset(modes,0,sizeof(modes)); + memset(snomasks,0,sizeof(snomasks)); for (unsigned int n = 0; n < MAXCHANS; n++) { |