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

index 8df0042..d20f56b 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.15 2008-10-21 21:31:53 rajo Exp $
+# $Platon: sendxmpp/sendxmpp,v 1.18 2009-01-10 11:40:14 rajo Exp $
 # $Id: $
 
 use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed
@@ -44,12 +44,13 @@ sub terminate();
 sub main();
 
 my # MakeMaker
-$VERSION       = [ q$Revision: 1.15 $ =~ m/(\S+)\s*$/g ]->[0];
+$VERSION       = [ q$Revision: 1.18 $ =~ m/(\S+)\s*$/g ]->[0];
 my $RESOURCE = 'sendxmpp';
 my $VERBOSE  = 0;
 my $DEBUG    = 0;
-my @suppported_message_types   = qw( message chat headline );
-my $message_type                               = 'message'; # default message type
+# http://tools.ietf.org/html/rfc3921#section-2  section 2.1.1 - Types of Message
+my @suppported_message_types   = qw( chat error groupchat headline );
+my $message_type                               = 'chat'; # default message type
 
 # start!
 &main;
@@ -307,13 +308,14 @@ sub xmpp_login ($$$$$$$$) {
                connectiontype  => 'tcpip',
                componentname   => $comp
        };
-       $arghash->{port} = $port if (!$port);
-       if (!$port) {
+
+       delete $arghash->{port} unless $port; 
+       if ($arghash->{port}) {
                @res = $cnx->Connect(%$arghash);
-               error_exit ("Could not connect to server '$host': $@") unless @res;
+               error_exit ("Could not connect to '$host' on port $port: $@") unless @res;
        } else {
                @res = $cnx->Connect(%$arghash);
-               error_exit ("Could not connect to '$host' on port $port: $@") unless @res;
+               error_exit ("Could not connect to server '$host': $@") unless @res;
        }
 
     xmpp_check_result("Connect",\@res,$cnx);