summaryrefslogtreecommitdiff
path: root/include/message.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/message.h')
-rw-r--r--include/message.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/message.h b/include/message.h
index 39ddfaa40..2e3cd9bb1 100644
--- a/include/message.h
+++ b/include/message.h
@@ -154,4 +154,18 @@ 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>();
+ }
+ }
};