/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2017 Peter Powell <petpow@saberuk.com>
+ * Copyright (C) 2017-2018 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2017-2018 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
* @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.
{
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>();
+ }
+ }
};