changeset 199:15ad726db5c8

Irccd: style
author David Demelier <markand@malikania.fr>
date Wed, 08 Jun 2016 19:59:00 +0200
parents b87679fbf7d8
children 1099568ef450
files lib/irccd/mod-directory.cpp lib/irccd/mod-elapsed-timer.cpp lib/irccd/mod-file.cpp lib/irccd/mod-logger.cpp lib/irccd/mod-plugin.cpp lib/irccd/mod-server.cpp lib/irccd/mod-system.cpp lib/irccd/mod-unicode.cpp
diffstat 8 files changed, 94 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/lib/irccd/mod-directory.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-directory.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -220,9 +220,9 @@
 }
 
 const duk_function_list_entry methods[] = {
-	{ "find",		methodFind,		DUK_VARARGS	},
-	{ "remove",		methodRemove,		1		},
-	{ nullptr,		nullptr,		0		} 
+	{ "find",	methodFind,	DUK_VARARGS	},
+	{ "remove",	methodRemove,	1		},
+	{ nullptr,	nullptr,	0		} 
 };
 
 /*
@@ -346,20 +346,20 @@
 }
 
 const duk_function_list_entry functions[] = {
-	{ "find", funcFind, DUK_VARARGS },
-	{ "mkdir", funcMkdir, DUK_VARARGS },
-	{ "remove", funcRemove, DUK_VARARGS },
-	{ nullptr, nullptr, 0 }
+	{ "find",		funcFind,		DUK_VARARGS	},
+	{ "mkdir",		funcMkdir,		DUK_VARARGS	},
+	{ "remove",		funcRemove,		DUK_VARARGS	},
+	{ nullptr,		nullptr,		0		}
 };
 
 const duk_number_list_entry constants[] = {
-	{ "Dot", static_cast<int>(fs::Dot) },
-	{ "DotDot", static_cast<int>(fs::DotDot) },
-	{ "TypeUnknown", static_cast<int>(fs::Entry::Unknown) },
-	{ "TypeDir", static_cast<int>(fs::Entry::Dir) },
-	{ "TypeFile", static_cast<int>(fs::Entry::File) },
-	{ "TypeLink", static_cast<int>(fs::Entry::Link) },
-	{ nullptr, 0 }
+	{ "Dot",		static_cast<int>(fs::Dot)		},
+	{ "DotDot",		static_cast<int>(fs::DotDot)		},
+	{ "TypeUnknown",	static_cast<int>(fs::Entry::Unknown)	},
+	{ "TypeDir",		static_cast<int>(fs::Entry::Dir)	},
+	{ "TypeFile",		static_cast<int>(fs::Entry::File)	},
+	{ "TypeLink",		static_cast<int>(fs::Entry::Link)	},
+	{ nullptr,		0					}
 };
 
 } // !namespace
--- a/lib/irccd/mod-elapsed-timer.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-elapsed-timer.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -129,11 +129,11 @@
 }
 
 const duk_function_list_entry methods[] = {
-	{ "elapsed", elapsed, 0 },
-	{ "pause", pause, 0 },
-	{ "reset", reset, 0 },
-	{ "restart", restart, 0 },
-	{ nullptr, nullptr, 0 }
+	{ "elapsed",	elapsed,	0 },
+	{ "pause",	pause,		0 },
+	{ "reset",	reset,		0 },
+	{ "restart",	restart,	0 },
+	{ nullptr,	nullptr,	0 }
 };
 
 } // !namespace
--- a/lib/irccd/mod-file.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-file.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -442,20 +442,20 @@
 }
 
 const duk_function_list_entry methods[] = {
-	{ "basename", methodBasename, 0 },
-	{ "close", methodClose, 0 },
-	{ "dirname", methodDirname, 0 },
-	{ "lines", methodLines, 0 },
-	{ "read", methodRead, 1 },
-	{ "readline", methodReadline, 0 },
-	{ "remove", methodRemove, 0 },
-	{ "seek", methodSeek, 2 },
+	{ "basename",	methodBasename,	0 },
+	{ "close",	methodClose,	0 },
+	{ "dirname",	methodDirname,	0 },
+	{ "lines",	methodLines,	0 },
+	{ "read",	methodRead,	1 },
+	{ "readline",	methodReadline,	0 },
+	{ "remove",	methodRemove,	0 },
+	{ "seek",	methodSeek,	2 },
 #if defined(HAVE_STAT)
-	{ "stat", methodStat, 0 },
+	{ "stat",	methodStat,	0 },
 #endif
-	{ "tell", methodTell, 0 },
-	{ "write", methodWrite, 1 },
-	{ nullptr, nullptr, 0 }
+	{ "tell",	methodTell,	0 },
+	{ "write",	methodWrite,	1 },
+	{ nullptr,	nullptr,	0 }
 };
 
 /*
@@ -610,21 +610,21 @@
 #endif // !HAVE_STAT
 
 const duk_function_list_entry functions[] = {
-	{ "basename", functionBasename, 1 },
-	{ "dirname", functionDirname, 1 },
-	{ "exists", functionExists, 1 },
-	{ "remove", functionRemove, 1 },
+	{ "basename",	functionBasename,	1 },
+	{ "dirname",	functionDirname,	1 },
+	{ "exists",	functionExists,		1 },
+	{ "remove",	functionRemove,		1 },
 #if defined(HAVE_STAT)
-	{ "stat", functionStat, 1 },
+	{ "stat",	functionStat,		1 },
 #endif
-	{ nullptr, nullptr, 0 }
+	{ nullptr,	nullptr,		0 }
 };
 
 const duk_number_list_entry constants[] = {
-	{ "SeekCur", SEEK_CUR },
-	{ "SeekEnd", SEEK_END },
-	{ "SeekSet", SEEK_SET },
-	{ nullptr, 0 } 
+	{ "SeekCur",	SEEK_CUR		},
+	{ "SeekEnd",	SEEK_END		},
+	{ "SeekSet",	SEEK_SET		},
+	{ nullptr, 	0			} 
 };
 
 } // !namespace
--- a/lib/irccd/mod-logger.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-logger.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -75,10 +75,10 @@
 }
 
 const duk_function_list_entry functions[] = {
-	{ "info", info, 1 },
-	{ "warning", warning, 1 },
-	{ "debug", debug, 1 },
-	{ nullptr, nullptr, 0 }
+	{ "info",	info,		1 },
+	{ "warning",	warning,	1 },
+	{ "debug",	debug,		1 },
+	{ nullptr,	nullptr,	0 }
 };
 
 } // !namespace
--- a/lib/irccd/mod-plugin.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-plugin.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -173,12 +173,12 @@
 }
 
 const duk_function_list_entry functions[] = {
-	{ "info", info, DUK_VARARGS },
-	{ "list", list, 0 },
-	{ "load", load, 1 },
-	{ "reload", reload, 1 },
-	{ "unload", unload, 1 },
-	{ nullptr, nullptr, 0 }
+	{ "info",	info,		DUK_VARARGS	},
+	{ "list",	list,		0		},
+	{ "load",	load,		1		},
+	{ "reload",	reload,		1		},
+	{ "unload",	unload,		1		},
+	{ nullptr,	nullptr,	0		}
 };
 
 } // !namespace
--- a/lib/irccd/mod-server.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-server.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -222,16 +222,9 @@
 	duk_put_prop_string(ctx, -2, "nickname");
 	dukx_push_std_string(ctx, server->identity().username);
 	duk_put_prop_string(ctx, -2, "username");
-
-	// Channels.
-	duk_push_array(ctx);
-
-	int i = 0;
-	for (const auto &channel : server->settings().channels) {
+	dukx_push_array(ctx, server->settings().channels, [] (auto ctx, auto channel) {
 		dukx_push_std_string(ctx, channel.name);
-		duk_put_prop_index(ctx, -2, i++);
-	}
-
+	});
 	duk_put_prop_string(ctx, -2, "channels");
 
 	return 1;
@@ -604,32 +597,32 @@
 }
 
 const duk_function_list_entry methods[] = {
-	{ "cmode", cmode, 2 },
-	{ "cnotice", cnotice, 2 },
-	{ "info", info, 0 },
-	{ "invite", invite, 2 },
-	{ "join", join, DUK_VARARGS },
-	{ "kick", kick, DUK_VARARGS },
-	{ "me", me, 2 },
-	{ "message", message, 2 },
-	{ "mode", mode, 1 },
-	{ "names", names, 1 },
-	{ "nick", nick, 1 },
-	{ "notice", notice, 2 },
-	{ "part", part, DUK_VARARGS },
-	{ "send", send, 1 },
-	{ "topic", topic, 2 },
-	{ "whois", whois, 1 },
-	{ "toString", toString, 0 },
-	{ nullptr, nullptr, 0 }
+	{ "cmode",	cmode,		2		},
+	{ "cnotice",	cnotice,	2		},
+	{ "info",	info,		0		},
+	{ "invite",	invite,		2		},
+	{ "join",	join,		DUK_VARARGS	},
+	{ "kick",	kick,		DUK_VARARGS	},
+	{ "me",		me,		2		},
+	{ "message",	message,	2		},
+	{ "mode",	mode,		1		},
+	{ "names",	names,		1		},
+	{ "nick",	nick,		1		},
+	{ "notice",	notice,		2		},
+	{ "part",	part,		DUK_VARARGS	},
+	{ "send",	send,		1		},
+	{ "topic",	topic,		2		},
+	{ "whois",	whois,		1		},
+	{ "toString",	toString,	0		},
+	{ nullptr,	nullptr,	0		}
 };
 
 const duk_function_list_entry functions[] = {
-	{ "add", add, 1 },
-	{ "find", find, 1 },
-	{ "list", list, 0 },
-	{ "remove", remove, 1 },
-	{ nullptr, nullptr, 0 }
+	{ "add",	add,		1		},
+	{ "find",	find,		1		},
+	{ "list",	list,		0		},
+	{ "remove",	remove,		1		},
+	{ nullptr,	nullptr,	0		}
 };
 
 } // !namespace
--- a/lib/irccd/mod-system.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-system.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -207,19 +207,19 @@
 }
 
 const duk_function_list_entry functions[] = {
-	{ "env", env, 1 },
-	{ "exec", exec, 1 },
-	{ "home", home, 0 },
-	{ "name", name, 0 },
+	{ "env",	env,		1 },
+	{ "exec",	exec,		1 },
+	{ "home",	home,		0 },
+	{ "name",	name,		0 },
 #if defined(HAVE_POPEN)
-	{ "popen", popen, 2 },
+	{ "popen",	popen,		2 },
 #endif
-	{ "sleep", sleep, 1 },
-	{ "ticks", ticks, 0 },
-	{ "uptime", uptime, 0 },
-	{ "usleep", usleep, 1 },
-	{ "version", version, 0 },
-	{ nullptr, nullptr, 0 }
+	{ "sleep",	sleep,		1 },
+	{ "ticks",	ticks,		0 },
+	{ "uptime",	uptime,		0 },
+	{ "usleep",	usleep,		1 },
+	{ "version",	version,	0 },
+	{ nullptr,	nullptr,	0 }
 };
 
 } // !namespace
--- a/lib/irccd/mod-unicode.cpp	Wed Jun 08 13:41:38 2016 +0200
+++ b/lib/irccd/mod-unicode.cpp	Wed Jun 08 19:59:00 2016 +0200
@@ -122,13 +122,13 @@
 }
 
 const duk_function_list_entry functions[] = {
-	{ "isDigit",		isDigit,	1	},
-	{ "isLetter",		isLetter,	1	},
-	{ "isLower",		isLower,	1	},
-	{ "isSpace",		isSpace,	1	},
-	{ "isTitle",		isTitle,	1	},
-	{ "isUpper",		isUpper,	1	},
-	{ nullptr,		nullptr,	0	} 
+	{ "isDigit",		isDigit,	1 },
+	{ "isLetter",		isLetter,	1 },
+	{ "isLower",		isLower,	1 },
+	{ "isSpace",		isSpace,	1 },
+	{ "isTitle",		isTitle,	1 },
+	{ "isUpper",		isUpper,	1 },
+	{ nullptr,		nullptr,	0 } 
 };
 
 } // !namespace