From 506d5d29d99283f52dab730fd5c5c98d837de048 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 21 Jan 2024 16:43:08 +0000 Subject: [PATCH] Only use 0 to compare boolean values. --- src/mami.js/sockchat_old.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mami.js/sockchat_old.js b/src/mami.js/sockchat_old.js index de9e364..fccf24b 100644 --- a/src/mami.js/sockchat_old.js +++ b/src/mami.js/sockchat_old.js @@ -549,8 +549,8 @@ Umi.Protocol.SockChat.Protocol = function(views) { sound = 'incoming'; const muser = Umi.Users.Get(data[2]) || chatBot, textParts = text.split("\f"); - isPM = data[5][4] === '1', - isAction = data[5][1] === '1' && data[5][3] === '0', + isPM = data[5][4] !== '0', + isAction = data[5][1] !== '0' && data[5][3] === '0', isBot = data[2] === '-1', pmChannel = '@' + muser.getName(), botInfo = {}; @@ -669,14 +669,14 @@ Umi.Protocol.SockChat.Protocol = function(views) { case '4': // channel switch(data[1]) { case '0': - Umi.Channels.Add(new Umi.Channel(data[2], data[3] === '1', data[4] === '1')); + Umi.Channels.Add(new Umi.Channel(data[2], data[3] !== '0', data[4] !== '0')); break; case '1': const uchannel = Umi.Channels.Get(data[2]); uchannel.setName(data[3]); - uchannel.setHasPassword(data[4] === '1'); - uchannel.setTemporary(data[5] === '1'); + uchannel.setHasPassword(data[4] !== '0'); + uchannel.setTemporary(data[5] !== '0'); Umi.Channels.Update(data[2], uchannel); break; @@ -790,7 +790,7 @@ Umi.Protocol.SockChat.Protocol = function(views) { channelName, false, cmbotInfo, - cmflags[1] === '1' && cmflags[3] === '0', + cmflags[1] !== '0' && cmflags[3] === '0', )); break; @@ -801,8 +801,8 @@ Umi.Protocol.SockChat.Protocol = function(views) { for(let i = 0; i < ecpamount; i++) { const channel = new Umi.Channel( data[ecpstart], - data[ecpstart + 1] === '1', - data[ecpstart + 2] === '1' + data[ecpstart + 1] !== '0', + data[ecpstart + 2] !== '0' ); Umi.Channels.Add(channel); @@ -851,7 +851,7 @@ Umi.Protocol.SockChat.Protocol = function(views) { noReconnect = true; wasKicked = true; - const isBan = data[1] === '1'; + const isBan = data[1] !== '0'; let message = 'You were kicked, refresh to log back in!'; if(isBan) {