Added /status command.

This commit is contained in:
Håvard Pettersson 2014-09-03 15:19:09 +02:00
parent 2c2e7f1bb1
commit d290499d9d

View File

@ -345,6 +345,29 @@ tox_weechat_cmd_name(void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
} }
int
tox_weechat_cmd_status(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
if (argc != 2)
return WEECHAT_RC_ERROR;
TOX_USERSTATUS status = TOX_USERSTATUS_INVALID;
if (weechat_strcasecmp(argv[1], "online") == 0)
status = TOX_USERSTATUS_NONE;
else if (weechat_strcasecmp(argv[1], "busy") == 0)
status = TOX_USERSTATUS_BUSY;
else if (weechat_strcasecmp(argv[1], "away") == 0)
status = TOX_USERSTATUS_AWAY;
if (status == TOX_USERSTATUS_INVALID)
return WEECHAT_RC_ERROR;
tox_set_user_status(tox, status);
return WEECHAT_RC_OK;
}
int int
tox_weechat_cmd_statusmsg(void *data, struct t_gui_buffer *buffer, tox_weechat_cmd_statusmsg(void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol) int argc, char **argv, char **argv_eol)
@ -412,6 +435,12 @@ tox_weechat_commands_init()
"name: your new name", "name: your new name",
NULL, tox_weechat_cmd_name, NULL); NULL, tox_weechat_cmd_name, NULL);
weechat_hook_command("status",
"change your Tox status",
"online|busy|away",
"",
NULL, tox_weechat_cmd_status, NULL);
weechat_hook_command("statusmsg", weechat_hook_command("statusmsg",
"change your Tox status message", "change your Tox status message",
"[<message>]", "[<message>]",