diff --git a/client/components/Message.vue b/client/components/Message.vue
index 4b8163a4..6178a71e 100644
--- a/client/components/Message.vue
+++ b/client/components/Message.vue
@@ -40,6 +40,13 @@
>
+
+
+ [
+ *{{ message.from.nick }}
+ ]
+
+
-
diff --git a/src/models/msg.js b/src/models/msg.js
index a96edef4..f398f227 100644
--- a/src/models/msg.js
+++ b/src/models/msg.js
@@ -48,7 +48,8 @@ class Msg {
this.type !== Msg.Type.TOPIC_SET_BY &&
this.type !== Msg.Type.MODE_CHANNEL &&
this.type !== Msg.Type.RAW &&
- this.type !== Msg.Type.WHOIS
+ this.type !== Msg.Type.WHOIS &&
+ this.type !== Msg.Type.PLUGIN
);
}
}
@@ -77,6 +78,7 @@ Msg.Type = {
TOPIC_SET_BY: "topic_set_by",
WHOIS: "whois",
RAW: "raw",
+ PLUGIN: "plugin",
};
module.exports = Msg;
diff --git a/src/plugins/packages/publicClient.js b/src/plugins/packages/publicClient.js
index c18cf668..7754f6ea 100644
--- a/src/plugins/packages/publicClient.js
+++ b/src/plugins/packages/publicClient.js
@@ -1,3 +1,5 @@
+const Msg = require("../../models/msg");
+
module.exports = class PublicClient {
constructor(client) {
this.client = client;
@@ -37,4 +39,24 @@ module.exports = class PublicClient {
getChannel(chanId) {
return this.client.find(chanId);
}
+
+ /**
+ * Sends a message to this client, displayed in the given channel.
+ *
+ * @param {String} text the message to send
+ * @param {Chan} chan the channel to send the message to
+ * @param {String} identifier the identifier/name of the packages that is sending this message
+ */
+ sendMessage(text, chan, identifier) {
+ chan.pushMessage(
+ this.client,
+ new Msg({
+ type: Msg.Type.PLUGIN,
+ text: text,
+ from: {
+ nick: identifier,
+ },
+ })
+ );
+ }
};