Import Upstream version 1.22 upstream/1.22
authorThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Fri, 11 Aug 2017 22:35:29 +0000 (19:35 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Fri, 11 Aug 2017 22:35:29 +0000 (19:35 -0300)
sendxmpp

index 4a86f6e..b78fbc2 100755 (executable)
--- a/sendxmpp
+++ b/sendxmpp
@@ -16,7 +16,7 @@ if 0; # not running under some shell
 #
 # Released under the terms of the GNU General Public License v2
 #
-# $Platon: sendxmpp/sendxmpp,v 1.20 2010-01-18 00:54:16 rajo Exp $
+# $Platon: sendxmpp/sendxmpp,v 1.22 2010-10-03 19:36:35 rajo Exp $
 # $Id: $
 
 use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed
@@ -44,7 +44,7 @@ sub terminate();
 sub main();
 
 my # MakeMaker
-$VERSION       = [ q$Revision: 1.20 $ =~ m/(\S+)\s*$/g ]->[0];
+$VERSION       = [ q$Revision: 1.22 $ =~ m/(\S+)\s*$/g ]->[0];
 my $RESOURCE = 'sendxmpp';
 my $VERBOSE  = 0;
 my $DEBUG    = 0;
@@ -178,7 +178,7 @@ sub read_config_file ($) {
                # account with specific connection host
                if ($config{'jserver'}  =~ /(.*);([-\.\w]+)/) {
                        $config{'jserver'}      = $2;
-                       $config{'username'}     .= "\@$1";
+                       $config{'username'}     .= "\@$1" unless $config{'component'};
                }
        }
 
@@ -405,7 +405,8 @@ sub xmpp_send_message ($$$$$$) {
     my ($cnx, $rcpt, $comp, $subject, $message_type, $msg) = @_;
 
     # for some reason, MessageSend does not return anything
-    $cnx->MessageSend('to'      => $rcpt . ( $comp ? "\@$comp" : '' ),
+       # mimeit01@xmpp.hs-esslingen.de: if $comp IS set, AND the rcpt DOESN'T contain an @, then @comp is added
+    $cnx->MessageSend('to'      => $rcpt . ( ($comp && index($rcpt, "@") == -1) ? "\@$comp" : '' ),
                'type'          => $message_type,
                'subject'       => $subject,
                'body'          => $msg);