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