Skip to content

Commit

Permalink
Added support for /y lfm messages, updated addon version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnertable committed Jul 31, 2018
1 parent 923b9fe commit 7c47646
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RaidBrowser/RaidBrowser.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 30300
## Title: Raid Browser
## Version: v1.2.0
## Version: v1.2.1
## Notes: A raid finder that parses chat channel text and displays any found raids in the raid browser LFR frame.
## Author: Horsebreed
## SavedVariablesPerCharacter: raid_browser_character_raidsets, raid_browser_character_current_raidset
Expand Down
23 changes: 20 additions & 3 deletions RaidBrowser/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,13 @@ local lfm_patterns = {
--'[%s]/w[%s]*[%a]+', -- Too greedy
}

local lfm_channel_listeners = {
["CHAT_MSG_CHANNEL"] = {},
["CHAT_MSG_YELL"] = {},
};

local channel_listeners = {};

local guild_recruitment_patterns = {
'recrui?ti?ng',
'recrui?t',
Expand Down Expand Up @@ -546,8 +553,12 @@ function raid_browser.raid_info(message)
return raid_info, roles, gs
end

local function is_lfm_channel(channel)
return channel == "CHAT_MSG_CHANNEL" or channel == "CHAT_MSG_YELL";
end

local function event_handler(self, event, message, sender)
if event == "CHAT_MSG_CHANNEL" then
if is_lfm_channel(event) then
local raid_info, roles, gs = raid_browser.raid_info(message)
if raid_info and roles and gs then

Expand Down Expand Up @@ -584,11 +595,17 @@ function raid_browser:OnEnable()

raid_browser.lfm_messages = {}
raid_browser.timer = raid_browser.set_timer(10, refresh_lfm_messages, true)
raid_browser.listener = raid_browser.add_event_listener("CHAT_MSG_CHANNEL", event_handler)
for channel, listener in pairs(lfm_channel_listeners) do
channel_listeners[i] = raid_browser.add_event_listener(channel, event_handler)
end

raid_browser.gui.raidset.initialize();
end

function raid_browser:OnDisable()
raid_browser.remove_event_listener ("CHAT_MSG_CHANNEL", raid_browser.listener)
for channel, listener in pairs(lfm_channel_listeners) do
raid_browser.remove_event_listener(channel, listener)
end

raid_browser.kill_timer(raid_browser.timer)
end

0 comments on commit 7c47646

Please sign in to comment.