Thread Tools Display Modes
02-05-13, 02:30 PM   #1
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
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.
  Reply With Quote
02-06-13, 12:08 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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/
__________________
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-06-13, 06:27 AM   #3
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
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
  Reply With Quote
02-07-13, 03:38 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
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-08-13, 02:10 PM   #5
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
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.

  Reply With Quote
02-08-13, 11:32 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
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

WoWInterface » 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