X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ojoin.cpp;h=56cef10b4ed3f8ae533df791a238055a97ee2ec3;hb=cee5a82d95fc3f5d3670ef483998bfc2d4a5a82e;hp=3710757aafa76d78cd8331937806ef01e78deca4;hpb=8fc268558586584479c622a3852f647eaf3a9b0e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 3710757aa..56cef10b4 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -58,25 +58,24 @@ class CommandOjoin : public SplitCommand if (notice) { - channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s joined on official network business.", - parameters[0].c_str(), user->nick.c_str()); - ServerInstance->PI->SendChannelNotice(channel, 0, user->nick + " joined on official network business."); + const std::string msg = user->nick + " joined on official network business."; + channel->WriteNotice(msg); + ServerInstance->PI->SendChannelNotice(channel, 0, msg); } } else { + channel = ServerInstance->FindChan(parameters[0]); + if (!channel) + return CMD_FAILURE; + ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used OJOIN in "+parameters[0]); // they're already in the channel - std::vector modes; - modes.push_back(parameters[0]); - modes.push_back(std::string("+") + npmh->GetModeChar()); + Modes::ChangeList changelist; + changelist.push_add(npmh, user->nick); if (op) - { - modes[1].push_back('o'); - modes.push_back(user->nick); - } - modes.push_back(user->nick); - ServerInstance->Modes->Process(modes, ServerInstance->FakeClient); + changelist.push_add(ServerInstance->Modes->FindMode('o', MODETYPE_CHANNEL), user->nick); + ServerInstance->Modes->Process(ServerInstance->FakeClient, channel, NULL, changelist); } return CMD_SUCCESS; } @@ -147,7 +146,7 @@ class ModuleOjoin : public Module if (source == memb->user) return MOD_RES_PASSTHRU; - source->WriteNumeric(ERR_RESTRICTED, memb->chan->name+" :Can't kick "+memb->user->nick+" as they're on official network business."); + source->WriteNumeric(ERR_RESTRICTED, memb->chan->name, "Can't kick "+memb->user->nick+" as they're on official network business."); return MOD_RES_DENY; }