diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-29 19:12:05 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-29 19:12:05 +0000 |
commit | c0f8576bbd4cfa5b4f0c13cad90c3b516e0efb43 (patch) | |
tree | df3f254c8d802b4cb373ec92f078f6b3950674ae /src | |
parent | b9e99da4dafd836e995970216835cefe3716a01a (diff) |
auto-set +s when +n is set (as +n requires +s) - allow +n to be 'set twice' allowing for snomask change without removal of +ns
Add default snomask chars
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5063 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-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 |
4 files changed, 29 insertions, 3 deletions
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++) { |