NAME
ThreatNet::IRC::Envelope - IRC envelope for ThreatNet::Message objects
SYNOPSIS
# Handle messages as provided from an IRC channel
sub handle_message {
my $envelope = shift;
# Only trust messages from our network
return unless $envelope->who =~ /\.mydomain.com$/;
# Filter out anything local
my $message = $envelope->message;
return unless $LocalFilter->keep($message);
do_something($message);
}
DESCRIPTION
ThreatNet::Message
objects can be created and moved around from and to a variety of places. However, when freshly recieved from an IRC channel, you may wish to apply logic to them based on special IRC-specific considerations.
The ThreatNet::IRC::Envelope
class provides special "envelope"
objects containing the actual message objects. The channel listener is able to apply specific logic to these envelopes, before the message itself is extracted and moves further into a system.
The primary use for these envelopes is to allow for applying trust rules on a sub-channel level. For example, trusting messages that come from a specific bot in a channel when the channel as a whole is untrusted.
METHODS
new $Message, $who, $where
The new
constructor creates a new IRC envelope for a particular message. It is most likely to happen inside the IRC/ThreatNet connector code, rather than in your own code.
Takes as argument a ThreatNet::Message object, the identifier of the source node, and then channel name in which the message occured.
Returns a new ThreatNet::IRC::Envelope
object, or undef
on error.
message
The message
accessor returns the contents of the envelope, a ThreatNet::Message (or sub-class) object.
who
The who
accessor returns the identification string of the source IRC client.
where
The where
accessor returns the name of the channel that the message occured in.
SUPPORT
All bugs should be filed via the bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ThreatNet-IRC
For other issues, or commercial enhancement and support, contact the author
AUTHORS
Adam Kennedy <adamk@cpan.org>
SEE ALSO
COPYRIGHT
Copyright (c) 2005 Adam Kennedy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.