X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmessage.h;h=2e3cd9bb1c88c4ef5f819d2eb8837de2cc40e090;hb=a697104a8c768228ce494967c11ff669d4aa3555;hp=7a968d86689dc96bb1d6cd2dcd5fb765c7336a48;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/message.h b/include/message.h index 7a968d866..2e3cd9bb1 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) 2017-2018 Sadie Powell + * Copyright (C) 2017-2018 Attila Molnar * * 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 @@ -63,7 +64,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. @@ -153,4 +154,18 @@ 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(); + } + } };