changeset 16:b3298e9d02c2

Irccdctl: enable general.verbose option, #412
author David Demelier <markand@malikania.fr>
date Fri, 12 Feb 2016 12:37:40 +0100
parents 8d74eeb81184
children 73b7d6dbe576
files irccdctl/irccdctl.cpp irccdctl/irccdctl.h
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/irccdctl/irccdctl.cpp	Thu Feb 11 13:48:53 2016 +0100
+++ b/irccdctl/irccdctl.cpp	Fri Feb 12 12:37:40 2016 +0100
@@ -34,6 +34,7 @@
 #include <path.h>
 #include <sockets.h>
 #include <system.h>
+#include <util.h>
 
 #include "irccdctl.h"
 
@@ -185,6 +186,14 @@
 		throw std::invalid_argument("invalid type given: " + it->value());
 }
 
+void Irccdctl::readGeneral(const ini::Section &sc)
+{
+	auto verbose = sc.find("verbose");
+
+	if (verbose != sc.end())
+		log::setVerbose(util::isBoolean(verbose->value()));
+}
+
 void Irccdctl::readAliases(const ini::Section &sc)
 {
 	for (const ini::Option &option : sc) {
@@ -234,6 +243,8 @@
 	/* Do not try to read [connect] if specified at command line */
 	if (it != doc.end() && options.count("-t") == 0 && options.count("--type") == 0)
 		readConnect(*it);
+	if ((it = doc.find("general")) != doc.end())
+		readGeneral(*it);
 	if ((it = doc.find("alias")) != doc.end())
 		readAliases(*it);
 }
--- a/irccdctl/irccdctl.h	Thu Feb 11 13:48:53 2016 +0100
+++ b/irccdctl/irccdctl.h	Fri Feb 12 12:37:40 2016 +0100
@@ -60,6 +60,7 @@
 	void readConnectIp(const ini::Section &sc);
 	void readConnectUnix(const ini::Section &sc);
 	void readConnect(const ini::Section &sc);
+	void readGeneral(const ini::Section &sc);
 	void readAliases(const ini::Section &sc);
 	void read(const std::string &path, const parser::Result &options);