LibSink-2.0

10 - Support for 5.1 channel "INSTANCE_CHAT" via group

I use kInstanceTimer (which uses libsink for output), and noticed that post 5.1, it lacked support for using "Group" in an LFD.

As I'm extremely inexperienced with both LUA & WoW API, I'm sure you can think of a cleaner way to do it.

For me, I changed:

local function channel(addon, text)
	-- Sanitize the text, remove all color codes.
	text = text:gsub("(|c%x%x%x%x%x%x%x%x)(.-)(|r)", color_strip)
	local loc = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "SAY"
	local chan = sink.channelMapping[loc]
	if chan == "GROUP" then
		chan = select(2, IsInInstance()) == "pvp" and "INSTANCE_CHAT" or (UnitInRaid("player") and "RAID" or "PARTY")
		if chan == "PARTY" and GetNumSubgroupMembers() == 0 then chan = "SAY" end
	elseif chan == "CHANNEL" then
		local id, name = GetChannelName(loc)
		if name then
			SendChatMessage(text, "CHANNEL", nil, id)
		else
			print(text .. L_NOTINCHANNEL)
		end
		return
	end
	SendChatMessage(text, chan or "SAY")
end

to

local function channel(addon, text)
	-- Sanitize the text, remove all color codes.
	text = text:gsub("(|c%x%x%x%x%x%x%x%x)(.-)(|r)", color_strip)
	local loc = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "SAY"
	local chan = sink.channelMapping[loc]
	if chan == "GROUP" then
		if (IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) then
			chan = "INSTANCE_CHAT"
		else
			chan = select(2, IsInInstance()) == "pvp" and "BATTLEGROUND" or (UnitInRaid("player") and "RAID" or "PARTY")
			if chan == "PARTY" and GetNumSubgroupMembers() == 0 then chan = "SAY" end
		end
	elseif chan == "CHANNEL" then
		local id, name = GetChannelName(loc)
		if name then
			SendChatMessage(text, "CHANNEL", nil, id)
		else
			print(text .. L_NOTINCHANNEL)
		end
		return
	end
	SendChatMessage(text, chan or "SAY")
end
User When Change
funkydude May 19, 2013 at 13:12 UTC
trigunflamez Jan 28, 2013 at 19:34 UTC Changed name from Support for 5.1 channel "INSTANCE_CHAT" to Support for 5.1 channel "INSTANCE_CHAT" via group

Changed description:
- I use kInstanceTimer (which uses libsink for output), and noticed that post 5.1, it lacked support for either selecting the Instance Chat channel or using it via "Group"; using either "Party" or "Group" in an LFD, would fail to render output.
+ I use kInstanceTimer (which uses libsink for output), and noticed that post 5.1, it lacked support for using "Group" in an LFD.

- So, it would probably do to add both support for the specific "INSTANCE_CHAT" channel as well as through the "GROUP" channel. Locally, I just patched it to work with group; as I'm extremely inexperienced with both LUA & WoW API,  I'm sure you can think of a cleaner way to do both.
+ As I'm extremely inexperienced with both LUA & WoW API,  I'm sure you can think of a cleaner way to do it.
  For me, I changed:
trigunflamez Jan 28, 2013 at 19:18 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Last updated
May 19, 2013
Reported
Jan 28, 2013
Status
Fixed - Developer made requested changes. QA should verify.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees