| 1 | # | ||
| 2 | # $Id: o2sms.pm 288 2006-08-01 18:04:33Z mackers $ | ||
| 3 | |||
| 4 | package WWW::SMS::IE::aftsms; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | WWW::SMS::IE::aftsms - A module to send SMS messages using the AFT gateway. | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | require WWW::SMS::IE::aftsms; | ||
| 13 | |||
| 14 | my $carrier = new WWW::SMS::IE::aftsms; | ||
| 15 | |||
| 16 | if ($carrier->login('aft_user', 'password')) | ||
| 17 | { | ||
| 18 | my $retval = $carrier->send('+353865551234', 'Hello World!'); | ||
| 19 | |||
| 20 | if (!$retval) | ||
| 21 | { | ||
| 22 | print $carrier->error() . "\n"; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | L<WWW::SMS::IE::o2sms> is a class to send SMS messages via the command line | ||
| 29 | using the AFT gateway. | ||
| 30 | |||
| 31 | For more information see L<WWW::SMS::IE::iesms>, | ||
| 32 | L<http://computer.donutsoft.net/sms/pmwiki.php?n=Main.HomePage> | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | use strict; | ||
| 37 | use warnings; | ||
| 38 | use vars qw( $VERSION ); | ||
| 39 | $VERSION = sprintf("0.%02d", q$Revision: 288 $ =~ /(\d+)/); | ||
| 40 | |||
| 41 | @WWW::SMS::IE::aftsms::ISA = qw{WWW::SMS::IE::iesms}; | ||
| 42 | |||
| 43 | use constant LOGIN_START_STEP => 0; | ||
| 44 | use constant LOGIN_END_STEP => 0; | ||
| 45 | use constant SEND_START_STEP => 0; | ||
| 46 | use constant SEND_END_STEP => undef; | ||
| 47 | use constant REMAINING_MESSAGES_MATCH => 1; | ||
| 48 | use constant ACTION_FILE => "aftsms.action"; | ||
| 49 | use constant SIMULATED_DELAY_MIN => 0; | ||
| 50 | use constant SIMULATED_DELAY_MAX => 0; | ||
| 51 | use constant SIMULATED_DELAY_PERCHAR => 0; | ||
| 52 | |||
| 53 | sub _init | ||
| 54 | { | ||
| 55 | my $self = shift; | ||
| 56 | |||
| 57 | $self->_log_debug("creating new instance of aft carrier"); | ||
| 58 | |||
| 59 | $self->_login_start_step(LOGIN_START_STEP); | ||
| 60 | $self->_login_end_step(LOGIN_END_STEP); | ||
| 61 | $self->_send_start_step(SEND_START_STEP); | ||
| 62 | $self->_send_end_step(SEND_END_STEP); | ||
| 63 | $self->_remaining_messages_match(REMAINING_MESSAGES_MATCH); | ||
| 64 | $self->_action_file(ACTION_FILE); | ||
| 65 | $self->_simulated_delay_max(SIMULATED_DELAY_MAX); | ||
| 66 | $self->_simulated_delay_min(SIMULATED_DELAY_MIN); | ||
| 67 | $self->_simulated_delay_perchar(SIMULATED_DELAY_PERCHAR); | ||
| 68 | |||
| 69 | $self->full_name("AFT"); | ||
| 70 | $self->domain_name("sms.donutsoft.net"); | ||
| 71 | |||
| 72 | if ($self->is_win32()) | ||
| 73 | { | ||
| 74 | $self->config_dir($ENV{TMP}); | ||
| 75 | $self->config_file($self->_get_home_dir() . "aftsms.ini"); | ||
| 76 | $self->message_file("aftsms_lastmsg.txt"); | ||
| 77 | $self->history_file("aftsms_history.txt"); | ||
| 78 | $self->cookie_file("aftsms.cookie"); | ||
| 79 | $self->action_state_file("aftsms.state"); | ||
| 80 | } | ||
| 81 | else | ||
| 82 | { | ||
| 83 | $self->config_dir($self->_get_home_dir() . "/.aftsms/"); | ||
| 84 | $self->config_file("config"); | ||
| 85 | $self->message_file("lastmsg"); | ||
| 86 | $self->history_file("history"); | ||
| 87 | $self->cookie_file(".cookie"); | ||
| 88 | $self->action_state_file(".state"); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | sub login | ||
| 93 | { | ||
| 94 | my ($self, $username, $password) = @_; | ||
| 95 | |||
| 96 | $self->_log_debug("performing dummy login for aft..."); | ||
| 97 | |||
| 98 | $self->_init_tg4w_runner() if (!$self->{tg4w_runner}); | ||
| 99 | |||
| 100 | $self->username($username) if (defined($username)); | ||
| 101 | $self->password($password) if (defined($password)); | ||
| 102 | |||
| 103 | return 1; | ||
| 104 | } | ||
| 105 | |||
| 106 | sub is_logged_in | ||
| 107 | { | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | sub is_aft | ||
| 112 | { | ||
| 113 | return 1; | ||
| 114 | } | ||
| 115 | |||
| 116 | =head1 DISCLAIMER | ||
| 117 | |||
| 118 | The author accepts no responsibility nor liability for your use of this | ||
| 119 | software. Please read the terms and conditions of the website of your mobile | ||
| 120 | provider before using the program. | ||
| 121 | |||
| 122 | =head1 SEE ALSO | ||
| 123 | |||
| 124 | L<WWW::SMS::IE::iesms> | ||
| 125 | |||
| 126 | L<http://www.mackers.com/projects/o2sms/> | ||
| 127 | |||
| 128 | L<http://computer.donutsoft.net/sms/pmwiki.php?n=Main.HomePage> | ||
| 129 | |||
| 130 | =head1 AUTHOR | ||
| 131 | |||
| 132 | David McNamara (me.at.mackers.dot.com) | ||
| 133 | |||
| 134 | =head1 COPYRIGHT | ||
| 135 | |||
| 136 | Copyright 2000-2006 David McNamara | ||
| 137 | |||
| 138 | This program is free software; you can redistribute it and/or modify it under | ||
| 139 | the same terms as Perl itself. | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | 1; |