Thread Tools Display Modes
02-07-14, 06:12 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Filter the bnet messages?

As many of you may be familiar with the addon 'OQ' (oQueue) it basically puts any users bnet message to 'OQ' which spams me constantly.

I'm wondering if there is a way to possibly prevent this bnet message from being displayed?

Looking over the bnet.lua, toast messages are stored in a local table and 'OnUpdate' the table is checked and the toast window is shown.

Only way I see this being done is to replace the blizzard function that adds the toast to the table.

Any thoughts??
Attached Files
File Type: lua BNet.lua (17.4 KB, 244 views)
File Type: xml BNet.xml (17.7 KB, 464 views)
  Reply With Quote
02-07-14, 08:32 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Probably:
Code:
local orig = BNToastFrame_AddToast
function BNToastFrame_AddToast(toastType, toastData)
     if toastType ~= 3 or toastData ~= "OQ" then
         return orig(toastType, toastData)
     end
end
On a side note, there's no need to attach Blizzard UI files to posts; you can just link to one of the several online mirrors of the code. Some even let you link directly to a specific line.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-07-14, 08:44 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Phanx View Post
Probably:
Code:
local orig = BNToastFrame_AddToast
function BNToastFrame_AddToast(toastType, toastData)
     if toastType ~= 3 or toastData ~= "OQ" then
         return orig(toastType, toastData)
     end
end
On a side note, there's no need to attach Blizzard UI files to posts; you can just link to one of the several online mirrors of the code. Some even let you link directly to a specific line.
More just for convenience. I'd rather be able to bring the file up in Notepad++ with a click or two.

Lua Code:
  1. local orig = BNToastFrame_AddToast
  2. function BNToastFrame_AddToast(toastType, toastData)
  3.      if toastData ~= "OQ" then
  4.          return orig(toastType, toastData)
  5.      end
  6. end

Think those conditionals would make more sense. Pass any 'BN_TOAST_TYPE_BROADCAST' that's not "OQ".

I'll give it a try.

Edit: Removed the check on toastType.

Edit 2: After doing a bit of testing, toastData would never be 'OQ' as a string. It would pass the friend id to be used with 'BNGetFriendInfoByID'.

Edit 3: More testing has revealed that the exact string has changed to '(OQ) ' which does include that space.

Lua Code:
  1. local orig = BNToastFrame_AddToast
  2. function BNToastFrame_AddToast(toastType, toastData)
  3.     if toastType == 3 then
  4.         local text = select(12,BNGetFriendInfoByID(toastData))
  5.         if text and text ~= "(OQ) " then -- Exact string, perhaps using string.find would be more appropriate.
  6.             orig(toastType, toastData)
  7.         end
  8.     else
  9.         orig(toastType, toastData)
  10.     end
  11. end

Last edited by suicidalkatt : 02-07-14 at 09:36 AM.
  Reply With Quote
02-07-14, 09:09 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you're going to spend CPU on calling select, why not just simplify the whole thing:

Code:
if toastType ~= 3 or select(12, BNGetFriendInfoByID(toastData)) ~= "OQ" then
	return orig(toastType, toastData)
end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-07-14, 09:35 AM   #5
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Makes sense, final code:

Lua Code:
  1. local f = CreateFrame("frame")
  2. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  3. f:SetScript("OnEvent", function()
  4.     f:UnregisterEvent("PLAYER_ENTERING_WORLD")
  5.     local orig = BNToastFrame_AddToast
  6.     function BNToastFrame_AddToast(toastType, toastData)
  7.         if toastType ~= 3 or select(12, BNGetFriendInfoByID(toastData)) ~= "(OQ) " then
  8.             return orig(toastType, toastData)
  9.         end
  10.     end
  11. end)

Alternatively if for some reason there is a deviation in the exact string this would fix the issue most likely:
Lua Code:
  1. if toastType ~= 3 or not strfind(strupper(select(12, BNGetFriendInfoByID(toastData))),"OQ") then

Last edited by suicidalkatt : 02-07-14 at 09:46 AM.
  Reply With Quote
02-07-14, 09:52 AM   #6
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Well did some searching apparently there is something similar yet not as simplified:
http://wow.curseforge.com/addons/oqspamblocker/

Also another thread regarding this issue:
http://www.wowinterface.com/forums/s...ad.php?t=48283
  Reply With Quote
02-07-14, 10:36 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by suicidalkatt View Post
Makes sense, final code:
There's no reason to create an extra frame and wait for PEW to hook this function. There's nothing being initialized (eg. saved variables) and the overhead of creating a frame is greater than the overhead of hooking (waiting might make sense if you were creating a bunch of frames or manipulating a large dataset, to reduce the time the user spends staring at the loading screen) so you can just hook directly in the main chunk.

Stop overcomplicating things.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-07-14, 03:11 PM   #8
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Blizzard is actually making some changes to bnet. Off of my brief skimming that would make oq use a hidden channel. Especially as the oq author is posting in it.

Blizz post
__________________
Tweets YouTube Website

Last edited by 10leej : 02-07-14 at 03:13 PM.
  Reply With Quote
02-08-14, 12:37 AM   #9
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by 10leej View Post
Blizzard is actually making some changes to bnet. Off of my brief skimming that would make oq use a hidden channel. Especially as the oq author is posting in it.

Blizz post
Glad that's being addressed, also that new api will add open a lot of doors for quite a lot of nice group finding mods for sure.
  Reply With Quote
02-14-14, 04:01 AM   #10
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
I had just been removing friends who used oQueue...
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Filter the bnet messages?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off