X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmessage.h;h=ed44868eeff4fd248f89d408e5aa6f827ea1b068;hb=HEAD;hp=7a968d86689dc96bb1d6cd2dcd5fb765c7336a48;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/message.h b/include/message.h index 7a968d866..ed44868ee 100644 --- a/include/message.h +++ b/include/message.h @@ -1,7 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2017 Peter Powell + * Copyright (C) 2018 Attila Molnar + * Copyright (C) 2017-2018, 2020 Sadie Powell * * 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 @@ -38,7 +39,10 @@ class CoreExport MessageDetails /* Whether to send the original message back to clients with echo-message support. */ bool echo_original; - /** The users who are exempted from receiving this message. */ + /** Whether to update the source user's idle time. */ + bool update_idle; + + /** The users who are exempted from receiving this message. */ CUList exemptions; /* The original message as sent by the user. */ @@ -54,7 +58,7 @@ class CoreExport MessageDetails std::string text; /** The type of message. */ - const MessageType type; + MessageType type; /** Determines whether the specified message is a CTCP. If the specified message * is a CTCP then the CTCP name and CTCP body are extracted and stored in the @@ -63,7 +67,7 @@ class CoreExport MessageDetails * @param body The location to store the parsed CTCP body. */ virtual bool IsCTCP(std::string& name, std::string& body) const = 0; - + /** Determines whether the specified message is a CTCP. If the specified message * is a CTCP then the CTCP name is extracted and stored in the name reference. * @param name The location to store the parsed CTCP name. @@ -77,6 +81,7 @@ class CoreExport MessageDetails MessageDetails(MessageType mt, const std::string& msg, const ClientProtocol::TagMap& tags) : echo(true) , echo_original(false) + , update_idle(true) , original_text(msg) , tags_in(tags) , text(msg) @@ -153,4 +158,23 @@ class CoreExport MessageTarget { return static_cast(dest); } + + /** Retrieves the name of the target of this message. */ + const std::string& GetName() const + { + switch (type) + { + case TYPE_CHANNEL: + return Get()->name; + case TYPE_USER: + return Get()->nick; + case TYPE_SERVER: + return *Get(); + } + + // We should never reach this point during a normal execution but + // handle it just in case. + static const std::string target = "*"; + return target; + } };