Refactored command parsing.

Allows for automatically tested command parsing by splitting parsing
and invokation of the commands.
This commit is contained in:
Jan Vidar Krey
2011-12-19 00:34:20 +01:00
parent fc5e09aa9e
commit f2cb84180a
11 changed files with 698 additions and 443 deletions

View File

@@ -254,6 +254,7 @@ int hub_handle_password(struct hub_info* hub, struct hub_user* u, struct adc_mes
int hub_handle_chat_message(struct hub_info* hub, struct hub_user* u, struct adc_message* cmd)
{
char* message = adc_msg_get_argument(cmd, 0);
char* message_decoded = NULL;
int ret = 0;
int relay = 1;
int broadcast;
@@ -289,7 +290,9 @@ int hub_handle_chat_message(struct hub_info* hub, struct hub_user* u, struct adc
}
else
{
relay = command_invoke(hub->commands, u, message);
message_decoded = adc_msg_unescape(message);
relay = command_invoke(hub->commands, u, message_decoded);
hub_free(message_decoded);
}
}