]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_channel/core_channel.h
Advertise the available extbans for services.
[user/henk/code/inspircd.git] / src / coremods / core_channel / core_channel.h
index c500add07277331fe86a5ad67ffc503a2798a38b..26b23c3ea5a5c2c93fed9e02a54ba97e40bcc762 100644 (file)
@@ -1,10 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
- *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
- *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ *   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
@@ -34,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
@@ -43,6 +65,8 @@ class CommandInvite : public Command
        Invite::APIImpl& invapi;
 
  public:
+       Invite::AnnounceState announceinvites;
+
        /** Constructor for invite.
         */
        CommandInvite(Module* parent, Invite::APIImpl& invapiimpl);
@@ -52,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) CXX11_OVERRIDE;
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE;
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
+       RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Handle /JOIN.
@@ -70,7 +94,7 @@ 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) CXX11_OVERRIDE;
+       CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Handle /TOPIC.
@@ -91,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) CXX11_OVERRIDE;
+       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.
@@ -112,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) CXX11_OVERRIDE;
+       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
@@ -136,8 +162,8 @@ 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) CXX11_OVERRIDE;
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE;
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE;
+       RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE;
 };
 
 /** Channel mode +b
@@ -146,8 +172,9 @@ class ModeChannelBan : public ListModeBase
 {
  public:
        ModeChannelBan(Module* Creator)
-               : ListModeBase(Creator, "ban", 'b', "End of channel ban list", 367, 368, true, "maxbans")
+               : ListModeBase(Creator, "ban", 'b', "End of channel ban list", RPL_BANLIST, RPL_ENDOFBANLIST, true)
        {
+               syntax = "<mask>";
        }
 };
 
@@ -155,12 +182,13 @@ class ModeChannelBan : public ListModeBase
  */
 class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
 {
-       static const std::string::size_type maxkeylen = 32;
  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