Reply
Thread Tools Display Modes
Unread 02-05-13, 02:30 PM   #1
jlrm365
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 52
Only messages with [LINKS] in trade?

I'm sure I remember seeing an addon that would not allow the display of messages in Trade channel, unless those messages contained links.

I hope that someone knows what this addon is / was, so that I can go and grab it.

I want to see people advertising their wares, so want to stay in trade, but the pointless chat often fills the screen and makes seeing genuine trade ads harder than it needs to be.

So..

Does an addon exist, that only allows you to see Trade channel messages with links?

Thanks.
jlrm365 is offline   Reply With Quote
Unread 02-06-13, 12:08 AM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,591
If you want to see all types of links:
Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)
If you only want to see specific types of links (eg. only item, enchant, and tradeskill links):
Code:
local AllowedLinkTypes = {
    enchant = true,
    item = true,
    trade = true,
}
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" then
        local linkType = message:match("|H(.-):") or "none"
        return not AllowedLinkTypes[linkType]
    end
end)
For either, change "Trade - City" to the full name of the trade channel in your language.

If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/
__________________
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
Unread 02-06-13, 06:27 AM   #3
jlrm365
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 52
Cool

Originally Posted by Phanx View Post
If you want to see all types of links:
Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)
If you only want to see specific types of links (eg. only item, enchant, and tradeskill links):
Code:
local AllowedLinkTypes = {
    enchant = true,
    item = true,
    trade = true,
}
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" then
        local linkType = message:match("|H(.-):") or "none"
        return not AllowedLinkTypes[linkType]
    end
end)
For either, change "Trade - City" to the full name of the trade channel in your language.

If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/
That post is a near revelation - for the code and the link.

I tweaked the product of that site, so the TOC and LUA shared the same name, but the automation it makes possible is a great help.

I'm going to test the addon now
Thanks.

EDIT:

It works. I prefer the first - as it does just what I wanted, in a micro fashion - but I have some ideas (for the second and in general) and so sent you a PM.

Last edited by jlrm365 : 02-06-13 at 09:19 AM. Reason: Results
jlrm365 is offline   Reply With Quote
Unread 02-07-13, 03:38 AM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,591
If you have a question, post it on the forums. I read 99% of everything posted on these forums, and will reply if I can help, as will dozens of other community members.

I do not provide any kind of private support or tutoring, and all PMs/emails asking for private support or tutoring will be either ignored, or replied to with a form letter suggesting you post a forum thread.
__________________
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
Unread 02-08-13, 02:10 PM   #5
jlrm365
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 52
Question

Originally Posted by Phanx View Post
If you have a question, post it on the forums. I read 99% of everything posted on these forums, and will reply if I can help, as will dozens of other community members.

I do not provide any kind of private support or tutoring, and all PMs/emails asking for private support or tutoring will be either ignored, or replied to with a form letter suggesting you post a forum thread.
Getting to the point then:

Your first "If you want to see all types of links" version is what I consider to be a perfect "micro addon" - under 6 lines, does one thing and does it well.
Is that your own code or is it generic?

Either way, would you mind if I turned it into an addon, uploaded it and credited you (as I have done with a couple of other micro addons)?

I've been using it and it's brilliant. I think it's something that would save the sanity of a lot of people.
Thanks.

jlrm365 is offline   Reply With Quote
Unread 02-08-13, 11:32 PM   #6
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,591
It is "my own code" in the sense that I typed it into the forum's text box without copying or reading from anywhere else, but it is also extremely "generic" in the sense that anyone with a basic understanding of Lua and the the WoW chat filtering API would write pretty much the same code. Feel free to do whatever you want with it. If you do want to give me credit, please make sure it is clear that I am not involved with the addon and people should contact you about bugs/suggestions, not me.
__________________
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
Reply

Go BackWoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Only messages with [LINKS] in trade?

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