]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/message.h
Use IsCTCP in blockcolor for ignoring CTCPs.
[user/henk/code/inspircd.git] / include / message.h
index 39ddfaa406e6f36aab59a44fe1194c0bd4a39228..068f3124659182b02e08609df9f90bedb78db94b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2017-2018 Sadie Powell <sadie@witchery.services>
- *   Copyright (C) 2017-2018 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2018 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2017-2018, 2020 Sadie Powell <sadie@witchery.services>
  *
  * 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
@@ -39,6 +39,9 @@ class CoreExport MessageDetails
        /* Whether to send the original message back to clients with echo-message support. */
        bool echo_original;
 
+       /** Whether to update the source user's idle time. */
+       bool update_idle;
+
         /** The users who are exempted from receiving this message. */
        CUList exemptions;
 
@@ -55,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
@@ -78,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)
@@ -154,4 +158,23 @@ class CoreExport MessageTarget
        {
                return static_cast<T*>(dest);
        }
+
+       /** Retrieves the name of the target of this message. */
+       const std::string& GetName() const
+       {
+               switch (type)
+               {
+                       case TYPE_CHANNEL:
+                               return Get<Channel>()->name;
+                       case TYPE_USER:
+                               return Get<User>()->nick;
+                       case TYPE_SERVER:
+                               return *Get<std::string>();
+               }
+
+               // We should never reach this point during a normal execution but
+               // handle it just in case.
+               static const std::string target = "*";
+               return target;
+       }
 };