WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Filter the bnet messages? (https://www.wowinterface.com/forums/showthread.php?t=48909)

suicidalkatt 02-07-14 06:12 AM

Filter the bnet messages?
 
2 Attachment(s)
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??

Phanx 02-07-14 08:32 AM

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. :p

suicidalkatt 02-07-14 08:44 AM

Quote:

Originally Posted by Phanx (Post 290510)
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. :p

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

Phanx 02-07-14 09:09 AM

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


suicidalkatt 02-07-14 09:35 AM

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

suicidalkatt 02-07-14 09:52 AM

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

Phanx 02-07-14 10:36 AM

Quote:

Originally Posted by suicidalkatt (Post 290513)
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. :p

10leej 02-07-14 03:11 PM

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

suicidalkatt 02-08-14 12:37 AM

Quote:

Originally Posted by 10leej (Post 290524)
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.

pelf 02-14-14 04:01 AM

I had just been removing friends who used oQueue...


All times are GMT -6. The time now is 07:04 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI