From 38ea706182bbb8981eb7496d41424a6c30e60bf0 Mon Sep 17 00:00:00 2001
From: Holger Paradies <retabell@gmx.de>
Date: Sat, 14 Aug 2021 12:50:14 +0200
Subject: Rework handling for ssl port

oftc does not support port 7000 for ssl
---
 kanotix-irc/kanotix-irc | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/kanotix-irc/kanotix-irc b/kanotix-irc/kanotix-irc
index b61b620..b49b9db 100755
--- a/kanotix-irc/kanotix-irc
+++ b/kanotix-irc/kanotix-irc
@@ -13,13 +13,18 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+USE_SSL=false # will be set through FLL_IRC_PORT used
 # override tool behaviour through distro-defaults
-FLL_IRC_SERVER="irc.freenode.net"
-FLL_IRC_PORT="6667"
+FLL_IRC_SERVER="irc.oftc.net"
+FLL_IRC_PORT="6697"
 FLL_IRC_CHANNEL="#kanotix"
 FLL_DISTRO_NAME="Kanotix"
 [ -r /etc/default/distro ] && . /etc/default/distro
 
+if [ "$FLL_IRC_PORT" = "6697" -o "$FLL_IRC_PORT" = "7000" -o "$FLL_IRC_PORT" = "7070" -o "$FLL_IRC_PORT" = "9999" ]; then
+   USE_SSL=true
+fi
+
 # define user settings
 NICK="Web-${FLL_DISTRO_NAME}$(mawk 'BEGIN{print int(1000 * rand())}')"
 FALLBACK_USER="$(getent passwd 1000 | cut -d\: -f1)"
@@ -77,9 +82,9 @@ kanotix_irssi()
 
 	CTCPS=0
 	if [ -e /etc/kanotix-version ]; then
-		QUITMSG="$(< /etc/kanotix-version) | http://www.kanotix.com"
+		QUITMSG="$(< /etc/kanotix-version) | http://kanotix.com"
 	else
-		QUITMSG="http://www.kanotix.com"
+		QUITMSG="http://kanotix.com"
 	fi
 
 	cat <<_EOF_ >"$IRSSICFG/config"
@@ -91,7 +96,7 @@ servers = (
     autoconnect = "yes";
 _EOF_
 	# if ssl port configured then add ssl options
-	if [ $FLL_IRC_PORT = "7000" ]; then
+	if $USE_SSL; then
 		cat <<_EOF_ >>"$IRSSICFG/config"
     use_ssl = "yes";
     ssl_verify = "yes";
@@ -362,7 +367,7 @@ E=UTF-8 (Unicode)
 F=63
 _EOF_
 	# if ssl port configured then add ssl options
-	if [ $FLL_IRC_PORT = "7000" ]; then
+	if $USE_SSL; then
 		cat <<_EOF_ >>"$XCHATCFG/servlist_.conf"
 D=1
 _EOF_
@@ -372,8 +377,7 @@ D=0
 _EOF_
 	fi
 	cat <<_EOF_ >>"$XCHATCFG/servlist_.conf"
-S=irc.freenode.net/$FLL_IRC_PORT
-S=irc.freenode.net/+7000
+S=$FLL_IRC_SERVER/$FLL_IRC_PORT
 _EOF_
 
 	cat <<_EOF_ >"$XCHATCFG/commands.conf"
@@ -420,7 +424,7 @@ E=UTF-8 (Unicode)
 F=63
 _EOF_
 	# if ssl port configured then add ssl options
-	if [ $FLL_IRC_PORT = "7000" ]; then
+	if $USE_SSL; then
 		cat <<_EOF_ >>"$HEXCHATCFG/servlist.conf"
 D=1
 _EOF_
@@ -430,8 +434,7 @@ D=0
 _EOF_
 	fi
 	cat <<_EOF_ >>"$HEXCHATCFG/servlist.conf"
-S=irc.freenode.net/$FLL_IRC_PORT
-S=irc.freenode.net/+7000
+S=$FLL_IRC_SERVER/$FLL_IRC_PORT
 _EOF_
 
 	cat <<_EOF_ >"$HEXCHATCFG/commands.conf"
@@ -523,7 +526,7 @@ if [ -z "$DISPLAY" ]; then
 else
 	# X11
 	if [ -x "$KONVERSATION" ]; then
-		if [ $FLL_IRC_PORT = "7000" ]; then
+		if $USE_SSL; then
 			exec "$KONVERSATION" --server "$FLL_IRC_SERVER" --ssl --port "$FLL_IRC_PORT" --channel "$FLL_IRC_CHANNEL" --nick "$NICK"
 		else
 			exec "$KONVERSATION" --server "$FLL_IRC_SERVER" --port "$FLL_IRC_PORT" --channel "$FLL_IRC_CHANNEL" --nick "$NICK"
-- 
cgit v1.0