Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use Net::Jabber qw( Client );
  4. use constant SERVER => 'aqq.eu';
  5. use constant PORT => 5222; # Port to connect to
  6. use constant USER => 'z4bb1x';
  7. use constant PASSWORD => 'apunahasan';
  8. use constant RESOURCE => 'perlscript';
  9.  
  10. my $connection = Net::Jabber::Client->new();
  11. $connection->Connect( "hostname" => SERVER,
  12. "port" => PORT )
  13. or die "Cannot connect ($!)\n";
  14.  
  15. my @result = $connection->AuthSend( "username" => USER,
  16. "password" => PASSWORD,
  17. "resource" => RESOURCE );
  18. if ($result[0] ne "ok") {
  19. die "Ident/Auth with server failed: $result[0] - $result[1]\n";
  20. }
  21.  
  22. my $date = dtg(time);
  23. my $bbmessage = $ARGV[2];
  24. my $bbsubject = $ARGV[1];
  25. #my $bbrecipient = $ARGV[0];
  26. my $bbrecipient = "s3rg\@aqq.eu";
  27. my $msg = Net::Jabber::Message->new();
  28. $msg->SetMessage( "to" => $bbrecipient,
  29. "body" => join("\n","$bbsubject","$bbmessage") );
  30. $msg->SetType("chat");
  31.  
  32. $connection->Send($msg);
  33. $connection->Disconnect();
  34. exit;
  35.  
  36. sub dtg {
  37. my ($string) = @_;
  38. my ($time_str);
  39. $time_str = localtime($string);
  40. return substr($time_str,4,15);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement