From 82a5a9e29270062a05ffa97756bd39afe1b218a8 Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 9 May 2024 21:34:06 +0000 Subject: [PATCH] Fixed various hacks to account for serverside inconsistencies. --- src/mami.js/sockchat/handlers.js | 13 ++++++------- src/proto.js/sockchat/authed.js | 1 - src/proto.js/sockchat/utils.js | 2 -- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mami.js/sockchat/handlers.js b/src/mami.js/sockchat/handlers.js index 7ddf8c4..41a7bed 100644 --- a/src/mami.js/sockchat/handlers.js +++ b/src/mami.js/sockchat/handlers.js @@ -335,8 +335,7 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe } if(authorMethod === 'name') { - // the concat below should be done by the server, remove when fixed - const botUserInfo = Umi.Users.FindExact(author) ?? Umi.Users.FindExact(`~${author}`); + const botUserInfo = Umi.Users.FindExact(author); author = new MamiMessageAuthorInfo( Umi.User.isCurrentUser(botUserInfo), botUserInfo, @@ -356,11 +355,11 @@ const MamiSockChatHandlers = function(ctx, client, setLoadingOverlay, sockChatRe author = new MamiMessageAuthorInfo( senderInfo.self, rawUserInfo, - senderInfo.id ?? rawUserInfo.id, - senderInfo.name ?? rawUserInfo.name, - senderInfo.colour ?? rawUserInfo.colour, - senderInfo.perms?.rank ?? rawUserInfo.perms?.rank ?? 0, - senderInfo.avatar ?? rawUserInfo.avatar ?? new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo.id ?? '0'), + senderInfo.id ?? rawUserInfo?.id, + senderInfo.name ?? rawUserInfo?.name, + senderInfo.colour ?? rawUserInfo?.colour, + senderInfo.perms?.rank ?? rawUserInfo?.perms?.rank ?? 0, + senderInfo.avatar ?? rawUserInfo?.avatar ?? new MamiUserAvatarInfo(senderInfo.id ?? rawUserInfo?.id ?? '0'), ); type = `message:${ev.detail.msg.flags.isAction ? 'action' : 'text'}`; diff --git a/src/proto.js/sockchat/authed.js b/src/proto.js/sockchat/authed.js index 7b3af54..2d53a95 100644 --- a/src/proto.js/sockchat/authed.js +++ b/src/proto.js/sockchat/authed.js @@ -243,7 +243,6 @@ const SockChatS2CMessagePopulate = (ctx, timeStamp, userId, userName, userColour args: botParts.slice(2), }; - // i think this is more Inaccurate Behaviour on the server side if(info.msg.botInfo.type === 'say') info.msg.botInfo.args[0] = SockChatUnfuckText(info.msg.botInfo.args[0]); } diff --git a/src/proto.js/sockchat/utils.js b/src/proto.js/sockchat/utils.js index 8aa7fe2..50f8019 100644 --- a/src/proto.js/sockchat/utils.js +++ b/src/proto.js/sockchat/utils.js @@ -1,6 +1,4 @@ const SockChatUnfuckText = (text, isAction) => { - // P7.1 doesn't wrap in , likely a bug in SharpChat - // check if this is the case with the PHPChat impl if(isAction && text.startsWith('')) text = text.slice(3, -4);