line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
################################################################################
|
2
|
|
|
|
|
|
|
# Copyright (c) 2001-2004 Simplewire. All rights reserved.
|
3
|
|
|
|
|
|
|
#
|
4
|
|
|
|
|
|
|
# Net::SMS.pm, version 2.63
|
5
|
|
|
|
|
|
|
#
|
6
|
|
|
|
|
|
|
#
|
7
|
|
|
|
|
|
|
# Simplewire, Inc. grants to Licensee, a non-exclusive, non-transferable,
|
8
|
|
|
|
|
|
|
# royalty-free and limited license to use Licensed Software internally for
|
9
|
|
|
|
|
|
|
# the purposes of evaluation only. No license is granted to Licensee
|
10
|
|
|
|
|
|
|
# for any other purpose. Licensee may not sell, rent, loan or otherwise
|
11
|
|
|
|
|
|
|
# encumber or transfer Licensed Software in whole or in part,
|
12
|
|
|
|
|
|
|
# to any third party.
|
13
|
|
|
|
|
|
|
#
|
14
|
|
|
|
|
|
|
# For more information on this license, please view the License.txt file
|
15
|
|
|
|
|
|
|
# included with your download or visit www.simplewire.com
|
16
|
|
|
|
|
|
|
#
|
17
|
|
|
|
|
|
|
################################################################################
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
20
|
|
|
|
|
|
|
# User documentation within and more is in POD format is at end of
|
21
|
|
|
|
|
|
|
# this file. Search for =head
|
22
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
package Net::SMS;
|
25
|
|
|
|
|
|
|
require 5.002;
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
28
|
|
|
|
|
|
|
# Other module use
|
29
|
|
|
|
|
|
|
#---------------------------------------------------------------------
|
30
|
1
|
|
|
1
|
|
25837
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
31
|
1
|
|
|
1
|
|
2017
|
use Unicode::String qw(utf8 latin1 utf16);
|
|
1
|
|
|
|
|
8652
|
|
|
1
|
|
|
|
|
98
|
|
32
|
1
|
|
|
1
|
|
11
|
use Exporter;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
33
|
1
|
|
|
1
|
|
2010
|
use XML::Parser;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use LWP::UserAgent;
|
35
|
|
|
|
|
|
|
use HTTP::Request;
|
36
|
|
|
|
|
|
|
use HTTP::Response;
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# for exporting
|
39
|
|
|
|
|
|
|
our(@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
@ISA = qw(Exporter);
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# symbols to export by default
|
44
|
|
|
|
|
|
|
@EXPORT = qw();
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# symbols to export on request
|
47
|
|
|
|
|
|
|
@EXPORT_OK = qw();
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# tagged sets of symbols
|
50
|
|
|
|
|
|
|
%EXPORT_TAGS = (content => [qw(CONTENT_TYPE_TEXT CONTENT_TYPE_RINGTONE CONTENT_TYPE_ICON CONTENT_TYPE_LOGO CONTENT_TYPE_PICTURE CONTENT_TYPE_PROFILE CONTENT_TYPE_SETTING CONTENT_TYPE_EMS CONTENT_TYPE_WAPPUSH)],
|
51
|
|
|
|
|
|
|
encoding => [qw(ENC_7BIT ENC_8BIT ENC_UCS2)],
|
52
|
|
|
|
|
|
|
proxy => [qw(PROXY_TYPE_NONE PROXY_TYPE_HTTP)] );
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# add to @EXPORT
|
55
|
|
|
|
|
|
|
Exporter::export_tags('content');
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# add to @EXPORT_OK
|
58
|
|
|
|
|
|
|
Exporter::export_ok_tags('encoding', 'proxy');
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
######################################################################
|
61
|
|
|
|
|
|
|
# Constants
|
62
|
|
|
|
|
|
|
######################################################################
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ONLY NEED TO CHANGE VERSION NUMBER HERE....
|
65
|
|
|
|
|
|
|
$VERSION = '2.64';
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# for constant values <=> string values
|
68
|
|
|
|
|
|
|
our (@CONTENT_TYPE, @ENC, @PROXY_TYPE);
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub CONTENT_TYPE_TEXT () { "text" }
|
71
|
|
|
|
|
|
|
sub CONTENT_TYPE_DATA () { "data" }
|
72
|
|
|
|
|
|
|
sub CONTENT_TYPE_RINGTONE () { "ringtone" }
|
73
|
|
|
|
|
|
|
sub CONTENT_TYPE_ICON () { "icon" }
|
74
|
|
|
|
|
|
|
sub CONTENT_TYPE_LOGO () { "logo" }
|
75
|
|
|
|
|
|
|
sub CONTENT_TYPE_PICTURE () { "picture" }
|
76
|
|
|
|
|
|
|
sub CONTENT_TYPE_PROFILE () { "profile" }
|
77
|
|
|
|
|
|
|
sub CONTENT_TYPE_SETTING () { "setting" }
|
78
|
|
|
|
|
|
|
sub CONTENT_TYPE_EMS () { "ems" }
|
79
|
|
|
|
|
|
|
sub CONTENT_TYPE_WAP_PUSH () { "wap_push" }
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# content type constants
|
82
|
|
|
|
|
|
|
@CONTENT_TYPE = (undef, "text", "data", "ringtone", "icon", "logo", "picture", "profile", "setting", "ems", "wap_push");
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub ENC_7BIT () { "7bit" }
|
85
|
|
|
|
|
|
|
sub ENC_8BIT () { "8bit" }
|
86
|
|
|
|
|
|
|
sub ENC_UCS2 () { "ucs2" }
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# encoding constants
|
89
|
|
|
|
|
|
|
@ENC = (undef, "7bit", "8bit", "ucs2");
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub PROXY_TYPE_NONE () { "none" }
|
92
|
|
|
|
|
|
|
sub PROXY_TYPE_HTTP () { "http" }
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# proxy constants
|
95
|
|
|
|
|
|
|
@PROXY_TYPE = (undef, "none", "http");
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
######################################################################
|
98
|
|
|
|
|
|
|
# Net::SMS->new();
|
99
|
|
|
|
|
|
|
#
|
100
|
|
|
|
|
|
|
######################################################################
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# validates an option is in an array
|
103
|
|
|
|
|
|
|
# arg1 is the variable to look for
|
104
|
|
|
|
|
|
|
# arg2 is a reference to an array to search
|
105
|
|
|
|
|
|
|
# returns 1 if found, 0 if not found
|
106
|
|
|
|
|
|
|
sub _validate_constant {
|
107
|
|
|
|
|
|
|
# first argument is constant
|
108
|
|
|
|
|
|
|
my $var = shift();
|
109
|
|
|
|
|
|
|
# second argument is reference to array
|
110
|
|
|
|
|
|
|
my @opts = @{ shift() };
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $success = 0;
|
113
|
|
|
|
|
|
|
foreach my $opt (@opts) {
|
114
|
|
|
|
|
|
|
# return true
|
115
|
|
|
|
|
|
|
return 1 if ($var eq $opt);
|
116
|
|
|
|
|
|
|
}
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# return false
|
119
|
|
|
|
|
|
|
return 0;
|
120
|
|
|
|
|
|
|
}
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# validates a boolean value
|
123
|
|
|
|
|
|
|
sub _validate_bool {
|
124
|
|
|
|
|
|
|
# first argument is variable
|
125
|
|
|
|
|
|
|
my $var = shift();
|
126
|
|
|
|
|
|
|
# test the truth value, defaulting to false
|
127
|
|
|
|
|
|
|
if ($var eq "true" || $var eq 1) {
|
128
|
|
|
|
|
|
|
return 1;
|
129
|
|
|
|
|
|
|
}
|
130
|
|
|
|
|
|
|
return 0;
|
131
|
|
|
|
|
|
|
}
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# tests whether SSL is available
|
134
|
|
|
|
|
|
|
sub _is_ssl_avail {
|
135
|
|
|
|
|
|
|
my $http = LWP::UserAgent->new();
|
136
|
|
|
|
|
|
|
return $http->is_protocol_supported('https');
|
137
|
|
|
|
|
|
|
}
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# prints out xml value of a bool
|
140
|
|
|
|
|
|
|
sub _return_bool {
|
141
|
|
|
|
|
|
|
my $var = shift();
|
142
|
|
|
|
|
|
|
if ($var) {
|
143
|
|
|
|
|
|
|
return "true";
|
144
|
|
|
|
|
|
|
}
|
145
|
|
|
|
|
|
|
return "false";
|
146
|
|
|
|
|
|
|
}
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub new {
|
149
|
|
|
|
|
|
|
my $that = shift;
|
150
|
|
|
|
|
|
|
my $class = ref($that) || $that;
|
151
|
|
|
|
|
|
|
local $_;
|
152
|
|
|
|
|
|
|
my %args;
|
153
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
154
|
|
|
|
|
|
|
# Define default package vars
|
155
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
156
|
|
|
|
|
|
|
# Placeholder
|
157
|
|
|
|
|
|
|
my $self = {NOTHING => 'nothing'};
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
bless($self, $class);
|
160
|
|
|
|
|
|
|
$self->reset();
|
161
|
|
|
|
|
|
|
return $self;
|
162
|
|
|
|
|
|
|
}
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub reset {
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# pop value
|
168
|
|
|
|
|
|
|
my $self = shift();
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
171
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
174
|
|
|
|
|
|
|
# Define default package vars
|
175
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
176
|
|
|
|
|
|
|
$self->{DEBUG} = 0;
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
$self->{m_SoftwareVendor} = "Simplewire, Inc.";
|
179
|
|
|
|
|
|
|
$self->{m_SoftwareWebsite} = "www.simplewire.com";
|
180
|
|
|
|
|
|
|
$self->{m_SoftwareTitle} = "Perl SMS Software Development Kit";
|
181
|
|
|
|
|
|
|
$self->{m_SoftwareVersion} = substr($VERSION, 0, length($VERSION)-1) . "." . chop($VERSION);
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
$self->{m_CarrierList} = [];
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
$self->{m_ClientStatusCode} = -1;
|
186
|
|
|
|
|
|
|
$self->{m_ClientStatusDesc} = '';
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
$self->{m_ErrorCode} = 0;
|
189
|
|
|
|
|
|
|
$self->{m_ErrorDescription} = undef;
|
190
|
|
|
|
|
|
|
$self->{m_ErrorResolution} = undef;
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$self->{m_StatusCode} = undef;
|
193
|
|
|
|
|
|
|
$self->{m_StatusDescription} = undef;
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$self->{m_NetworkId} = undef;
|
196
|
|
|
|
|
|
|
$self->{m_DestAddr} = undef;
|
197
|
|
|
|
|
|
|
$self->{m_SourceAddr} = undef;
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
$self->{m_TicketId} = undef;
|
200
|
|
|
|
|
|
|
$self->{m_TicketFee} = undef;
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$self->{m_MsgFrom} = undef;
|
203
|
|
|
|
|
|
|
$self->{m_MsgImage} = undef;
|
204
|
|
|
|
|
|
|
$self->{m_MsgImageFilename} = undef;
|
205
|
|
|
|
|
|
|
$self->{m_MsgRingtone} = undef;
|
206
|
|
|
|
|
|
|
$self->{m_MsgData} = undef;
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
$self->{m_OptCountryCode} = undef;
|
209
|
|
|
|
|
|
|
$self->{m_OptEncoding} = undef;
|
210
|
|
|
|
|
|
|
$self->{m_OptFlash} = undef;
|
211
|
|
|
|
|
|
|
$self->{m_OptNetworkCode} = undef;
|
212
|
|
|
|
|
|
|
$self->{m_OptPhone} = undef;
|
213
|
|
|
|
|
|
|
$self->{m_OptType} = undef;
|
214
|
|
|
|
|
|
|
$self->{m_OptUrl} = undef;
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$self->{m_Udh} = undef;
|
217
|
|
|
|
|
|
|
$self->{m_OptUdhi} = 0;
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
$self->{m_Protocol} = 'paging';
|
220
|
|
|
|
|
|
|
$self->{m_Type} = undef;
|
221
|
|
|
|
|
|
|
$self->{m_Version} = '2.0';
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$self->{m_RequestXML} = undef;
|
224
|
|
|
|
|
|
|
$self->{m_ResponseXML} = undef;
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
$self->{m_ProxyType} = undef;
|
227
|
|
|
|
|
|
|
$self->{m_ProxyPassword} = undef;
|
228
|
|
|
|
|
|
|
$self->{m_ProxyPort} = 0;
|
229
|
|
|
|
|
|
|
$self->{m_ProxyHost} = undef;
|
230
|
|
|
|
|
|
|
$self->{m_ProxyUsername} = undef;
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
$self->{m_Secure} = 0;
|
233
|
|
|
|
|
|
|
$self->{m_ConnectionTimeout} = 30;
|
234
|
|
|
|
|
|
|
$self->{m_RemoteFile} = '/wmp';
|
235
|
|
|
|
|
|
|
$self->{m_RemoteHost} = 'wmp.simplewire.com';
|
236
|
|
|
|
|
|
|
$self->{m_RemotePort} = 0;
|
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
$self->{m_AccountId} = undef;
|
239
|
|
|
|
|
|
|
$self->{m_AccountPassword} = undef;
|
240
|
|
|
|
|
|
|
$self->{m_AccountBalance} = undef;
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
$self->{m_UserAgent} = 'Perl/SMS/' . $self->{m_SoftwareVersion};
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# added for EMS
|
245
|
|
|
|
|
|
|
$self->{m_OptContentType} = '';
|
246
|
|
|
|
|
|
|
$self->{m_EmsElements} = [];
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
}
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub account {
|
252
|
|
|
|
|
|
|
# pop value
|
253
|
|
|
|
|
|
|
my $self = shift();
|
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
256
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
$self->send('account');
|
259
|
|
|
|
|
|
|
# return success/failure
|
260
|
|
|
|
|
|
|
return $self->success();
|
261
|
|
|
|
|
|
|
}
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub accountBalance {
|
265
|
|
|
|
|
|
|
# pop value
|
266
|
|
|
|
|
|
|
my $self = shift();
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
269
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_AccountBalance} = shift(); }
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
return $self->{m_AccountBalance} if defined($self->{m_AccountBalance}) || return undef;
|
274
|
|
|
|
|
|
|
}
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
# new in 2.60
|
278
|
|
|
|
|
|
|
sub secure {
|
279
|
|
|
|
|
|
|
# pop value
|
280
|
|
|
|
|
|
|
my $self = shift();
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
283
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
if (@_ == 1) {
|
286
|
|
|
|
|
|
|
$self->{m_Secure} = _validate_bool(shift());
|
287
|
|
|
|
|
|
|
# check whether this was set to true
|
288
|
|
|
|
|
|
|
if ($self->{m_Secure} && !_is_ssl_avail()) {
|
289
|
|
|
|
|
|
|
die "SSL is not available for secure messaging";
|
290
|
|
|
|
|
|
|
}
|
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
}
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
return $self->{m_Secure} if defined($self->{m_Secure}) || return undef;
|
295
|
|
|
|
|
|
|
}
|
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub carrierList {
|
300
|
|
|
|
|
|
|
# pop value
|
301
|
|
|
|
|
|
|
my $self = shift();
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
304
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
return @{ $self->{m_CarrierList} };
|
307
|
|
|
|
|
|
|
}
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
sub list {
|
311
|
|
|
|
|
|
|
# pop value
|
312
|
|
|
|
|
|
|
my $self = shift();
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
315
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
$self->send('list');
|
318
|
|
|
|
|
|
|
# return success/failure
|
319
|
|
|
|
|
|
|
return $self->success();
|
320
|
|
|
|
|
|
|
}
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
# DEPRECATED TO list()
|
323
|
|
|
|
|
|
|
sub carrierListSend {
|
324
|
|
|
|
|
|
|
list(@_);
|
325
|
|
|
|
|
|
|
}
|
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub connectionTimeout {
|
329
|
|
|
|
|
|
|
# pop value
|
330
|
|
|
|
|
|
|
my $self = shift();
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
333
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ConnectionTimeout} = shift(); }
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
return $self->{m_ConnectionTimeout} if defined($self->{m_ConnectionTimeout}) || return undef;
|
338
|
|
|
|
|
|
|
}
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub debug {
|
342
|
|
|
|
|
|
|
# pop value
|
343
|
|
|
|
|
|
|
my $self = shift();
|
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
346
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
if (@_ == 1) { $self->{DEBUG} = shift(); }
|
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
return $self->{DEBUG} if defined($self->{DEBUG}) || return undef;
|
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
}
|
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
# DEPRECATED TO debug()
|
355
|
|
|
|
|
|
|
sub debugMode {
|
356
|
|
|
|
|
|
|
debug(@_);
|
357
|
|
|
|
|
|
|
}
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub errorCode {
|
361
|
|
|
|
|
|
|
# pop value
|
362
|
|
|
|
|
|
|
my $self = shift();
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
365
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ErrorCode} = shift(); }
|
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
return $self->{m_ErrorCode} if defined($self->{m_ErrorCode}) || return undef;
|
370
|
|
|
|
|
|
|
}
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub errorDescription {
|
373
|
|
|
|
|
|
|
# pop value
|
374
|
|
|
|
|
|
|
my $self = shift();
|
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
377
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ErrorDescription} = shift(); }
|
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
return $self->{m_ErrorDescription} if defined($self->{m_ErrorDescription}) || return undef;
|
382
|
|
|
|
|
|
|
}
|
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
# DEPRECATED TO errorDescription
|
386
|
|
|
|
|
|
|
sub errorDesc {
|
387
|
|
|
|
|
|
|
errorDescription(@_);
|
388
|
|
|
|
|
|
|
}
|
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub errorResolution {
|
392
|
|
|
|
|
|
|
# pop value
|
393
|
|
|
|
|
|
|
my $self = shift();
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
396
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ErrorResolution} = shift(); }
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
return $self->{m_ErrorResolution} if defined($self->{m_ErrorResolution}) || return undef;
|
401
|
|
|
|
|
|
|
}
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
sub isAccount {
|
405
|
|
|
|
|
|
|
# pop value
|
406
|
|
|
|
|
|
|
my $self = shift();
|
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
409
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "account");
|
412
|
|
|
|
|
|
|
return 0;
|
413
|
|
|
|
|
|
|
}
|
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
sub isList {
|
417
|
|
|
|
|
|
|
# pop value
|
418
|
|
|
|
|
|
|
my $self = shift();
|
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
421
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "list");
|
424
|
|
|
|
|
|
|
return 0;
|
425
|
|
|
|
|
|
|
}
|
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
# DEPRECATED TO isList()
|
429
|
|
|
|
|
|
|
sub isCarrierlist {
|
430
|
|
|
|
|
|
|
isList(@_);
|
431
|
|
|
|
|
|
|
}
|
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
sub isSubmit {
|
435
|
|
|
|
|
|
|
# pop value
|
436
|
|
|
|
|
|
|
my $self = shift();
|
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
439
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "submit");
|
442
|
|
|
|
|
|
|
return 0;
|
443
|
|
|
|
|
|
|
}
|
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
# DEPRECATED TO isSubmit()
|
446
|
|
|
|
|
|
|
sub isMsg {
|
447
|
|
|
|
|
|
|
isSubmit(@_);
|
448
|
|
|
|
|
|
|
}
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub isNotify {
|
451
|
|
|
|
|
|
|
# pop value
|
452
|
|
|
|
|
|
|
my $self = shift();
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
455
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "notify");
|
458
|
|
|
|
|
|
|
return 0;
|
459
|
|
|
|
|
|
|
}
|
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
sub isDeliver {
|
462
|
|
|
|
|
|
|
# pop value
|
463
|
|
|
|
|
|
|
my $self = shift();
|
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
466
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "deliver" || $self->{m_Type} eq "sendpage");
|
469
|
|
|
|
|
|
|
return 0;
|
470
|
|
|
|
|
|
|
}
|
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
sub isQuery {
|
473
|
|
|
|
|
|
|
# pop value
|
474
|
|
|
|
|
|
|
my $self = shift();
|
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
477
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
return 1 if ($self->{m_Type} eq "query");
|
480
|
|
|
|
|
|
|
return 0;
|
481
|
|
|
|
|
|
|
}
|
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# DEPRECATED TO isQuery()
|
484
|
|
|
|
|
|
|
sub isMsgStatus {
|
485
|
|
|
|
|
|
|
isQuery(@_);
|
486
|
|
|
|
|
|
|
}
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
sub sourceAddr {
|
490
|
|
|
|
|
|
|
# pop value
|
491
|
|
|
|
|
|
|
my $self = shift();
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
494
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
# if parameter list has length == 1, then pop value and set call back.
|
497
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_SourceAddr} = shift(); }
|
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
return $self->{m_SourceAddr} if defined($self->{m_SourceAddr}) || return undef;
|
500
|
|
|
|
|
|
|
}
|
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
# DEPRECATED TO sourceAddr
|
503
|
|
|
|
|
|
|
sub msgCallback {
|
504
|
|
|
|
|
|
|
sourceAddr(@_);
|
505
|
|
|
|
|
|
|
}
|
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
sub networkId {
|
509
|
|
|
|
|
|
|
# pop value
|
510
|
|
|
|
|
|
|
my $self = shift();
|
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
513
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
if (@_ == 1) { $self->{NetworkId} = shift(); }
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
return $self->{NetworkId} if defined($self->{NetworkId}) || return undef;
|
518
|
|
|
|
|
|
|
}
|
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
# DEPRECATED TO networkId
|
521
|
|
|
|
|
|
|
sub msgCarrierID {
|
522
|
|
|
|
|
|
|
networkId(@_);
|
523
|
|
|
|
|
|
|
}
|
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
sub msgCLIIconFilename {
|
527
|
|
|
|
|
|
|
# pop value
|
528
|
|
|
|
|
|
|
my $self = shift();
|
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
531
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
if (@_ == 1) {
|
534
|
|
|
|
|
|
|
my $file_path = shift();
|
535
|
|
|
|
|
|
|
my $hexResult = '';
|
536
|
|
|
|
|
|
|
my $buf;
|
537
|
|
|
|
|
|
|
my $fh;
|
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
540
|
|
|
|
|
|
|
binmode $fh;
|
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
while(read $fh, $buf, 1) {
|
543
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
544
|
|
|
|
|
|
|
}
|
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
close($fh);
|
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
$self->{m_MsgImageFilename} = $file_path;
|
549
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
550
|
|
|
|
|
|
|
$self->optContentType('icon');
|
551
|
|
|
|
|
|
|
#$self->{m_OptType} = 'icon';
|
552
|
|
|
|
|
|
|
}
|
553
|
|
|
|
|
|
|
return $self->{m_MsgImageFilename} if defined($self->{m_MsgImageFilename}) || return undef;
|
554
|
|
|
|
|
|
|
}
|
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
sub msgCLIIconHex {
|
558
|
|
|
|
|
|
|
# pop value
|
559
|
|
|
|
|
|
|
my $self = shift();
|
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
562
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
if (@_ == 1)
|
565
|
|
|
|
|
|
|
{
|
566
|
|
|
|
|
|
|
my $hexResult = shift();
|
567
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
568
|
|
|
|
|
|
|
$self->optContentType('icon');
|
569
|
|
|
|
|
|
|
#$self->{m_OptType} = 'icon';
|
570
|
|
|
|
|
|
|
}
|
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
return $self->{m_MsgImage} if defined($self->{m_MsgImage}) || return undef;
|
573
|
|
|
|
|
|
|
}
|
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
sub msgFrom {
|
577
|
|
|
|
|
|
|
# pop value
|
578
|
|
|
|
|
|
|
my $self = shift();
|
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
581
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_MsgFrom} = shift(); }
|
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
return $self->{m_MsgFrom} if defined($self->{m_MsgFrom}) || return undef;
|
586
|
|
|
|
|
|
|
}
|
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
sub msgOperatorLogoFilename {
|
590
|
|
|
|
|
|
|
# pop value
|
591
|
|
|
|
|
|
|
my $self = shift();
|
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
594
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
if (@_ == 1)
|
597
|
|
|
|
|
|
|
{
|
598
|
|
|
|
|
|
|
my $file_path = shift();
|
599
|
|
|
|
|
|
|
my $hexResult = '';
|
600
|
|
|
|
|
|
|
my $buf;
|
601
|
|
|
|
|
|
|
my $fh;
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
604
|
|
|
|
|
|
|
binmode $fh;
|
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
while(read $fh, $buf, 1)
|
607
|
|
|
|
|
|
|
{
|
608
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
609
|
|
|
|
|
|
|
}
|
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
close($fh);
|
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
$self->{m_MsgImageFilename} = $file_path;
|
614
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
615
|
|
|
|
|
|
|
$self->optContentType('logo');
|
616
|
|
|
|
|
|
|
#$self->{m_OptType} = 'logo';
|
617
|
|
|
|
|
|
|
}
|
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
return $self->{m_MsgImageFilename} if defined($self->{m_MsgImageFilename}) || return undef;
|
620
|
|
|
|
|
|
|
}
|
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub msgOperatorLogoHex {
|
624
|
|
|
|
|
|
|
# pop value
|
625
|
|
|
|
|
|
|
my $self = shift();
|
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
628
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
if (@_ == 1) {
|
631
|
|
|
|
|
|
|
my $hexResult = shift();
|
632
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
633
|
|
|
|
|
|
|
$self->optContentType('logo');
|
634
|
|
|
|
|
|
|
#$self->{m_OptType} = 'logo';
|
635
|
|
|
|
|
|
|
}
|
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
return $self->{m_MsgImage} if defined($self->{m_MsgImage}) || return undef;
|
638
|
|
|
|
|
|
|
}
|
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
sub msgPictureFilename {
|
642
|
|
|
|
|
|
|
# pop value
|
643
|
|
|
|
|
|
|
my $self = shift();
|
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
646
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
if (@_ == 1) {
|
649
|
|
|
|
|
|
|
my $file_path = shift();
|
650
|
|
|
|
|
|
|
my $hexResult = '';
|
651
|
|
|
|
|
|
|
my $buf;
|
652
|
|
|
|
|
|
|
my $fh;
|
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
655
|
|
|
|
|
|
|
binmode $fh;
|
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
while (read $fh, $buf, 1) {
|
658
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
659
|
|
|
|
|
|
|
}
|
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
close($fh);
|
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
$self->{m_MsgImageFilename} = $file_path;
|
664
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
665
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PICTURE);
|
666
|
|
|
|
|
|
|
#$self->{m_OptType} = 'picture';
|
667
|
|
|
|
|
|
|
}
|
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
return $self->{m_MsgImageFilename} if defined($self->{m_MsgImageFilename}) || return undef;
|
670
|
|
|
|
|
|
|
}
|
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
sub msgPictureHex {
|
674
|
|
|
|
|
|
|
# pop value
|
675
|
|
|
|
|
|
|
my $self = shift();
|
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
678
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
if (@_ == 1) {
|
681
|
|
|
|
|
|
|
my $hexResult = shift();
|
682
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
683
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PICTURE);
|
684
|
|
|
|
|
|
|
#$self->{m_OptType} = 'picture';
|
685
|
|
|
|
|
|
|
}
|
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
return $self->{m_MsgImage} if defined($self->{m_MsgImage}) || return undef;
|
688
|
|
|
|
|
|
|
}
|
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
sub destAddr {
|
692
|
|
|
|
|
|
|
# pop value
|
693
|
|
|
|
|
|
|
my $self = shift();
|
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
696
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_DestAddr} = shift(); }
|
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
return $self->{m_DestAddr} if defined($self->{m_DestAddr}) || return undef;
|
701
|
|
|
|
|
|
|
}
|
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
# DEPRECATED TO destAddr()
|
704
|
|
|
|
|
|
|
sub msgPin {
|
705
|
|
|
|
|
|
|
destAddr(@_);
|
706
|
|
|
|
|
|
|
}
|
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
sub msgProfileName {
|
710
|
|
|
|
|
|
|
# pop value
|
711
|
|
|
|
|
|
|
my $self = shift();
|
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
714
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
if (@_ == 1) {
|
717
|
|
|
|
|
|
|
$self->msgText(shift());
|
718
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PROFILE);
|
719
|
|
|
|
|
|
|
#$self->{m_OptType} = 'profile';
|
720
|
|
|
|
|
|
|
}
|
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
return $self->msgText();
|
723
|
|
|
|
|
|
|
}
|
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
sub msgProfileRingtone {
|
727
|
|
|
|
|
|
|
# pop value
|
728
|
|
|
|
|
|
|
my $self = shift();
|
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
731
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
if (@_ == 1) {
|
734
|
|
|
|
|
|
|
$self->{m_MsgRingtone} = shift();
|
735
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PROFILE);
|
736
|
|
|
|
|
|
|
#$self->{m_OptType} = 'profile';
|
737
|
|
|
|
|
|
|
}
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
return $self->{m_MsgRingtone} if defined($self->{m_MsgRingtone}) || return undef;
|
740
|
|
|
|
|
|
|
}
|
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
sub msgProfileScreenSaverFilename {
|
744
|
|
|
|
|
|
|
# pop value
|
745
|
|
|
|
|
|
|
my $self = shift();
|
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
748
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
if (@_ == 1) {
|
751
|
|
|
|
|
|
|
my $file_path = shift();
|
752
|
|
|
|
|
|
|
my $hexResult = '';
|
753
|
|
|
|
|
|
|
my $buf;
|
754
|
|
|
|
|
|
|
my $fh;
|
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
757
|
|
|
|
|
|
|
binmode $fh;
|
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
while (read $fh, $buf, 1) {
|
760
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
761
|
|
|
|
|
|
|
}
|
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
close($fh);
|
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
$self->{m_MsgImageFilename} = $file_path;
|
766
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
767
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PROFILE);
|
768
|
|
|
|
|
|
|
#$self->{m_OptType} = 'profile';
|
769
|
|
|
|
|
|
|
}
|
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
return $self->{m_MsgImageFilename} if defined($self->{m_MsgImageFilename}) || return undef;
|
772
|
|
|
|
|
|
|
}
|
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
sub msgProfileScreenSaverHex {
|
776
|
|
|
|
|
|
|
# pop value
|
777
|
|
|
|
|
|
|
my $self = shift();
|
778
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
780
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
if (@_ == 1)
|
783
|
|
|
|
|
|
|
{
|
784
|
|
|
|
|
|
|
my $hexResult = shift();
|
785
|
|
|
|
|
|
|
$self->{m_MsgImage} = $hexResult;
|
786
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_PROFILE);
|
787
|
|
|
|
|
|
|
#$self->{m_OptType} = 'profile';
|
788
|
|
|
|
|
|
|
}
|
789
|
|
|
|
|
|
|
return $self->{m_MsgImage} if defined($self->{m_MsgImage}) || return undef;
|
790
|
|
|
|
|
|
|
}
|
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
sub msgRingtone {
|
794
|
|
|
|
|
|
|
# pop value
|
795
|
|
|
|
|
|
|
my $self = shift();
|
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
798
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
if (@_ == 1) {
|
801
|
|
|
|
|
|
|
$self->{m_MsgRingtone} = shift();
|
802
|
|
|
|
|
|
|
$self->optContentType(CONTENT_TYPE_RINGTONE);
|
803
|
|
|
|
|
|
|
#$self->{m_OptType} = 'ringtone';
|
804
|
|
|
|
|
|
|
}
|
805
|
|
|
|
|
|
|
return $self->{m_MsgRingtone} if defined($self->{m_MsgRingtone}) || return undef;
|
806
|
|
|
|
|
|
|
}
|
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
sub submit {
|
810
|
|
|
|
|
|
|
# pop value
|
811
|
|
|
|
|
|
|
my $self = shift();
|
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
814
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
$self->send('submit');
|
817
|
|
|
|
|
|
|
# return success/failure
|
818
|
|
|
|
|
|
|
return $self->success();
|
819
|
|
|
|
|
|
|
}
|
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
# DEPRECATED TO submit();
|
822
|
|
|
|
|
|
|
sub msgSend {
|
823
|
|
|
|
|
|
|
submit(@_);
|
824
|
|
|
|
|
|
|
}
|
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
# DEPRECATED, DON'T USE ANYMORE
|
828
|
|
|
|
|
|
|
sub msgSendEx {
|
829
|
|
|
|
|
|
|
# pop value
|
830
|
|
|
|
|
|
|
my $self = shift();
|
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
833
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
$self->networkId(shift());
|
836
|
|
|
|
|
|
|
$self->destAddr(shift());
|
837
|
|
|
|
|
|
|
$self->msgFrom(shift());
|
838
|
|
|
|
|
|
|
$self->sourceAddr(shift());
|
839
|
|
|
|
|
|
|
$self->msgText(shift());
|
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
return $self->submit();
|
842
|
|
|
|
|
|
|
}
|
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
sub statusCode {
|
845
|
|
|
|
|
|
|
# pop value
|
846
|
|
|
|
|
|
|
my $self = shift();
|
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
849
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_StatusCode} = shift(); }
|
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
return $self->{m_StatusCode} if defined($self->{m_StatusCode}) || return undef;
|
854
|
|
|
|
|
|
|
}
|
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
# DEPRECATED TO statusCode()
|
858
|
|
|
|
|
|
|
sub msgStatusCode {
|
859
|
|
|
|
|
|
|
statusCode(@_);
|
860
|
|
|
|
|
|
|
}
|
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
sub statusDescription {
|
864
|
|
|
|
|
|
|
# pop value
|
865
|
|
|
|
|
|
|
my $self = shift();
|
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
868
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_StatusDescription} = shift(); }
|
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
return $self->{m_StatusDescription} if defined($self->{m_StatusDescription}) || return undef;
|
873
|
|
|
|
|
|
|
}
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
# DEPRECATED TO statusDescription
|
877
|
|
|
|
|
|
|
sub msgStatusDesc {
|
878
|
|
|
|
|
|
|
statusDescription(@_);
|
879
|
|
|
|
|
|
|
}
|
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
sub query {
|
883
|
|
|
|
|
|
|
# pop value
|
884
|
|
|
|
|
|
|
my $self = shift();
|
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
887
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
$self->send('query');
|
890
|
|
|
|
|
|
|
# return success/failure
|
891
|
|
|
|
|
|
|
return $self->success();
|
892
|
|
|
|
|
|
|
}
|
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
# DEPRECATED TO query()
|
896
|
|
|
|
|
|
|
sub msgStatusSend {
|
897
|
|
|
|
|
|
|
query(@_);
|
898
|
|
|
|
|
|
|
}
|
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
sub msgData {
|
902
|
|
|
|
|
|
|
# pop value
|
903
|
|
|
|
|
|
|
my $self = shift();
|
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
906
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_MsgData} = shift(); }
|
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
return $self->{m_MsgData} if defined($self->{m_MsgData}) || return undef;
|
911
|
|
|
|
|
|
|
}
|
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
# DEPRECATED TO msgData
|
915
|
|
|
|
|
|
|
sub msgText {
|
916
|
|
|
|
|
|
|
msgData(@_);
|
917
|
|
|
|
|
|
|
}
|
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
sub ticketId {
|
921
|
|
|
|
|
|
|
# pop value
|
922
|
|
|
|
|
|
|
my $self = shift();
|
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
925
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_TicketId} = shift(); }
|
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
return $self->{m_TicketId} if defined($self->{m_TicketId}) || return undef;
|
930
|
|
|
|
|
|
|
}
|
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
# DEPRECATED TO ticketId
|
934
|
|
|
|
|
|
|
sub msgTicketID {
|
935
|
|
|
|
|
|
|
ticketId(@_);
|
936
|
|
|
|
|
|
|
}
|
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
sub ticketFee {
|
940
|
|
|
|
|
|
|
# pop value
|
941
|
|
|
|
|
|
|
my $self = shift();
|
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
944
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_TicketFee} = shift(); }
|
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
return $self->{m_TicketFee} if defined($self->{m_TicketFee}) || return undef;
|
949
|
|
|
|
|
|
|
}
|
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
sub optCountryCode {
|
953
|
|
|
|
|
|
|
# pop value
|
954
|
|
|
|
|
|
|
my $self = shift();
|
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
957
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptCountryCode} = shift(); }
|
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
return $self->{m_OptCountryCode} if defined($self->{m_OptCountryCode}) || return undef;
|
962
|
|
|
|
|
|
|
}
|
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
sub optEncoding {
|
966
|
|
|
|
|
|
|
# pop value
|
967
|
|
|
|
|
|
|
my $self = shift();
|
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
970
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
if (@_ == 1) {
|
973
|
|
|
|
|
|
|
# we're being set
|
974
|
|
|
|
|
|
|
my $var = shift;
|
975
|
|
|
|
|
|
|
# validate the argument
|
976
|
|
|
|
|
|
|
my $success = _validate_constant($var, \@ENC);
|
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
if ($success == 1) {
|
979
|
|
|
|
|
|
|
$self->{m_OptEncoding} = $var;
|
980
|
|
|
|
|
|
|
} else {
|
981
|
|
|
|
|
|
|
die "You must set optEncoding to one of the following: " . join(", ", @ENC) . "\n";
|
982
|
|
|
|
|
|
|
}
|
983
|
|
|
|
|
|
|
}
|
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
# we are being read
|
986
|
|
|
|
|
|
|
return $self->{m_OptEncoding} if defined($self->{m_OptEncoding}) || return undef;
|
987
|
|
|
|
|
|
|
}
|
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
# DEPRECATED TO optEncoding
|
990
|
|
|
|
|
|
|
sub optDataCoding {
|
991
|
|
|
|
|
|
|
optEncoding(@_);
|
992
|
|
|
|
|
|
|
}
|
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
# DEPRECATED
|
996
|
|
|
|
|
|
|
sub optDelimiter {
|
997
|
|
|
|
|
|
|
# do nothing
|
998
|
|
|
|
|
|
|
}
|
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
# DEPRECATED
|
1002
|
|
|
|
|
|
|
sub optFields {
|
1003
|
|
|
|
|
|
|
# do nothing
|
1004
|
|
|
|
|
|
|
}
|
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
sub optFlash {
|
1008
|
|
|
|
|
|
|
# pop value
|
1009
|
|
|
|
|
|
|
my $self = shift();
|
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1012
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptFlash} = _validate_bool(shift()); }
|
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
return $self->{m_OptFlash} if defined($self->{m_OptFlash}) || return undef;
|
1017
|
|
|
|
|
|
|
}
|
1018
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
sub optNetworkCode {
|
1021
|
|
|
|
|
|
|
# pop value
|
1022
|
|
|
|
|
|
|
my $self = shift();
|
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1025
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptNetworkCode} = shift(); }
|
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
return $self->{m_OptNetworkCode} if defined($self->{m_OptNetworkCode}) || return undef;
|
1030
|
|
|
|
|
|
|
}
|
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
sub optPhone {
|
1034
|
|
|
|
|
|
|
# pop value
|
1035
|
|
|
|
|
|
|
my $self = shift();
|
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1038
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptPhone} = shift(); }
|
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
return $self->{m_OptPhone} if defined($self->{m_OptPhone}) || return undef;
|
1043
|
|
|
|
|
|
|
}
|
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
# DEPRECATED
|
1047
|
|
|
|
|
|
|
sub optTimeout {
|
1048
|
|
|
|
|
|
|
# do nothing
|
1049
|
|
|
|
|
|
|
}
|
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
# DEPRECATED to optContentType
|
1053
|
|
|
|
|
|
|
sub optType {
|
1054
|
|
|
|
|
|
|
optContentType(@_);
|
1055
|
|
|
|
|
|
|
}
|
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
sub optUrl {
|
1059
|
|
|
|
|
|
|
# pop value
|
1060
|
|
|
|
|
|
|
my $self = shift();
|
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1063
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptUrl} = shift(); }
|
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
return $self->{m_OptUrl} if defined($self->{m_OptUrl}) || return undef;
|
1068
|
|
|
|
|
|
|
}
|
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
sub optUdhi {
|
1072
|
|
|
|
|
|
|
# pop value
|
1073
|
|
|
|
|
|
|
my $self = shift();
|
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1076
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_OptUdhi} = _validate_bool(shift());}
|
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
return $self->{m_OptUdhi} if defined($self->{m_OptUdhi}) || return undef;
|
1081
|
|
|
|
|
|
|
}
|
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
# sets/gets the User Data Header as raw byte string
|
1085
|
|
|
|
|
|
|
sub udh {
|
1086
|
|
|
|
|
|
|
# pop value
|
1087
|
|
|
|
|
|
|
my $self = shift();
|
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1090
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_Udh} = shift(); }
|
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
return $self->{m_Udh} if defined($self->{m_Udh}) || return undef;
|
1095
|
|
|
|
|
|
|
}
|
1096
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
############################################
|
1099
|
|
|
|
|
|
|
# EMS Functionality
|
1100
|
|
|
|
|
|
|
# Must set optContentType = "ems" for EMS to work
|
1101
|
|
|
|
|
|
|
# emsAddText()
|
1102
|
|
|
|
|
|
|
# emsAddPredefinedSound()
|
1103
|
|
|
|
|
|
|
# emsAddPredefinedAnimation()
|
1104
|
|
|
|
|
|
|
# emsAddUserDefinedSound()
|
1105
|
|
|
|
|
|
|
# emsAddSmallPicture()
|
1106
|
|
|
|
|
|
|
# emsAddSmallPictureHex()
|
1107
|
|
|
|
|
|
|
# emsAddLargePicture()
|
1108
|
|
|
|
|
|
|
# emsAddLargePictureHex()
|
1109
|
|
|
|
|
|
|
# emsAddUserPromptIndicator()
|
1110
|
|
|
|
|
|
|
############################################
|
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
sub optContentType {
|
1113
|
|
|
|
|
|
|
# this function deprecates the optType function and requires
|
1114
|
|
|
|
|
|
|
# a list of constants. So check for 'em
|
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
# pop value
|
1117
|
|
|
|
|
|
|
my $self = shift();
|
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1120
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
if (@_ == 1) {
|
1123
|
|
|
|
|
|
|
# we're being set
|
1124
|
|
|
|
|
|
|
my $var = shift;
|
1125
|
|
|
|
|
|
|
# validate the argument
|
1126
|
|
|
|
|
|
|
my $success = _validate_constant($var, \@CONTENT_TYPE);
|
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
if ($success == 1) {
|
1129
|
|
|
|
|
|
|
# set both vars so we don't break anything
|
1130
|
|
|
|
|
|
|
# eventually optType should be phased out
|
1131
|
|
|
|
|
|
|
$self->{m_OptContentType} = $var;
|
1132
|
|
|
|
|
|
|
} else {
|
1133
|
|
|
|
|
|
|
die "You must set optContentType to one of the following: " . join(", ", @CONTENT_TYPE) . "\n";
|
1134
|
|
|
|
|
|
|
}
|
1135
|
|
|
|
|
|
|
}
|
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
# we're being read
|
1138
|
|
|
|
|
|
|
return $self->{m_OptContentType} if defined($self->{m_OptContentType}) || return undef;
|
1139
|
|
|
|
|
|
|
}
|
1140
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
sub priv_emsAddElement {
|
1142
|
|
|
|
|
|
|
# Private function that appends to the
|
1143
|
|
|
|
|
|
|
# $self->{m_EmsElements} array
|
1144
|
|
|
|
|
|
|
#
|
1145
|
|
|
|
|
|
|
# INPUT: name, type, value
|
1146
|
|
|
|
|
|
|
# OUTPUT: sizeof array after push()
|
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
# pop value
|
1149
|
|
|
|
|
|
|
my $self = shift();
|
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
# build hash
|
1152
|
|
|
|
|
|
|
my $ems = {};
|
1153
|
|
|
|
|
|
|
$ems->{"name"} = shift;
|
1154
|
|
|
|
|
|
|
$ems->{"type"} = shift;
|
1155
|
|
|
|
|
|
|
$ems->{"value"} = shift;
|
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
#print "name:" . $ems->{"name"} . "\n";
|
1158
|
|
|
|
|
|
|
#print "type:" . $ems->{"type"} . "\n";
|
1159
|
|
|
|
|
|
|
#print "val: " . $ems->{"value"} . "\n";
|
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
#print "size of elements before push:" . $#{$self->{m_EmsElements}} . "\n";
|
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
push @{ $self->{m_EmsElements} }, $ems;
|
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
#print "size of elements after push:" . $#{$self->{m_EmsElements}} . "\n";
|
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
#my $arr = pop @{$self->{m_EmsElements}};
|
1168
|
|
|
|
|
|
|
#print $arr->{"name"} . "\n";
|
1169
|
|
|
|
|
|
|
#print $arr->{"type"} . "\n";
|
1170
|
|
|
|
|
|
|
#print $arr->{"value"} . "\n";
|
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
#print "size of elements after pop:" . $#{$self->{m_EmsElements}} . "\n";
|
1173
|
|
|
|
|
|
|
return $#{$self->{m_EmsElements}} + 1;
|
1174
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
}
|
1176
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
sub emsAddText {
|
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
# pop value
|
1180
|
|
|
|
|
|
|
my $self = shift();
|
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1183
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1184
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1186
|
|
|
|
|
|
|
$self->priv_emsAddElement("text", "", shift);
|
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
}
|
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
sub emsAddPredefinedSound {
|
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
# EMS Predefined Sound
|
1193
|
|
|
|
|
|
|
# 0 Chimes high
|
1194
|
|
|
|
|
|
|
# 1 Chimes low
|
1195
|
|
|
|
|
|
|
# 2 Ding
|
1196
|
|
|
|
|
|
|
# 3 Ta Da
|
1197
|
|
|
|
|
|
|
# 4 Notify
|
1198
|
|
|
|
|
|
|
# 5 Drum
|
1199
|
|
|
|
|
|
|
# 6 Claps
|
1200
|
|
|
|
|
|
|
# 7 Fan Fare
|
1201
|
|
|
|
|
|
|
# 8 Chords high
|
1202
|
|
|
|
|
|
|
# 9 Chords low
|
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
# pop value
|
1205
|
|
|
|
|
|
|
my $self = shift();
|
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1208
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
# check vals
|
1211
|
|
|
|
|
|
|
my $val = shift;
|
1212
|
|
|
|
|
|
|
if ($val >= 0 && $val < 10) {
|
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1215
|
|
|
|
|
|
|
$self->priv_emsAddElement("sound", "predefined", $val);
|
1216
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
} else {
|
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
die "You must use a Predefined Sound between 0 and 9. Please see the perldoc.";
|
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
}
|
1222
|
|
|
|
|
|
|
}
|
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
sub emsAddPredefinedAnimation {
|
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
# EMS Predefined anim
|
1227
|
|
|
|
|
|
|
# 0 I am ironic, flirty
|
1228
|
|
|
|
|
|
|
# 1 I am glad
|
1229
|
|
|
|
|
|
|
# 2 I am sceptic
|
1230
|
|
|
|
|
|
|
# 3 I am sad
|
1231
|
|
|
|
|
|
|
# 4 WOW!
|
1232
|
|
|
|
|
|
|
# 5 I am crying
|
1233
|
|
|
|
|
|
|
# 6 I am winking
|
1234
|
|
|
|
|
|
|
# 7 I am laughing
|
1235
|
|
|
|
|
|
|
# 8 I am indifferent
|
1236
|
|
|
|
|
|
|
# 9 In love/ kissing
|
1237
|
|
|
|
|
|
|
# 10 I am confused
|
1238
|
|
|
|
|
|
|
# 11 Tongue hanging out
|
1239
|
|
|
|
|
|
|
# 12 I am angry
|
1240
|
|
|
|
|
|
|
# 13 Wearing glasses
|
1241
|
|
|
|
|
|
|
# 14 Devil
|
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
# pop value
|
1244
|
|
|
|
|
|
|
my $self = shift();
|
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1247
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
# check vals
|
1250
|
|
|
|
|
|
|
my $val = shift;
|
1251
|
|
|
|
|
|
|
if ($val >= 0 && $val < 15) {
|
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1254
|
|
|
|
|
|
|
$self->priv_emsAddElement("animation", "predefined", $val);
|
1255
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
} else {
|
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
die "You must use a Predefined Animation between 0 and 14. Please see the perldoc.";
|
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
}
|
1261
|
|
|
|
|
|
|
}
|
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
sub emsAddUserDefinedSound {
|
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
# EMS User Defined Sound
|
1266
|
|
|
|
|
|
|
# User defined sounds are sent over the air interface. They are monophonic only,
|
1267
|
|
|
|
|
|
|
# use the iMelody format, and have a maximum length of 128 Bytes (without the
|
1268
|
|
|
|
|
|
|
# use of the UPI (use the word "join" to concatenate lengthy messages)
|
1269
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
# pop value
|
1271
|
|
|
|
|
|
|
my $self = shift();
|
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1274
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1277
|
|
|
|
|
|
|
$self->priv_emsAddElement("sound", "user", shift);
|
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
}
|
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
sub emsAddSmallPicture {
|
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
# EMS Small pictures are 16x16 pixels, Black and white
|
1284
|
|
|
|
|
|
|
# pop value
|
1285
|
|
|
|
|
|
|
my $self = shift();
|
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1288
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
# read in image data
|
1291
|
|
|
|
|
|
|
my $file_path = shift();
|
1292
|
|
|
|
|
|
|
my $hexResult = '';
|
1293
|
|
|
|
|
|
|
my $buf;
|
1294
|
|
|
|
|
|
|
my $fh;
|
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
1297
|
|
|
|
|
|
|
binmode $fh;
|
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
while(read $fh, $buf, 1)
|
1300
|
|
|
|
|
|
|
{
|
1301
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
1302
|
|
|
|
|
|
|
}
|
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
close($fh);
|
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1307
|
|
|
|
|
|
|
$self->priv_emsAddElement("picture", "small", $hexResult);
|
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
}
|
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
sub emsAddSmallPictureHex {
|
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
# EMS Small pictures are 16x16 pixels, Black and white
|
1314
|
|
|
|
|
|
|
# pop value
|
1315
|
|
|
|
|
|
|
my $self = shift();
|
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1318
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1321
|
|
|
|
|
|
|
$self->priv_emsAddElement("picture", "small", shift);
|
1322
|
|
|
|
|
|
|
|
1323
|
|
|
|
|
|
|
}
|
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
sub emsAddLargePicture {
|
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
# EMS Large pictures are 32x32 pixels or of variable size
|
1328
|
|
|
|
|
|
|
# maximum 128 bytes, where width is a multiple of 8 pixels, Black and white
|
1329
|
|
|
|
|
|
|
# Larger pictures may be sent, but the word "join" must be placed
|
1330
|
|
|
|
|
|
|
# in the UPI (user prompt indicator)
|
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
# pop value
|
1333
|
|
|
|
|
|
|
my $self = shift();
|
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1336
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
# read in image data
|
1339
|
|
|
|
|
|
|
my $file_path = shift();
|
1340
|
|
|
|
|
|
|
my $hexResult = '';
|
1341
|
|
|
|
|
|
|
my $buf;
|
1342
|
|
|
|
|
|
|
my $fh;
|
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
open($fh, "< $file_path") || die "Can't open file \"$file_path\"";
|
1345
|
|
|
|
|
|
|
binmode $fh;
|
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
while(read $fh, $buf, 1)
|
1348
|
|
|
|
|
|
|
{
|
1349
|
|
|
|
|
|
|
$hexResult .= sprintf( "%2.2lX", ord($buf) );
|
1350
|
|
|
|
|
|
|
}
|
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
close($fh);
|
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1355
|
|
|
|
|
|
|
$self->priv_emsAddElement("picture", "large", $hexResult);
|
1356
|
|
|
|
|
|
|
}
|
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
sub emsAddLargePictureHex {
|
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
# EMS Large pictures are 32x32 pixels or of variable size
|
1361
|
|
|
|
|
|
|
# maximum 128 bytes, where width is a multiple of 8 pixels, Black and white
|
1362
|
|
|
|
|
|
|
# Larger pictures may be sent, but the word "join" must be placed
|
1363
|
|
|
|
|
|
|
# in the UPI (user prompt indicator)
|
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
# pop value
|
1366
|
|
|
|
|
|
|
my $self = shift();
|
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1369
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1372
|
|
|
|
|
|
|
$self->priv_emsAddElement("picture", "large", shift);
|
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
}
|
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
sub emsAddUserPromptIndicator {
|
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
# EMS User Prompt Indicator
|
1379
|
|
|
|
|
|
|
# This feature introduced in 3GPP TS 23.040 Release 4 allows handsets to stitch
|
1380
|
|
|
|
|
|
|
# pictures and user-defined sounds. It also allows the user to be prompted upon
|
1381
|
|
|
|
|
|
|
# reception of the message to execute media specific actions (storage, handset
|
1382
|
|
|
|
|
|
|
# personalisation, etc.). UPI is typically used by content providers when they send
|
1383
|
|
|
|
|
|
|
# content to users. Please refer to tables in chapter 4 for more information about
|
1384
|
|
|
|
|
|
|
# which products support this feature.
|
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
# pop value
|
1387
|
|
|
|
|
|
|
my $self = shift();
|
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1390
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
# append content to m_EmsElements with helper function
|
1393
|
|
|
|
|
|
|
$self->priv_emsAddElement("upi", "", shift);
|
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
}
|
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
############################################
|
1398
|
|
|
|
|
|
|
# End EMS Functionality
|
1399
|
|
|
|
|
|
|
############################################
|
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
sub requestXML {
|
1403
|
|
|
|
|
|
|
# pop value
|
1404
|
|
|
|
|
|
|
my $self = shift();
|
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1407
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_RequestXML} = shift(); }
|
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
return $self->{m_RequestXML} if defined($self->{m_RequestXML}) || return undef;
|
1412
|
|
|
|
|
|
|
}
|
1413
|
|
|
|
|
|
|
|
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
sub responseXML {
|
1416
|
|
|
|
|
|
|
# pop value
|
1417
|
|
|
|
|
|
|
my $self = shift();
|
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1420
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ResponseXML} = shift(); }
|
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
return $self->{m_ResponseXML} if defined($self->{m_ResponseXML}) || return undef;
|
1425
|
|
|
|
|
|
|
}
|
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
sub remoteHost {
|
1429
|
|
|
|
|
|
|
# pop value
|
1430
|
|
|
|
|
|
|
my $self = shift();
|
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1433
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_RemoteHost} = shift(); }
|
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
return $self->{m_RemoteHost} if defined($self->{m_RemoteHost}) || return undef;
|
1438
|
|
|
|
|
|
|
}
|
1439
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
sub remotePort {
|
1442
|
|
|
|
|
|
|
# pop value
|
1443
|
|
|
|
|
|
|
my $self = shift();
|
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1446
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_RemotePort} = shift(); }
|
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
return $self->{m_RemotePort} if defined($self->{m_RemotePort}) || return undef;
|
1451
|
|
|
|
|
|
|
}
|
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
# DEPRECATED, BUT JUST MAPS TO REMOTE PORT
|
1455
|
|
|
|
|
|
|
sub serverPort {
|
1456
|
|
|
|
|
|
|
remotePort(@_);
|
1457
|
|
|
|
|
|
|
}
|
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
# DEPRECATED IN 2.6.0, SEE REMOTE HOST
|
1461
|
|
|
|
|
|
|
sub serverDomain {
|
1462
|
|
|
|
|
|
|
# do nothing
|
1463
|
|
|
|
|
|
|
}
|
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
# DEPRECATED IN 2.6.0, SEE REMOTE HOST
|
1467
|
|
|
|
|
|
|
sub serverName {
|
1468
|
|
|
|
|
|
|
# do nothing
|
1469
|
|
|
|
|
|
|
}
|
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
sub accountId {
|
1473
|
|
|
|
|
|
|
# pop value
|
1474
|
|
|
|
|
|
|
my $self = shift();
|
1475
|
|
|
|
|
|
|
|
1476
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1477
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
my $var = shift();
|
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
if (defined($var)) { $self->{m_AccountId} = $var; }
|
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
return $self->{m_AccountId} if defined($self->{m_AccountId}) || return undef;
|
1484
|
|
|
|
|
|
|
}
|
1485
|
|
|
|
|
|
|
|
1486
|
|
|
|
|
|
|
# DEPRECATED TO accountId()
|
1487
|
|
|
|
|
|
|
sub subscriberID {
|
1488
|
|
|
|
|
|
|
accountId(@_);
|
1489
|
|
|
|
|
|
|
}
|
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
sub accountPassword {
|
1493
|
|
|
|
|
|
|
# pop value
|
1494
|
|
|
|
|
|
|
my $self = shift();
|
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1497
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
my $var = shift();
|
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
if (defined($var)) { $self->{m_AccountPassword} = $var; }
|
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
return $self->{m_AccountPassword} if defined($self->{m_AccountPassword}) || return undef;
|
1504
|
|
|
|
|
|
|
}
|
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
# DEPRECATED TO accountPassword()
|
1507
|
|
|
|
|
|
|
sub subscriberPassword {
|
1508
|
|
|
|
|
|
|
accountPassword(@_);
|
1509
|
|
|
|
|
|
|
}
|
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
|
1512
|
|
|
|
|
|
|
sub success {
|
1513
|
|
|
|
|
|
|
# pop value
|
1514
|
|
|
|
|
|
|
my $self = shift();
|
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1517
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
# if the error_code is between 0 and 10 then its an okay response.
|
1520
|
|
|
|
|
|
|
if ($self->errorCode >= 0 and $self->errorCode <= 10 and $self->errorCode ne "") {
|
1521
|
|
|
|
|
|
|
return 1;
|
1522
|
|
|
|
|
|
|
}
|
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
return 0;
|
1525
|
|
|
|
|
|
|
}
|
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
# DEPRECATED Does nothing. Here for backward compatibility.
|
1529
|
|
|
|
|
|
|
sub synchronous {
|
1530
|
|
|
|
|
|
|
# do nothing
|
1531
|
|
|
|
|
|
|
}
|
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
# DEPRECATED - DON'T USE
|
1534
|
|
|
|
|
|
|
sub userIP {
|
1535
|
|
|
|
|
|
|
# do nothing
|
1536
|
|
|
|
|
|
|
}
|
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
# READ-ONLY
|
1539
|
|
|
|
|
|
|
sub userAgent {
|
1540
|
|
|
|
|
|
|
# pop value
|
1541
|
|
|
|
|
|
|
my $self = shift();
|
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1544
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
return $self->{m_UserAgent};
|
1547
|
|
|
|
|
|
|
}
|
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
sub proxyType {
|
1550
|
|
|
|
|
|
|
# pop value
|
1551
|
|
|
|
|
|
|
my $self = shift();
|
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1554
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1555
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
if (@_ == 1) {
|
1557
|
|
|
|
|
|
|
# we're being set
|
1558
|
|
|
|
|
|
|
my $var = shift;
|
1559
|
|
|
|
|
|
|
# validate the argument
|
1560
|
|
|
|
|
|
|
my $success = _validate_constant($var, \@PROXY_TYPE);
|
1561
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
if ($success == 1) {
|
1563
|
|
|
|
|
|
|
$self->{m_ProxyType} = $var;
|
1564
|
|
|
|
|
|
|
} else {
|
1565
|
|
|
|
|
|
|
die "You must set proxyType to one of the following: " . join(", ", @PROXY_TYPE) . "\n";
|
1566
|
|
|
|
|
|
|
}
|
1567
|
|
|
|
|
|
|
}
|
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
return $self->{m_ProxyType} if defined($self->{m_ProxyType}) || return undef;
|
1570
|
|
|
|
|
|
|
}
|
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
sub proxyHost {
|
1574
|
|
|
|
|
|
|
# pop value
|
1575
|
|
|
|
|
|
|
my $self = shift();
|
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1578
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1579
|
|
|
|
|
|
|
|
1580
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ProxyServer} = shift(); }
|
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
return $self->{m_ProxyServer} if defined($self->{m_ProxyServer}) || return undef;
|
1583
|
|
|
|
|
|
|
}
|
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
|
1586
|
|
|
|
|
|
|
# DEPRECATED TO proxyHost
|
1587
|
|
|
|
|
|
|
sub proxyServer {
|
1588
|
|
|
|
|
|
|
proxyHost(@_);
|
1589
|
|
|
|
|
|
|
}
|
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
sub proxyPort {
|
1593
|
|
|
|
|
|
|
# pop value
|
1594
|
|
|
|
|
|
|
my $self = shift();
|
1595
|
|
|
|
|
|
|
|
1596
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1597
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ProxyPort} = shift(); }
|
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
return $self->{m_ProxyPort} if defined($self->{m_ProxyPort}) || return undef;
|
1602
|
|
|
|
|
|
|
}
|
1603
|
|
|
|
|
|
|
|
1604
|
|
|
|
|
|
|
|
1605
|
|
|
|
|
|
|
sub proxyUsername {
|
1606
|
|
|
|
|
|
|
# pop value
|
1607
|
|
|
|
|
|
|
my $self = shift();
|
1608
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1610
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ProxyUsername} = shift(); }
|
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
return $self->{m_ProxyUsername} if defined($self->{m_ProxyUsername}) || return undef;
|
1615
|
|
|
|
|
|
|
}
|
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
# DEPRECATED - SPELLED WRONG
|
1618
|
|
|
|
|
|
|
sub proxyUserName {
|
1619
|
|
|
|
|
|
|
proxyUsername(@_);
|
1620
|
|
|
|
|
|
|
}
|
1621
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
sub proxyPassword {
|
1624
|
|
|
|
|
|
|
# pop value
|
1625
|
|
|
|
|
|
|
my $self = shift();
|
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1628
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1629
|
|
|
|
|
|
|
|
1630
|
|
|
|
|
|
|
if (@_ == 1) { $self->{m_ProxyPassword} = shift(); }
|
1631
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
return $self->{m_ProxyPassword} if defined($self->{m_ProxyPassword}) || return undef;
|
1633
|
|
|
|
|
|
|
}
|
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
sub toXML {
|
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
# pop value
|
1639
|
|
|
|
|
|
|
my $self = shift();
|
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1642
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1643
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1645
|
|
|
|
|
|
|
# Common heading for all requests
|
1646
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
my $t = $self->{m_Type};
|
1649
|
|
|
|
|
|
|
if ($t eq "submit") {
|
1650
|
|
|
|
|
|
|
$t = "sendpage";
|
1651
|
|
|
|
|
|
|
} elsif ($t eq "query") {
|
1652
|
|
|
|
|
|
|
$t = "checkstatus";
|
1653
|
|
|
|
|
|
|
} elsif ($t eq "list") {
|
1654
|
|
|
|
|
|
|
$t = "carrierlist";
|
1655
|
|
|
|
|
|
|
}
|
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
my $xml =<
|
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
ENDXML
|
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1665
|
|
|
|
|
|
|
# If submit
|
1666
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1667
|
|
|
|
|
|
|
if ($self->isSubmit) {
|
1668
|
|
|
|
|
|
|
#
|
1669
|
|
|
|
|
|
|
# add |
1670
|
|
|
|
|
|
|
#
|
1671
|
|
|
|
|
|
|
$xml .= " |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
if (defined($self->optCountryCode)) {
|
1674
|
|
|
|
|
|
|
$xml .= ' countrycode="' . $self->optCountryCode . '"';
|
1675
|
|
|
|
|
|
|
}
|
1676
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
if (defined($self->optEncoding)) {
|
1678
|
|
|
|
|
|
|
$xml .= ' datacoding="' . $self->optEncoding . '"';
|
1679
|
|
|
|
|
|
|
}
|
1680
|
|
|
|
|
|
|
|
1681
|
|
|
|
|
|
|
if (defined($self->optFlash)) {
|
1682
|
|
|
|
|
|
|
$xml .= ' flash="' . _return_bool($self->optFlash) . '"';
|
1683
|
|
|
|
|
|
|
}
|
1684
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
if (defined($self->optNetworkCode)) {
|
1686
|
|
|
|
|
|
|
$xml .= ' networkcode="' . $self->optNetworkCode . '"';
|
1687
|
|
|
|
|
|
|
}
|
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
if (defined($self->optPhone)) {
|
1690
|
|
|
|
|
|
|
$xml .= ' phone="' . $self->optPhone . '"';
|
1691
|
|
|
|
|
|
|
}
|
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
if (defined($self->optContentType)) {
|
1694
|
|
|
|
|
|
|
$xml .= ' type="' . $self->optContentType . '"';
|
1695
|
|
|
|
|
|
|
}
|
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
if (defined($self->optUrl)) {
|
1698
|
|
|
|
|
|
|
$xml .= ' url="' . $self->optUrl . '"';
|
1699
|
|
|
|
|
|
|
}
|
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
$xml .= "/>\n";
|
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
#
|
1704
|
|
|
|
|
|
|
# add attributes
|
1705
|
|
|
|
|
|
|
#
|
1706
|
|
|
|
|
|
|
#$xml .= "
|
1707
|
|
|
|
|
|
|
|
1708
|
|
|
|
|
|
|
#if (defined($self->networkId)) {
|
1709
|
|
|
|
|
|
|
# $xml .= ' serviceid="' . $self->networkId . '"';
|
1710
|
|
|
|
|
|
|
#}
|
1711
|
|
|
|
|
|
|
|
1712
|
|
|
|
|
|
|
#if (defined($self->destAddr)) {
|
1713
|
|
|
|
|
|
|
# $xml .= ' pin="' . $self->destAddr . '"';
|
1714
|
|
|
|
|
|
|
#}
|
1715
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
#$xml .= "/>\n";
|
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
#
|
1719
|
|
|
|
|
|
|
# add |
1720
|
|
|
|
|
|
|
#
|
1721
|
|
|
|
|
|
|
#$xml .= " |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
#if (defined($self->sourceAddr)) {
|
1724
|
|
|
|
|
|
|
# $xml .= ' addr="' . $self->sourceAddr . '"';
|
1725
|
|
|
|
|
|
|
#}
|
1726
|
|
|
|
|
|
|
|
1727
|
|
|
|
|
|
|
#$xml .= "/>\n";
|
1728
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
#
|
1730
|
|
|
|
|
|
|
# add attributes
|
1731
|
|
|
|
|
|
|
#
|
1732
|
|
|
|
|
|
|
$xml .= "
|
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
if (defined($self->networkId)) {
|
1735
|
|
|
|
|
|
|
$xml .= ' serviceid="' . $self->networkId . '"';
|
1736
|
|
|
|
|
|
|
}
|
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
if (defined($self->destAddr)) {
|
1739
|
|
|
|
|
|
|
$xml .= ' pin="' . $self->destAddr . '"';
|
1740
|
|
|
|
|
|
|
}
|
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
if (defined($self->sourceAddr)) {
|
1743
|
|
|
|
|
|
|
$xml .= ' callback="' . $self->sourceAddr . '"';
|
1744
|
|
|
|
|
|
|
}
|
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
if (defined($self->msgFrom)) {
|
1747
|
|
|
|
|
|
|
$xml .= ' from="' . unicode_encode($self->msgFrom) . '"';
|
1748
|
|
|
|
|
|
|
}
|
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
if (defined($self->msgText)) {
|
1751
|
|
|
|
|
|
|
$xml .= ' text="' . unicode_encode($self->msgText) . '"';
|
1752
|
|
|
|
|
|
|
}
|
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
if (defined($self->msgRingtone)) {
|
1755
|
|
|
|
|
|
|
$xml .= ' ringtone="' . html_encode( $self->msgRingtone) . '"';
|
1756
|
|
|
|
|
|
|
}
|
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
if (defined($self->{m_MsgImage})) {
|
1759
|
|
|
|
|
|
|
$xml .= ' image="' . $self->{m_MsgImage} . '"';
|
1760
|
|
|
|
|
|
|
}
|
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
$xml .= ">\n";
|
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
# EMS FUNCTIONALITY
|
1765
|
|
|
|
|
|
|
# Check to see if EMS was added and place it here
|
1766
|
|
|
|
|
|
|
#print "checking to see if we have ems...\n";
|
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
if (defined($self->{m_EmsElements}) && $#{$self->{m_EmsElements}} >= 0) {
|
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
#print "We have EMS\n";
|
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
# start ems element
|
1773
|
|
|
|
|
|
|
$xml .= "\t\n";
|
1774
|
|
|
|
|
|
|
|
1775
|
|
|
|
|
|
|
# add all ems elements
|
1776
|
|
|
|
|
|
|
my @arr = @{ $self->{m_EmsElements} };
|
1777
|
|
|
|
|
|
|
foreach my $item (@arr) {
|
1778
|
|
|
|
|
|
|
|
1779
|
|
|
|
|
|
|
#print $item->{name} . "\n";
|
1780
|
|
|
|
|
|
|
$xml .= "<" . $item->{name};
|
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
# if type exists, then add it
|
1783
|
|
|
|
|
|
|
if ($item->{type} ne "") {
|
1784
|
|
|
|
|
|
|
$xml .= " type=\"" . $self->html_encode($item->{type}) . "\"";
|
1785
|
|
|
|
|
|
|
}
|
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
# if value exists, then add it
|
1788
|
|
|
|
|
|
|
if ($item->{value} ne "") {
|
1789
|
|
|
|
|
|
|
$xml .= " value=\"";
|
1790
|
|
|
|
|
|
|
|
1791
|
|
|
|
|
|
|
# if type is text, unicode escape
|
1792
|
|
|
|
|
|
|
if ($item->{name} eq "text") {
|
1793
|
|
|
|
|
|
|
$xml .= $self->unicode_encode($item->{value});
|
1794
|
|
|
|
|
|
|
} elsif ($item->{name} eq "sound") {
|
1795
|
|
|
|
|
|
|
# sounds need to only have newlines escaped
|
1796
|
|
|
|
|
|
|
my $tmp = $item->{value};
|
1797
|
|
|
|
|
|
|
$tmp =~ s/\n/
/g;
|
1798
|
|
|
|
|
|
|
$tmp =~ s/\r\n/
/g;
|
1799
|
|
|
|
|
|
|
$xml .= $tmp;
|
1800
|
|
|
|
|
|
|
#$xml .= $self->unicode_encode($item->{value});
|
1801
|
|
|
|
|
|
|
} else {
|
1802
|
|
|
|
|
|
|
$xml .= $self->html_encode($item->{value});
|
1803
|
|
|
|
|
|
|
}
|
1804
|
|
|
|
|
|
|
$xml .= "\"";
|
1805
|
|
|
|
|
|
|
}
|
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
# end element
|
1808
|
|
|
|
|
|
|
$xml .= "/>\n";
|
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
} # foreach loop
|
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
# end ems tag
|
1813
|
|
|
|
|
|
|
$xml .= "\t\n";
|
1814
|
|
|
|
|
|
|
|
1815
|
|
|
|
|
|
|
}
|
1816
|
|
|
|
|
|
|
# End EMS
|
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
$xml .= " \n";
|
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1821
|
|
|
|
|
|
|
# If query()
|
1822
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1823
|
|
|
|
|
|
|
} elsif ($self->isQuery) {
|
1824
|
|
|
|
|
|
|
|
1825
|
|
|
|
|
|
|
# Check to see if any options were set for the sendpage
|
1826
|
|
|
|
|
|
|
if (defined($self->ticketId)) {
|
1827
|
|
|
|
|
|
|
$xml .= "
|
1828
|
|
|
|
|
|
|
# set the ticket id
|
1829
|
|
|
|
|
|
|
if (defined($self->ticketId)) {
|
1830
|
|
|
|
|
|
|
$xml .= ' id="' . $self->ticketId . '"';
|
1831
|
|
|
|
|
|
|
}
|
1832
|
|
|
|
|
|
|
$xml .= "/>\n";
|
1833
|
|
|
|
|
|
|
}
|
1834
|
|
|
|
|
|
|
|
1835
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1836
|
|
|
|
|
|
|
# If list
|
1837
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1838
|
|
|
|
|
|
|
} elsif ($self->isList) {
|
1839
|
|
|
|
|
|
|
# no options to set for network list
|
1840
|
|
|
|
|
|
|
|
1841
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1842
|
|
|
|
|
|
|
# If account
|
1843
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1844
|
|
|
|
|
|
|
} elsif ($self->isAccount) {
|
1845
|
|
|
|
|
|
|
# no options to set for account information
|
1846
|
|
|
|
|
|
|
}
|
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1850
|
|
|
|
|
|
|
# End XML all the same
|
1851
|
|
|
|
|
|
|
#-----------------------------------------------------------------
|
1852
|
|
|
|
|
|
|
$xml .= '';
|
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
$self->{m_RequestXML} = $xml;
|
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
if ($self->{DEBUG}) {
|
1857
|
|
|
|
|
|
|
print 'REQUEST XML ==' . "\n" . $self->{m_RequestXML} . "\n";
|
1858
|
|
|
|
|
|
|
}
|
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
return $xml;
|
1861
|
|
|
|
|
|
|
}
|
1862
|
|
|
|
|
|
|
|
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
# REMOVED v2.6.0
|
1865
|
|
|
|
|
|
|
#sub xmlParse {
|
1866
|
|
|
|
|
|
|
# # pop value
|
1867
|
|
|
|
|
|
|
# my $self = shift();
|
1868
|
|
|
|
|
|
|
|
1869
|
|
|
|
|
|
|
# # check to make sure that this function is being called on an object
|
1870
|
|
|
|
|
|
|
# die "You must instantiate an object to use this function" if !(ref($self));
|
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
# return $self->xmlParseEx($self->toXML());
|
1873
|
|
|
|
|
|
|
#}
|
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
# parses both requests and responses
|
1877
|
|
|
|
|
|
|
# handles both WMP v2.0 and WMP v2.5
|
1878
|
|
|
|
|
|
|
sub parse {
|
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
# pop value
|
1881
|
|
|
|
|
|
|
my $self = shift();
|
1882
|
|
|
|
|
|
|
|
1883
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
1884
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
if (@_ ne "1") { die "You must pass XML for this function to parse"; }
|
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
my $xml = shift();
|
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
# create new parser
|
1891
|
|
|
|
|
|
|
my $parser = new XML::Parser(Handlers => { Init => sub { $self->_handle_init(@_) },
|
1892
|
|
|
|
|
|
|
Final => sub { $self->_handle_final(@_) },
|
1893
|
|
|
|
|
|
|
Start => sub { $self->_handle_start(@_) },
|
1894
|
|
|
|
|
|
|
End => sub { $self->_handle_end(@_) } } );
|
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
# reset the carrier list
|
1897
|
|
|
|
|
|
|
$self->{m_CarrierList} = [];
|
1898
|
|
|
|
|
|
|
|
1899
|
|
|
|
|
|
|
# begin parsing xml
|
1900
|
|
|
|
|
|
|
$parser->parse($xml);
|
1901
|
|
|
|
|
|
|
}
|
1902
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
sub _handle_start {
|
1904
|
|
|
|
|
|
|
my $self = shift();
|
1905
|
|
|
|
|
|
|
my $expat = shift();
|
1906
|
|
|
|
|
|
|
my $element = shift();
|
1907
|
|
|
|
|
|
|
my @attrs = @_;
|
1908
|
|
|
|
|
|
|
|
1909
|
|
|
|
|
|
|
# select which function to use for parsing
|
1910
|
|
|
|
|
|
|
if ($element eq "request") {
|
1911
|
|
|
|
|
|
|
$self->_parse_request(@attrs);
|
1912
|
|
|
|
|
|
|
} elsif ($element eq "response") {
|
1913
|
|
|
|
|
|
|
$self->_parse_response(@attrs);
|
1914
|
|
|
|
|
|
|
} elsif ($element eq "error") {
|
1915
|
|
|
|
|
|
|
$self->_parse_error(@attrs);
|
1916
|
|
|
|
|
|
|
} elsif ($element eq "status") {
|
1917
|
|
|
|
|
|
|
$self->_parse_status(@attrs);
|
1918
|
|
|
|
|
|
|
} elsif ($element eq "ticket") {
|
1919
|
|
|
|
|
|
|
$self->_parse_ticket(@attrs);
|
1920
|
|
|
|
|
|
|
} elsif ($element eq "account") {
|
1921
|
|
|
|
|
|
|
$self->_parse_account(@attrs);
|
1922
|
|
|
|
|
|
|
} elsif ($element eq "subscriber") {
|
1923
|
|
|
|
|
|
|
$self->_parse_account(@attrs);
|
1924
|
|
|
|
|
|
|
} elsif ($element eq "dest") {
|
1925
|
|
|
|
|
|
|
$self->_parse_dest(@attrs);
|
1926
|
|
|
|
|
|
|
} elsif ($element eq "source") {
|
1927
|
|
|
|
|
|
|
$self->_parse_source(@attrs);
|
1928
|
|
|
|
|
|
|
} elsif ($element eq "option") {
|
1929
|
|
|
|
|
|
|
$self->_parse_option(@attrs);
|
1930
|
|
|
|
|
|
|
} elsif ($element eq "message") {
|
1931
|
|
|
|
|
|
|
$self->_parse_message(@attrs);
|
1932
|
|
|
|
|
|
|
} elsif ($element eq "page") {
|
1933
|
|
|
|
|
|
|
$self->_parse_page(@attrs);
|
1934
|
|
|
|
|
|
|
} elsif ($element eq "service") {
|
1935
|
|
|
|
|
|
|
$self->_parse_service(@attrs);
|
1936
|
|
|
|
|
|
|
} else {
|
1937
|
|
|
|
|
|
|
# unknown element type
|
1938
|
|
|
|
|
|
|
}
|
1939
|
|
|
|
|
|
|
}
|
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
sub _handle_end {
|
1942
|
|
|
|
|
|
|
# do nothing...
|
1943
|
|
|
|
|
|
|
}
|
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
sub _handle_init {
|
1946
|
|
|
|
|
|
|
# do nothing...
|
1947
|
|
|
|
|
|
|
}
|
1948
|
|
|
|
|
|
|
|
1949
|
|
|
|
|
|
|
sub _handle_final {
|
1950
|
|
|
|
|
|
|
# do nothing...
|
1951
|
|
|
|
|
|
|
}
|
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
sub _parse_request {
|
1954
|
|
|
|
|
|
|
# get the values
|
1955
|
|
|
|
|
|
|
my $self = shift();
|
1956
|
|
|
|
|
|
|
|
1957
|
|
|
|
|
|
|
#print "parse_request -> " . $self . "\n";
|
1958
|
|
|
|
|
|
|
|
1959
|
|
|
|
|
|
|
my @attrs = @_;
|
1960
|
|
|
|
|
|
|
# loop through each attribute
|
1961
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
1962
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
1963
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
if ($name eq 'version') {
|
1966
|
|
|
|
|
|
|
$self->{m_Version} = $value;
|
1967
|
|
|
|
|
|
|
} elsif ($name eq 'protocol') {
|
1968
|
|
|
|
|
|
|
$self->{m_Protocol} = $value;
|
1969
|
|
|
|
|
|
|
} elsif ($name eq 'type') {
|
1970
|
|
|
|
|
|
|
$self->{m_Type} = $value;
|
1971
|
|
|
|
|
|
|
}
|
1972
|
|
|
|
|
|
|
}
|
1973
|
|
|
|
|
|
|
}
|
1974
|
|
|
|
|
|
|
|
1975
|
|
|
|
|
|
|
sub _parse_response {
|
1976
|
|
|
|
|
|
|
# get the values
|
1977
|
|
|
|
|
|
|
my $self = shift();
|
1978
|
|
|
|
|
|
|
my @attrs = @_;
|
1979
|
|
|
|
|
|
|
# loop through each attribute
|
1980
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
1981
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
1982
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
1983
|
|
|
|
|
|
|
|
1984
|
|
|
|
|
|
|
if ($name eq 'version') {
|
1985
|
|
|
|
|
|
|
$self->{m_Version} = $value;
|
1986
|
|
|
|
|
|
|
} elsif ($name eq 'protocol') {
|
1987
|
|
|
|
|
|
|
$self->{m_Protocol} = $value;
|
1988
|
|
|
|
|
|
|
} elsif ($name eq 'type') {
|
1989
|
|
|
|
|
|
|
$self->{m_Type} = $value;
|
1990
|
|
|
|
|
|
|
}
|
1991
|
|
|
|
|
|
|
}
|
1992
|
|
|
|
|
|
|
}
|
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
sub _parse_error {
|
1995
|
|
|
|
|
|
|
# get the values
|
1996
|
|
|
|
|
|
|
my $self = shift();
|
1997
|
|
|
|
|
|
|
my @attrs = @_;
|
1998
|
|
|
|
|
|
|
# loop through each attribute
|
1999
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2000
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2001
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
if ($name eq 'code') {
|
2004
|
|
|
|
|
|
|
$self->errorCode($value);
|
2005
|
|
|
|
|
|
|
} elsif ($name eq 'description') {
|
2006
|
|
|
|
|
|
|
$self->errorDescription($value);
|
2007
|
|
|
|
|
|
|
} elsif ($name eq 'resolution') {
|
2008
|
|
|
|
|
|
|
$self->errorResolution($value);
|
2009
|
|
|
|
|
|
|
}
|
2010
|
|
|
|
|
|
|
}
|
2011
|
|
|
|
|
|
|
}
|
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
sub _parse_status {
|
2014
|
|
|
|
|
|
|
# get the values
|
2015
|
|
|
|
|
|
|
my $self = shift();
|
2016
|
|
|
|
|
|
|
my @attrs = @_;
|
2017
|
|
|
|
|
|
|
# loop through each attribute
|
2018
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2019
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2020
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
if ($name eq 'code') {
|
2023
|
|
|
|
|
|
|
$self->statusCode($value);
|
2024
|
|
|
|
|
|
|
} elsif ($name eq 'description') {
|
2025
|
|
|
|
|
|
|
$self->statusDescription($value);
|
2026
|
|
|
|
|
|
|
}
|
2027
|
|
|
|
|
|
|
}
|
2028
|
|
|
|
|
|
|
}
|
2029
|
|
|
|
|
|
|
|
2030
|
|
|
|
|
|
|
sub _parse_account {
|
2031
|
|
|
|
|
|
|
# get the values
|
2032
|
|
|
|
|
|
|
my $self = shift();
|
2033
|
|
|
|
|
|
|
my @attrs = @_;
|
2034
|
|
|
|
|
|
|
# loop through each attribute
|
2035
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2036
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2037
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
if ($name eq 'id') {
|
2040
|
|
|
|
|
|
|
$self->accountId($value);
|
2041
|
|
|
|
|
|
|
} elsif ($name eq 'password') {
|
2042
|
|
|
|
|
|
|
$self->accountPassword($value);
|
2043
|
|
|
|
|
|
|
} elsif ($name eq 'balance') {
|
2044
|
|
|
|
|
|
|
$self->accountBalance($value);
|
2045
|
|
|
|
|
|
|
}
|
2046
|
|
|
|
|
|
|
}
|
2047
|
|
|
|
|
|
|
}
|
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
|
2050
|
|
|
|
|
|
|
sub _parse_ticket {
|
2051
|
|
|
|
|
|
|
# get the values
|
2052
|
|
|
|
|
|
|
my $self = shift();
|
2053
|
|
|
|
|
|
|
my @attrs = @_;
|
2054
|
|
|
|
|
|
|
# loop through each attribute
|
2055
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2056
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2057
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
if ($name eq 'id') {
|
2060
|
|
|
|
|
|
|
$self->ticketId($value);
|
2061
|
|
|
|
|
|
|
} elsif ($name eq 'fee') {
|
2062
|
|
|
|
|
|
|
$self->ticketFee($value);
|
2063
|
|
|
|
|
|
|
}
|
2064
|
|
|
|
|
|
|
}
|
2065
|
|
|
|
|
|
|
}
|
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
sub _parse_dest {
|
2069
|
|
|
|
|
|
|
# get the values
|
2070
|
|
|
|
|
|
|
my $self = shift();
|
2071
|
|
|
|
|
|
|
my @attrs = @_;
|
2072
|
|
|
|
|
|
|
# loop through each attribute
|
2073
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2074
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2075
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2076
|
|
|
|
|
|
|
|
2077
|
|
|
|
|
|
|
if ($name eq 'addr') {
|
2078
|
|
|
|
|
|
|
$self->destAddr($value);
|
2079
|
|
|
|
|
|
|
} elsif ($name eq 'network') {
|
2080
|
|
|
|
|
|
|
$self->networkId($value);
|
2081
|
|
|
|
|
|
|
}
|
2082
|
|
|
|
|
|
|
}
|
2083
|
|
|
|
|
|
|
}
|
2084
|
|
|
|
|
|
|
|
2085
|
|
|
|
|
|
|
|
2086
|
|
|
|
|
|
|
sub _parse_source {
|
2087
|
|
|
|
|
|
|
# get the values
|
2088
|
|
|
|
|
|
|
my $self = shift();
|
2089
|
|
|
|
|
|
|
my @attrs = @_;
|
2090
|
|
|
|
|
|
|
# loop through each attribute
|
2091
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2092
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2093
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
if ($name eq 'addr') {
|
2096
|
|
|
|
|
|
|
$self->sourceAddr($value);
|
2097
|
|
|
|
|
|
|
}
|
2098
|
|
|
|
|
|
|
}
|
2099
|
|
|
|
|
|
|
}
|
2100
|
|
|
|
|
|
|
|
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
sub _parse_option {
|
2103
|
|
|
|
|
|
|
# get the values
|
2104
|
|
|
|
|
|
|
my $self = shift();
|
2105
|
|
|
|
|
|
|
my @attrs = @_;
|
2106
|
|
|
|
|
|
|
# loop through each attribute
|
2107
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2108
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2109
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2110
|
|
|
|
|
|
|
|
2111
|
|
|
|
|
|
|
if ($name eq 'udhi') {
|
2112
|
|
|
|
|
|
|
$self->optUdhi($value);
|
2113
|
|
|
|
|
|
|
} elsif ($name eq 'encoding') {
|
2114
|
|
|
|
|
|
|
$self->optEncoding($value);
|
2115
|
|
|
|
|
|
|
}
|
2116
|
|
|
|
|
|
|
}
|
2117
|
|
|
|
|
|
|
}
|
2118
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
|
2120
|
|
|
|
|
|
|
sub _parse_page {
|
2121
|
|
|
|
|
|
|
# get the values
|
2122
|
|
|
|
|
|
|
my $self = shift();
|
2123
|
|
|
|
|
|
|
my @attrs = @_;
|
2124
|
|
|
|
|
|
|
# loop through each attribute
|
2125
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2126
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2127
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2128
|
|
|
|
|
|
|
if ($name eq 'pin') {
|
2129
|
|
|
|
|
|
|
$self->destAddr($value);
|
2130
|
|
|
|
|
|
|
} elsif ($name eq 'callback') {
|
2131
|
|
|
|
|
|
|
$self->sourceAddr($value);
|
2132
|
|
|
|
|
|
|
} elsif ($name eq 'text') {
|
2133
|
|
|
|
|
|
|
# interpret text attribute as the actual
|
2134
|
|
|
|
|
|
|
# byte values in the string which should
|
2135
|
|
|
|
|
|
|
# only represent text in WMP v2.0
|
2136
|
|
|
|
|
|
|
$self->msgText($value);
|
2137
|
|
|
|
|
|
|
}
|
2138
|
|
|
|
|
|
|
}
|
2139
|
|
|
|
|
|
|
}
|
2140
|
|
|
|
|
|
|
|
2141
|
|
|
|
|
|
|
sub _parse_message {
|
2142
|
|
|
|
|
|
|
# get the values
|
2143
|
|
|
|
|
|
|
my $self = shift();
|
2144
|
|
|
|
|
|
|
my @attrs = @_;
|
2145
|
|
|
|
|
|
|
# loop through each attribute
|
2146
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2147
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2148
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
if ($name eq 'data') {
|
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
# convert hex-encoded string into byte string
|
2153
|
|
|
|
|
|
|
# incoming message data is always in bytes
|
2154
|
|
|
|
|
|
|
# interpret what the data means with the
|
2155
|
|
|
|
|
|
|
# "encoding" attribute
|
2156
|
|
|
|
|
|
|
$self->msgData(pack("H*", $value));
|
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
} elsif ($name eq 'udh') {
|
2159
|
|
|
|
|
|
|
|
2160
|
|
|
|
|
|
|
# convert hex-encoded string into byte string
|
2161
|
|
|
|
|
|
|
$self->udh(pack("H*", $value));
|
2162
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
}
|
2164
|
|
|
|
|
|
|
}
|
2165
|
|
|
|
|
|
|
}
|
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
sub _parse_service {
|
2168
|
|
|
|
|
|
|
# get the values
|
2169
|
|
|
|
|
|
|
my $self = shift();
|
2170
|
|
|
|
|
|
|
my @attrs = @_;
|
2171
|
|
|
|
|
|
|
# new hash for the list entry
|
2172
|
|
|
|
|
|
|
my $s = {};
|
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
# loop through each attribute
|
2175
|
|
|
|
|
|
|
for (my $i = 0; $i < @attrs; $i+=2) {
|
2176
|
|
|
|
|
|
|
my $name = $attrs[$i];
|
2177
|
|
|
|
|
|
|
my $value = $attrs[$i+1];
|
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
if ($name eq 'id') {
|
2180
|
|
|
|
|
|
|
$s->{ID} = $value;
|
2181
|
|
|
|
|
|
|
} elsif ($name eq 'title') {
|
2182
|
|
|
|
|
|
|
$s->{Title} = $value;
|
2183
|
|
|
|
|
|
|
} elsif ($name eq 'subtitle') {
|
2184
|
|
|
|
|
|
|
$s->{SubTitle} = $value;
|
2185
|
|
|
|
|
|
|
} elsif ($name eq 'contenttype') {
|
2186
|
|
|
|
|
|
|
$s->{ContentType} = $value;
|
2187
|
|
|
|
|
|
|
} elsif ($name eq 'pinrequired') {
|
2188
|
|
|
|
|
|
|
$s->{PinRequired} = $value;
|
2189
|
|
|
|
|
|
|
} elsif ($name eq 'pinminlength') {
|
2190
|
|
|
|
|
|
|
$s->{PinMinLength} = $value;
|
2191
|
|
|
|
|
|
|
} elsif ($name eq 'pinmaxlength') {
|
2192
|
|
|
|
|
|
|
$s->{PinMaxLength} = $value;
|
2193
|
|
|
|
|
|
|
} elsif ($name eq 'textrequired') {
|
2194
|
|
|
|
|
|
|
$s->{TextRequired} = $value;
|
2195
|
|
|
|
|
|
|
} elsif ($name eq 'textminlength') {
|
2196
|
|
|
|
|
|
|
$s->{TextMinLength} = $value;
|
2197
|
|
|
|
|
|
|
} elsif ($name eq 'textmaxlength') {
|
2198
|
|
|
|
|
|
|
$s->{TextMaxLength} = $value;
|
2199
|
|
|
|
|
|
|
} elsif ($name eq 'fromrequired') {
|
2200
|
|
|
|
|
|
|
$s->{FromRequired} = $value;
|
2201
|
|
|
|
|
|
|
} elsif ($name eq 'fromminlength') {
|
2202
|
|
|
|
|
|
|
$s->{FromMinLength} = $value;
|
2203
|
|
|
|
|
|
|
} elsif ($name eq 'frommaxlength') {
|
2204
|
|
|
|
|
|
|
$s->{FromMaxLength} = $value;
|
2205
|
|
|
|
|
|
|
} elsif ($name eq 'callbackrequired') {
|
2206
|
|
|
|
|
|
|
$s->{CallbackRequired} = $value;
|
2207
|
|
|
|
|
|
|
} elsif ($name eq 'callbacksupported') {
|
2208
|
|
|
|
|
|
|
$s->{CallbackSupported} = $value;
|
2209
|
|
|
|
|
|
|
} elsif ($name eq 'callbackminlength') {
|
2210
|
|
|
|
|
|
|
$s->{CallbackMinLength} = $value;
|
2211
|
|
|
|
|
|
|
} elsif ($name eq 'callbackmaxlength') {
|
2212
|
|
|
|
|
|
|
$s->{CallbackMaxLength} = $value;
|
2213
|
|
|
|
|
|
|
} elsif ($name eq 'type') {
|
2214
|
|
|
|
|
|
|
$s->{Type} = $value;
|
2215
|
|
|
|
|
|
|
} elsif ($name eq 'smartmsg') {
|
2216
|
|
|
|
|
|
|
$s->{SmartMsgID} = $value;
|
2217
|
|
|
|
|
|
|
} elsif ($name eq 'countrycode') {
|
2218
|
|
|
|
|
|
|
$s->{CountryCode} = $value;
|
2219
|
|
|
|
|
|
|
} elsif ($name eq 'countryname') {
|
2220
|
|
|
|
|
|
|
$s->{CountryName} = $value;
|
2221
|
|
|
|
|
|
|
}
|
2222
|
|
|
|
|
|
|
}
|
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
# add entry onto carrier list
|
2225
|
|
|
|
|
|
|
push @{ $self->{m_CarrierList} }, $s;
|
2226
|
|
|
|
|
|
|
}
|
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
######################################################################
|
2229
|
|
|
|
|
|
|
#
|
2230
|
|
|
|
|
|
|
# PRIVATE FUNCTIONS
|
2231
|
|
|
|
|
|
|
#
|
2232
|
|
|
|
|
|
|
######################################################################
|
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
sub escape {
|
2235
|
|
|
|
|
|
|
shift() if ref($_[0]);
|
2236
|
|
|
|
|
|
|
my $toencode = shift();
|
2237
|
|
|
|
|
|
|
return undef unless defined($toencode);
|
2238
|
|
|
|
|
|
|
$toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
|
2239
|
|
|
|
|
|
|
return $toencode;
|
2240
|
|
|
|
|
|
|
}
|
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
|
2243
|
|
|
|
|
|
|
sub html_encode {
|
2244
|
|
|
|
|
|
|
shift() if ref($_[0]);
|
2245
|
|
|
|
|
|
|
my $toencode = shift();
|
2246
|
|
|
|
|
|
|
return undef unless defined($toencode);
|
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
$toencode =~ s/</g;
|
2249
|
|
|
|
|
|
|
$toencode =~ s/>/>/g;
|
2250
|
|
|
|
|
|
|
$toencode =~ s/&/&/g;
|
2251
|
|
|
|
|
|
|
$toencode =~ s/"/"/g;
|
2252
|
|
|
|
|
|
|
$toencode =~ s/'/'/g;
|
2253
|
|
|
|
|
|
|
|
2254
|
|
|
|
|
|
|
return $toencode;
|
2255
|
|
|
|
|
|
|
}
|
2256
|
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
sub unicode_encode {
|
2259
|
|
|
|
|
|
|
|
2260
|
|
|
|
|
|
|
shift() if ref($_[0]);
|
2261
|
|
|
|
|
|
|
my $toencode = shift();
|
2262
|
|
|
|
|
|
|
return undef unless defined($toencode);
|
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
Unicode::String->stringify_as("utf8");
|
2265
|
|
|
|
|
|
|
my $unicode_str = Unicode::String->new();
|
2266
|
|
|
|
|
|
|
my $text_str = "";
|
2267
|
|
|
|
|
|
|
my $pack_str = "";
|
2268
|
|
|
|
|
|
|
|
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
# encode Perl UTF-8 string into latin1 Unicode::String
|
2271
|
|
|
|
|
|
|
# - currently only Basic Latin and Latin 1 Supplement
|
2272
|
|
|
|
|
|
|
# are supported here due to issues with Unicode::String .
|
2273
|
|
|
|
|
|
|
$unicode_str->latin1( $toencode );
|
2274
|
|
|
|
|
|
|
|
2275
|
|
|
|
|
|
|
# Convert to hex format ("U+XXXX U+XXXX ")
|
2276
|
|
|
|
|
|
|
$text_str = $unicode_str->hex;
|
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
# Now, the interesting part.
|
2279
|
|
|
|
|
|
|
# We must search for the (now hex-encoded)
|
2280
|
|
|
|
|
|
|
# Simplewire Unicode escape sequence.
|
2281
|
|
|
|
|
|
|
my $pattern = 'U\+005[C|c] U\+0058 U\+00([0-9A-Fa-f])([0-9A-Fa-f]) U\+00([0-9A-Fa-f])([0-9A-Fa-f]) U\+00([0-9A-Fa-f])([0-9A-Fa-f]) U\+00([0-9A-Fa-f])([0-9A-Fa-f])';
|
2282
|
|
|
|
|
|
|
|
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
# Replace Simplewire escapes with entities (beginning of string)
|
2285
|
|
|
|
|
|
|
$_ = $text_str;
|
2286
|
|
|
|
|
|
|
if( /^$pattern/ )
|
2287
|
|
|
|
|
|
|
{
|
2288
|
|
|
|
|
|
|
$pack_str = pack "H8", "$1$2$3$4$5$6$7$8";
|
2289
|
|
|
|
|
|
|
$text_str =~ s/^$pattern/\$pack_str/;
|
2290
|
|
|
|
|
|
|
}
|
2291
|
|
|
|
|
|
|
|
2292
|
|
|
|
|
|
|
# Replace Simplewire escapes with entities (middle of string)
|
2293
|
|
|
|
|
|
|
$_ = $text_str;
|
2294
|
|
|
|
|
|
|
while( / $pattern/ )
|
2295
|
|
|
|
|
|
|
{
|
2296
|
|
|
|
|
|
|
$pack_str = pack "H8", "$1$2$3$4$5$6$7$8";
|
2297
|
|
|
|
|
|
|
$text_str =~ s/ $pattern/\;\$pack_str/;
|
2298
|
|
|
|
|
|
|
$_ = $text_str;
|
2299
|
|
|
|
|
|
|
}
|
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
# Replace "U+" with "" (beginning of string)
|
2303
|
|
|
|
|
|
|
$text_str =~ s/^U\+// ;
|
2304
|
|
|
|
|
|
|
|
2305
|
|
|
|
|
|
|
# Replace " U+" with ";" (middle of string)
|
2306
|
|
|
|
|
|
|
$text_str =~ s/ U\+/;/g ;
|
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
# Append ";" to end of string to close last entity.
|
2310
|
|
|
|
|
|
|
# This last ";" at the end of the string isn't necessary in most parsers.
|
2311
|
|
|
|
|
|
|
# However, it is included anyways to ensure full compatibility.
|
2312
|
|
|
|
|
|
|
if( $text_str ne "" )
|
2313
|
|
|
|
|
|
|
{
|
2314
|
|
|
|
|
|
|
$text_str .= ';';
|
2315
|
|
|
|
|
|
|
}
|
2316
|
|
|
|
|
|
|
|
2317
|
|
|
|
|
|
|
return $text_str;
|
2318
|
|
|
|
|
|
|
}
|
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
sub handle_http_error {
|
2322
|
|
|
|
|
|
|
|
2323
|
|
|
|
|
|
|
my $self = shift();
|
2324
|
|
|
|
|
|
|
my $http_error = shift();
|
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
my $errorLookup = {
|
2327
|
|
|
|
|
|
|
#HTTP Simplewire
|
2328
|
|
|
|
|
|
|
#ERROR ERROR
|
2329
|
|
|
|
|
|
|
#---------------------
|
2330
|
|
|
|
|
|
|
400 => 251,
|
2331
|
|
|
|
|
|
|
401 => 252,
|
2332
|
|
|
|
|
|
|
402 => 253,
|
2333
|
|
|
|
|
|
|
403 => 254,
|
2334
|
|
|
|
|
|
|
404 => 255,
|
2335
|
|
|
|
|
|
|
405 => 256,
|
2336
|
|
|
|
|
|
|
406 => 257,
|
2337
|
|
|
|
|
|
|
407 => 258,
|
2338
|
|
|
|
|
|
|
408 => 259,
|
2339
|
|
|
|
|
|
|
409 => 260,
|
2340
|
|
|
|
|
|
|
410 => 261,
|
2341
|
|
|
|
|
|
|
411 => 262,
|
2342
|
|
|
|
|
|
|
412 => 263,
|
2343
|
|
|
|
|
|
|
413 => 264,
|
2344
|
|
|
|
|
|
|
414 => 265,
|
2345
|
|
|
|
|
|
|
415 => 266,
|
2346
|
|
|
|
|
|
|
500 => 267,
|
2347
|
|
|
|
|
|
|
501 => 268,
|
2348
|
|
|
|
|
|
|
502 => 269,
|
2349
|
|
|
|
|
|
|
503 => 270,
|
2350
|
|
|
|
|
|
|
504 => 271,
|
2351
|
|
|
|
|
|
|
505 => 272,
|
2352
|
|
|
|
|
|
|
};
|
2353
|
|
|
|
|
|
|
|
2354
|
|
|
|
|
|
|
# check if it was anything but success codes
|
2355
|
|
|
|
|
|
|
if( $http_error >= 200 && $http_error < 300 ) {
|
2356
|
|
|
|
|
|
|
# return that no error was found
|
2357
|
|
|
|
|
|
|
# $self->raise_error(0);
|
2358
|
|
|
|
|
|
|
return 0;
|
2359
|
|
|
|
|
|
|
}
|
2360
|
|
|
|
|
|
|
|
2361
|
|
|
|
|
|
|
# Check if valid http error number
|
2362
|
|
|
|
|
|
|
if (defined( $errorLookup->{$http_error})) {
|
2363
|
|
|
|
|
|
|
# valid http error number, so set Simplewire error
|
2364
|
|
|
|
|
|
|
$self->raise_error( $errorLookup->{$http_error} );
|
2365
|
|
|
|
|
|
|
return 1;
|
2366
|
|
|
|
|
|
|
}
|
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
# At this point, we know that the error is not a success code
|
2369
|
|
|
|
|
|
|
# Nor is it an http error on our list of http errors, so return 0
|
2370
|
|
|
|
|
|
|
# - no http error.
|
2371
|
|
|
|
|
|
|
return 0;
|
2372
|
|
|
|
|
|
|
}
|
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
sub raise_error {
|
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
my $self = shift();
|
2377
|
|
|
|
|
|
|
my $error = shift();
|
2378
|
|
|
|
|
|
|
|
2379
|
|
|
|
|
|
|
$self->errorCode($error);
|
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
my $errorLookup = {
|
2382
|
|
|
|
|
|
|
# Client/Internet Error Codes
|
2383
|
|
|
|
|
|
|
101 => "Error while parsing response. Request was sent off.",
|
2384
|
|
|
|
|
|
|
102 => "The required version attribute of the response element was not found in the response.",
|
2385
|
|
|
|
|
|
|
103 => "The required protocol attribute of the response element was not found in the response.",
|
2386
|
|
|
|
|
|
|
104 => "The required type attribute of the response element was not found in the response.",
|
2387
|
|
|
|
|
|
|
105 => "The client tool does not know how to handle the type of response.",
|
2388
|
|
|
|
|
|
|
106 => "A connection could not be established with the Simplewire network.",
|
2389
|
|
|
|
|
|
|
107 => "Internet The connection timed out.",
|
2390
|
|
|
|
|
|
|
108 => "Internet An internal error occured while connecting.",
|
2391
|
|
|
|
|
|
|
109 => "Internet Trying to use an invalid URL.",
|
2392
|
|
|
|
|
|
|
110 => "Internet The host name could not be resolved.",
|
2393
|
|
|
|
|
|
|
111 => "Internet The specified protocol is not supported.",
|
2394
|
|
|
|
|
|
|
112 => "Internet An error occured while authenticating.",
|
2395
|
|
|
|
|
|
|
113 => "Internet An error occured while logging on.",
|
2396
|
|
|
|
|
|
|
114 => "Internet An invalid operation was attempted.",
|
2397
|
|
|
|
|
|
|
115 => "Internet The request is pending.",
|
2398
|
|
|
|
|
|
|
116 => "Internet An error occured while processing the proxy request.",
|
2399
|
|
|
|
|
|
|
117 => "Internet SOCKS server returned an invalid version.",
|
2400
|
|
|
|
|
|
|
118 => "Internet SOCKS error while connecting.",
|
2401
|
|
|
|
|
|
|
119 => "Internet SOCKS authentication error.",
|
2402
|
|
|
|
|
|
|
120 => "Internet SOCKS general error.",
|
2403
|
|
|
|
|
|
|
121 => "Internet Proxy authentication error.",
|
2404
|
|
|
|
|
|
|
122 => "Internet The proxy host name could not be resolved.",
|
2405
|
|
|
|
|
|
|
123 => "Internet An error occured while transfering data.",
|
2406
|
|
|
|
|
|
|
|
2407
|
|
|
|
|
|
|
# HTTP Errors
|
2408
|
|
|
|
|
|
|
250 => "HTTP Error.",
|
2409
|
|
|
|
|
|
|
251 => "HTTP Bad request.", # 400
|
2410
|
|
|
|
|
|
|
252 => "HTTP Unauthorized.", # 401
|
2411
|
|
|
|
|
|
|
253 => "HTTP Payment required.", # 402
|
2412
|
|
|
|
|
|
|
254 => "HTTP Forbidden.", # 403
|
2413
|
|
|
|
|
|
|
255 => "HTTP Not found.", # 404
|
2414
|
|
|
|
|
|
|
256 => "HTTP Method not allowed.", # 405
|
2415
|
|
|
|
|
|
|
257 => "HTTP Not acceptable.", # 406
|
2416
|
|
|
|
|
|
|
258 => "HTTP Proxy authentication required.", # 407
|
2417
|
|
|
|
|
|
|
259 => "HTTP Request timeout.", # 408
|
2418
|
|
|
|
|
|
|
260 => "HTTP Conflict.", # 409
|
2419
|
|
|
|
|
|
|
261 => "HTTP Gone.", # 410
|
2420
|
|
|
|
|
|
|
262 => "HTTP Length required.", # 411
|
2421
|
|
|
|
|
|
|
263 => "HTTP Precondition failed.", # 412
|
2422
|
|
|
|
|
|
|
264 => "HTTP Request Entity too large.", # 413
|
2423
|
|
|
|
|
|
|
265 => "HTTP Request-URI too long.", # 414
|
2424
|
|
|
|
|
|
|
266 => "HTTP Unsupported media type.", # 415
|
2425
|
|
|
|
|
|
|
267 => "HTTP Internal server error.", # 500
|
2426
|
|
|
|
|
|
|
268 => "SSL not supported or bad HTTP method", # 501
|
2427
|
|
|
|
|
|
|
269 => "HTTP Bad gateway.", # 502
|
2428
|
|
|
|
|
|
|
270 => "HTTP Service unavailable.", # 503
|
2429
|
|
|
|
|
|
|
271 => "HTTP Gateway timeout.", # 504
|
2430
|
|
|
|
|
|
|
272 => "HTTP Version not supported.", # 505
|
2431
|
|
|
|
|
|
|
};
|
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
# Check if valid error number
|
2435
|
|
|
|
|
|
|
if (defined( $errorLookup->{$error})) {
|
2436
|
|
|
|
|
|
|
# valid error number, so set error description
|
2437
|
|
|
|
|
|
|
$self->errorDesc( $errorLookup->{$error} );
|
2438
|
|
|
|
|
|
|
} else {
|
2439
|
|
|
|
|
|
|
# invalid error number, so set general error
|
2440
|
|
|
|
|
|
|
$self->errorCode( 106 );
|
2441
|
|
|
|
|
|
|
$self->errorDesc( $errorLookup->{106} );
|
2442
|
|
|
|
|
|
|
}
|
2443
|
|
|
|
|
|
|
}
|
2444
|
|
|
|
|
|
|
|
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
sub prepare_post {
|
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
my $self = shift();
|
2449
|
|
|
|
|
|
|
my $varref = shift();
|
2450
|
|
|
|
|
|
|
|
2451
|
|
|
|
|
|
|
my $body = "";
|
2452
|
|
|
|
|
|
|
# cycle through all key/value pairs and add to content
|
2453
|
|
|
|
|
|
|
while (my ($var,$value) = map { escape($_) } each %$varref)
|
2454
|
|
|
|
|
|
|
{
|
2455
|
|
|
|
|
|
|
if ($body)
|
2456
|
|
|
|
|
|
|
{
|
2457
|
|
|
|
|
|
|
$body .= "&$var=$value";
|
2458
|
|
|
|
|
|
|
}
|
2459
|
|
|
|
|
|
|
else
|
2460
|
|
|
|
|
|
|
{
|
2461
|
|
|
|
|
|
|
$body = "$var=$value";
|
2462
|
|
|
|
|
|
|
}
|
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
}
|
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
# return newly formed content
|
2467
|
|
|
|
|
|
|
return $body;
|
2468
|
|
|
|
|
|
|
}
|
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
|
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
sub send {
|
2473
|
|
|
|
|
|
|
|
2474
|
|
|
|
|
|
|
# pop value
|
2475
|
|
|
|
|
|
|
my $self = shift();
|
2476
|
|
|
|
|
|
|
|
2477
|
|
|
|
|
|
|
# check to make sure that this function is being called on an object
|
2478
|
|
|
|
|
|
|
die "You must instantiate an object to use this function" if !(ref($self));
|
2479
|
|
|
|
|
|
|
|
2480
|
|
|
|
|
|
|
$self->{m_Type} = shift();
|
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
my $txt = "";
|
2483
|
|
|
|
|
|
|
|
2484
|
|
|
|
|
|
|
##################################################################
|
2485
|
|
|
|
|
|
|
# Create LWP::UserAgent Object
|
2486
|
|
|
|
|
|
|
##################################################################
|
2487
|
|
|
|
|
|
|
my $http = new LWP::UserAgent;
|
2488
|
|
|
|
|
|
|
$http->timeout( $self->connectionTimeout );
|
2489
|
|
|
|
|
|
|
$http->agent( $self->{m_UserAgent} . ' ' . $http->agent );
|
2490
|
|
|
|
|
|
|
|
2491
|
|
|
|
|
|
|
if( defined( $self->{m_ProxyServer} ) )
|
2492
|
|
|
|
|
|
|
{
|
2493
|
|
|
|
|
|
|
$http->proxy("http", "http://" . $self->proxyServer . ':' . $self->proxyPort . '/');
|
2494
|
|
|
|
|
|
|
}
|
2495
|
|
|
|
|
|
|
|
2496
|
|
|
|
|
|
|
my $httpErrorEvent = undef;
|
2497
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
# Create a request
|
2499
|
|
|
|
|
|
|
my $request = undef;
|
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
my $response = undef;
|
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
# create the xml body
|
2504
|
|
|
|
|
|
|
my $body = $self->toXML();
|
2505
|
|
|
|
|
|
|
|
2506
|
|
|
|
|
|
|
##########################################################
|
2507
|
|
|
|
|
|
|
# Create the url to retrieve
|
2508
|
|
|
|
|
|
|
##########################################################
|
2509
|
|
|
|
|
|
|
my $server_name = $self->remoteHost;
|
2510
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
# check whether or not the port needs overridden
|
2512
|
|
|
|
|
|
|
if (defined($self->remotePort) && $self->remotePort > 0) {
|
2513
|
|
|
|
|
|
|
if ($self->debug) { print "Connect: overriding remote port to " . $self->remotePort . "\n"; }
|
2514
|
|
|
|
|
|
|
$server_name = $server_name . ":" . $self->remotePort;
|
2515
|
|
|
|
|
|
|
} else {
|
2516
|
|
|
|
|
|
|
if ($self->debug) { print "Connect: using default http or https port\n"; }
|
2517
|
|
|
|
|
|
|
}
|
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
my $full_file = undef;
|
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
if ($self->{m_Secure}) {
|
2522
|
|
|
|
|
|
|
$full_file = 'https://' . $server_name . $self->{m_RemoteFile};
|
2523
|
|
|
|
|
|
|
} else {
|
2524
|
|
|
|
|
|
|
$full_file = 'http://' . $server_name . $self->{m_RemoteFile};
|
2525
|
|
|
|
|
|
|
}
|
2526
|
|
|
|
|
|
|
|
2527
|
|
|
|
|
|
|
if ($self->debug) {
|
2528
|
|
|
|
|
|
|
print "Connecting to: $full_file\n";
|
2529
|
|
|
|
|
|
|
}
|
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
##########################################################
|
2532
|
|
|
|
|
|
|
# Request and get response
|
2533
|
|
|
|
|
|
|
##########################################################
|
2534
|
|
|
|
|
|
|
|
2535
|
|
|
|
|
|
|
# finish setting up request
|
2536
|
|
|
|
|
|
|
$request = new HTTP::Request( POST => $full_file);
|
2537
|
|
|
|
|
|
|
$request->content_type("text/xml");
|
2538
|
|
|
|
|
|
|
$request->content($body);
|
2539
|
|
|
|
|
|
|
$request->header( 'Accept' => 'text/xml' );
|
2540
|
|
|
|
|
|
|
$request->proxy_authorization_basic( $self->proxyUsername,
|
2541
|
|
|
|
|
|
|
$self->proxyPassword );
|
2542
|
|
|
|
|
|
|
|
2543
|
|
|
|
|
|
|
# send off request and get response
|
2544
|
|
|
|
|
|
|
$response = $http->request($request);
|
2545
|
|
|
|
|
|
|
|
2546
|
|
|
|
|
|
|
$self->{m_ClientStatusCode} = $response->code;
|
2547
|
|
|
|
|
|
|
$self->{m_ClientStatusDesc} = $response->message;
|
2548
|
|
|
|
|
|
|
|
2549
|
|
|
|
|
|
|
if ($self->handle_http_error($self->{m_ClientStatusCode})) {
|
2550
|
|
|
|
|
|
|
$httpErrorEvent = 1;
|
2551
|
|
|
|
|
|
|
}
|
2552
|
|
|
|
|
|
|
|
2553
|
|
|
|
|
|
|
if ( $self->{DEBUG} && defined( $self->proxyServer ) && $response->is_success) {
|
2554
|
|
|
|
|
|
|
print "Successful Proxy\n";
|
2555
|
|
|
|
|
|
|
} elsif( $self->{DEBUG} && defined($self->proxyServer)) {
|
2556
|
|
|
|
|
|
|
print "Failed Proxy\n";
|
2557
|
|
|
|
|
|
|
}
|
2558
|
|
|
|
|
|
|
|
2559
|
|
|
|
|
|
|
if (defined($response) && defined($response->content)) {
|
2560
|
|
|
|
|
|
|
$txt = $response->content;
|
2561
|
|
|
|
|
|
|
} else {
|
2562
|
|
|
|
|
|
|
$txt = "";
|
2563
|
|
|
|
|
|
|
}
|
2564
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
if($self->{DEBUG}) {
|
2566
|
|
|
|
|
|
|
print "@ SEND\n";
|
2567
|
|
|
|
|
|
|
print "Client Status Code: $self->{m_ClientStatusCode}\n";
|
2568
|
|
|
|
|
|
|
print "Client Status Desc: $self->{m_ClientStatusDesc}\n";
|
2569
|
|
|
|
|
|
|
print "m_ErrorCode == " . $self->errorCode . "\n";
|
2570
|
|
|
|
|
|
|
print "m_ErrorDesc == " . $self->errorDesc . "\n";
|
2571
|
|
|
|
|
|
|
print "Response Body == " . $txt . "\n";
|
2572
|
|
|
|
|
|
|
}
|
2573
|
|
|
|
|
|
|
|
2574
|
|
|
|
|
|
|
# now, check for errors, special cases. Parse response.
|
2575
|
|
|
|
|
|
|
# Check for HTTP Error
|
2576
|
|
|
|
|
|
|
if ( defined($httpErrorEvent) ) {
|
2577
|
|
|
|
|
|
|
# do nothing. Http error codes were already set.
|
2578
|
|
|
|
|
|
|
return 0;
|
2579
|
|
|
|
|
|
|
} elsif (defined($txt) && $txt eq "") {
|
2580
|
|
|
|
|
|
|
$self->raise_error(106);
|
2581
|
|
|
|
|
|
|
return 0;
|
2582
|
|
|
|
|
|
|
# Now parse the xml
|
2583
|
|
|
|
|
|
|
} else {
|
2584
|
|
|
|
|
|
|
# Cleanup text
|
2585
|
|
|
|
|
|
|
if (defined($txt)) {
|
2586
|
|
|
|
|
|
|
# set the response xml
|
2587
|
|
|
|
|
|
|
$self->{ResponseXML} = $txt;
|
2588
|
|
|
|
|
|
|
$self->parse($txt);
|
2589
|
|
|
|
|
|
|
return 1;
|
2590
|
|
|
|
|
|
|
} else {
|
2591
|
|
|
|
|
|
|
# Problem, set general error. Return fail.
|
2592
|
|
|
|
|
|
|
$self->raise_error(106);
|
2593
|
|
|
|
|
|
|
return 0;
|
2594
|
|
|
|
|
|
|
}
|
2595
|
|
|
|
|
|
|
}
|
2596
|
|
|
|
|
|
|
}
|
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
1;
|
2599
|
|
|
|
|
|
|
__END__;
|