From 3efd135c3e12362bbb916c619340e1a73cfcdcad Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Tue, 7 May 2024 11:53:57 +0100 Subject: [PATCH] Remove broadcast 'upgrade' support Chomp's "smart" routing feature allows a prefix to opt-in to having its messages yeeted out across group chats if the destination target for a whisper is in your group. This is strictly an optimistic upgrade and not a guarantee on comms routing. With the advent of per-prefix throttles and the difference between behavior for whispers vs. group channels, this ends up being a trap that can ultimately slow such comms down to a crawl. For now let's kill off this support from the perspective of senders entirely and revisit if it's desirable later. Chomp can still receive messages with the broadcast bit set and process them accordingly, but going forward it won't send them out. --- .luacheckrc | 5 ----- Internal.lua | 2 +- Public.lua | 10 ---------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index d0aa59c..3da83de 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -58,8 +58,6 @@ read_globals = { "GetTime", "hooksecurefunc", "IsLoggedIn", - "LE_PARTY_CATEGORY_HOME", - "LE_REALM_RELATION_COALESCED", "securecallfunction", "strcmputf8i", "string.join", @@ -68,10 +66,7 @@ read_globals = { "UnitFactionGroup", "UnitFullName", "UnitInParty", - "UnitInRaid", - "UnitInSubgroup", "UnitName", - "UnitRealmRelationship", "UNKNOWNOBJECT", "WOW_PROJECT_ID", "WOW_PROJECT_MAINLINE", diff --git a/Internal.lua b/Internal.lua index 0b1ad73..9ca451e 100644 --- a/Internal.lua +++ b/Internal.lua @@ -14,7 +14,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ]] -local VERSION = 26 +local VERSION = 27 if IsLoggedIn() then error(("Chomp Message Library (embedded: %s) cannot be loaded after login."):format((...))) diff --git a/Public.lua b/Public.lua index d725860..50f2767 100644 --- a/Public.lua +++ b/Public.lua @@ -337,16 +337,6 @@ function Chomp.SmartAddonMessage(prefix, data, kind, target, messageOptions) ToBattleNet(bitField, prefix, Internal.EncodeQuotedPrintable(data, false), kind, bnetIDGameAccount, messageOptions.priority, messageOptions.queue) return "BATTLENET" end - local targetUnit = Ambiguate(target, "none") - -- Swap the commented line for the one following it to force testing of - -- broadcast whispers. - --if prefixData.broadcastPrefix and messageOptions.allowBroadcast and UnitInParty(targetUnit) then - if prefixData.broadcastPrefix and messageOptions.allowBroadcast and UnitRealmRelationship(targetUnit) == LE_REALM_RELATION_COALESCED then - bitField = bit.bor(bitField, Internal.BITS.BROADCAST) - kind = UnitInRaid(targetUnit, LE_PARTY_CATEGORY_HOME) and not UnitInSubgroup(targetUnit, LE_PARTY_CATEGORY_HOME) and "RAID" or UnitInParty(targetUnit, LE_PARTY_CATEGORY_HOME) and "PARTY" or "INSTANCE_CHAT" - data = ("%s\127%s"):format(not messageOptions.universalBroadcast and Chomp.NameMergedRealm(target) or "", data) - target = nil - end end if not messageOptions.binaryBlob then ToInGameLogged(bitField, prefix, Internal.EncodeQuotedPrintable(data, true), kind, target, messageOptions.priority, messageOptions.queue)