|
From: Alfred E. <alf...@ho...> - 2000-08-03 05:55:02
|
FAQ: HOW TO USE THE FILTER SYSTEM
1. Q: When is it appropriate to use toc filters?
Q: When is it appropriate to use preproc filters?
A: Basically, if you're writing a component with filters, you want to
directly access the toc functions to avoid calling the
preproc_register
function before it's loaded. If you're writing a package, or just
adding some of your own filters, you want to use the preproc
functions.
2. Q: How do I make my own filters?
A: First thing to do is to create a function that contains your filter
code:
proc Some_filter {msg args} {
....Some code
return $filtered_msg
}
msg = the incoming text
args = additional arguments, like the $id used by some chat
filters
filtered_msg = the text once you're done with it
Then you need to register it:
toc_register_filter connName type Some_filter
for components or
preproc::register connName type Some_filter optional_comments
connName = $::SCREENNAME or * (usually *)
type = type of filter [see #3]
Some_filter = your function name
optional_comments = variable containing comments for preproc filters
3. Q: What are the filter types?
A: These are available for both the toc and preproc functions
IM_OUT -- outgoing IM's
IM_IN -- incoming IM's
CHAT_OUT -- outgoing CHAT's
CHAT_IN -- incoming CHAT's
These are for available for just preproc
OUT -- both outgoing IM's and CHAT's
IN -- both incoming IM's and CHAT's
4. Q: How do I unload filters when my package is unloaded?
A: You use:
toc_unregister_filter connName type func
for components and
preproc::unregister connName type func
for packages and all else.
connName = $::SCREENNAME or * (usually *)
type = type of filter [see #3]
func = name of your filter function
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
|