| 1 | # $Id: General.pm,v 1.3 2003/04/08 00:27:30 cwest Exp $ | ||
| 2 | package POEST::Plugin::General; | ||
| 3 | |||
| 4 | =pod | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | POEST::Plugin::General - General SMTP commands implemented. | ||
| 9 | |||
| 10 | =head1 ABSTRACT | ||
| 11 | |||
| 12 | This class implements general SMTP commands, in order to get them | ||
| 13 | out of the way. | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | There are some SMTP commands that are fairly straight forward | ||
| 18 | to implement, they are implemented here. | ||
| 19 | |||
| 20 | =cut | ||
| 21 | |||
| 22 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | $^W = 1; | ||
| 24 | |||
| 25 | 1 | ▶ | use vars qw[$VERSION @ISA]; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | $VERSION = (qw$Revision: 1.3 $)[1]; | ||
| 27 | |||
| 28 | 0 | ▶ | use POEST::Plugin; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 29 | @ISA = qw[POEST::Plugin]; | ||
| 30 | |||
| 31 | =head2 Events | ||
| 32 | |||
| 33 | =head3 HELO | ||
| 34 | |||
| 35 | Returns the response for C<HELO>. | ||
| 36 | |||
| 37 | =head3 ELOH | ||
| 38 | |||
| 39 | Returns a simple "Ok" response to C<ELOH>. | ||
| 40 | |||
| 41 | =head3 NOOP | ||
| 42 | |||
| 43 | Returns the response for C<NOOP>. | ||
| 44 | |||
| 45 | =head3 QUIT | ||
| 46 | |||
| 47 | Returns the response for C<QUIT>. | ||
| 48 | |||
| 49 | =head3 send_banner | ||
| 50 | |||
| 51 | Sends the banner for the SMTP server when a session initializes. This | ||
| 52 | is how an SMTP server introduces itself to the client. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | sub EVENTS () { [ qw[ HELO ELOH NOOP QUIT send_banner ] ] } | ||
| 57 | |||
| 58 | =head2 Configuration | ||
| 59 | |||
| 60 | =head3 hostname | ||
| 61 | |||
| 62 | The hostname that we run as a primary. This is used when sending the | ||
| 63 | banner. | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | sub CONFIG () { [ qw[ hostname ] ] } | ||
| 68 | |||
| 69 | sub send_banner { | ||
| 70 | my ($kernel, $self, $heap) = @_[KERNEL, OBJECT, HEAP]; | ||
| 71 | my $client = $heap->{client}; | ||
| 72 | |||
| 73 | my $banner = "$self->{hostname} ESMTP poest/v0.1"; | ||
| 74 | |||
| 75 | $client->put( SMTP_SERVICE_READY, $banner ); | ||
| 76 | } | ||
| 77 | |||
| 78 | sub HELO { | ||
| 79 | my ($kernel, $self, $heap) = @_[KERNEL, OBJECT, HEAP]; | ||
| 80 | my $client = $heap->{client}; | ||
| 81 | |||
| 82 | $client->put( SMTP_OK, qq[$self->{hostname} Ok] ); | ||
| 83 | } | ||
| 84 | |||
| 85 | sub ELOH { | ||
| 86 | my ($kernel, $self, $heap) = @_[KERNEL, OBJECT, HEAP]; | ||
| 87 | my $client = $heap->{client}; | ||
| 88 | |||
| 89 | $client->put( SMTP_OK, qq[$self->{hostname} Ok] ); | ||
| 90 | } | ||
| 91 | |||
| 92 | sub NOOP { | ||
| 93 | my $client = $_[HEAP]->{client}; | ||
| 94 | |||
| 95 | $client->put( SMTP_OK, q[Ok] ); | ||
| 96 | } | ||
| 97 | |||
| 98 | sub QUIT { | ||
| 99 | my ($kernel, $heap) = @_[KERNEL, HEAP]; | ||
| 100 | my $client = $heap->{client}; | ||
| 101 | |||
| 102 | $client->put( SMTP_QUIT, q[Bye!] ); | ||
| 103 | $heap->{shutdown_now} = 1; | ||
| 104 | } | ||
| 105 | |||
| 106 | 1; | ||
| 107 | |||
| 108 | __END__ | ||