diff --git a/client/components/Chat.vue b/client/components/Chat.vue index b635530e..2108abd8 100644 --- a/client/components/Chat.vue +++ b/client/components/Chat.vue @@ -43,7 +43,16 @@ aria-label="Toggle user list"/> -
+
+ +
+
+ + + + + + + + + + + + + + +
BannedBanned ByBanned At
{{ ban.hostmask }} + {{ ban.banned_at | localetime }}
+ + + diff --git a/client/js/socket-events/msg_special.js b/client/js/socket-events/msg_special.js new file mode 100644 index 00000000..27e9ebfc --- /dev/null +++ b/client/js/socket-events/msg_special.js @@ -0,0 +1,7 @@ +"use strict"; + +const socket = require("../socket"); + +socket.on("msg:special", function(data) { + findChannel(data.chan).data = data.data; +}); diff --git a/client/views/actions/ban_list.tpl b/client/views/actions/ban_list.tpl deleted file mode 100644 index c73ba7dc..00000000 --- a/client/views/actions/ban_list.tpl +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - {{#each bans}} - - - - - - {{/each}} - -
BannedBanned ByBanned At
{{hostmask}}{{{parse banned_by}}}{{{localetime banned_at}}}
diff --git a/src/models/chan.js b/src/models/chan.js index 6fe7e580..56d5adf0 100644 --- a/src/models/chan.js +++ b/src/models/chan.js @@ -16,6 +16,12 @@ Chan.Type = { SPECIAL: "special", }; +Chan.SpecialType = { + BANLIST: "list_bans", + CHANNELLIST: "list_channels", + IGNORELIST: "list_ignored", +}; + Chan.State = { PARTED: 0, JOINED: 1, diff --git a/src/models/msg.js b/src/models/msg.js index 6a1b7038..f38147eb 100644 --- a/src/models/msg.js +++ b/src/models/msg.js @@ -44,11 +44,6 @@ class Msg { return this.type !== Msg.Type.MOTD && this.type !== Msg.Type.ERROR && - this.type !== Msg.Type.BANLIST && - this.type !== Msg.Type.IGNORELIST && - this.type !== "channel_list" && - this.type !== "channel_list_loading" && - this.type !== "channel_list_truncated" && this.type !== Msg.Type.TOPIC_SET_BY && this.type !== Msg.Type.WHOIS; } @@ -76,8 +71,6 @@ Msg.Type = { TOPIC: "topic", TOPIC_SET_BY: "topic_set_by", WHOIS: "whois", - BANLIST: "ban_list", - IGNORELIST: "ignore_list", }; module.exports = Msg; diff --git a/src/plugins/irc-events/banlist.js b/src/plugins/irc-events/banlist.js index 723ae3fc..6ad856b3 100644 --- a/src/plugins/irc-events/banlist.js +++ b/src/plugins/irc-events/banlist.js @@ -31,29 +31,31 @@ module.exports = function(irc, network) { const chanName = `Banlist for ${channel}`; let chan = network.getChannel(chanName); + const data = bans.map((data) => ({ + hostmask: data.banned, + banned_by: data.banned_by, + banned_at: data.banned_at * 1000, + })); if (typeof chan === "undefined") { chan = client.createChannel({ type: Chan.Type.SPECIAL, + special: Chan.SpecialType.BANLIST, name: chanName, + data: data, }); client.emit("join", { network: network.uuid, chan: chan.getFilteredClone(true), index: network.addChannel(chan), }); - } + } else { + chan.data = data; - chan.pushMessage(client, - new Msg({ - type: Msg.Type.BANLIST, - bans: bans.map((data) => ({ - hostmask: data.banned, - banned_by: data.banned_by, - banned_at: data.banned_at * 1000, - })), - }), - true - ); + client.emit("msg:special", { + chan: chan.id, + data: data, + }); + } }); };