]> jfr.im git - irc/xchat.git/commitdiff
Allow 'hostname:port' for none IPv6 addresses
authorlsitu <redacted>
Fri, 17 Jul 2009 05:31:50 +0000 (05:31 +0000)
committerlsitu <redacted>
Fri, 17 Jul 2009 05:31:50 +0000 (05:31 +0000)
git-svn-id: svn://svn.code.sf.net/p/xchat/svn@1360 893a96be-7f27-4fdf-9d1e-6aeec9d3cce1

plugins/perl/Xchat.pm

index 76b56a755be66eba0d8288e74a88bbde60919f07..65096d53e9588185199d38c807d8038383890199 100644 (file)
@@ -797,6 +797,15 @@ sub parse_server {
        my $data = shift;
        if( $data ) {
                my ($host, $port) = split /\//, $data;
+               unless( $port ) {
+                       my @parts = split /:/, $host;
+
+                       # if more than 2 then we are probably dealing with a IPv6 address
+                       # if less than 2 then no port was specified
+                       if( @parts == 2 ) {
+                               $port = $parts[1];
+                       }
+               }
                return { host => $host, port => $port };
        }
 }