Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, March 28, 2024

Diff for sendxmpp/sendxmpp between version 1.18 and 1.19

version 1.18, 2009/01/10 11:40:14 version 1.19, 2010/01/15 17:08:17
Line 16  if 0; # not running under some shell
Line 16  if 0; # not running under some shell
 #  #
 # Released under the terms of the GNU General Public License v2  # Released under the terms of the GNU General Public License v2
 #  #
 # $Platon: sendxmpp/sendxmpp,v 1.17 2009-01-09 22:50:48 rajo Exp $  # $Platon: sendxmpp/sendxmpp,v 1.18 2009-01-10 11:40:14 rajo Exp $
 # $Id$  # $Id$
   
 use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed  use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed
Line 28  use open ':utf8';
Line 28  use open ':utf8';
 use open ':std';  use open ':std';
   
 # subroutines decls  # subroutines decls
 sub xmpp_login($$$$$$$$);  sub xmpp_login($$$$$$$$$);
 sub xmpp_send ($$$$);  sub xmpp_send ($$$$);
 sub xmpp_send_raw_xml($$);  sub xmpp_send_raw_xml($$);
 sub xmpp_send_message($$$$$$);  sub xmpp_send_message($$$$$$);
Line 72  sub main () {
Line 72  sub main () {
   
     # login to xmpp      # login to xmpp
     my $cnx =  xmpp_login ($$cmdline{'jserver'}  || $$config{'jserver'},      my $cnx =  xmpp_login ($$cmdline{'jserver'}  || $$config{'jserver'},
                            $$cmdline{'port'}     || $$config{'port'},                             $$cmdline{'port'}     || $$config{'port'} || ($$cmdline{'ssl'} ? 5223 : 5222)),
                            $$cmdline{'username'} || $$config{'username'},                             $$cmdline{'username'} || $$config{'username'},
                            $$cmdline{'password'} || $$config{'password'},                             $$cmdline{'password'} || $$config{'password'},
                            $$cmdline{'component'}|| $$config{'component'},                             $$cmdline{'component'}|| $$config{'component'},
                            $$cmdline{'resource'},                             $$cmdline{'resource'},
                            $$cmdline{'tls'},                             $$cmdline{'tls'},
                              $$cmdline{'ssl'},
                            $$cmdline{'debug'})                             $$cmdline{'debug'})
       or error_exit("cannot login: $!");        or error_exit("cannot login: $!");
   
Line 206  sub parse_cmdline () {
Line 207  sub parse_cmdline () {
     usage() unless (scalar(@ARGV));      usage() unless (scalar(@ARGV));
   
         my ($subject,$file,$resource,$jserver,$port,$username,$password,$component,          my ($subject,$file,$resource,$jserver,$port,$username,$password,$component,
         $message, $chatroom, $headline, $debug, $tls, $interactive, $help, $raw, $verbose);          $message, $chatroom, $headline, $debug, $tls, $ssl, $interactive, $help, $raw, $verbose);
     my $res = GetOptions ('subject|s=s'    => \$subject,      my $res = GetOptions ('subject|s=s'    => \$subject,
                           'file|f=s'       => \$file,                            'file|f=s'       => \$file,
                           'resource|r=s'   => \$resource,                            'resource|r=s'   => \$resource,
Line 219  sub parse_cmdline () {
Line 220  sub parse_cmdline () {
                           'message-type=s' => \$message_type,                            'message-type=s' => \$message_type,
                           'chatroom|c'     => \$chatroom,                            'chatroom|c'     => \$chatroom,
                           'tls|t'          => \$tls,                            'tls|t'          => \$tls,
                             'ssl|e'          => \$ssl,
                           'interactive|i'  => \$interactive,                            'interactive|i'  => \$interactive,
                           'help|usage|h'   => \$help,                            'help|usage|h'   => \$help,
                           'debug|d'        => \$debug,                            'debug|d'        => \$debug,
Line 245  sub parse_cmdline () {
Line 247  sub parse_cmdline () {
         if (scalar(grep { $message_type eq $_ } @suppported_message_types) == 0) {          if (scalar(grep { $message_type eq $_ } @suppported_message_types) == 0) {
                 error_exit("Unsupported message type '$message_type'");                  error_exit("Unsupported message type '$message_type'");
         }          }
   
           if ($ssl && $tls) {
               error_exit("Connect securely wether using -e (--ssl) or -t (--tls)");
           }
   
         if ($headline) {          if ($headline) {
                 # --headline withouth --message-type                  # --headline withouth --message-type
Line 273  sub parse_cmdline () {
Line 279  sub parse_cmdline () {
                 'message-type'    => $message_type,                  'message-type'    => $message_type,
                 'interactive' => ($interactive or 0),                  'interactive' => ($interactive or 0),
                 'tls'         => ($tls or 0),                  'tls'         => ($tls or 0),
                   'ssl'         => ($ssl or 0),
                 'debug'       => ($debug or 0),                  'debug'       => ($debug or 0),
                 'verbose'     => ($verbose or 0),                  'verbose'     => ($verbose or 0),
                 'raw'         => ($raw or 0),                  'raw'         => ($raw or 0),
Line 291  sub parse_cmdline () {
Line 298  sub parse_cmdline () {
   
 #  #
 # xmpp_login: login to the xmpp (jabber) server  # xmpp_login: login to the xmpp (jabber) server
 # input: hostname,port,username,password,resource,tls,debug  # input: hostname,port,username,password,resource,tls,ssl,debug
 # output: an XMPP connection object  # output: an XMPP connection object
 #  #
 sub xmpp_login ($$$$$$$$) {  sub xmpp_login ($$$$$$$$$) {
   
     my ($host, $port, $user, $pw, $comp, $res, $tls, $debug) = @_;      my ($host, $port, $user, $pw, $comp, $res, $tls, $ssl, $debug) = @_;
     my $cnx = new Net::XMPP::Client(debuglevel=>($debug?2:0));      my $cnx = new Net::XMPP::Client(debuglevel=>($debug?2:0));
     error_exit "could not create XMPP client object: $!"      error_exit "could not create XMPP client object: $!"
         unless ($cnx);          unless ($cnx);
Line 304  sub xmpp_login ($$$$$$$$) {
Line 311  sub xmpp_login ($$$$$$$$) {
     my @res;      my @res;
         my $arghash = {          my $arghash = {
                 hostname                => $host,                  hostname                => $host,
                   port            => $port,
                 tls                             => $tls,                  tls                             => $tls,
                   ssl             => $ssl,
                 connectiontype  => 'tcpip',                  connectiontype  => 'tcpip',
                 componentname   => $comp                  componentname   => $comp
         };          };
Line 581  Use resource I<res> for the sender [defa
Line 590  Use resource I<res> for the sender [defa
   
 Connect securely, using TLS  Connect securely, using TLS
   
   =item B<-e>,B<--ssl>
   
   Connect securely, using SSL
   
 =item B<-l>,B<--headline>  =item B<-l>,B<--headline>
   
 Backward compatibility option. You should use B<--message-type=headline> instead. Send a headline type message (not stored in offline messages)  Backward compatibility option. You should use B<--message-type=headline> instead. Send a headline type message (not stored in offline messages)

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top