-if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.has_option("irc", "channel"):
- irc_host = ini.get("irc", "host")
- irc_port = 6667
- irc_chan = ini.get("irc", "channel")
- irc_nick = ini.get("irc", "nickname")
- irc_pass = None
-
- if ini.has_option("irc", "port"):
- irc_port = ini.getint("irc", "port")
-
- if ini.has_option("irc", "password"):
- irc_pass = ini.get("irc", "password")
-
- irc = reporters.IRC(irc_host, irc_nick,
- port = irc_port,
- password = irc_pass,
- channels = [ irc_chan ],
- notify_events = [ 'exception', 'problem', 'recovery' ]
- )
-
- c['services'].append(irc)
+if ini.has_section("irc"):
+ iniirc = ini['irc']
+ irc_host = iniirc.get("host", None)
+ irc_port = iniirc.getint("port", 6667)
+ irc_chan = iniirc.get("channel", None)
+ irc_nick = iniirc.get("nickname", None)
+ irc_pass = iniirc.get("password", None)
+
+ if irc_host and irc_nick and irc_chan:
+ irc = reporters.IRC(irc_host, irc_nick,
+ port = irc_port,
+ password = irc_pass,
+ channels = [ irc_chan ],
+ notify_events = [ 'exception', 'problem', 'recovery' ]
+ )
+
+ c['services'].append(irc)