statistics
People Online: 15
Today's Visitors: 67
Total Visitors: 3,793,378
May 22, 2012, 10:29:16 PM
Shoutbox
   
 
[DevTeam] [Zeke]: I love that I get emailed when someone reports spam on the boards, but I can't do anything about it.
[DevTeam] [Nachonut]: lol i got you
[DevTeam] [Astaldo]: How about "hide email address from public checked" and it's still visible in all my posts...
[DevTeam] [Astaldo]: I'd delete my account on this site, but by the time I realized the problem half the spambots on the planet had it already
[Developer] [Pazza]: Astaldo if you log out and view your profile with a refresh you'll see that your email is hidden.
[Developer] [Pazza]: Your user level on the forums permit you to see emails even though they are marked hidden.
[DevTeam] [Astaldo]: Ah.. thanks for the clarification and apologies for "crying wolf" in that case :
[DevTeam] [Kaidenn]: PAZZA! i miss you.
[DevTeam] [Nachonut]: Lol, it's funny how it takes spam message reports to get me to come back
[DevTeam] [sylvanaar]: Check out the beta tester forum. Need alpha testers and feedback so I can come up with a maintenance plan.
[Developer] [Pazza]: loaded some new spam prevention modules... lets see if this stops the bastards.
[DevTeam] [Maziel]: Thought I'd check in and say Howdy Doody from Australia
[DevTeam] [Maziel]: Yeah the spam from shoes salesmen was becoming insane
[Guest] [Delakando]: What ever happened to the ability to track friend's location by wim? Other then just showing their general zone location.
Zeke pokes his head around the corner.
[DevTeam] [Zeke]: Anybody home?
[Guest] [Theillur]: I would like to know if it is just me.
[Guest] [Theillur]: http://www.wimaddon.com/forums/index.php/topic,1796.0.html
[Guest] [Nev]: I'm here
[Guest] [Nev]: I don't think anyone else is though
[Guest] [tomasio]: great site [url=http://freeonlinemusicvideos.net].[/url] [url=http://freepeopleclothing.org].[/url]
[Guest] [Theillur]: Nev it is not working for Zeke as well.
[DevTeam] [lothaer]: im here
[DevTeam] [lothaer]: ...
lothaer yawns sleepily.
[DevTeam] [lothaer]: sooooooooooooooooo
[Guest] [j3ff]: Hello. It is very quiet. I would love a response to my thread directly below your "Been very quiet" thread!
[DevTeam] [lothaer]: Check out my new post in the Skins forum
[DevTeam] [lothaer]: Posted a new download in the skins forum check it out
[DevTeam] [lothaer]: Zeke, Maziel, Pazza, Nachonut, sylvanaar, Kaidenn, Astaldo where are you?
[DevTeam] [lothaer]: It would be a real shame if WIM was left to die.
[DevTeam] [lothaer]: i think these forums are dead, Sylvanaar dosnt post on them as he only bug fixes when possible. WIMs future isnt very bright
[Guest] [justgiz]: Yea, its rather sad.
[Guest] [silvercola]: I wish it had skype
[DevTeam] [lothaer]: noy possible for a addon to do.
[DevTeam] [lothaer]: ...........
[Guest] [elzershark]: where is the download file?
lothaer beckons everyone over to you.
[DevTeam] [lothaer]: has anyone been able to take WIM to the beta yet?
[DevTeam] [lothaer]: PTR*
[DevTeam] [Maziel]: *sticks head up and looks around*
lothaer cries.
[DevTeam] [lothaer]: who the hell flagged my post as spam?
[Guest] [primalforce]: Hey guys
[DevTeam] [lothaer]: hello Primalforce.
[DevTeam] [lothaer]: PAZZA COME BACK!!!
[DevTeam] [Nachonut]: Ahhh memories
[Guest] [Ignis]: wtb update
[DevTeam] [lothaer]: soooo.....
Pazza starts to complain... Kinda reminds you of Sloans dont it?
 
   
   
News: World of Warcraft v4.0.1
 
Pages: [1]
Print
Author Topic: WIM's Hook and Interoperability with other Mods  (Read 1179 times)
deffling
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


View Profile
« on: March 16, 2007, 05:38:53 PM »

appreciate the great job with WIM!

Downloaded 2.0.8 from this site and gave it a try...still has the same problem as 1.5x code base. Here's code (from 1.5x series) i've made changes to and some reasons why I think the handling is incorrect.

for wim.lua
Intrepreted from blizzard's chatframe.lua

WIM_ChatFrame_MessageEventHandler should only return true if it has handled or is suppressing a message
if not, it should return the original message handler i.e. WIM_ChatFrame_MessageEventHandler_orig and not return true
returning true will exit the entire chatframe_onevent
returning false will cause the next handler (if there is any) to run, not to suppress it, the suppression comes from not calling the original message handler, which actually adds to chatframe.
returning false for suppression works for the previous hooking function in the older version due to a conditional check.
making the above changes will cause less problem for other hooks on chatframe message handling functions.

Code:
function WIM_ChatFrame_MessageEventHandler(event)
-- if WIM is disabled, don't bother doing anything, let everything work as normal.
if( WIM_Data.enableWIM == false) then
return WIM_ChatFrame_MessageEventHandler_orig(event);
end
local msg = "";
local filterResult;
if((event == "CHAT_MSG_AFK" or event == "CHAT_MSG_DND") and WIM_Data.showAFK) then
local afkType;
if( event == "CHAT_MSG_AFK" ) then
afkType = WIM_LOCALIZED_AFK;
else
afkType = WIM_LOCALIZED_DND;
end
msg = "<"..afkType.."> |Hplayer:"..arg2.."|h"..arg2.."|h: "..arg1;
WIM_PostMessage(arg2, msg, 3);
if(WIM_Data.supressWisps) then
ChatEdit_SetLastTellTarget(arg2);
return true;
else
return WIM_ChatFrame_MessageEventHandler_orig(event);
end
elseif(event == "CHAT_MSG_WHISPER") then
filterResult = WIM_FilterResult(arg1, arg2);
if(filterResult ~= 1 and filterResult ~= 2) then
msg = "[|Hplayer:"..arg2.."|h"..WIM_GetAlias(arg2, true).."|h]: "..arg1;
WIM_PostMessage(arg2, msg, 1, arg2, arg1);
end
if(WIM_Data.supressWisps) then
if(filterResult == 1) then
return WIM_ChatFrame_MessageEventHandler_orig(event);
else
ChatEdit_SetLastTellTarget(arg2);
return true;
end
else
if(filterResult == 2) then
return true;
else
return WIM_ChatFrame_MessageEventHandler_orig(event);
end
end
elseif(event == "CHAT_MSG_WHISPER_INFORM") then
filterResult = WIM_FilterResult(arg1, UnitName("player"));
if(filterResult ~= 1 and filterResult ~= 2) then
msg = "[|Hplayer:"..UnitName("player").."|h"..WIM_GetAlias(UnitName("player"), true).."|h]: "..arg1;
WIM_PostMessage(arg2, msg, 2, UnitName("player") ,arg1);
end
if(WIM_Data.supressWisps) then
if(filterResult == 1) then
return WIM_ChatFrame_MessageEventHandler_orig(event);
else
return true;
end
else
if(filterResult == 2) then
return true;
else
return WIM_ChatFrame_MessageEventHandler_orig(event);
end
end
elseif(event == "CHAT_MSG_SYSTEM") then
local tstart,tfinish = string.find(arg1, "\'(%a+)\'");
if(tstart ~= nil and tfinish ~= nil) then
user = string.sub(arg1, tstart+1, tfinish-1);
user = string.gsub(user, "^%l", string.upper)
tstart, tfinish = string.find(arg1, "playing");
if(tstart ~= nil and WIM_Windows[user] ~= nil) then
-- player not playing, can't whisper
msg = "|Hplayer:"..user.."|h"..user.."|h is not currently playing!";
WIM_PostMessage(user, msg, 4);
if(WIM_Data.supressWisps) then
return true;
else
return WIM_ChatFrame_MessageEventHandler_orig(event);
end
end
end
end
return WIM_ChatFrame_MessageEventHandler_orig(event);
end

for wim.xml
Code:
<OnEvent>
WIM_Incoming(event);
-- since this is a hook which will be called by chatframe_onevent handler, there should be no need to call it below
-- WIM_ChatFrame_MessageEventHandler(event);
</OnEvent>
Logged
Pazza
Administrator
Hero Member
*****

Karma: +89/-15
Offline Offline

Posts: 1375


Effin A


View Profile WWW
« Reply #1 on: March 17, 2007, 09:30:11 AM »

Thanks for taking the time to explain this issue. I will definitely try returning the original hooked function instead of true/false.

As far as the two sources of whisper catches, let me explain my reasons.

WIM handles whispers event messages on its own. It uses its own events, which is why i pass the extra boolean value to my internal message handler. The reason for the hook, is to be able to suppress, that is all. It is not good to rely on the hook alone to receive the events. The reason behind this is if someone has whispers disabled on the default chat frame, you will not receive any more whispers. If the user has whispers showing on the default frame and any other tab on their chat frame, WIM will receive 2-3 (respectively) of the same whisper events and therefore cause duplicate messages showing.


That is why the events are handled the way they are.

If I am missing something, or did not explain something correctly, please let me know. Thanks for the advice.
Logged

My hobbies consume way too much time :-).
Pazza
Administrator
Hero Member
*****

Karma: +89/-15
Offline Offline

Posts: 1375


Effin A


View Profile WWW
« Reply #2 on: March 17, 2007, 09:33:20 AM »

Quote
this is just advice from a dev to another. no malicious intent.

made a post on ur website after trying 2.0.8. while providing a api for filtering is great, it is also important to adhere to blizzard original code logic and return values so that WIM will work with other mods like spam sentry and others that also hooks blizzard's functions.

Original message from ui.worldofwar.net WIM comments.
Logged

My hobbies consume way too much time :-).
deffling
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


View Profile
« Reply #3 on: March 17, 2007, 04:13:21 PM »

Thanks for taking the time to explain this issue. I will definitely try returning the original hooked function instead of true/false.

As far as the two sources of whisper catches, let me explain my reasons.

WIM handles whispers event messages on its own. It uses its own events, which is why i pass the extra boolean value to my internal message handler. The reason for the hook, is to be able to suppress, that is all. It is not good to rely on the hook alone to receive the events. The reason behind this is if someone has whispers disabled on the default chat frame, you will not receive any more whispers. If the user has whispers showing on the default frame and any other tab on their chat frame, WIM will receive 2-3 (respectively) of the same whisper events and therefore cause duplicate messages showing.


That is why the events are handled the way they are.

If I am missing something, or did not explain something correctly, please let me know. Thanks for the advice.

I totally understand the reason why WIM is catching events on its own as well as through hooking the message handler, but let's say the user totally don't want to get any whispers at all, shouldn't that be allowed? Can WIM prompt the user if it detects whisper on more than 1 chatframe or if whisper is not registered on any chatframe? Otherwise, mods doing filtering will have to hook both blizzard's chatframe and WIM's hook or use WIM's filter api.

Also a question on using the filter api. My mods generate a large bunch of whispers without any fixed prefix or suffix. Do I add every single whisper using the filter api? If I do so, does WIM remove the filters after it is suppressed (memory concern)?
Logged
Pazza
Administrator
Hero Member
*****

Karma: +89/-15
Offline Offline

Posts: 1375


Effin A


View Profile WWW
« Reply #4 on: March 17, 2007, 06:20:45 PM »

Well. I don't think WIM should nag the users based off of their personal settings. if they want to not receive whispers at all, they can disable wim from the option screen. Then WIM will no longer catch anything and they can turn whisps off themselves in the chat frames.

As far as the Filter API, it is simply an interface to filter out extra messages prior to WIM processing its own filter definitions. How you decide to interpret the messages is up to you. Having prefixes in your messages would make things a whole lot easier. Then you can have your addon load a filter into WIM itself. I can explain that later. I will probably add that to the API section as well. All it involves is populating a table key and val. Example...

Code:
WIM_Filters["my filter pattern"] = "Ignore";

or

Code:
WIM_Filters["my filter pattern"] = "Block";


Your addon can call this. This way it will always be loaded into WIM.

As far as your messages are sent, you would need to apply some sort of regular expression to identify your messages. Unfortunately that is all I can think of.
Logged

My hobbies consume way too much time :-).
Pages: [1]
Print
Jump to:  

You must be logged in to send a message to the shout box.
     
  test stamp