#!/usr/bin/perl use warnings; use strict; use Config::Simple; use Net::Jabber qw(Client); use File::Basename; use Data::Dumper; # config file syntax: "option value" # options are: server, port, username, password, ressource # location: ~/.jabberwallrc if(@ARGV != 3) { print "usage: ", basename($0), " \n"; exit 1; } open FH, "<", $ARGV[0] or die "$ARGV[0]: $!"; my @recipients = ; close FH; my %config; Config::Simple->import_from("$ENV{HOME}/.jabberwallrc", \%config); my $clnt = new Net::Jabber::Client; my $status = $clnt->Connect(hostname=>$config{server}, port=>$config{port}, tls=>1, ssl_ca_path=>"/etc/ssl/certs/ca-certificates.crt"); if (!defined($status)) { die "Jabber connect error ($!)\n"; } my @result = $clnt->AuthSend(username=>$config{username}, password=>$config{password}, resource=>$config{resource}); if ($result[0] ne "ok") { die "Jabber auth error: @result\n"; } chomp(my $subject = $ARGV[1]); my $body = $ARGV[2]; for my $to (@recipients) { chomp $to; next if ($to eq ""); $clnt->MessageSend(to=>$to, subject=>$subject, body=>$body, type=>"message", priority=>0); } $clnt->Disconnect();