Added a bar item next to nickname when busy/away.

This commit is contained in:
Håvard Pettersson 2014-09-03 23:38:30 +02:00
parent c1e4b9af3d
commit 136cd966aa
2 changed files with 25 additions and 0 deletions

View File

@ -364,6 +364,7 @@ tox_weechat_cmd_status(void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_ERROR;
tox_set_user_status(tox, status);
weechat_bar_item_update("away");
return WEECHAT_RC_OK;
}

View File

@ -8,6 +8,29 @@
#include "tox-weechat.h"
#include "tox-weechat-utils.h"
#include "tox-weechat-gui.h"
char *
bar_item_away(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
char *status = NULL;;
switch (tox_get_self_user_status(tox))
{
case TOX_USERSTATUS_BUSY:
status = strdup("busy");
break;
case TOX_USERSTATUS_AWAY:
status = strdup("away");
break;
}
return status;
}
char *
bar_item_input_prompt(void *data,
struct t_gui_bar_item *item,
@ -39,6 +62,7 @@ bar_item_buffer_plugin(void *data, struct t_gui_bar_item *item,
void tox_weechat_gui_init()
{
weechat_bar_item_new("away", bar_item_away, NULL);
weechat_bar_item_new("input_prompt", bar_item_input_prompt, NULL);
weechat_bar_item_new("buffer_plugin", bar_item_buffer_plugin, NULL);
}