~rcr/rirc

ddd82e18e9d39623b58c03c4ed857c77fd7433bd — Richard Robbins 2 months ago 2170399 dev
cleanup command string handling
1 files changed, 6 insertions(+), 23 deletions(-)

M src/state.c
M src/state.c => src/state.c +6 -23
@@ 602,30 602,13 @@ command(struct channel *c, char *args)
	if (!(arg = irc_strsep(&args)))
		return;

	if (!strcasecmp(arg, "clear")) {
		command_clear(c, args);
		return;
	}

	if (!strcasecmp(arg, "close")) {
		command_close(c, args);
		return;
	}

	if (!strcasecmp(arg, "connect")) {
		command_connect(c, args);
		return;
	}

	if (!strcasecmp(arg, "disconnect")) {
		command_disconnect(c, args);
		return;
	}

	if (!strcasecmp(arg, "quit")) {
		command_quit(c, args);
		return;
	#define X(CMD) \
	if (!strcasecmp(arg, #CMD)) { \
		command_##CMD(c, args);   \
		return;                   \
	}
	COMMAND_HANDLERS
	#undef X

	action(action_error, "Unknown command '%s'", arg);
}