]> git.pld-linux.org Git - packages/asa.git/blob - asa-svn-26-05-2007.patch
- updated to recent version,
[packages/asa.git] / asa-svn-26-05-2007.patch
1 diff -ruN asa-0.1.7/ApaSMSAgent.pl asa-svn-26-05-2007/ApaSMSAgent.pl
2 --- asa-0.1.7/ApaSMSAgent.pl    2005-04-22 12:23:56.000000000 +0200
3 +++ asa-svn-26-05-2007/ApaSMSAgent.pl   2007-05-26 09:24:06.000000000 +0200
4 @@ -58,7 +58,7 @@
5  };
6  
7  my $STD_MSG="Hello! I'm ApaSMSAgent ".VERSION."\n".
8 -       "Add contacts like +48xxxxxxxxx@".$config{service_name}." to your roster to send them SMS messages.\n".
9 +       "Add contacts like +xxxxxxxxxxx@".$config{service_name}." to your roster to send them SMS messages.\n".
10         "Browse ".$config{service_name}." in your service browser to see available plugins and change their options or register if needed.\n".
11         "Available plugins:";
12  foreach my $p (keys %plugins) {
13 @@ -303,8 +303,8 @@
14                 } elsif ($type eq 'set') {
15                         my $nr=$query_o->GetPrompt();
16                         # FIXME needs work:
17 -                       if ($nr=~/[0-9]{11,11}/) {
18 -                               $nr=~s/^.*([0-9]{11,11}).*$/$1/;
19 +                       if ($nr=~/[0-9]{11,}/) {
20 +                               $nr=~s/^.*?([0-9]{11,}).*?$/$1/;
21                         } elsif ($nr=~/[0-9]{9,9}/) {
22                                 $nr=~s/^.*([0-9]{9,9}).*$/48$1/;
23                         } else {
24 @@ -405,9 +405,21 @@
25                                 $message->SetBody($b);
26                                 $message->SetType($message_o->GetType());
27                                 $Connection->Send($message);
28 +                       } elsif ($body =~ /^\/stats$/i) {
29 +                               log3("stats from admin $base_from");
30 +                               my $b="Users #".(keys %numbers);
31 +                my $numbers_count = 0;
32 +                               foreach my $user (keys %numbers) {
33 +                    $numbers_count += keys %{$numbers{$user}};
34 +                };
35 +                $b .= ", numbers #".$numbers_count;
36 +                               $message->SetBody($b);
37 +                               $message->SetType($message_o->GetType());
38 +                               $Connection->Send($message);
39                         } elsif ($body =~ /^\/help$/i) {
40                                 log3("help from admin $base_from");
41                                 $message->SetBody("/wall or /motd - wall message\n".
42 +                                       "/stats - print basic statistic info\n".
43                                         "/DUMPPLUGINS - dump plugins hash\n".
44                                         "/DUMPCONFIG - dump config hash\n".
45  #                                      "/dumpnumbers - dump numbers hash\n".
46 @@ -480,7 +492,7 @@
47                         };
48                 };
49         } elsif ($to =~ /@/) { # someting with @ :P
50 -               if ($to =~ /^\+[0-9]{11}\@/) { # generic nr, good nr 
51 +               if ($to =~ /^\+(48[0-9]{9}|[0-9]{11,})\@/) { # generic nr, good nr 
52                         my $nr=$to; $nr=~s/@.+$//;
53                         if ($type eq 'subscribe') {
54                                 $presence->SetType('subscribe'); # ask him for auth, we need to maintain his list of numbers
55 diff -ruN asa-0.1.7/config.xml asa-svn-26-05-2007/config.xml
56 --- asa-0.1.7/config.xml        2005-01-14 21:18:13.000000000 +0100
57 +++ asa-svn-26-05-2007/config.xml       2007-05-26 09:24:23.000000000 +0200
58 @@ -28,23 +28,23 @@
59         <load>
60                 <plugin>MiastoPlusa</plugin>
61                 <plugin>WwwPlusa</plugin>
62 -               <plugin>IdeaMbox</plugin>
63 -               <plugin>EraOmnix_Podstawowa</plugin>
64 -               <plugin>EraOmnix_Platna</plugin>
65 +               <plugin>OrangeMbox</plugin>
66 +               <plugin>EraOmnix_Sponsorowana</plugin>
67 +               <plugin>EraOmnix_Multimedialna</plugin>
68         </load>
69         <!-- plugins' own options and settings -->
70         <plugins>
71                 <MiastoPlusa>
72                         <accounts_file>./storage/accounts-MiastoPlusa.mldbm</accounts_file>
73                 </MiastoPlusa>
74 -               <IdeaMbox>
75 -                       <accounts_file>./storage/accounts-IdeaMbox.mldbm</accounts_file>
76 -               </IdeaMbox>
77 -               <EraOmnix_Podstawowa>
78 -                       <accounts_file>./storage/accounts-EraOmnix_Podstawowa.mldbm</accounts_file>
79 -               </EraOmnix_Podstawowa>
80 -               <EraOmnix_Platna>
81 -                       <accounts_file>./storage/accounts-EraOmnix_Platna.mldbm</accounts_file>
82 -               </EraOmnix_Platna>
83 +               <OrangeMbox>
84 +                       <accounts_file>./storage/accounts-OrangeMbox.mldbm</accounts_file>
85 +               </OrangeMbox>
86 +               <EraOmnix_Sponsorowana>
87 +                       <accounts_file>./storage/accounts-EraOmnix_Sponsorowana.mldbm</accounts_file>
88 +               </EraOmnix_Sponsorowana>
89 +               <EraOmnix_Multimedialna>
90 +                       <accounts_file>./storage/accounts-EraOmnix_Multimedialna.mldbm</accounts_file>
91 +               </EraOmnix_Multimedialna>
92         </plugins>
93  </config>
94 diff -ruN asa-0.1.7/plugins/EraOmnix_Multimedialna.pl asa-svn-26-05-2007/plugins/EraOmnix_Multimedialna.pl
95 --- asa-0.1.7/plugins/EraOmnix_Multimedialna.pl 1970-01-01 01:00:00.000000000 +0100
96 +++ asa-svn-26-05-2007/plugins/EraOmnix_Multimedialna.pl        2007-05-26 09:25:13.000000000 +0200
97 @@ -0,0 +1,181 @@
98 +use strict;
99 +use LWP::UserAgent;
100 +use HTTP::Request::Common qw(GET POST);
101 +use HTTP::Response;
102 +use Unicode::Lite;
103 +
104 +my $PLUGIN_NAME                        = "EraOmnix_Multimedialna";
105 +my $PLUGIN_VERSION             = "0.3-20051002-kg";
106 +my $DEFAULT_PRIO               = 5;
107 +my $DEST_NUMBERS_REGEXP                =  '^\+[0-9]+'; # needed linke this in // good numberz? any, they say
108 +
109 +use vars qw ( %EraOmnix_Mult_accounts );
110 +
111 +# RULES:
112 +# 1. ALWAYS, ALWAYS, ALWAYS create new presence/message/iq
113 +# 2. Create handlers, plugin is named ser.vi.ce/Plugin
114 +# 3. Provide ALL info into %plugin_data
115 +
116 +RegisterEvent('iq','^'.$config{service_name}."/".$PLUGIN_NAME.'$',\&EraOmnix_Mult_InIQ); # for registration
117 +RegisterEvent('pre_connect','.+',\&EraOmnix_Mult_PreConn); # for loading some data ;)
118 +
119 +$plugin_data{$PLUGIN_NAME}->{inmessage_h}=\&EraOmnix_Mult_InMessage;
120 +$plugin_data{$PLUGIN_NAME}->{will_take_h}=\&EraOmnix_Mult_WillTake;
121 +$plugin_data{$PLUGIN_NAME}->{default_prio}=$DEFAULT_PRIO;
122 +$plugin_data{$PLUGIN_NAME}->{version}=$PLUGIN_VERSION;
123 +$plugin_data{$PLUGIN_NAME}->{needs_reg}=1;
124 +
125 +sub EraOmnix_Mult_WillTake {
126 +        my $from=shift;
127 +        my $to_nr=shift; # if not provided, it means it asks for the service, w/o number served by it 
128 +        return (($to_nr?($to_nr =~ /$DEST_NUMBERS_REGEXP/):1)&&(exists($EraOmnix_Mult_accounts{$from})));
129 +};
130 +
131 +sub EraOmnix_Mult_PreConn {
132 +#      %EraOmnix_Mult_accounts=%{LoadXMLHash('accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME)};
133 +       my $t=tie(%EraOmnix_Mult_accounts,"MLDBM::Sync",$config{plugins}->{$PLUGIN_NAME}->{accounts_file},O_CREAT|O_RDWR,0600);
134 +       log2($PLUGIN_NAME.": Ready.");
135 +};
136 +
137 +sub EraOmnix_Mult_InIQ {
138 +       my $iq_o=shift;
139 +       my $xmlns=shift;
140 +       my $query_o=$iq_o->GetQuery();
141 +       my $type=$iq_o->GetType();
142 +       my $from=$iq_o->GetFrom(); my $to=$iq_o->GetTo();
143 +       my $iq=new Net::Jabber::IQ;
144 +       $iq->SetFrom($to); $iq->SetTo($from); $iq->SetID($iq_o->GetID);
145 +       my $query=$iq->NewQuery($xmlns);
146 +
147 +       if ($xmlns eq 'jabber:iq:register') {
148 +               my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
149 +               my $account=$EraOmnix_Mult_accounts{$base_from};
150 +               if ($type eq 'get') {
151 +                       $iq->SetType('result');
152 +                       $query->SetInstructions('Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
153 +                               "You can add a contact like this to your roster.\n\n".
154 +                               "Provide your Username and Password to ".$PLUGIN_NAME." gateway.\n".
155 +                               "See http://www.eraomnix.pl/pl/between-us/send-sms-mms for info.\n\n".
156 +                               "Note: x:data compilant client allows setting more options.");
157 +                       $query->SetUsername( ($account?$account->{username}:'') );
158 +                       $query->SetPassword('');
159 +                       # x:data ...
160 +                       my $xd=( (Net::Jabber->VERSION>1.30) ? new Net::Jabber::Stanza("x") : new Net::Jabber::X );
161 +                       $xd->SetXMLNS('jabber:x:data');
162 +                       $xd->SetData(instructions=>'Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
163 +                                       "You can add a contact like this to your roster.\n".
164 +                                       "Provide your Username and Password to ".$PLUGIN_NAME." gateway.\n".
165 +                                       "See http://www.eraomnix.pl/pl/between-us/send-sms-mms for info.\n".
166 +                                       "You can configure additional options too. When changing options, remember to provide ".
167 +                                       "your password!",
168 +                               title=>"$PLUGIN_NAME Registration",
169 +                               type=>'form');
170 +                       $xd->AddField(type=>'text-single',var=>'username',label=>'User name',
171 +                               value=>($account?$account->{username}:''));
172 +                       $xd->AddField(type=>'text-private',var=>'password',label=>'Password (!) ');
173 +                       $xd->AddField(type=>'boolean',var=>'mms',label=>'MMS',
174 +                               value=>($account->{mms}?$account->{mms}:0));
175 +                       $query->AddX($xd);
176 +                       # ... x:data
177 +                       $Connection->Send($iq);
178 +               } elsif ($type eq 'set') {
179 +                       # x:data ...
180 +                       my @xd=$query_o->GetX('jabber:x:data'); my %f;
181 +                       if ($#xd>-1) {
182 +                               foreach my $x ($xd[0]->GetFields()) { $f{$x->GetVar()}=$x->GetValue(); };
183 +                       } else {
184 +                               $f{username}=$query_o->GetUsername(); $f{password}=$query_o->GetPassword();
185 +                               $f{mms}=0;
186 +                       };
187 +                       # ... x:data
188 +                       if (($f{username} eq '')&&($f{password} eq '')) {
189 +                               SendPluginPresencesToUser($PLUGIN_NAME,'unavailable',$from);
190 +                               delete $EraOmnix_Mult_accounts{$base_from};
191 +                       } else {
192 +                               for my $i (qw(username password mms)) { $account->{$i}=$f{$i}; };
193 +                               $EraOmnix_Mult_accounts{$base_from}=$account;
194 +                               SendPluginPresencesToUser($PLUGIN_NAME,'available',$from);
195 +                               PushAgentToUsersRoster($from); # important in any plugin which needs registration!
196 +                       };
197 +#                      SaveXMLHash(\%EraOmnix_Mult_accounts,'accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME);
198 +                       $iq->SetType('result');
199 +                       $Connection->Send($iq);
200 +               };
201 +       };
202 +};
203 +
204 +my %EraOmnix_Mult_errmsgs=(
205 +       '0'=>'wysy³ka bez b³êdu',
206 +       '1'=>'awaria systemu',
207 +       '2'=>'u¿ytkownik nieautoryzowany',
208 +       '3'=>'dostêp zablokowany',
209 +       '5'=>'b³±d sk³adni',    
210 +       '7'=>'wyczerpany limit SMS',
211 +       '8'=>'b³êdny adres odbiorcy SMS',
212 +       '9'=>'wiadomo¶æ zbyt d³uga',
213 +       '10'=>'brak wymaganej liczby Â¿etonów'
214 +);
215 +
216 +sub EraOmnix_Mult_InMessage {
217 +       my $message_o=shift;
218 +       my $type=shift;
219 +       my $to=$message_o->GetTo(); my $from=$message_o->GetFrom();
220 +       my $message=new Net::Jabber::Message;
221 +       $message->SetTo($from); $message->SetFrom($to); $message->SetType($type);
222 +       my $SN=$config{service_name};
223 +       my $PN=$SN."/".$PLUGIN_NAME;
224 +       my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
225 +       my $nr=$to; $nr=~s/@.+$//g;
226 +       return unless ($to =~ /$PN$/); # shouldn't happen
227 +
228 +       my $account=$EraOmnix_Mult_accounts{$base_from};
229 +
230 +       # the guts:
231 +
232 +       my $result_message="";
233 +       $nr=~s/\+//g;
234 +       my $sig=$base_from; $sig=~s/@.+$//g;
235 +
236 +       my $ua=new LWP::UserAgent;
237 +       $ua->agent("Mozilla/3.0 (X11, I, Linux 2.4.0 i486"); # ;)
238 +       $ua->timeout(30); # quickly please!
239 +       $ua->no_proxy('www.eraomnix.pl');
240 +
241 +       my $r=$ua->post('http://www.eraomnix.pl/msg/api/do/tinker/omnix',[
242 +               success=>'http://success/',
243 +               failure=>'http://failure/',
244 +               login=>$account->{username},
245 +               password=>$account->{password},
246 +               number=>$nr,
247 +               message=>convert('utf8','latin2',$message_o->GetBody()),
248 +        mms=>( ($account->{mms} =~ /(true|yes|1)/) ? "true" : "false" ),
249 +               ]);
250 +       if ($r->status_line =~ /302 Moved/) {
251 +               my $loc=$r->header("Location");
252 +               if ($loc =~ /\/success\//) {
253 +                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
254 +                       my $tok=($loc =~ /X-ERA-tokens/)?$loc:""; $tok=~s/^.+X-ERA-tokens=//g; $tok=~s/\&.+$//g;
255 +                       my $cost=($loc =~ /X-ERA-cost/)?$loc:""; $cost=~s/^.+X-ERA-cost=//g; $cost=~s/\&.+$//g;
256 +                       $result_message=convert('latin2','utf8',"SMS wys³any".
257 +                               (($err ne '')?", status: ".$EraOmnix_Mult_errmsgs{$err}:"").
258 +                               (($tok ne '')?", pozosta³o Â¿etonów: $tok":"").
259 +                               (($cost ne '')?", zu¿yte Â¿etony: $cost":""));
260 +               } else {
261 +                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
262 +                       my $tok=($loc =~ /X-ERA-tokens/)?$loc:""; $tok=~s/^.+X-ERA-tokens=//g; $tok=~s/\&.+$//g;
263 +                       my $cost=($loc =~ /X-ERA-cost/)?$loc:""; $cost=~s/^.+X-ERA-cost=//g; $cost=~s/\&.+$//g;
264 +                       $result_message=convert('latin2','utf8',"B³±d wysy³ania".
265 +                               (($err ne '')?", status: ".$EraOmnix_Mult_errmsgs{$err}:"").
266 +                               (($tok ne '')?", pozosta³o Â¿etonów: $tok":"").
267 +                               (($cost ne '')?", zu¿yte Â¿etony: $cost":""));
268 +               };
269 +       } else {
270 +               $result_message="HTTP Error";
271 +       };
272 +
273 +       $message->SetBody("www.eraomnix.pl: ".$result_message);
274 +       $Connection->Send($message);
275 +};
276 +
277 +1;
278 +
279 diff -ruN asa-0.1.7/plugins/EraOmnix_Podstawowa.pl asa-svn-26-05-2007/plugins/EraOmnix_Podstawowa.pl
280 --- asa-0.1.7/plugins/EraOmnix_Podstawowa.pl    2005-08-08 13:06:50.000000000 +0200
281 +++ asa-svn-26-05-2007/plugins/EraOmnix_Podstawowa.pl   2007-05-26 09:25:26.000000000 +0200
282 @@ -2,12 +2,13 @@
283  use LWP::UserAgent;
284  use HTTP::Request::Common qw(GET POST);
285  use HTTP::Response;
286 +use HTTP::Cookies; 
287  use Unicode::Lite;
288  
289  my $PLUGIN_NAME                        = "EraOmnix_Podstawowa";
290 -my $PLUGIN_VERSION             = "0.3";
291 +my $PLUGIN_VERSION             = "0.4-20050930-kg";
292  my $DEFAULT_PRIO               = 4;
293 -my $DEST_NUMBERS_REGEXP                =  '^\+48(88[80]|60[24680]|69[24680]|66[0248])'; # needed linke this in // good numberz?
294 +my $DEST_NUMBERS_REGEXP        = '^\+48(88[80]|60[24680]|69[24680]|66[02468])'; # needed linke this in // good numberz?
295  
296  use vars qw ( %EraOmnix_Podst_accounts );
297  
298 @@ -27,7 +28,7 @@
299  
300  sub EraOmnix_Podst_WillTake {
301          my $from=shift;
302 -        my $to_nr=shift; # if not provided, it means it asks for the service, w/o number served by it 
303 +        my $to_nr=shift; # if not provided, it means it asks for the service, w/o number served by it
304          return (($to_nr?($to_nr =~ /$DEST_NUMBERS_REGEXP/):1)&&(exists($EraOmnix_Podst_accounts{$from})));
305  };
306  
307 @@ -55,7 +56,7 @@
308                         $query->SetInstructions('Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
309                                 "You can add a contact like this to your roster.\n\n".
310                                 "Provide your Username (48xxxxxxxxx) and Password to ".$PLUGIN_NAME." gateway.\n".
311 -                               "See http://www.eraomnix.pl/sms for info.\n\n".
312 +                               "See http://www.eraomnix.pl/sms for info.\n\n".                
313                                 "Note: x:data compilant client allows setting more options.");
314                         $query->SetUsername( ($account?$account->{username}:'') );
315                         $query->SetPassword('');
316 @@ -95,7 +96,7 @@
317                         } else {
318                                 for my $i (qw(username password contact signature)) { $account->{$i}=$f{$i}; };
319                                 $EraOmnix_Podst_accounts{$base_from}=$account;
320 -                               SendPluginPresencesToUser($PLUGIN_NAME,'available',$from);
321 +                SendPluginPresencesToUser($PLUGIN_NAME,'available',$from);
322                                 PushAgentToUsersRoster($from); # important in any plugin which needs registration!
323                         };
324  #                      SaveXMLHash(\%EraOmnix_Podst_accounts,'accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME);
325 @@ -110,7 +111,7 @@
326         '1'=>'awaria systemu',
327         '2'=>'u¿ytkownik nieautoryzowany',
328         '3'=>'dostêp zablokowany',
329 -       '5'=>'b³±d sk³adni',    
330 +       '5'=>'b³±d sk³adni',
331         '7'=>'wyczerpany limit SMS',
332         '8'=>'b³êdny adres odbiorcy SMS',
333         '9'=>'wiadomo¶æ zbyt d³uga',
334 @@ -129,51 +130,101 @@
335         my $nr=$to; $nr=~s/@.+$//g;
336         return unless ($to =~ /$PN$/); # shouldn't happen
337  
338 -       my $account=$EraOmnix_Podst_accounts{$base_from};
339 -
340 -       # the guts:
341 -
342         my $result_message="";
343         $nr=~s/\+//g;
344         my $sig=$base_from; $sig=~s/@.+$//g;
345  
346 -       my $ua=new LWP::UserAgent;
347 -       $ua->agent("Mozilla/3.0 (X11, I, Linux 2.4.0 i486"); # ;)
348 -       $ua->timeout(30); # quickly please!
349 -       $ua->no_proxy('www.eraomnix.pl');
350 -
351 -       my $r=$ua->post('http://www.eraomnix.pl/sms/do/extern/tinker/free/send',[
352 -               login=>$account->{username},
353 -               password=>$account->{password},
354 -               success=>'http://success/',
355 -               failure=>'http://failure/',
356 -               number=>$nr,
357 -               message=>convert('utf8','latin2',$message_o->GetBody()),
358 -               signature=>( $account->{signature} ? $account->{signature} : $sig),
359 -               contact=>( $account->{contact} ? $account->{contact} : "")
360 -               ]);
361 -       if ($r->status_line =~ /302 Moved/) {
362 -               my $loc=$r->header("Location");
363 -               if ($loc =~ /\/success\//) {
364 -                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
365 -                       my $cnt=($loc =~ /X-ERA-counter/)?$loc:""; $cnt=~s/^.+X-ERA-counter=//g; $cnt=~s/\&.+$//g;
366 -                       $result_message=convert('latin2','utf8',"SMS wys³any".
367 -                               (($err ne '')?", status: ".$EraOmnix_Podst_errmsgs{$err}:"").
368 -                               (($cnt ne '')?", pozosta³o smsów: $cnt":""));
369 -               } else {
370 -                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
371 -                       my $cnt=($loc =~ /X-ERA-counter/)?$loc:""; $cnt=~s/^.+X-ERA-counter=//g; $cnt=~s/\&.+$//g;
372 -                       $result_message=convert('latin2','utf8',"B³±d wysy³ania".
373 -                               (($err ne '')?", status: ".$EraOmnix_Podst_errmsgs{$err}:"").
374 -                               (($cnt ne '')?", pozosta³o smsów: $cnt":""));
375 -               };
376 -       } else {
377 -               $result_message="HTTP Error";
378 -       };
379 -
380 -       $message->SetBody("www.eraomnix.pl: ".$result_message);
381 +       my $account=$EraOmnix_Podst_accounts{$base_from};
382 +    
383 +    $result_message=sendSmsViaOmnix($account->{username}, $account->{password}, $nr, convert('utf8','latin2',$message_o->GetBody()), $sig);
384 +       $message->SetBody("www.eraomnix.pl: ".convert('latin2','utf8', $result_message));
385         $Connection->Send($message);
386  };
387  
388 -1;
389 +# credits:
390 +# Jacek Fiok <jfiok@jfiok.org>; http://sms.jfiok.org 
391 +# Piotr W³odarczyk <piotr@wlodarczyk.waw.pl> 
392 +sub sendSmsViaOmnix
393 +{
394 +       my ($login, $password, $number, $message, $sig) = @_;    
395 +
396 +    my $cookie_jar = HTTP::Cookies->new; 
397 +    my $ua = new LWP::UserAgent;
398 +    $ua->timeout(30);
399 +    $ua->agent("Mozilla/3.0 (X11, I, Linux 2.4.0 i486");
400 +    $ua->env_proxy();
401 +    $ua->cookie_jar($cookie_jar); 
402 +    push @{ $ua->requests_redirectable }, 'POST';
403 +    my $token;
404 +
405 +    # 1. get sms-index
406 +    my $res = $ua->request (GET 'http://www.eraomnix.pl/msg/user/sponsored/welcome.do');
407 +    return "B³±d przy otwieraniu formularza [1]" unless $res->is_success;
408 +    if ($res->content =~ /TOKEN\" value=\"(.*)\"/ ) { $token=$1;} 
409 +
410 +    # 2. send the POST login form
411 +    my $req = POST "http://www.eraomnix.pl/sso2/authenticate.do", [
412 +       login => $login,
413 +        password => $password,
414 +        "org.apache.struts.taglib.html.TOKEN" => $token
415 +    ];
416 +
417 +    $res = $ua->request($req);
418 +    return "B³±d przy logowaniu - zerwane po³±czenie [2]" unless $res->is_success;
419 +    return "B³±d przy logowaniu - nieprawid³owe has³o [2]" unless $res->content =~ /Pozosta³o SMS/;
420 +
421 +    my $poczatek=0;
422 +    my $dlugosc=110;
423 +
424 +    my $wiadomosc=$message;
425 +    my $ilosc_smsow = 1; 
426 +    
427 +    if ((length($wiadomosc) % $dlugosc) != 0) { 
428 +        $ilosc_smsow = ((length($wiadomosc) - (length($wiadomosc) % $dlugosc)) / $dlugosc) + 1; 
429 +    } else {
430 +        $ilosc_smsow = length($wiadomosc) / $dlugosc;
431 +    }
432 +
433 +    # pêtla wysy³aj±ca po kawa³ku
434 +    for (my $i=1;$i<=$ilosc_smsow;$i++) 
435 +    {
436 +        $message=substr($wiadomosc,$poczatek,$dlugosc);
437 +        $poczatek += $dlugosc;
438 +
439 +        my $sms_zostalo = 666;
440 +        if ($res->content =~ /Pozosta.o SMS.w: \<b\>([0-9]+)\<\/b\>/) { $sms_zostalo = $1; }
441 +        return "Nie mogê odczytaæ ilo¶ci dostêpnych SMSów" if $sms_zostalo == 666;
442 +        return "Limit wiadomo¶ci na dzi¶ przekroczony" if $sms_zostalo == 0;
443 +       
444 +        # 3. wyslij
445 +        if ($res->content =~ /TOKEN\" value=\"(.*)\"/ ) { $token=$1;} else { return "Nie widzê tokena!"; }
446 +        
447 +        $req = POST 'http://www.eraomnix.pl/msg/user/sponsored/sms.do', [
448 +               "top.phoneReceiver" => $number,
449 +            "top.text"  => $message,
450 +            "org.apache.struts.taglib.html.TOKEN" => $token,
451 +            "top.signature"    => $sig,
452 +            "top.characterLimit" => '99',
453 +            "send" => '0',
454 +            "mmsTab" => 'mmsTab',
455 +            "send_x" => '15',
456 +            "send_y" => '13'
457 +        ];
458 +
459 +        $res = $ua->request($req);
460 +        if (!($res->is_success)) { return "B³±d przy podgl±dzie wiadomo¶ci [3]"; }
461 +
462 +        # 4. czy sie wys³a³o (?).
463 +        my $sms_zostalo2 = 666;
464 +        if ($res->content =~ /Pozosta³o SMSów: \<b\>([0-9]+)\<\/b\>/) { $sms_zostalo2 = $1; }
465 +        if ($sms_zostalo2 == 666) { zakoncz ("Nie mogê odczytaæ ilo¶ci dostêpnych SMSów", 1); }
466 +        if ($sms_zostalo > $sms_zostalo2) 
467 +        {
468 +            return "Wszystko OK; pozosta³y limit wiadomo¶ci: ".$sms_zostalo2; 
469 +        } else {
470 +            return "Wiadomo¶æ wys³ana, ale STATUS NIEZNANY (pozosta³y limit: ".$sms_zostalo2.").";
471 +        }
472 +    }    
473 +}
474  
475 +1;
476 diff -ruN asa-0.1.7/plugins/EraOmnix_Sponsorowana.pl asa-svn-26-05-2007/plugins/EraOmnix_Sponsorowana.pl
477 --- asa-0.1.7/plugins/EraOmnix_Sponsorowana.pl  1970-01-01 01:00:00.000000000 +0100
478 +++ asa-svn-26-05-2007/plugins/EraOmnix_Sponsorowana.pl 2007-05-26 09:25:33.000000000 +0200
479 @@ -0,0 +1,175 @@
480 +use strict;
481 +use LWP::UserAgent;
482 +use HTTP::Request::Common qw(GET POST);
483 +use HTTP::Response;
484 +use Unicode::Lite;
485 +
486 +my $PLUGIN_NAME                        = "EraOmnix_Sponsorowana";
487 +my $PLUGIN_VERSION             = "0.4-20060612-kg";
488 +my $DEFAULT_PRIO               = 4;
489 +my $DEST_NUMBERS_REGEXP                =  '^\+48(60[02468]|66[028]|69[2468]|78[78]|88[0689])'; # needed linke this in // good numberz?
490 +# Era/TT: 600, 602, 604, 606, 608, 660, 662, 668, 692, 694, 696, 698, 788
491 +# Heyah: 880, 886, 888, 889, 788
492 +
493 +use vars qw ( %EraOmnix_Spons_accounts );
494 +
495 +# RULES:
496 +# 1. ALWAYS, ALWAYS, ALWAYS create new presence/message/iq
497 +# 2. Create handlers, plugin is named ser.vi.ce/Plugin
498 +# 3. Provide ALL info into %plugin_data
499 +
500 +RegisterEvent('iq','^'.$config{service_name}."/".$PLUGIN_NAME.'$',\&EraOmnix_Spons_InIQ); # for registration
501 +RegisterEvent('pre_connect','.+',\&EraOmnix_Spons_PreConn); # for loading some data ;)
502 +
503 +$plugin_data{$PLUGIN_NAME}->{inmessage_h}=\&EraOmnix_Spons_InMessage;
504 +$plugin_data{$PLUGIN_NAME}->{will_take_h}=\&EraOmnix_Spons_WillTake;
505 +$plugin_data{$PLUGIN_NAME}->{default_prio}=$DEFAULT_PRIO;
506 +$plugin_data{$PLUGIN_NAME}->{version}=$PLUGIN_VERSION;
507 +$plugin_data{$PLUGIN_NAME}->{needs_reg}=1;
508 +
509 +sub EraOmnix_Spons_WillTake {
510 +        my $from=shift;
511 +        my $to_nr=shift; # if not provided, it means it asks for the service, w/o number served by it 
512 +        return (($to_nr?($to_nr =~ /$DEST_NUMBERS_REGEXP/):1)&&(exists($EraOmnix_Spons_accounts{$from})));
513 +};
514 +
515 +sub EraOmnix_Spons_PreConn {
516 +#      %EraOmnix_Spons_accounts=%{LoadXMLHash('accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME)};
517 +       my $t=tie(%EraOmnix_Spons_accounts,"MLDBM::Sync",$config{plugins}->{$PLUGIN_NAME}->{accounts_file},O_CREAT|O_RDWR,0600);
518 +       log2($PLUGIN_NAME.": Ready.");
519 +};
520 +
521 +sub EraOmnix_Spons_InIQ {
522 +       my $iq_o=shift;
523 +       my $xmlns=shift;
524 +       my $query_o=$iq_o->GetQuery();
525 +       my $type=$iq_o->GetType();
526 +       my $from=$iq_o->GetFrom(); my $to=$iq_o->GetTo();
527 +       my $iq=new Net::Jabber::IQ;
528 +       $iq->SetFrom($to); $iq->SetTo($from); $iq->SetID($iq_o->GetID);
529 +       my $query=$iq->NewQuery($xmlns);
530 +
531 +       if ($xmlns eq 'jabber:iq:register') {
532 +               my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
533 +               my $account=$EraOmnix_Spons_accounts{$base_from};
534 +               if ($type eq 'get') {
535 +                       $iq->SetType('result');
536 +                       $query->SetInstructions('Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
537 +                               "You can add a contact like this to your roster.\n\n".
538 +                               "Provide your Username (48xxxxxxxxx) and Password to ".$PLUGIN_NAME." gateway.\n".
539 +                               "See http://www.eraomnix.pl/pl/between-us/send-sms-mms for info.\n\n".
540 +                               "Note: x:data compilant client allows setting more options.");
541 +                       $query->SetUsername( ($account?$account->{username}:'') );
542 +                       $query->SetPassword('');
543 +                       # x:data ...
544 +                       my $xd=( (Net::Jabber->VERSION>1.30) ? new Net::Jabber::Stanza("x") : new Net::Jabber::X );
545 +                       $xd->SetXMLNS('jabber:x:data');
546 +                       $xd->SetData(instructions=>'Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
547 +                                       "You can add a contact like this to your roster.\n".
548 +                                       "Provide your Username and Password to ".$PLUGIN_NAME." gateway.\n".
549 +                                       "See http://www.eraomnix.pl/pl/between-us/send-sms-mms for info.\n".
550 +                                       "You can configure additional options too. When changing options, remember to provide ".
551 +                                       "your password!",
552 +                               title=>"$PLUGIN_NAME Registration",
553 +                               type=>'form');
554 +                       $xd->AddField(type=>'text-single',var=>'username',label=>'User name',
555 +                               value=>($account?$account->{username}:''));
556 +                       $xd->AddField(type=>'text-private',var=>'password',label=>'Password (!) ');
557 +                       $query->AddX($xd);
558 +                       $Connection->Send($iq);
559 +               } elsif ($type eq 'set') {
560 +                       # x:data ...
561 +                       my @xd=$query_o->GetX('jabber:x:data'); my %f;
562 +                       if ($#xd>-1) {
563 +                               foreach my $x ($xd[0]->GetFields()) { $f{$x->GetVar()}=$x->GetValue(); };
564 +                       } else {
565 +                               $f{username}=$query_o->GetUsername(); $f{password}=$query_o->GetPassword();
566 +                       };
567 +                       # ... x:data
568 +                       if (($f{username} eq '')&&($f{password} eq '')) {
569 +                               SendPluginPresencesToUser($PLUGIN_NAME,'unavailable',$from);
570 +                               delete $EraOmnix_Spons_accounts{$base_from};
571 +                       } else {
572 +                               for my $i (qw(username password)) { $account->{$i}=$f{$i}; };
573 +                               $EraOmnix_Spons_accounts{$base_from}=$account;
574 +                               SendPluginPresencesToUser($PLUGIN_NAME,'available',$from);
575 +                               PushAgentToUsersRoster($from); # important in any plugin which needs registration!
576 +                       };
577 +#                      SaveXMLHash(\%EraOmnix_Spons_accounts,'accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME);
578 +                       $iq->SetType('result');
579 +                       $Connection->Send($iq);
580 +               };
581 +       };
582 +};
583 +
584 +my %EraOmnix_Spons_errmsgs=(
585 +       '0'=>'wysy³ka bez b³êdu',
586 +       '1'=>'awaria systemu',
587 +       '2'=>'u¿ytkownik nieautoryzowany',
588 +       '3'=>'dostêp zablokowany',
589 +       '5'=>'b³±d sk³adni',    
590 +       '7'=>'wyczerpany limit SMS',
591 +       '8'=>'b³êdny adres odbiorcy SMS',
592 +       '9'=>'wiadomo¶æ zbyt d³uga',
593 +       '10'=>'brak wymaganej liczby Â¿etonów'
594 +);
595 +
596 +sub EraOmnix_Spons_InMessage {
597 +       my $message_o=shift;
598 +       my $type=shift;
599 +       my $to=$message_o->GetTo(); my $from=$message_o->GetFrom();
600 +       my $message=new Net::Jabber::Message;
601 +       $message->SetTo($from); $message->SetFrom($to); $message->SetType($type);
602 +       my $SN=$config{service_name};
603 +       my $PN=$SN."/".$PLUGIN_NAME;
604 +       my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
605 +       my $nr=$to; $nr=~s/@.+$//g;
606 +       return unless ($to =~ /$PN$/); # shouldn't happen
607 +
608 +       my $account=$EraOmnix_Spons_accounts{$base_from};
609 +
610 +       # the guts:
611 +
612 +       my $result_message="";
613 +       $nr=~s/\+//g;
614 +       my $sig=$base_from; $sig=~s/@.+$//g;
615 +
616 +       my $ua=new LWP::UserAgent;
617 +       $ua->agent("Mozilla/3.0 (X11, I, Linux 2.4.0 i486"); # ;)
618 +       $ua->timeout(30); # quickly please!
619 +       $ua->no_proxy('www.eraomnix.pl');
620 +
621 +       my $r=$ua->post('http://www.eraomnix.pl/msg/api/do/tinker/sponsored',[
622 +               success=>'http://success/',
623 +               failure=>'http://failure/',
624 +               login=>$account->{username},
625 +               password=>$account->{password},
626 +               number=>$nr,
627 +               message=>convert('utf8','latin2',$message_o->GetBody()),
628 +        mms=>0,
629 +               ]);
630 +       if ($r->status_line =~ /302 Moved/) {
631 +               my $loc=$r->header("Location");
632 +               if ($loc =~ /\/success\//) {
633 +                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
634 +                       my $cnt=($loc =~ /X-ERA-counter/)?$loc:""; $cnt=~s/^.+X-ERA-counter=//g; $cnt=~s/\&.+$//g;
635 +                       $result_message=convert('latin2','utf8',"SMS wys³any".
636 +                               (($err ne '')?", status: ".$EraOmnix_Spons_errmsgs{$err}:"").
637 +                               (($cnt ne '')?", pozosta³o smsów: $cnt":""));
638 +               } else {
639 +                       my $err=($loc =~ /X-ERA-error/)?$loc:""; $err=~s/^.+X-ERA-error=//g; $err=~s/\&.+$//g;
640 +                       my $cnt=($loc =~ /X-ERA-counter/)?$loc:""; $cnt=~s/^.+X-ERA-counter=//g; $cnt=~s/\&.+$//g;
641 +                       $result_message=convert('latin2','utf8',"B³±d wysy³ania".
642 +                               (($err ne '')?", status: ".$EraOmnix_Spons_errmsgs{$err}:"").
643 +                               (($cnt ne '')?", pozosta³o smsów: $cnt":""));
644 +               };
645 +       } else {
646 +               $result_message="HTTP Error";
647 +       };
648 +
649 +       $message->SetBody("www.eraomnix.pl: ".$result_message);
650 +       $Connection->Send($message);
651 +};
652 +
653 +1;
654 +
655 diff -ruN asa-0.1.7/plugins/MiastoPlusa.pl asa-svn-26-05-2007/plugins/MiastoPlusa.pl
656 --- asa-0.1.7/plugins/MiastoPlusa.pl    2005-04-22 12:24:35.000000000 +0200
657 +++ asa-svn-26-05-2007/plugins/MiastoPlusa.pl   2007-05-26 09:25:47.000000000 +0200
658 @@ -5,9 +5,9 @@
659  use Unicode::Lite;
660  
661  my $PLUGIN_NAME                        = "MiastoPlusa";
662 -my $PLUGIN_VERSION             = "0.7";
663 +my $PLUGIN_VERSION             = "0.7-20060612-kg";
664  my $DEFAULT_PRIO               = 2;
665 -my $DEST_NUMBERS_REGEXP                =  '^\+48(88[07-9]|60[0-9]|69[0-9]|50[0-9]|66[0-9])'; # needed like this in //
666 +my $DEST_NUMBERS_REGEXP                =  '^\+[0-9]+';
667  
668  use vars qw ( %MiastoPlusa_accounts );
669  
670 diff -ruN asa-0.1.7/plugins/OrangeMbox.pl asa-svn-26-05-2007/plugins/OrangeMbox.pl
671 --- asa-0.1.7/plugins/OrangeMbox.pl     1970-01-01 01:00:00.000000000 +0100
672 +++ asa-svn-26-05-2007/plugins/OrangeMbox.pl    2007-05-26 09:25:52.000000000 +0200
673 @@ -0,0 +1,225 @@
674 +use strict;
675 +use LWP::UserAgent;
676 +use HTTP::Request::Common qw(GET POST);
677 +use HTTP::Response;
678 +use Crypt::SSLeay; # warn NOW, not when logging in
679 +use Unicode::Lite;
680 +use HTTP::Cookies;
681 +
682 +
683 +my $PLUGIN_NAME                        = "OrangeMbox";
684 +my $PLUGIN_VERSION             = "0.5-20070501-kg";
685 +my $DEFAULT_PRIO               = 3;
686 +my $DEST_NUMBERS_REGEXP                =  '^\+[0-9]+'; # needed linke this in //, BUT it's not for everyone (only ideowcy maj\xc4\x85 dowsz\xc4\x85d)
687 +
688 +use vars qw ( %OrangeMbox_accounts );
689 +
690 +# RULES:
691 +# 1. ALWAYS, ALWAYS, ALWAYS create new presence/message/iq
692 +# 2. Create handlers, plugin is named ser.vi.ce/Plugin
693 +# 3. Provide ALL info into %plugin_data
694 +
695 +RegisterEvent('iq','^'.$config{service_name}."/".$PLUGIN_NAME.'$',\&OrangeMbox_InIQ); # for registration
696 +RegisterEvent('pre_connect','.+',\&OrangeMbox_PreConn); # for loading some data ;)
697 +
698 +$plugin_data{$PLUGIN_NAME}->{inmessage_h}=\&OrangeMbox_InMessage;
699 +$plugin_data{$PLUGIN_NAME}->{will_take_h}=\&OrangeMbox_WillTake;
700 +$plugin_data{$PLUGIN_NAME}->{default_prio}=$DEFAULT_PRIO;
701 +$plugin_data{$PLUGIN_NAME}->{version}=$PLUGIN_VERSION;
702 +$plugin_data{$PLUGIN_NAME}->{needs_reg}=1;
703 +
704 +sub OrangeMbox_WillTake {
705 +        my $from=shift;
706 +        my $to_nr=shift; # if not provided, it means it asks for the service, w/o number served by it 
707 +        return (($to_nr?($to_nr =~ /$DEST_NUMBERS_REGEXP/):1)&&(exists($OrangeMbox_accounts{$from})));
708 +};
709 +
710 +sub OrangeMbox_PreConn {
711 +#      %OrangeMbox_accounts=%{LoadXMLHash('accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME)};
712 +       my $t=tie(%OrangeMbox_accounts,"MLDBM::Sync",$config{plugins}->{$PLUGIN_NAME}->{accounts_file},O_CREAT|O_RDWR,0600);
713 +#      $t->SyncCacheSize($config{numbers_tiehash_cache}) TODO eventually
714 +       log2($PLUGIN_NAME.": Ready.");
715 +};
716 +
717 +sub OrangeMbox_InIQ {
718 +       my $iq_o=shift;
719 +       my $xmlns=shift;
720 +       my $query_o=$iq_o->GetQuery();
721 +       my $type=$iq_o->GetType();
722 +       my $from=$iq_o->GetFrom(); my $to=$iq_o->GetTo();
723 +       my $iq=new Net::Jabber::IQ;
724 +       $iq->SetFrom($to); $iq->SetTo($from); $iq->SetID($iq_o->GetID);
725 +       my $query=$iq->NewQuery($xmlns);
726 +
727 +       if ($xmlns eq 'jabber:iq:register') {
728 +               my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
729 +               if ($type eq 'get') {
730 +                       $iq->SetType('result');
731 +                       $query->SetInstructions('Send a message to: +48TELNUMBER@'.$config{service_name}." to send an SMS.\n".
732 +                               "You can add a contact like this to your roster.\n\n".
733 +                               "Provide your Username and Password to ".$PLUGIN_NAME." gateway.\n".
734 +                               "See http://www.orange.pl/ for info.");
735 +                       $query->SetUsername( ($OrangeMbox_accounts{$base_from}?$OrangeMbox_accounts{$base_from}->{username}:'') );
736 +                       $query->SetPassword('');
737 +                       $Connection->Send($iq);
738 +               } elsif ($type eq 'set') {
739 +                       if (($query_o->GetUsername() eq '')&&($query_o->GetPassword() eq '')) {
740 +                               SendPluginPresencesToUser($PLUGIN_NAME,'unavailable',$from);
741 +                               delete $OrangeMbox_accounts{$base_from};
742 +                       } else {
743 +                               my $a=$OrangeMbox_accounts{$base_from};
744 +                               $a->{username}=$query_o->GetUsername();
745 +                               $a->{password}=$query_o->GetPassword();
746 +                               $OrangeMbox_accounts{$base_from}=$a;
747 +                               SendPluginPresencesToUser($PLUGIN_NAME,'available',$from);
748 +                               PushAgentToUsersRoster($from); # important in any plugin which needs registration!
749 +                       };
750 +#                      SaveXMLHash(\%OrangeMbox_accounts,'accounts',$config{plugins}->{$PLUGIN_NAME}->{accounts_file},$PLUGIN_NAME);
751 +                       $iq->SetType('result');
752 +                       $Connection->Send($iq);
753 +               };
754 +       };
755 +};
756 +
757 +sub OrangeMbox_InMessage {
758 +       my $message_o=shift;
759 +       my $type=shift;
760 +       my $to=$message_o->GetTo(); my $from=$message_o->GetFrom();
761 +       my $message=new Net::Jabber::Message;
762 +       $message->SetTo($from); $message->SetFrom($to); $message->SetType($type);
763 +       my $SN=$config{service_name};
764 +       my $PN=$SN."/".$PLUGIN_NAME;
765 +       my $base_from=$from; $base_from=~s/\/.+$//g if ($base_from =~ /\//);
766 +       my $nr=$to; $nr=~s/@.+$//g;
767 +       return unless ($to =~ /$PN$/); # shouldn't happen
768 +
769 +       # the guts:
770 +    
771 +    my $account = $OrangeMbox_accounts{$base_from};
772 +    my $result_message=sendSmsViaOrange($account->{username}, $account->{password}, $nr, $message_o->GetBody());
773 +       $message->SetBody("www.orange.pl: ".$result_message);
774 +       $Connection->Send($message);
775 +};
776 +
777 +# credits:
778 +# Jacek Fiok <jfiok@jfiok.org>; http://sms.jfiok.org
779 +# Spley <spley@home.pl>
780 +# Maciej Krzyzanowski <spider@popnet.pl>
781 +# Rafal 'RaV.' Matczak <rafal.matczak.orangutan.poczta.finemedia.pl>
782 +sub sendSmsViaOrange
783 +{
784 +    my ($login, $password, $number, $message) = @_;  
785 +
786 +    my $cookie_jar = HTTP::Cookies->new;
787 +    my $ua = new LWP::UserAgent;
788 +    $ua->timeout(30);
789 +    $ua->agent("Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7d");
790 +    $ua->no_proxy('www.orange.pl');
791 +    $ua->cookie_jar($cookie_jar);
792 +
793 +    my $res; my $req;
794 +
795 +    $number =~ s/^\+48//;
796 +    $number =~ s/^00//;
797 +
798 +    push @{ $ua->requests_redirectable }, 'POST';
799 +
800 +
801 +    # 1. get sms-index
802 +    $res = $ua->request (GET 'http://www.orange.pl/portal/map/map/signin');
803 +    return "B\xc5\x82\xc4\x85d przy otwieraniu formularza [1]" unless $res->is_success;
804 +
805 +    # 2. send the POST login form
806 +    # FIXME ssl!
807 +    $req = POST 'http://www.orange.pl/portal/map/map/homeo?_DARGS=/gear/static/home/login.jsp.loginFormId', [
808 +        '_dyncharset'=>'UTF-8',
809 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL'=>'/portal/map/map/signin',
810 +        '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginErrorURL'=>' ',
811 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL'=>'http://www.orange.pl/portal/map/map/message_box',
812 +        '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.loginSuccessURL'=>' ',
813 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login'=>$login,
814 +        '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.login'=>' ',
815 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password'=>$password,
816 +        '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.value.password'=>' ',
817 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.x'=>13,
818 +        '/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login.y'=>7,
819 +        '_D:/amg/ptk/map/core/formhandlers/AdvancedProfileFormHandler.login'=>' ',
820 +        '_DARGS'=>'/gear/static/home/login.jsp.loginFormId',
821 +    ];
822 +
823 +
824 +    $req->referer ("https://www.orange.pl/portal/map/map/idmp/sloin");
825 +    $res = $ua->request($req);
826 +    return "B\xc5\x82\xc4\x85d przy logowaniu [2]" unless $res->is_success;
827 +    return "B\xc5\x82\xc4\x85d przy logowaniu - nieprawid\xc5\x82owe has\xc5\x82o? [2]" unless $res->content =~ /zalogowany jako/;
828 +
829 +    #$req = GET 'http://www.orange.pl/portal/map/map/message_box';
830 +    #$res = $ua->request($req);
831 +
832 +    # Nie do konca odczytuje jeszcze ilosc pozostalych smsow (jesli sa jeszcze z doladowan)
833 +    # FIXME zrobic to ladniej..
834 +    my $sms_zostalo = 666;
835 +    my $cnt = $res->content;
836 +
837 +    my $l = index $cnt, 'div id="syndication"';  my $r = index $cnt, 'div id="mbox-menu"'; $cnt = substr($cnt, $l, $r-$l); 
838 +    $cnt =~ s/\s+//mg; $cnt =~ s/(?:<\/[^>]+>|<[^>]+>)//g; if ($cnt =~ /darmowe:([0-9]+)(zdo[^0-9]*([0-9]*))?/) 
839 +    {
840 +        $sms_zostalo = eval ($1);
841 +        $sms_zostalo += eval ($3) if $3;
842 +    }
843 +
844 +    return "Nie mog\xc4\x99 odczyta\xc4\x87 ilo\xc5\x9bci dost\xc4\x99pnych SMS\xc3\xb3w" if $sms_zostalo == 666;
845 +    return "Limit wiadomo\xc5\x9bci na ten miesi\xc4\x85c przekroczony" if $sms_zostalo == 0;
846 +
847 +    $res = $ua->request (GET 'http://www.orange.pl/portal/map/map/message_box?mbox_view=newsms&mbox_edit=new');
848 +    return "B\xc5\x82\xc4\x85d przy otwarciu formularza SMS [4]" unless $res->is_success;
849 +
850 +    # _DARGS=/gear/mapmessagebox/smsform.jsp na WWW jest i w GET string i w POST :)
851 +    $req = POST 'http://www.orange.pl/portal/map/map/message_box?_DARGS=/gear/mapmessagebox/smsform.jsp', [
852 +        '_dyncharset'=>'UTF-8',
853 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type'=>'sms',
854 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.type'=>' ',
855 +        'enabled'=>'false',
856 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL'=>'/portal/map/map/message_box?mbox_view=newsms',
857 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.errorURL'=>' ',
858 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL'=>'/portal/map/map/message_box?mbox_view=messageslist',
859 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.successURL'=>' ',
860 +        #'smscounter'=>'1',
861 +        'counter'=>(640 - length($message)),
862 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to'=>$number,
863 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.to'=>' ',
864 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body'=>' ',
865 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.body'=>$message,
866 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.x'=>'57',
867 +        '/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create.y'=>'12',
868 +        #'/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create'=>'Wy%C5%9Blij',
869 +        '_D:/amg/ptk/map/messagebox/formhandlers/MessageFormHandler.create'=>' ',
870 +        '_DARGS'=>'/gear/mapmessagebox/smsform.jsp',
871 +    ];
872 +    $req->referer('http://www.orange.pl/portal/map/map/message_box?mbox_view=newsms&mbox_edit=new');
873 +    $res = $ua->request($req);
874 +
875 +    return "B\xc5\x82\xc4\x85d przy ostatecznym wysy\xc5\x82aniu SMS [5]" unless $res->is_success;
876 +
877 +    $cnt  = $res->content;
878 +    return $1 if $res->content =~ /div class="box-error">\s*<p>(.*)<\/p>/m;
879 +    
880 +    my $sms_zostalo2 = 666;
881 +
882 +    $l = index $cnt, 'div id="syndication"'; $r = index $cnt, 'div id="mbox-menu"'; $cnt = substr($cnt, $l, $r-$l); 
883 +    $cnt =~ s/\s+//mg; $cnt =~ s/(?:<\/[^>]+>|<[^>]+>)//g; if ($cnt =~ /darmowe:([0-9]+)(zdo[^0-9]*([0-9]*))?/) 
884 +    {
885 +        $sms_zostalo2 = eval ($1);
886 +        $sms_zostalo2 += eval ($3) if $3;
887 +    }
888 +    
889 +    return "Nie mog\xc4\x99 odczyta\xc4\x87 ilo\xc5\x9bci dost\xc4\x99pnych SMS\xc3\xb3w" if $sms_zostalo2 == 666;
890 +    if ($sms_zostalo > $sms_zostalo2) {
891 +        return "Wszystko OK; pozosta\xc5\x82y limit wiadomo\xc5\x9bci: ".$sms_zostalo2; 
892 +    } else {
893 +        return "Wiadomo\xc5\x9b\xc4\x87 wys\xc5\x82ana, ale STATUS NIEZNANY (pozosta\xc5\x82y limit: ".$sms_zostalo2.").";
894 +    }
895 +}
896 +
897 +1;
898 +
899 diff -ruN asa-0.1.7/plugins/WwwPlusa.pl asa-svn-26-05-2007/plugins/WwwPlusa.pl
900 --- asa-0.1.7/plugins/WwwPlusa.pl       2005-01-04 20:31:24.000000000 +0100
901 +++ asa-svn-26-05-2007/plugins/WwwPlusa.pl      2007-05-26 09:26:03.000000000 +0200
902 @@ -5,9 +5,9 @@
903  use strict;
904  
905  my $PLUGIN_NAME                        = "WwwPlusa";
906 -my $PLUGIN_VERSION             = "0.1";
907 +my $PLUGIN_VERSION             = "0.2-20051005-kg";
908  my $DEFAULT_PRIO               = 1;
909 -my $DEST_NUMBERS_REGEXP                = '^\+48(60[13579]|69[1357]|66[13])'; # needed linke this in //
910 +my $DEST_NUMBERS_REGEXP                = '^\+48(6[069][13579])'; # needed linke this in //
911  
912  # RULES:
913  # 1. ALWAYS, ALWAYS, ALWAYS create new presence/message/iq
This page took 0.217365 seconds and 3 git commands to generate.