Only use 0 to compare boolean values.

This commit is contained in:
flash 2024-01-21 16:43:08 +00:00
parent a5843ae71b
commit 506d5d29d9

View file

@ -549,8 +549,8 @@ Umi.Protocol.SockChat.Protocol = function(views) {
sound = 'incoming'; sound = 'incoming';
const muser = Umi.Users.Get(data[2]) || chatBot, const muser = Umi.Users.Get(data[2]) || chatBot,
textParts = text.split("\f"); textParts = text.split("\f");
isPM = data[5][4] === '1', isPM = data[5][4] !== '0',
isAction = data[5][1] === '1' && data[5][3] === '0', isAction = data[5][1] !== '0' && data[5][3] === '0',
isBot = data[2] === '-1', isBot = data[2] === '-1',
pmChannel = '@' + muser.getName(), pmChannel = '@' + muser.getName(),
botInfo = {}; botInfo = {};
@ -669,14 +669,14 @@ Umi.Protocol.SockChat.Protocol = function(views) {
case '4': // channel case '4': // channel
switch(data[1]) { switch(data[1]) {
case '0': 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; break;
case '1': case '1':
const uchannel = Umi.Channels.Get(data[2]); const uchannel = Umi.Channels.Get(data[2]);
uchannel.setName(data[3]); uchannel.setName(data[3]);
uchannel.setHasPassword(data[4] === '1'); uchannel.setHasPassword(data[4] !== '0');
uchannel.setTemporary(data[5] === '1'); uchannel.setTemporary(data[5] !== '0');
Umi.Channels.Update(data[2], uchannel); Umi.Channels.Update(data[2], uchannel);
break; break;
@ -790,7 +790,7 @@ Umi.Protocol.SockChat.Protocol = function(views) {
channelName, channelName,
false, false,
cmbotInfo, cmbotInfo,
cmflags[1] === '1' && cmflags[3] === '0', cmflags[1] !== '0' && cmflags[3] === '0',
)); ));
break; break;
@ -801,8 +801,8 @@ Umi.Protocol.SockChat.Protocol = function(views) {
for(let i = 0; i < ecpamount; i++) { for(let i = 0; i < ecpamount; i++) {
const channel = new Umi.Channel( const channel = new Umi.Channel(
data[ecpstart], data[ecpstart],
data[ecpstart + 1] === '1', data[ecpstart + 1] !== '0',
data[ecpstart + 2] === '1' data[ecpstart + 2] !== '0'
); );
Umi.Channels.Add(channel); Umi.Channels.Add(channel);
@ -851,7 +851,7 @@ Umi.Protocol.SockChat.Protocol = function(views) {
noReconnect = true; noReconnect = true;
wasKicked = true; wasKicked = true;
const isBan = data[1] === '1'; const isBan = data[1] !== '0';
let message = 'You were kicked, refresh to log back in!'; let message = 'You were kicked, refresh to log back in!';
if(isBan) { if(isBan) {