Documentation | ApplicationKit | MessageFilter
SYNOPSIS
Perl
use HaikuR1::MessageFilter qw(B_ANY_DELIVERY B_ANY_SOURCE); my $filter1 = HaikuR1::MessageFilter->new(...); my $filter2 = HaikuR1::MessageFilter->new($filter1); $handler->AddFilter($filter1); $handler->AddFilter($filter2);
Python
from HaikuR1.ApplicationKit import MessageFilter, B_ANY_DELIVERY B_ANY_SOURCE filter1 = MessageFilter(...) filter2 = MessageFilter(filter1) handler->AddFilter(filter1) handler->AddFilter(filter2)
DESCRIPTION
Exposes the BMessageFilter
object.
For more information on MessageFilter, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a MessageFilter.
Perl
HaikuR1::MessageFilter->new($copy_from); HaikuR1::MessageFilter->new( delivery => $delivery, source => $source, what => $what, hook => $hook, );
Python
MessageFilter(copy_from) MessageFilter( delivery = delivery, source = source, what = what, hook = hook, )
copy_from
A MessageFilter to copy.
delivery
A constant specifying the delivery method; defaults to
B_ANY_DELIVERY
. Only messages delivered by the specified method will be filtered.source
A constant specifying the type of source; defaults to
B_ANY_SOURCE
. Only messages from the specified type of source will be filtered.what
An integer command constant, if set, only messages whose
what
property matches will be filtered.hook
A hook function; if supplied here, this function will be called to do the filtering; otherwise, the Filter hook will be called. This function will take three arguments: the Message, the target Handler, and the MessageFilter itself. It should return the empty value to indicate the message should be skipped, or a target Handler, which may either be the same target that was passed in or a new target.
copy
Copies the contents of another object into this object.
Perl
$messagefilter->copy($copy_from);
Python
messagefilter.copy(copy_from)
copy_from
A MessageFilter to copy.
Command
Returns the command (the what
of the message being filtered).
Perl
$messagefilter->Command();
Python
messagefilter.Command()
FiltersAnyCommand
Returns true if no message command was specified for the filter; false if a command was specified.
Perl
$messagefilter->FiltersAnyCommand();
Python
messagefilter.FiltersAnyCommand()
Looper
Returns the Looper whose messages are filtered by this filter, or the empty value if the filter has not been assigned to a Looper. (Note: When a Looper is deleted, or when its SetFilterList has been called to replace or remove the filter list, all filters assigned to it will be deleted.)
Perl
$messagefilter->Looper();
Python
messagefilter.Looper()
MessageDelivery
Returns the delivery method.
Perl
$messagefilter->MessageDelivery();
Python
messagefilter.MessageDelivery()
MessageSource
Returns the source type.
Perl
$messagefilter->MessageSource();
Python
messagefilter.MessageSource()
HOOKS
Filter
Called to filter a Message; should return the new target Handler (which may be the same as the original target), or the empty value if the Message should be skipped.
Perl
$messagefilter->Filter($message, $target);
Python
messagefilter.Filter(message, target)
message
A Message, the Message to filter.
target
A Handler, the original target.
CONSTANTS
Message delivery methods
Perl
use HaikuR1::Roster qw(:message_delivery)
Python
Python does not support export tags.
B_ANY_DELIVERY
Specifies that a filter accepts messages delivered by any method.
B_DROPPED_DELIVERY
Specifies that a filter accepts messages delivered by drag-and-drop.
B_PROGRAMMED_DELIVERY
Specifies that a filter accepts messages delivered programmatically.
Message source types
Perl
use HaikuR1::Roster qw(:message_source)
Python
Python does not support export tags.
B_ANY_SOURCE
Specifies that a filter accepts messages from any source.
B_REMOTE_SOURCE
Specifies that a filter accepts messages from remote sources.
B_LOCAL_SOURCE
Specifies that a filter accepts messages from local sources.