diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_helpop.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_invisible.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_jumpserver.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_knock.cpp | 12 |
7 files changed, 33 insertions, 37 deletions
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index af55f9bc8..a7f9e4007 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -45,16 +45,16 @@ class CommandHelpop : public Command if (parameter == "index") { /* iterate over all helpop items */ - user->WriteServ("NOTICE %s :HELPOP topic index", user->nick); + user->WriteServ("NOTICE %s :HELPOP topic index", user->nick.c_str()); for (std::map<irc::string, std::string>::iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++) { - user->WriteServ("NOTICE %s : %s", user->nick, iter->first.c_str()); + user->WriteServ("NOTICE %s : %s", user->nick.c_str(), iter->first.c_str()); } - user->WriteServ("NOTICE %s :*** End of HELPOP topic index", user->nick); + user->WriteServ("NOTICE %s :*** End of HELPOP topic index", user->nick.c_str()); } else { - user->WriteServ("NOTICE %s :*** HELPOP for %s", user->nick, parameter.c_str()); + user->WriteServ("NOTICE %s :*** HELPOP for %s", user->nick.c_str(), parameter.c_str()); std::map<irc::string, std::string>::iterator iter = helpop_map.find(parameter); @@ -68,9 +68,9 @@ class CommandHelpop : public Command std::string token = "*"; while (stream.GetToken(token)) - user->WriteServ("NOTICE %s :%s", user->nick, token.c_str()); + user->WriteServ("NOTICE %s :%s", user->nick.c_str(), token.c_str()); - user->WriteServ("NOTICE %s :*** End of HELPOP", user->nick); + user->WriteServ("NOTICE %s :*** End of HELPOP", user->nick.c_str()); } /* We dont want these going out over the network, return CMD_FAILURE diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 8f251cb46..a9ea8c06e 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -367,10 +367,9 @@ class ModuleIdent : public Module { /* User::ident is currently the username field from USER; with m_ident loaded, that * should be preceded by a ~. The field is actually IDENTMAX+2 characters wide. */ - memmove(user->ident + 1, user->ident, IDENTMAX); - user->ident[0] = '~'; - /* Ensure that it is null terminated */ - user->ident[IDENTMAX + 1] = '\0'; + if (user->ident.length() > IDENTMAX + 1) + user->ident.assign(user->ident, 0, IDENTMAX); + user->ident.insert('~', 0); user->WriteServ("NOTICE Auth :*** Looking up your ident..."); @@ -384,7 +383,7 @@ class ModuleIdent : public Module if (getsockname(user->GetFd(), (sockaddr*) &laddr, &laddrsz) != 0) { - user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident); + user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str()); return 0; } @@ -416,8 +415,6 @@ class ModuleIdent : public Module */ virtual bool OnCheckReady(User *user) { - ServerInstance->Logs->Log("m_ident",DEBUG,"OnCheckReady %s", user->nick); - /* Does user have an ident socket attached at all? */ IdentRequestSocket *isock = NULL; if (!user->GetExt("ident_socket", isock)) @@ -460,7 +457,7 @@ class ModuleIdent : public Module user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", isock->GetResult()); /* Copy the ident string to the user */ - strlcpy(user->ident, isock->GetResult(), IDENTMAX+1); + user->ident.assign(isock->GetResult(), 0, IDENTMAX+1); /* The user isnt actually disconnecting, we call this to clean up the user */ OnUserDisconnect(user); @@ -483,7 +480,6 @@ class ModuleIdent : public Module isock->Close(); delete isock; user->Shrink("ident_socket"); - ServerInstance->Logs->Log("m_ident",DEBUG, "Removed ident socket from %s", user->nick); } } }; diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 155c518c4..59b4c6ff4 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -74,7 +74,7 @@ class InvisibleMode : public ModeHandler if (!ok) { - source->WriteNumeric(481, "%s :Permission Denied - You do not have access to become invisible via user mode +Q", source->nick); + source->WriteNumeric(481, "%s :Permission Denied - You do not have access to become invisible via user mode +Q", source->nick.c_str()); return MODEACTION_DENY; } @@ -100,7 +100,7 @@ class InvisibleMode : public ModeHandler CUList *ulist = f->first->GetUsers(); char tb[MAXBUF]; - snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost(), adding ? "PART" : "JOIN", f->first->name); + snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost().c_str(), adding ? "PART" : "JOIN", f->first->name); std::string out = tb; std::string n = this->ServerInstance->Modes->ModeString(dest, f->first); @@ -116,7 +116,7 @@ class InvisibleMode : public ModeHandler } } - ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has become %svisible (%sQ)", dest->GetFullHost(), adding ? "in" : "", adding ? "+" : "-"); + ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has become %svisible (%sQ)", dest->GetFullHost().c_str(), adding ? "in" : "", adding ? "+" : "-"); return MODEACTION_ALLOW; } else @@ -195,7 +195,7 @@ class ModuleInvisible : public Module silent = true; /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */ this->WriteCommonFrom(user, channel, "JOIN %s", channel->name); - ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost(), channel->name); + ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost().c_str(), channel->name); } } @@ -245,9 +245,9 @@ class ModuleInvisible : public Module if ((target_type == TYPE_USER) && (IS_LOCAL(user))) { User* target = (User*)dest; - if(target->IsModeSet('Q') && !*user->oper) + if(target->IsModeSet('Q') && !IS_OPER(user)) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, target->nick); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), target->nick.c_str()); return 1; } } @@ -269,7 +269,7 @@ class ModuleInvisible : public Module va_start(argsPtr, text); vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - snprintf(tb,MAXBUF,":%s %s",user->GetFullHost(),textbuffer); + snprintf(tb,MAXBUF,":%s %s",user->GetFullHost().c_str(), textbuffer); CUList *ulist = channel->GetUsers(); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index c406c1701..4a92c996e 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -135,7 +135,7 @@ class JoinFlood : public ModeHandler int nsecs = atoi(secs); if ((njoins<1) || (nsecs<1)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name); parameter.clear(); return MODEACTION_DENY; } @@ -184,7 +184,7 @@ class JoinFlood : public ModeHandler } else { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name); return MODEACTION_DENY; } } @@ -231,7 +231,7 @@ class ModuleJoinFlood : public Module { if (f->islocked()) { - user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick,chan->name); + user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick.c_str(),chan->name); return 1; } } diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 14448c72e..0bb198a4d 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -50,9 +50,9 @@ class CommandJumpserver : public Command if (!parameters.size()) { if (port) - user->WriteServ("NOTICE %s :*** Disabled jumpserver (previously set to '%s:%d')", user->nick, redirect_to.c_str(), port); + user->WriteServ("NOTICE %s :*** Disabled jumpserver (previously set to '%s:%d')", user->nick.c_str(), redirect_to.c_str(), port); else - user->WriteServ("NOTICE %s :*** jumpserver was not enabled.", user->nick); + user->WriteServ("NOTICE %s :*** jumpserver was not enabled.", user->nick.c_str()); port = 0; redirect_to.clear(); @@ -89,7 +89,7 @@ class CommandJumpserver : public Command User* t = *i; if (!IS_OPER(t)) { - t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", user->nick, parameters[0].c_str(), parameters[1].c_str()); + t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", user->nick.c_str(), parameters[0].c_str(), parameters[1].c_str()); ServerInstance->Users->QuitUser(t, reason); n_done++; } @@ -106,7 +106,7 @@ class CommandJumpserver : public Command port = atoi(parameters[1].c_str()); } - user->WriteServ("NOTICE %s :*** Set jumpserver to server '%s' port '%s', flags '+%s%s'%s%s%s: %s", user->nick, parameters[0].c_str(), parameters[1].c_str(), + user->WriteServ("NOTICE %s :*** Set jumpserver to server '%s' port '%s', flags '+%s%s'%s%s%s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[1].c_str(), redirect_all_immediately ? "a" : "", redirect_new_users ? "n" : "", n_done ? " (" : "", @@ -141,7 +141,7 @@ class ModuleJumpServer : public Module { if (js->port && js->redirect_new_users) { - user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick, js->redirect_to.c_str(), js->port); + user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick.c_str(), js->redirect_to.c_str(), js->port); ServerInstance->Users->QuitUser(user, js->reason); return 0; } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 16def4d79..1e7513eb1 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -145,7 +145,7 @@ public: { if (iter->first == user) { - user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name); + user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick.c_str(), chan->name); return 1; } } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 6ec05602d..07b898110 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -34,25 +34,25 @@ class CommandKnock : public Command if (!c) { - user->WriteNumeric(401, "%s %s :No such channel",user->nick, parameters[0].c_str()); + user->WriteNumeric(401, "%s %s :No such channel",user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } if (c->HasUser(user)) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick.c_str(), c->name); return CMD_FAILURE; } if (c->IsModeSet('K')) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick.c_str(), c->name); return CMD_FAILURE; } if (!c->modes[CM_INVITEONLY]) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick.c_str(), c->name); return CMD_FAILURE; } @@ -62,8 +62,8 @@ class CommandKnock : public Command } line = line + parameters[parameters.size()-1]; - c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str()); - user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name); + c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick.c_str(), c->name, line.c_str()); + user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick.c_str(),c->name); return CMD_SUCCESS; } }; |