As a followup to my previous post about sending messages around...
It seems that using SendAddonMessage with a custom channel doesn't work (or I'm doing something totally wrong).
If I send a message with SendAddonMessage to a party, it works fine, but if I do it to a (custom) channel, nothing get's received.
Sample project attached. What am I doing wrong? It looks right...
Code:
SLASH_ZSCT1 = "/zsct"
SlashCmdList["ZSCT"] = function(msg)
print("Sent message through party ...")
C_ChatInfo.SendAddonMessage(prefix, "sent using party")
print("Sent message through channel (" .. channelid .. ") ...")
C_ChatInfo.SendAddonMessage(prefix, "sent using channel", "CHANNEL", channelid)
end
local function zSendChatTest_EventHandler(self, event, pre, msg, distribution, sender)
if pre == prefix then
print("Received message " .. msg)
end
end
channelname = "zsendchattest"
prefix = "zsendchattest"
password = "secret"
JoinChannelByName(channelname, password)
channelid = GetChannelName(channelname)
C_ChatInfo.RegisterAddonMessagePrefix(prefix)
zSendChatTest_Frame = CreateFrame("Frame")
zSendChatTest_Frame:SetScript("OnEvent", zSendChatTest_EventHandler)
zSendChatTest_Frame:RegisterEvent("CHAT_MSG_ADDON")
print("ZSCT Loaded")
Results:
Client 1 ("master")
Client 2 ("slave")