X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ojoin.cpp;h=d9d3c71b67c919d69d52e02f68e2db3dd9cba9e2;hb=c7b938502295ddc5b2c89e0854d8c5c19ede32dc;hp=e3366056d5cca5145e21df4469dc6827df738548;hpb=687778b72e31322a73b2e2e17af6bd0f2a2561bc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index e3366056d..d9d3c71b6 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -1,7 +1,10 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2009 Taros + * Copyright (C) 2019 Robby + * Copyright (C) 2013, 2017-2018, 2020-2021 Sadie Powell + * Copyright (C) 2012-2014, 2016 Attila Molnar + * Copyright (C) 2010 Craig Edwards * Copyright (C) 2009-2010 Daniel De Graaf * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -30,11 +33,14 @@ class CommandOjoin : public SplitCommand bool notice; bool op; ModeHandler* npmh; + ChanModeReference opmode; CommandOjoin(Module* parent, ModeHandler& mode) : SplitCommand(parent, "OJOIN", 1) , npmh(&mode) + , opmode(parent, "op") { - flags_needed = 'o'; syntax = ""; + flags_needed = 'o'; + syntax = ""; active = false; } @@ -43,7 +49,7 @@ class CommandOjoin : public SplitCommand // Make sure the channel name is allowable. if (!ServerInstance->IsChannel(parameters[0])) { - user->WriteNotice("*** Invalid characters in channel name or name too long"); + user->WriteNumeric(ERR_BADCHANMASK, parameters[0], "Invalid channel name"); return CMD_FAILURE; } @@ -57,7 +63,7 @@ class CommandOjoin : public SplitCommand ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used OJOIN to join "+channel->name); if (notice) - channel->WriteNotice(user->nick + " joined on official network business."); + channel->WriteRemoteNotice(user->nick + " joined on official network business."); } else { @@ -69,8 +75,8 @@ class CommandOjoin : public SplitCommand // they're already in the channel Modes::ChangeList changelist; changelist.push_add(npmh, user->nick); - if (op) - changelist.push_add(ServerInstance->Modes->FindMode('o', MODETYPE_CHANNEL), user->nick); + if (op && opmode) + changelist.push_add(*opmode, user->nick); ServerInstance->Modes->Process(ServerInstance->FakeClient, channel, NULL, changelist); } return CMD_SUCCESS; @@ -117,8 +123,8 @@ class ModuleOjoin : public Module if (mycommand.active) { privs += np.GetModeChar(); - if (mycommand.op) - privs += 'o'; + if (mycommand.op && mycommand.opmode) + privs += mycommand.opmode->IsPrefixMode()->GetPrefix(); return MOD_RES_ALLOW; } @@ -153,7 +159,7 @@ class ModuleOjoin : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the OJOIN command, allows an oper to join a channel and be immune to kicks", VF_VENDOR); + return Version("Adds the /OJOIN command which allows server operators to join a channel and receive the server operator-only Y (official-join) channel prefix mode.", VF_VENDOR); } };