[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filters



On Wed, 2003-03-26 at 18:35, Dagmar d'Surreal wrote:

> 
> Two things, one because I don't normally do anything with python that
> doesn't involve a gun to my head...
> 
> 1. What are XCHAT_EAT_XCHAT and XCHAT_EAT_ALL equivalent to, and what
> does EAT stand for there?

XCHAT_EAT_NONE, XCHAT_EAT_ALL, XCHAT_EAT_XCHAT and XCHAT_EAT_PLUGIN are
constants for the C plugin API that are used as return values for event
handlers, to control further handling of that event.
XCHAT_EAT_NONE:
	both X-Chat's core and other plugins will receive that event
XCHAT_EAT_ALL:
	neither X-Chat's core or other plugins will receive that event
XCHAT_EAT_XCHAT:
	X-Chat's core will not receive that event, but other plugins will
XCHAT_EAT_PLUGIN:
	X-Chat's core will receive that event but other plugins won't

For python scripts, its equivalents are xchat.EAT_NONE, xchat.EAT_ALL,
xchat.EAT_XCHAT and xchat.EAT_PLUGIN.


> 2. The following from the URL above seems very unsafe...
> 
>     if re.search('#', noColor) or \
>            re.search('http://', noColor, re.I) or \
>            re.search('www\.', noColor, re.I):
>         xchat.command('RAW NOTICE %s :Your message has been classified as spam '\
>                       'and ignored!' % sourceNick)
>         return xchat.EAT_XCHAT    
> 
> I've not had time to audit through X-Chat's code to see exactly how it handles
> avoiding flooding the server, but with other clients in the past /raw commands
> typically bypassed throttling routines (for good reason)  This could be
> problematic... I'd like to suggest simply storing a epoch seconds in a global
> variable before exiting this subroutine, and on entry comparing to see if it's
> the same as the current time to decide whether or not to bother warning the
> user their message has been refused. 

Indeed, a very wise suggestion. Thank you.

-- 
	Ricardo

This is a digitally signed message part