Commands for presence updates

This commit is contained in:
James Booth
2012-05-27 20:36:31 +01:00
parent f5eab87588
commit dd9f6f825e
6 changed files with 74 additions and 52 deletions

View File

@@ -45,6 +45,7 @@ static gboolean _cmd_close(const char * const inp);
static gboolean _cmd_set_beep(const char * const inp);
static gboolean _cmd_set_flash(const char * const inp);
static gboolean _cmd_away(const char * const inp);
static gboolean _cmd_online(const char * const inp);
static gboolean _cmd_default(const char * const inp);
gboolean process_input(char *inp)
@@ -103,6 +104,8 @@ static gboolean _handle_command(const char * const command, const char * const i
result = _cmd_set_flash(inp);
} else if (strcmp(command, "/away") == 0) {
result = _cmd_away(inp);
} else if (strcmp(command, "/online") == 0) {
result = _cmd_online(inp);
} else {
result = _cmd_default(inp);
}
@@ -261,12 +264,28 @@ static gboolean _cmd_away(const char * const inp)
cons_show("You are not currently connected.");
} else {
jabber_update_presence(PRESENCE_AWAY);
title_bar_set_status(PRESENCE_AWAY);
cons_show("Status set to \"away\"");
}
return TRUE;
}
static gboolean _cmd_online(const char * const inp)
{
jabber_conn_status_t conn_status = jabber_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else {
jabber_update_presence(PRESENCE_ONLINE);
title_bar_set_status(PRESENCE_ONLINE);
cons_show("Status set to \"online\"");
}
return TRUE;
}
static gboolean _cmd_default(const char * const inp)
{
if (win_in_chat()) {