From 7666e778e4628dd111ed3dbc76311dd021b05698 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sun, 3 Jul 2016 22:21:50 +0100
Subject: [PATCH] function to remove irc server

---
 src/freedombone-app-irc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/freedombone-app-irc b/src/freedombone-app-irc
index 6d9e5082e..4f0cde4ea 100755
--- a/src/freedombone-app-irc
+++ b/src/freedombone-app-irc
@@ -34,6 +34,23 @@ IRC_ONION_PORT=6697
 # An optional password to log into IRC. This applies to all users
 IRC_PASSWORD=
 
+function remove_irc_server {
+	if ! grep -Fxq "install_irc_server" $COMPLETION_FILE; then
+		return
+	fi
+	systemctl stop ngircd
+	apt-get -y remove --purge ngircd
+	if [ -d /etc/ngircd ]; then
+		rm -rf /etc/ngircd
+	fi
+	iptables -D INPUT -p tcp --dport $IRC_PORT  -j ACCEPT
+	iptables -D INPUT -p tcp --dport 1024:65535 --sport $IRC_PORT -j ACCEPT
+	function_check save_firewall_settings
+	save_firewall_settings
+	sed -i '/install_irc_server/d' $COMPLETION_FILE
+	sed -i '/IRC /d' $COMPLETION_FILE
+}
+
 function configure_firewall_for_irc {
 	if [ ! -d /etc/ngircd ]; then
 		return
-- 
GitLab