mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 07:06:20 +00:00
Added basic /status command to find out about a specific contact
This commit is contained in:
@@ -108,6 +108,7 @@ static gboolean _cmd_online(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_dnd(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_chat(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_xa(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_status(const char * const inp, struct cmd_help_t help);
|
||||
|
||||
/*
|
||||
* The commands are broken down into three groups:
|
||||
@@ -190,6 +191,15 @@ static struct cmd_t main_commands[] =
|
||||
"Example : /msg boothj5@gmail.com Hey, here's a message!",
|
||||
NULL } } },
|
||||
|
||||
{ "/status",
|
||||
_cmd_status,
|
||||
{ "/msg user@host", "Find out a contacts status.",
|
||||
{ "/msg user@host",
|
||||
"--------------",
|
||||
"Find out someones presence information.",
|
||||
"Use tab completion to autocomplete the contact.",
|
||||
NULL } } },
|
||||
|
||||
{ "/join",
|
||||
_cmd_join,
|
||||
{ "/join room@server [nick]", "Join a chat room.",
|
||||
@@ -777,6 +787,8 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
|
||||
_parameter_autocomplete(input, size, "/msg",
|
||||
contact_list_find_contact);
|
||||
_parameter_autocomplete(input, size, "/status",
|
||||
contact_list_find_contact);
|
||||
_parameter_autocomplete(input, size, "/connect",
|
||||
prefs_find_login);
|
||||
_parameter_autocomplete(input, size, "/sub",
|
||||
@@ -1162,6 +1174,33 @@ _cmd_msg(const char * const inp, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_status(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
char *usr = NULL;
|
||||
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
if (conn_status != JABBER_CONNECTED) {
|
||||
cons_show("You are not currently connected.");
|
||||
} else {
|
||||
// copy input
|
||||
char inp_cpy[strlen(inp) + 1];
|
||||
strcpy(inp_cpy, inp);
|
||||
|
||||
// get user
|
||||
strtok(inp_cpy, " ");
|
||||
usr = strtok(NULL, " ");
|
||||
if (usr != NULL) {
|
||||
win_show_status(usr);
|
||||
} else {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_join(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user