Long messages fix.
This commit is contained in:
parent
da55487653
commit
e3cb17e173
@ -21,11 +21,7 @@ sub new {
|
||||
sub decrypt {
|
||||
my ( $self, $base64 ) = @_;
|
||||
|
||||
# Decrypt message
|
||||
my $dec = decode_base64($base64);
|
||||
# my $dec = `echo "$base64" | base64 -d`;
|
||||
|
||||
return $dec;
|
||||
return decode_base64($base64);
|
||||
}
|
||||
|
||||
sub encode {
|
||||
@ -42,7 +38,8 @@ sub encode {
|
||||
$message .= '@repto:' . $data->{hash} . "\n" if defined( $data->{hash} );
|
||||
$message .= $data->{post};
|
||||
|
||||
my $encoded = `echo "$message" | base64`;
|
||||
# my $encoded = `echo "$message" | base64`;
|
||||
my $encoded = encode_base64($message);
|
||||
$encoded =~ s/\//_/g;
|
||||
$encoded =~ s/\+/-/g;
|
||||
|
||||
|
19
II/Get.pm
19
II/Get.pm
@ -72,33 +72,22 @@ sub get_echo {
|
||||
}
|
||||
$db->commit();
|
||||
|
||||
# Get messages
|
||||
my @msg_con;
|
||||
# Get messages and populate hash
|
||||
my $count = 0;
|
||||
while ( $count < @new ) {
|
||||
my $new_messages_url = "$host$msg_url" . $new[$count]->{hash};
|
||||
my $req_msg = HTTP::Request->new( GET => $new_messages_url );
|
||||
my $res_msg = $ua->request($req_msg);
|
||||
|
||||
if ( $res_msg->is_success() ) {
|
||||
push( @msg_con, $res_msg->content() );
|
||||
my ( $hash, $m ) = split(':', $res_msg->content());
|
||||
push( @messages_hash, { hash => $hash, base64 => $m } );
|
||||
}
|
||||
else {
|
||||
print $res_msg->status_line, "\n";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
# Populate hash
|
||||
while (<@msg_con>) {
|
||||
my @message = split /:/, $_;
|
||||
if ( defined( $message[1] ) ) {
|
||||
my $h = {
|
||||
hash => $message[0],
|
||||
base64 => $message[1],
|
||||
};
|
||||
push( @messages_hash, $h );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $new_messages
|
||||
|
Loading…
Reference in New Issue
Block a user