Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use Net::Jabber qw( Client );
- use constant SERVER => 'aqq.eu';
- use constant PORT => 5222; # Port to connect to
- use constant USER => 'z4bb1x';
- use constant PASSWORD => 'apunahasan';
- use constant RESOURCE => 'perlscript';
- my $connection = Net::Jabber::Client->new();
- $connection->Connect( "hostname" => SERVER,
- "port" => PORT )
- or die "Cannot connect ($!)\n";
- my @result = $connection->AuthSend( "username" => USER,
- "password" => PASSWORD,
- "resource" => RESOURCE );
- if ($result[0] ne "ok") {
- die "Ident/Auth with server failed: $result[0] - $result[1]\n";
- }
- my $date = dtg(time);
- my $bbmessage = $ARGV[2];
- my $bbsubject = $ARGV[1];
- #my $bbrecipient = $ARGV[0];
- my $bbrecipient = "s3rg\@aqq.eu";
- my $msg = Net::Jabber::Message->new();
- $msg->SetMessage( "to" => $bbrecipient,
- "body" => join("\n","$bbsubject","$bbmessage") );
- $msg->SetType("chat");
- $connection->Send($msg);
- $connection->Disconnect();
- exit;
- sub dtg {
- my ($string) = @_;
- my ($time_str);
- $time_str = localtime($string);
- return substr($time_str,4,15);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement