mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 11:16:22 +00:00
Moved start commands to command.module
This commit is contained in:
30
command.c
30
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;
|
||||
|
||||
Reference in New Issue
Block a user