-
Notifications
You must be signed in to change notification settings - Fork 0
/
oqueue_filters.lua
60 lines (51 loc) · 1.81 KB
/
oqueue_filters.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--[[
@file oqueue_chat_filter.lua
@brief chat filter functions for oqueue
@author rmcinnis
@date april 06, 2012
@copyright Solid ICE Technologies
this file may be distributed so long as it remains unaltered
if this file is posted to a web site, credit must be given to me along with a link to my web page
no code in this file may be used in other works without expressed permission
]]--
local addonName, OQ = ... ;
local oq = OQ:mod() ; -- thank goodness i stumbled across this trick
local _ ; -- throw away (was getting taint warning; what happened blizz?)
function oq.chat_filter(self, event, msg, author, ...)
if (oq.is_oqueue_msg( msg )) then
-- make sure 'author' is bn.enabled
return true ;
end
if msg and ((msg == "(OQ) ") or (msg == "")) then
return true ; -- remove empty message
end
local now = GetTime() ;
if ((msg == "You aren't in a party.") and (now < oq._error_ignore_tm)) then
-- ignore message
return true ;
end
-- hide error msg if scorekeeper is temporarily offline or being ignored
if (msg:find( "No player named '".. OQ.SK_NAME .."' is currently playing") ~= nil) or
((msg:find( OQ.SK_NAME) ~= nil) and (msg:find( "is no longer being ignored" ) ~= nil)) then
-- ignore message
return true ;
end
-- remove duplicate afk msgs
if (oq._last_afkmsg == nil) then
oq._last_afkmsg = 0 ;
end
if ((msg:find( OQ.SYS_YOUARE_AFK ) ~= nil) or
(msg:find( OQ.SYS_YOUARENOT_AFK ) ~= nil)) then
if ((now - oq._last_afkmsg) < 15) then
-- remove msg
oq._last_afkmsg = now ;
return true ;
end
oq._last_afkmsg = now ;
end
-- b-net spam
if (msg:find( "is not online" ) ~= nil) then
return true ;
end
-- return false, msg, author, ...
end