summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-bar-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc/irc-bar-item.c')
-rw-r--r--src/plugins/irc/irc-bar-item.c126
1 files changed, 50 insertions, 76 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 740a6f6a9..fb599fb02 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -1,7 +1,7 @@
/*
* irc-bar-item.c - bar items for IRC plugin
*
- * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -34,65 +34,12 @@
/*
- * Returns content of bar item "away": bar item with away indicator.
- */
-
-char *
-irc_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)
-{
- struct t_irc_server *server;
- char *buf, *message;
- int length;
-
- /* make C compiler happy */
- (void) data;
- (void) item;
- (void) window;
- (void) extra_info;
-
- if (!buffer)
- return NULL;
-
- buf = NULL;
-
- irc_buffer_get_server_and_channel (buffer, &server, NULL);
-
- if (server && server->is_away)
- {
- if (weechat_config_boolean (irc_config_look_item_away_message)
- && server->away_message && server->away_message[0])
- {
- message = strdup (server->away_message);
- }
- else
- {
- message = strdup (_("away"));
- }
- if (message)
- {
- length = strlen (message) + 64 + 1;
- buf = malloc (length);
- if (buf)
- {
- snprintf (buf, length, "%s%s",
- IRC_COLOR_ITEM_AWAY,
- message);
- }
- free (message);
- }
- }
-
- return buf;
-}
-
-/*
* Returns content of bar item "buffer_plugin": bar item with buffer plugin.
*/
char *
-irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_plugin (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -104,6 +51,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -252,12 +200,14 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name)
*/
char *
-irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_name (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -272,12 +222,14 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_short_name (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -291,7 +243,8 @@ irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_modes (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -303,6 +256,7 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -351,7 +305,8 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
+irc_bar_item_channel (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
@@ -362,6 +317,7 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -428,7 +384,8 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
+irc_bar_item_lag (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
@@ -436,6 +393,7 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
struct t_irc_server *server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -467,7 +425,8 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
+irc_bar_item_input_prompt (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -479,6 +438,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
int length;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -548,7 +508,8 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
+irc_bar_item_nick_modes (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -558,6 +519,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
int length;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -587,7 +549,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
*/
struct t_hashtable *
-irc_bar_item_focus_buffer_nicklist (void *data,
+irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data,
struct t_hashtable *info)
{
long unsigned int value;
@@ -609,6 +571,7 @@ irc_bar_item_focus_buffer_nicklist (void *data,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (ptr_server && ptr_channel)
@@ -633,10 +596,12 @@ irc_bar_item_focus_buffer_nicklist (void *data,
*/
int
-irc_bar_item_buffer_switch (void *data, const char *signal,
+irc_bar_item_buffer_switch (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -673,17 +638,26 @@ irc_bar_item_update_channel ()
void
irc_bar_item_init ()
{
- weechat_bar_item_new ("away", &irc_bar_item_away, NULL);
- weechat_bar_item_new ("buffer_plugin", &irc_bar_item_buffer_plugin, NULL);
- weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL);
- weechat_bar_item_new ("buffer_short_name", &irc_bar_item_buffer_short_name, NULL);
- weechat_bar_item_new ("buffer_modes", &irc_bar_item_buffer_modes, NULL);
- weechat_bar_item_new ("irc_channel", &irc_bar_item_channel, NULL);
- weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL);
- weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL);
- weechat_bar_item_new ("irc_nick_modes", &irc_bar_item_nick_modes, NULL);
+ weechat_bar_item_new ("buffer_plugin",
+ &irc_bar_item_buffer_plugin, NULL, NULL);
+ weechat_bar_item_new ("buffer_name",
+ &irc_bar_item_buffer_name, NULL, NULL);
+ weechat_bar_item_new ("buffer_short_name",
+ &irc_bar_item_buffer_short_name, NULL, NULL);
+ weechat_bar_item_new ("buffer_modes",
+ &irc_bar_item_buffer_modes, NULL, NULL);
+ weechat_bar_item_new ("irc_channel",
+ &irc_bar_item_channel, NULL, NULL);
+ weechat_bar_item_new ("lag",
+ &irc_bar_item_lag, NULL, NULL);
+ weechat_bar_item_new ("input_prompt",
+ &irc_bar_item_input_prompt, NULL, NULL);
+ weechat_bar_item_new ("irc_nick_modes",
+ &irc_bar_item_nick_modes, NULL, NULL);
+
weechat_hook_focus ("buffer_nicklist",
- &irc_bar_item_focus_buffer_nicklist, NULL);
+ &irc_bar_item_focus_buffer_nicklist, NULL, NULL);
+
weechat_hook_signal ("buffer_switch",
- &irc_bar_item_buffer_switch, NULL);
+ &irc_bar_item_buffer_switch, NULL, NULL);
}