diff --git a/AddonComm.lua b/AddonComm.lua
index 022ec13..e22dff2 100644
--- a/AddonComm.lua
+++ b/AddonComm.lua
@@ -123,9 +123,11 @@ function AC:Receive(msgType, msg, channel, sender)
if v then
if not v:find("-") then
local name, realm = UnitName(v)
- if realm then
+ if realm and realm ~= "" then
v = ("%s-%s"):format(name, realm)
end
+ elseif v:match("^%w+-$") then
+ log:Error(L("AC_ERR_MALFORMED_DATA"):format(sender))
end
table.insert(self.GroupMembers, v)
end
@@ -137,9 +139,11 @@ function AC:Receive(msgType, msg, channel, sender)
if self.GroupMembers[1] ~= UnitName("player") then return end
if not msg:find("-") then
local name, realm = UnitName(msg)
- if realm then
+ if realm and realm ~= "" then
msg = ("%s-%s"):format(name, realm)
end
+ elseif msg:match("^%w+-$") then
+ log:Error(L("AC_ERR_MALFORMED_DATA"):format(sender))
end
if not CET:HasValue(self.GroupMembers, msg) then
table.insert(self.GroupMembers, msg)
@@ -192,9 +196,12 @@ function AC:Send(msgType, msg, channel, target)
if type(target) == "string" then
if not target:find("-") then
local name, realm = UnitName(target)
- if realm then
+ if realm and realm ~= "" then
target = ("%s-%s"):format(name, realm)
end
+ elseif target:match("^%w+-$") then
+ log:Error(L("AC_ERR_MALFORMED_DATA_SEND"):format(target))
+ return
end
end
SendAddonMessage(msgType, msg, channel, target)
diff --git a/BattleNetTools.lua b/BattleNetTools.lua
index 5fd81f5..aff24c5 100644
--- a/BattleNetTools.lua
+++ b/BattleNetTools.lua
@@ -142,7 +142,7 @@ function BNT:GetFriendByName(name)
if n <= 0 then return nil end
for i = 1, n do
local friend = ParseBNFriendResult(BNGetFriendInfo(i))
- if friend.ToonName:lower() == name:lower() then
+ if (friend.ToonName or ""):lower() == name:lower() then
return friend
end
end
@@ -159,7 +159,7 @@ function BNT:GetToonByName(name)
for i = 1, numF do
for t = 1, BNGetNumFriendToons(i) do
local toon = ParseBNToonResult(BNGetFriendToonInfo(i, t))
- if toon.Name:lower() == name:lower() then return toon end
+ if (toon.Name or ""):lower() == name:lower() then return toon end
end
end
return nil
diff --git a/Events_Chat.lua b/Events_Chat.lua
index 0bd94e9..611a0ef 100644
--- a/Events_Chat.lua
+++ b/Events_Chat.lua
@@ -193,7 +193,7 @@ function C.Events.CHAT_MSG_SAY(self, event, ...)
local chan = CM:GetRespondChannelByEvent(event)
local msg = (select(1, ...))
local sender = (select(2, ...))
- CM:HandleMessage(msg, sender, chan)
+ CM:HandleMessage(msg, sender, chan, nil, "SAY")
end
--- Event handler for CHAT_MSG_WHISPER.
@@ -220,5 +220,5 @@ function C.Events.CHAT_MSG_YELL(self, event, ...)
local chan = CM:GetRespondChannelByEvent(event)
local msg = (select(1, ...))
local sender = (select(2, ...))
- CM:HandleMessage(msg, sender, chan)
+ CM:HandleMessage(msg, sender, chan, nil, "YELL")
end
diff --git a/GroupTools.lua b/GroupTools.lua
index dcbd8aa..4493214 100644
--- a/GroupTools.lua
+++ b/GroupTools.lua
@@ -75,7 +75,7 @@ end
--
function GT:GetNumGroupMembers()
if not self:IsGroup() then return 0 end
- if UnitInRaid("player") then
+ if self:IsRaid() then
return GetNumGroupMembers()
else
return GetNumSubgroupMembers() + 1 -- We need to add one because it won't count the player
@@ -90,8 +90,8 @@ end
function GT:IsGroupFull()
-- We need to add 1 to the number because it doesn't count the player.
local num = self:GetNumGroupMembers()
- local max = self.RaidMax
- if self:IsGroup() then max = self.PartyMax end
+ local max = self.PartyMax
+ if self:IsRaid() then max = self.RaidMax end
if num >= max then return true end
return false
end
diff --git a/locales/enUS.lua b/locales/enUS.lua
index 6719706..7c414f2 100644
--- a/locales/enUS.lua
+++ b/locales/enUS.lua
@@ -52,6 +52,8 @@ local L = {
AC_ERR_PREFIX = "[FATAL] Failed to register AddOn prefix %q. Maximum number of prefixes reached on client.",
AC_ERR_MSGTYPE = "Invalid message type specified: %s",
+ AC_ERR_MALFORMED_DATA = "Malformed data received from %s. Their AddOn is probably outdated.",
+ AC_ERR_MALFORMED_DATA_SEND = "[AddonComm] Malformed data detected (\"%s\"). Aborting Send...",
AC_GROUP_NORESP = "No response from group, running updater...",
AC_GROUP_R_UPDATE = "Updated group members, controller: %s",
diff --git a/locales/svSE.lua b/locales/svSE.lua
index 273997a..369ccd2 100644
--- a/locales/svSE.lua
+++ b/locales/svSE.lua
@@ -52,6 +52,8 @@ local L = {
AC_ERR_PREFIX = "[KRITISK] Misslyckades med att registrera AddOn prefix %q. Maximalt antal prefix har nåtts på klienten.",
AC_ERR_MSGTYPE = "Ogiltig meddelandetyp: %s",
+ AC_ERR_MALFORMED_DATA = "Ogiltig data från %s. Deras AddOn är antagligen inaktuell.",
+ AC_ERR_MALFORMED_DATA_SEND = "[AddonComm] Malformed data detected (\"%s\"). Aborting Send...",
AC_GROUP_NORESP = "Inget svar från grupp, uppdaterar...",
AC_GROUP_R_UPDATE = "Gruppmedlemmar uppdaterade, kontrollerare: %s",