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; return WEECHAT_RC_ERROR;
tox_set_user_status(tox, status); tox_set_user_status(tox, status);
weechat_bar_item_update("away");
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
} }

View file

@ -8,6 +8,29 @@
#include "tox-weechat.h" #include "tox-weechat.h"
#include "tox-weechat-utils.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 * char *
bar_item_input_prompt(void *data, bar_item_input_prompt(void *data,
struct t_gui_bar_item *item, 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() 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("input_prompt", bar_item_input_prompt, NULL);
weechat_bar_item_new("buffer_plugin", bar_item_buffer_plugin, NULL); weechat_bar_item_new("buffer_plugin", bar_item_buffer_plugin, NULL);
} }