From 9db56f4fc160f15fd918aca9da09f7f1539bc420 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 10 Feb 2012 23:53:13 +0000 Subject: Moved start commands to command.module --- command.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'command.c') diff --git a/command.c b/command.c index 7b578cd8..8477a639 100644 --- a/command.c +++ b/command.c @@ -11,6 +11,36 @@ static int cmd_msg(char *cmd); static int cmd_close(char *cmd); static int cmd_default(char *cmd); +int handle_start_command(char *cmd) +{ + int result; + + if (strcmp(cmd, "/quit") == 0) { + result = QUIT_PROF; + } else if (strncmp(cmd, "/help", 5) == 0) { + cons_help(); + inp_clear(); + result = AWAIT_COMMAND; + } else if (strncmp(cmd, "/connect ", 9) == 0) { + char *user; + user = strndup(cmd+9, strlen(cmd)-9); + + inp_bar_get_password(); + char passwd[20]; + inp_get_password(passwd); + + inp_bar_print_message(user); + jabber_connect(user, passwd); + result = START_MAIN; + } else { + cons_bad_command(cmd); + inp_clear(); + result = AWAIT_COMMAND; + } + + return result; +} + int handle_command(char *cmd) { int result = FALSE; -- cgit 1.4.1-2-gfad0