]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_channel/core_channel.h
Fail a SANICK if the target nickname already exists.
[user/henk/code/inspircd.git] / src / coremods / core_channel / core_channel.h
index 0dafde8cbcf278c001b5852a31482ec7ec94560e..26b23c3ea5a5c2c93fed9e02a54ba97e40bcc762 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2017-2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2014-2015 Attila Molnar <attilamolnar@hush.com>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -20,6 +21,8 @@
 #pragma once
 
 #include "inspircd.h"
+#include "listmode.h"
+#include "modules/exemption.h"
 
 namespace Topic
 {
@@ -29,8 +32,32 @@ namespace Topic
 namespace Invite
 {
        class APIImpl;
+
+       /** Used to indicate who we announce invites to on a channel. */
+       enum AnnounceState
+       {
+               /** Don't send invite announcements. */
+               ANNOUNCE_NONE,
+
+               /** Send invite announcements to all users. */
+               ANNOUNCE_ALL,
+
+               /** Send invite announcements to channel operators and higher. */
+               ANNOUNCE_OPS,
+
+               /** Send invite announcements to channel half-operators (if available) and higher. */
+               ANNOUNCE_DYNAMIC
+       };
 }
 
+enum
+{
+       // From RFC 1459.
+       RPL_BANLIST = 367,
+       RPL_ENDOFBANLIST = 368,
+       ERR_KEYSET = 467
+};
+
 /** Handle /INVITE.
  */
 class CommandInvite : public Command
@@ -38,6 +65,8 @@ class CommandInvite : public Command
        Invite::APIImpl& invapi;
 
  public:
+       Invite::AnnounceState announceinvites;
+
        /** Constructor for invite.
         */
        CommandInvite(Module* parent, Invite::APIImpl& invapiimpl);
@@ -47,8 +76,8 @@ class CommandInvite : public Command
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult Handle(const std::vector<std::string>& parameters, User*user);
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
+       RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Handle /JOIN.
@@ -65,13 +94,14 @@ class CommandJoin : public SplitCommand
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
+       CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Handle /TOPIC.
  */
 class CommandTopic : public SplitCommand
 {
+       CheckExemption::EventProvider exemptionprov;
        ChanModeReference secretmode;
        ChanModeReference topiclockmode;
 
@@ -85,16 +115,18 @@ class CommandTopic : public SplitCommand
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
+       CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Handle /NAMES.
  */
 class CommandNames : public SplitCommand
 {
+ private:
        ChanModeReference secretmode;
        ChanModeReference privatemode;
        UserModeReference invisiblemode;
+       Events::ModuleEventProvider namesevprov;
 
  public:
        /** Constructor for names.
@@ -106,7 +138,7 @@ class CommandNames : public SplitCommand
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
+       CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
 
        /** Spool the NAMES list for a given channel to the given user
         * @param user User to spool the NAMES list to
@@ -130,6 +162,68 @@ class CommandKick : public Command
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
+       RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
+};
+
+/** Channel mode +b
+ */
+class ModeChannelBan : public ListModeBase
+{
+ public:
+       ModeChannelBan(Module* Creator)
+               : ListModeBase(Creator, "ban", 'b', "End of channel ban list", RPL_BANLIST, RPL_ENDOFBANLIST, true)
+       {
+               syntax = "<mask>";
+       }
+};
+
+/** Channel mode +k
+ */
+class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
+{
+ public:
+       static const std::string::size_type maxkeylen;
+       ModeChannelKey(Module* Creator);
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
+       void SerializeParam(Channel* chan, const std::string* key, std::string& out)    ;
+       ModeAction OnSet(User* source, Channel* chan, std::string& param) CXX11_OVERRIDE;
+       bool IsParameterSecret() CXX11_OVERRIDE;
+};
+
+/** Channel mode +l
+ */
+class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
+{
+ public:
+       size_t minlimit;
+       ModeChannelLimit(Module* Creator);
+       bool ResolveModeConflict(std::string& their_param, const std::string& our_param, Channel* channel) CXX11_OVERRIDE;
+       void SerializeParam(Channel* chan, intptr_t n, std::string& out);
+       ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE;
+};
+
+/** Channel mode +o
+ */
+class ModeChannelOp : public PrefixMode
+{
+ public:
+       ModeChannelOp(Module* Creator)
+               : PrefixMode(Creator, "op", 'o', OP_VALUE, '@')
+       {
+               ranktoset = ranktounset = OP_VALUE;
+       }
+};
+
+/** Channel mode +v
+ */
+class ModeChannelVoice : public PrefixMode
+{
+ public:
+       ModeChannelVoice(Module* Creator)
+               : PrefixMode(Creator, "voice", 'v', VOICE_VALUE, '+')
+       {
+               selfremove = false;
+               ranktoset = ranktounset = HALFOP_VALUE;
+       }
 };