diff --git a/client/views/actions/away.tpl b/client/views/actions/away.tpl
index 04a54bc6..a7a894e7 100644
--- a/client/views/actions/away.tpl
+++ b/client/views/actions/away.tpl
@@ -1,3 +1,7 @@
-{{> ../user_name from}}
-is away
-({{{parse text}}})
+{{#if self}}
+ {{{parse text}}}
+{{else}}
+ {{> ../user_name from}}
+ is away
+ ({{{parse text}}})
+{{/if}}
diff --git a/client/views/actions/back.tpl b/client/views/actions/back.tpl
index 02520366..bd7a66de 100644
--- a/client/views/actions/back.tpl
+++ b/client/views/actions/back.tpl
@@ -1,2 +1,6 @@
-{{> ../user_name from}}
-is back
+{{#if self}}
+ {{{parse text}}}
+{{else}}
+ {{> ../user_name from}}
+ is back
+{{/if}}
diff --git a/src/plugins/irc-events/away.js b/src/plugins/irc-events/away.js
index e0cc9e3b..25895632 100644
--- a/src/plugins/irc-events/away.js
+++ b/src/plugins/irc-events/away.js
@@ -4,9 +4,26 @@ const Msg = require("../../models/msg");
module.exports = function(irc, network) {
const client = this;
- irc.on("away", (data) => {
+
+ irc.on("away", (data) => handleAway(Msg.Type.AWAY, data));
+ irc.on("back", (data) => handleAway(Msg.Type.BACK, data));
+
+ function handleAway(type, data) {
const away = data.message;
+ if (data.self) {
+ const msg = new Msg({
+ self: true,
+ type: type,
+ text: away,
+ time: data.time,
+ });
+
+ network.channels[0].pushMessage(client, msg, true);
+
+ return;
+ }
+
network.channels.forEach((chan) => {
const user = chan.findUser(data.nick);
@@ -15,7 +32,7 @@ module.exports = function(irc, network) {
}
const msg = new Msg({
- type: away ? Msg.Type.AWAY : Msg.Type.BACK,
+ type: type,
text: away || "",
time: data.time,
from: user,
@@ -24,5 +41,5 @@ module.exports = function(irc, network) {
chan.pushMessage(client, msg);
user.away = away;
});
- });
+ }
};