[LEDE-DEV] [PATCH] phase1: irc-bot: allow to use noticeOnChannel

Alexander Couzens lynxis at fe80.eu
Tue Jun 27 11:14:47 PDT 2017


notices are shown in a different color or handled in a
different way on the clients.
---
 phase1/config.ini.example | 1 +
 phase1/master.cfg         | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/phase1/config.ini.example b/phase1/config.ini.example
index bfbe837..f2c15fd 100644
--- a/phase1/config.ini.example
+++ b/phase1/config.ini.example
@@ -18,6 +18,7 @@ port = 6667
 channel = #example-channel
 nickname = example-builder
 password = example
+notice = True
 
 [repo]
 url = https://git.lede-project.org/source.git
diff --git a/phase1/master.cfg b/phase1/master.cfg
index 04879e8..c6fb0c3 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -803,6 +803,7 @@ if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.h
 	irc_chan = ini.get("irc", "channel")
 	irc_nick = ini.get("irc", "nickname")
 	irc_pass = None
+	irc_notice = False
 
 	if ini.has_option("irc", "port"):
 		irc_port = ini.getint("irc", "port")
@@ -810,13 +811,17 @@ if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.h
 	if ini.has_option("irc", "password"):
 		irc_pass = ini.get("irc", "password")
 
+	if ini.has_option("irc", "notice")
+		irc_notice = ini.getboolean("irc", "notice")
+
 	irc = words.IRC(irc_host, irc_nick, port = irc_port, password = irc_pass,
 			channels = [{ "channel": irc_chan }],
 			notify_events = {
 			  'exception': 1,
 			  'successToFailure': 1,
 			  'failureToSuccess': 1
-			}
+			},
+			noticeOnChannel=irc_notice
 	)
 
 	c['status'].append(irc)
-- 
2.13.1




More information about the Lede-dev mailing list