Reply
 
Thread Tools Display Modes
Old 02-07-14, 05:12 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 308
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, 15 views)
File Type: xml BNet.xml (17.7 KB, 11 views)
suicidalkatt is offline   Reply With Quote
Old 02-07-14, 07:32 AM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,945
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 02-07-14, 07:44 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 308
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 08:36 AM.
suicidalkatt is offline   Reply With Quote
Old 02-07-14, 08:09 AM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,945
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
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 02-07-14, 08:35 AM   #5
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 308
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 08:46 AM.
suicidalkatt is offline   Reply With Quote
Old 02-07-14, 08:52 AM   #6
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 308
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
suicidalkatt is offline   Reply With Quote
Old 02-07-14, 09:36 AM   #7
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,945
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 02-07-14, 02:11 PM   #8
10leej
A Scalebane Royal Guard
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 426
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

Last edited by 10leej : 02-07-14 at 02:13 PM.
10leej is offline   Reply With Quote
Old 02-07-14, 11:37 PM   #9
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 308
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.
suicidalkatt is offline   Reply With Quote
Old 02-14-14, 03:01 AM   #10
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 128
I had just been removing friends who used oQueue...
pelf is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » General Authoring Discussion » Filter the bnet messages?

Thread Tools
Display Modes

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