X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_user%2Fcore_user.h;h=8289ad5a80e958070e0a65a4b9bfd96bb49400a1;hb=ef61e7b19ca6bee05b459088967242ae6950d9c5;hp=0418588c1e2916ff81fd7425590c06ac55108d89;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_user/core_user.h b/src/coremods/core_user/core_user.h index 0418588c1..8289ad5a8 100644 --- a/src/coremods/core_user/core_user.h +++ b/src/coremods/core_user/core_user.h @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2017-2019 Sadie Powell * Copyright (C) 2014 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -20,6 +21,8 @@ #pragma once #include "inspircd.h" +#include "listmode.h" +#include "modules/away.h" class MessageWrapper { @@ -49,6 +52,9 @@ class MessageWrapper */ class CommandAway : public Command { + private: + Away::EventProvider awayevprov; + public: /** Constructor for away. */ @@ -58,44 +64,32 @@ class CommandAway : 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; }; -class CommandMode : public Command +/** Handle /ISON. + */ +class CommandIson : public SplitCommand { - unsigned int sent[256]; - unsigned int seq; - - /** Show the list of one or more list modes to a user. - * @param user User to send to. - * @param chan Channel whose lists to show. - * @param mode_sequence Mode letters to show the lists of. - */ - void DisplayListModes(User* user, Channel* chan, const std::string& mode_sequence); - - /** Show the current modes of a channel or a user to a user. - * @param user User to show the modes to. - * @param targetuser User whose modes to show. NULL if showing the modes of a channel. - * @param targetchannel Channel whose modes to show. NULL if showing the modes of a user. - */ - void DisplayCurrentModes(User* user, User* targetuser, Channel* targetchannel); - public: - /** Constructor for mode. - */ - CommandMode(Module* parent); - + /** Constructor for ison. + */ + CommandIson(Module* parent) + : SplitCommand(parent, "ISON", 1) + { + allow_empty_last_param = false; + syntax = " []+"; + } /** 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 HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE; }; + /** Handle /NICK. */ class CommandNick : public SplitCommand @@ -110,7 +104,7 @@ class CommandNick : 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 /PART. @@ -129,14 +123,17 @@ class CommandPart : 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; }; /** Handle /QUIT. */ class CommandQuit : public Command { + private: + StringExtItem operquit; + public: MessageWrapper msgwrap; @@ -149,9 +146,9 @@ class CommandQuit : 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 Handle(User* user, const Params& parameters) CXX11_OVERRIDE; - RouteDescriptor GetRouting(User* user, const std::vector& parameters); + RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE; }; /** Handle /USER. @@ -168,7 +165,7 @@ class CommandUser : 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; /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user * successfully executes the USER or the NICK command. @@ -179,3 +176,60 @@ class CommandUser : public SplitCommand */ static CmdResult CheckRegister(LocalUser* user); }; + +/** Handle /USERHOST. + */ +class CommandUserhost : public Command +{ + UserModeReference hideopermode; + + public: + /** Constructor for userhost. + */ + CommandUserhost(Module* parent) + : Command(parent,"USERHOST", 1) + , hideopermode(parent, "hideoper") + { + allow_empty_last_param = false; + syntax = " []+"; + } + /** 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(User* user, const Params& parameters) CXX11_OVERRIDE; +}; + +/** User mode +s + */ +class ModeUserServerNoticeMask : public ModeHandler +{ + /** Process a snomask modifier string, e.g. +abc-de + * @param user The target user + * @param input A sequence of notice mask characters + * @return The cleaned mode sequence which can be output, + * e.g. in the above example if masks c and e are not + * valid, this function will return +ab-d + */ + std::string ProcessNoticeMasks(User* user, const std::string& input); + + public: + ModeUserServerNoticeMask(Module* Creator); + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) CXX11_OVERRIDE; + + /** Create a displayable mode string of the snomasks set on a given user + * @param user The user whose notice masks to format + * @return The notice mask character sequence + */ + std::string GetUserParameter(const User* user) const CXX11_OVERRIDE; +}; + +/** User mode +o + */ +class ModeUserOperator : public ModeHandler +{ + public: + ModeUserOperator(Module* Creator); + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) CXX11_OVERRIDE; +};