From: b Date: Mon, 15 May 2023 21:46:52 +0000 (+0000) Subject: url encoding X-Git-Tag: v1.0.0~10 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=924936781b74b57f5430ce5fcc72bc132f1378da;p=ott%2Fpost url encoding --- diff --git a/botm-common b/botm-common index 29f4a0d..6cc2a02 160000 --- a/botm-common +++ b/botm-common @@ -1 +1 @@ -Subproject commit 29f4a0d68bcb31fb4032b61f191b0b88a1be922f +Subproject commit 6cc2a0295896e671fa71946ca6428f0c806a9a77 diff --git a/sendpost.1.pl b/sendpost.1.pl index 58d8353..2d12d60 100644 --- a/sendpost.1.pl +++ b/sendpost.1.pl @@ -21,7 +21,7 @@ use Getopt::Long; use Encode qw(encode decode); ###PERL_LIB: use lib '/botm/lib/post'; -use botm_common qw(readdatafile writedatafile join_path); +use botm_common qw(read_data_file write_data_file url_encode url_decode join_path); ###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8'; ###PERL_ENCODING_FILE_OUT: use constant ENCODING_FILE_OUT => 'utf8'; @@ -107,15 +107,15 @@ if ($options{'mirror-url'} eq '') { } print "options:\n"; -my $a = writedatafile(\*STDOUT, ENCODING_STD_OUT, 0, \%options); +my $a = write_data_file(\*STDOUT, ENCODING_STD_OUT, 0, \%options); print "$a\n"; -# foreach my $ind (keys %options) { - # print $ind.'='.$options{$ind}."\n"; -# } -# print; +foreach my $ind (keys %options) { + print $ind.'=>'.url_decode($options{$ind})."<\n"; +} +print; foreach my $arg (@ARGV) { print "\nFILE $arg\n"; - my %data = readdatafile($arg, 'utf8', 1); + my %data = read_data_file($arg, 'utf8', 1); foreach my $ind (keys %data) { print $ind.'='.$data{$ind}."\n"; } @@ -123,7 +123,7 @@ foreach my $arg (@ARGV) { # if ((scalar @ARGV) == 0) { # print "\nSTDIN\n"; # my $fh; - # my %data = readdatafile(\*STDIN, 'utf8', 1); + # my %data = read_data_file(\*STDIN, 'utf8', 1); # foreach my $ind (keys %data) { # print $ind.'='.$data{$ind}."\n"; # } @@ -134,112 +134,112 @@ sub prepare_post { (my $cmd_options, my $file_data) = @_; my %post; - if ($cmd_options->{'subject'}) ne '') { + if (($cmd_options->{'subject'}) ne '') { $post{'subject'} = $cmd_options->{'subject'}; } - elsif ($file_data->{'subject'}) ne '') { + elsif (($file_data->{'subject'}) ne '') { $post{'subject'} = $file_data->{'subject'}; } else { $post{'subject'} = DEFAULT_SUBJECT; } - if ($cmd_options->{'username'}) ne '') { + if (($cmd_options->{'username'}) ne '') { $post{'username'} = $cmd_options->{'username'}; } - elsif ($file_data->{'username'}) ne '') { + elsif (($file_data->{'username'}) ne '') { $post{'username'} = $file_data->{'username'}; } else { $post{'username'} = DEFAULT_USERNAME; } - if ($cmd_options->{'password'}) ne '') { + if (($cmd_options->{'password'}) ne '') { $post{'password'} = $cmd_options->{'password'}; } - elsif ($file_data->{'password'}) ne '') { + elsif (($file_data->{'password'}) ne '') { $post{'password'} = $file_data->{'password'}; } else { $post{'password'} = DEFAULT_PASSWORD; } - if ($cmd_options->{'content'}) ne '') { + if (($cmd_options->{'content'}) ne '') { $post{'content'} = $cmd_options->{'content'}; } - elsif ($file_data->{'content'}) ne '') { + elsif (($file_data->{'content'}) ne '') { $post{'content'} = $file_data->{'content'}; } else { $post{'content'} = ''; } - if ($cmd_options->{'no-bbcode'}) ne '') { + if (($cmd_options->{'no-bbcode'}) ne '') { $post{'bbcode'} = 0; } - elsif ($cmd_options->{'bbcode'}) ne '') { + elsif (($cmd_options->{'bbcode'}) ne '') { $post{'bbcode'} = 1; } - elsif ($file_data->{'bbcode'}) ne '') { + elsif (($file_data->{'bbcode'}) ne '') { $post{'bbcode'} = $file_data->{'bbcode'}+0; } else { $post{'bbcode'} = 1; } - if ($cmd_options->{'no-smilies'}) ne '') { + if (($cmd_options->{'no-smilies'}) ne '') { $post{'smilies'} = 0; } - elsif ($cmd_options->{'smilies'}) ne '') { + elsif (($cmd_options->{'smilies'}) ne '') { $post{'smilies'} = 1; } - elsif ($file_data->{'smilies'}) ne '') { + elsif (($file_data->{'smilies'}) ne '') { $post{'smilies'} = $file_data->{'smilies'}+0; } else { $post{'smilies'} = 1; } - if ($cmd_options->{'no-urls'}) ne '') { + if (($cmd_options->{'no-urls'}) ne '') { $post{'urls'} = 0; } - elsif ($cmd_options->{'urls'}) ne '') { + elsif (($cmd_options->{'urls'}) ne '') { $post{'urls'} = 1; } - elsif ($file_data->{'urls'}) ne '') { + elsif (($file_data->{'urls'}) ne '') { $post{'urls'} = $file_data->{'urls'}+0; } else { $post{'urls'} = 1; } - if ($cmd_options->{'no-signature'}) ne '') { + if (($cmd_options->{'no-signature'}) ne '') { $post{'signature'} = 0; } - elsif ($cmd_options->{'signature'}) ne '') { + elsif (($cmd_options->{'signature'}) ne '') { $post{'signature'} = 1; } - elsif ($file_data->{'signature'}) ne '') { + elsif (($file_data->{'signature'}) ne '') { $post{'signature'} = $file_data->{'signature'}+0; } else { $post{'signature'} = 1; } - if ($cmd_options->{'no-notify'}) ne '') { + if (($cmd_options->{'no-notify'}) ne '') { $post{'notify'} = 0; } - elsif ($cmd_options->{'notify'}) ne '') { + elsif (($cmd_options->{'notify'}) ne '') { $post{'notify'} = 1; } - elsif ($file_data->{'notify'}) ne '') { + elsif (($file_data->{'notify'}) ne '') { $post{'notify'} = $file_data->{'notify'}+0; } else { $post{'notify'} = 0; } - if ($file_data->{'time'}) ne '') { + if (($file_data->{'time'}) ne '') { $post{'time'} = $file_data->{'time'}+0; } else {