ThreatNet::IRC::Envelope - IRC envelope for ThreatNet::Message objects
# 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); }
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.
ThreatNet::Message
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.
ThreatNet::IRC::Envelope
"envelope"
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.
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.
new
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.
undef
The message accessor returns the contents of the envelope, a ThreatNet::Message (or sub-class) object.
message
The who accessor returns the identification string of the source IRC client.
who
The where accessor returns the name of the channel that the message occured in.
where
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
Adam Kennedy <adamk@cpan.org>
http://ali.as/threatnet/
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.
To install ThreatNet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ThreatNet
CPAN shell
perl -MCPAN -e shell install ThreatNet
For more information on module installation, please visit the detailed CPAN module installation guide.