X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_channel%2Fcore_channel.h;h=59a41779055e1ade7df7d2546dcfab8995976b3b;hb=f8a9b6ba4ae0b4b3c7b2a408332230dd82eb4608;hp=7e213b5a54563e265d95efc5ac7a742551554f1e;hpb=930fd98e48f68b050d3938607bf420844fabbc37;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_channel/core_channel.h b/src/coremods/core_channel/core_channel.h index 7e213b5a5..59a417790 100644 --- a/src/coremods/core_channel/core_channel.h +++ b/src/coremods/core_channel/core_channel.h @@ -2,6 +2,9 @@ * InspIRCd -- Internet Relay Chat Daemon * * Copyright (C) 2014 Attila Molnar + * Copyright (C) 2008 Robin Burchell + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006 Craig Edwards * * 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,28 +23,55 @@ #pragma once #include "inspircd.h" +#include "listmode.h" +#include "modules/exemption.h" namespace Topic { void ShowTopic(LocalUser* user, Channel* chan); } +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 + }; +} + /** Handle /INVITE. */ class CommandInvite : public Command { + Invite::APIImpl& invapi; + public: + Invite::AnnounceState announceinvites; + /** Constructor for invite. */ - CommandInvite (Module* parent); + CommandInvite(Module* parent, Invite::APIImpl& invapiimpl); /** Handle command. * @param parameters The parameters to the command * @param user The user issuing the command * @return A value from CmdResult to indicate command success or failure. */ - CmdResult Handle(const std::vector& parameters, User*user); - RouteDescriptor GetRouting(User* user, const std::vector& parameters); + CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; /** Handle /JOIN. @@ -58,13 +88,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& 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; @@ -78,12 +109,12 @@ 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& parameters, LocalUser* user); + CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE; }; /** Handle /NAMES. */ -class CommandNames : public Command +class CommandNames : public SplitCommand { ChanModeReference secretmode; ChanModeReference privatemode; @@ -99,14 +130,14 @@ class CommandNames : 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& parameters, User *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 * @param chan Channel whose nicklist to send - * @param isinside If true, the user is inside the channel, if not then false + * @param show_invisible True to show invisible (+i) members to the user, false to omit them from the list */ - void SendNames(User* user, Channel* chan, bool isinside); + void SendNames(LocalUser* user, Channel* chan, bool show_invisible); }; /** Handle /KICK. @@ -123,6 +154,66 @@ 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& parameters, User *user); - RouteDescriptor GetRouting(User* user, const std::vector& 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", 367, 368, true, "maxbans") + { + } +}; + +/** Channel mode +k + */ +class ModeChannelKey : public ParamMode +{ + 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; +}; + +/** Channel mode +l + */ +class ModeChannelLimit : public ParamMode +{ + 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; + } };