1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 09:43:13 +02:00

Add IRC bar items (buffer name, lag indicator), use bar items from plugins with callback to core items if not found

This commit is contained in:
Sebastien Helleu
2008-09-21 19:32:41 +02:00
parent e1bb85457a
commit a8b12f2597
30 changed files with 396 additions and 47 deletions
+2
View File
@@ -98,6 +98,8 @@
./src/plugins/fifo/fifo.h
./src/plugins/fifo/fifo-info.c
./src/plugins/fifo/fifo-info.h
./src/plugins/irc/irc-bar-item.c
./src/plugins/irc/irc-bar-item.h
./src/plugins/irc/irc-buffer.c
./src/plugins/irc/irc-buffer.h
./src/plugins/irc/irc.c
+4 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2205,6 +2205,9 @@ msgstr "%s chyba při čtení FIFO roury, zavírám ji\n"
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr "%s nevalidní syntaxe pro IRC server ('%s'), ignorován\n"
+4 -1
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2146,6 +2146,9 @@ msgstr "%s Fehler beim Lesen vom FIFO, FIFO wird geschlossen\n"
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
# ???
#, fuzzy, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
+4 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2124,6 +2124,9 @@ msgstr "%s error al leer la tubería FIFO, cerrándola\n"
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr "%s sintaxis inválida para el servidor IRC ('%s'), ignorado\n"
+11 -4
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"PO-Revision-Date: 2008-09-18 18:50+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2008-09-21 19:29+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -1023,10 +1023,14 @@ msgstr ""
" right: saute à la fenêtre à droite\n"
"splith: éclate la fenêtre en deux horizontalement\n"
"splitv: éclate la fenêtre en deux verticalement\n"
"resize: redimensionne une fenêtre, la nouvelle taille est <pct> pourcentage de la fenêtre parent\n"
"resize: redimensionne une fenêtre, la nouvelle taille est <pct> pourcentage "
"de la fenêtre parent\n"
" merge: fusionne la fenêtre avec une autre\n"
"\n"
"Pour splith et splitv, pct est un pourcentage qui représente la taille de la nouvelle fenêtre, calculée par rapport à la taille de la fenêtre courante. Par exemple 25 signifie créer une fenêtre qui a pour taille: taille_courante / 4"
"Pour splith et splitv, pct est un pourcentage qui représente la taille de la "
"nouvelle fenêtre, calculée par rapport à la taille de la fenêtre courante. "
"Par exemple 25 signifie créer une fenêtre qui a pour taille: "
"taille_courante / 4"
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
@@ -2127,6 +2131,9 @@ msgstr "%s%s: erreur d'ouverture du fichier, fermeture"
msgid "name of FIFO pipe"
msgstr "nom du tube FIFO"
msgid "Lag"
msgstr "Lag"
#, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr "%s%s: erreur avec le serveur IRC de l'URL (\"%s\"), ignoré"
+4 -1
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2153,6 +2153,9 @@ msgstr "%s hiba a FIFO cső olvasása közben, bezárás\n"
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr "%s érvénytelen szintaxis az IRC szervernek ('%s'), mellőzve\n"
+4 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2158,6 +2158,9 @@ msgstr "%s ошибка чтения FIFO pipe, закрываю его\n"
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr "%s некорректный синтаксис IRC сервра ('%s'), игнорируется\n"
+2
View File
@@ -99,6 +99,8 @@ SET(WEECHAT_SOURCES
./src/plugins/fifo/fifo.h
./src/plugins/fifo/fifo-info.c
./src/plugins/fifo/fifo-info.h
./src/plugins/irc/irc-bar-item.c
./src/plugins/irc/irc-bar-item.h
./src/plugins/irc/irc-buffer.c
./src/plugins/irc/irc-buffer.h
./src/plugins/irc/irc.c
+4 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-18 18:49+0200\n"
"POT-Creation-Date: 2008-09-21 19:29+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1814,6 +1814,9 @@ msgstr ""
msgid "name of FIFO pipe"
msgstr ""
msgid "Lag"
msgstr ""
#, c-format
msgid "%s%s: error with IRC server from URL (\"%s\"), ignored"
msgstr ""
+36 -9
View File
@@ -145,26 +145,49 @@ gui_bar_item_string_is_item (const char *string, const char *item_name)
/*
* gui_bar_item_search_with_plugin: search a bar item for a plugin
* if exact_plugin == 1, then search only for
* this plugin, otherwise, if plugin is not
* found, function may return item for core
* (plugin == NULL)
*/
struct t_gui_bar_item *
gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin,
int exact_plugin,
const char *item_name)
{
struct t_gui_bar_item *ptr_item;
struct t_gui_bar_item *ptr_item, *item_found_plugin;
struct t_gui_bar_item *item_found_without_plugin;
if (!item_name || !item_name[0])
return NULL;
item_found_plugin = NULL;
item_found_without_plugin = NULL;
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
{
if ((ptr_item->plugin == plugin)
&& (strcmp (ptr_item->name, item_name) == 0))
return ptr_item;
if (strcmp (ptr_item->name, item_name) == 0)
{
if (ptr_item->plugin == plugin)
{
log_printf("item found 1: %x", ptr_item);
return ptr_item;
}
if (!exact_plugin)
{
if (ptr_item->plugin)
item_found_plugin = ptr_item;
else
item_found_without_plugin = ptr_item;
}
}
}
/* bar item not found */
return NULL;
if (item_found_without_plugin)
return item_found_without_plugin;
return item_found_plugin;
}
/*
@@ -374,7 +397,9 @@ gui_bar_item_get_value (const char *name, struct t_gui_bar *bar,
item_value = NULL;
if (item_name)
{
ptr_item = gui_bar_item_search (item_name);
ptr_item = gui_bar_item_search_with_plugin ((window) ? window->buffer->plugin : NULL,
0,
item_name);
if (ptr_item)
{
if (ptr_item->build_callback)
@@ -490,7 +515,7 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
return NULL;
/* it's not possible to create 2 bar items with same name for same plugin */
if (gui_bar_item_search_with_plugin (plugin, name))
if (gui_bar_item_search_with_plugin (plugin, 1, name))
return NULL;
/* create bar item */
@@ -1333,7 +1358,9 @@ gui_bar_item_print_log ()
{
log_printf ("");
log_printf ("[bar item (addr:0x%x)]", ptr_item);
log_printf (" plugin . . . . . . . . : 0x%x", ptr_item->plugin);
log_printf (" plugin . . . . . . . . : 0x%x ('%s')",
ptr_item->plugin,
(ptr_item->plugin) ? ptr_item->plugin->name : "");
log_printf (" name . . . . . . . . . : '%s'", ptr_item->name);
log_printf (" build_callback . . . . : 0x%x", ptr_item->build_callback);
log_printf (" build_callback_data. . : 0x%x", ptr_item->build_callback_data);
+1 -1
View File
@@ -1721,7 +1721,7 @@ gui_bar_create_default ()
buf = malloc (length);
if (buf)
{
snprintf (buf, length, "[%s],[%s],[%s],%s,(%s),[%s],[%s],%s,%s",
snprintf (buf, length, "[%s],[%s],[%s],%s,(%s),[lag],[%s],[%s],%s,%s",
gui_bar_item_names[GUI_BAR_ITEM_TIME],
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT],
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN],
+25 -14
View File
@@ -265,10 +265,15 @@ gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin)
int
gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
{
if (string_strcasecmp (property, "notify") == 0)
return buffer->notify;
else if (string_strcasecmp (property, "lines_hidden") == 0)
return buffer->lines_hidden;
if (buffer && property)
{
if (string_strcasecmp (property, "number") == 0)
return buffer->number;
else if (string_strcasecmp (property, "notify") == 0)
return buffer->notify;
else if (string_strcasecmp (property, "lines_hidden") == 0)
return buffer->lines_hidden;
}
return 0;
}
@@ -280,14 +285,17 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
char *
gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return (buffer->plugin) ? buffer->plugin->name : NULL;
else if (string_strcasecmp (property, "name") == 0)
return buffer->name;
else if (string_strcasecmp (property, "title") == 0)
return buffer->title;
else if (string_strcasecmp (property, "nick") == 0)
return buffer->input_nick;
if (buffer && property)
{
if (string_strcasecmp (property, "plugin") == 0)
return (buffer->plugin) ? buffer->plugin->name : NULL;
else if (string_strcasecmp (property, "name") == 0)
return buffer->name;
else if (string_strcasecmp (property, "title") == 0)
return buffer->title;
else if (string_strcasecmp (property, "nick") == 0)
return buffer->input_nick;
}
return NULL;
}
@@ -299,8 +307,11 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
void *
gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
if (buffer && property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
}
return NULL;
}
+51
View File
@@ -37,6 +37,7 @@
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
#include "../plugins/plugin.h"
#include "gui-window.h"
@@ -303,6 +304,56 @@ gui_window_valid (struct t_gui_window *window)
return 0;
}
/*
* gui_window_get_integer: get a window property as integer
*/
int
gui_window_get_integer (struct t_gui_window *window, const char *property)
{
if (window && property)
{
}
return 0;
}
/*
* gui_window_get_string: get a window property as string
*/
char *
gui_window_get_string (struct t_gui_window *window, const char *property)
{
if (window && property)
{
}
return NULL;
}
/*
* gui_windowr_get_pointer: get a window property as pointer
*/
void *
gui_window_get_pointer (struct t_gui_window *window, const char *property)
{
if (property)
{
if (string_strcasecmp (property, "current") == 0)
return gui_current_window;
if (window)
{
if (string_strcasecmp (property, "buffer") == 0)
return window->buffer;
}
}
return NULL;
}
/*
* gui_window_free: delete a window
*/
+6
View File
@@ -123,6 +123,12 @@ extern struct t_gui_window *gui_window_new (struct t_gui_window *parent,
int x, int y, int width, int height,
int width_pct, int height_pct);
extern int gui_window_valid (struct t_gui_window *window);
extern int gui_window_get_integer (struct t_gui_window *window,
const char *property);
extern char *gui_window_get_string (struct t_gui_window *window,
const char *property);
extern void *gui_window_get_pointer (struct t_gui_window *window,
const char *property);
extern void gui_window_free (struct t_gui_window *window);
extern struct t_gui_window *gui_window_search_by_buffer (struct t_gui_buffer *buffer);
extern void gui_window_switch_server (struct t_gui_window *window);
+1
View File
@@ -16,6 +16,7 @@
ADD_LIBRARY(irc MODULE
irc.c irc.h
irc-bar-item.c irc-bar-item.h
irc-buffer.c irc-buffer.h
irc-channel.c irc-channel.h
irc-color.c irc-color.h
+2
View File
@@ -22,6 +22,8 @@ lib_LTLIBRARIES = irc.la
irc_la_SOURCES = irc.c \
irc.h \
irc-bar-item.c \
irc-bar-item.h \
irc-buffer.c \
irc-buffer.h \
irc-channel.c \
+164
View File
@@ -0,0 +1,164 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-bar-item.c: bar items for IRC plugin */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../weechat-plugin.h"
#include "irc.h"
#include "irc-buffer.h"
#include "irc-config.h"
#include "irc-server.h"
#include "irc-channel.h"
/*
* irc_bar_item_buffer_name: bar item with buffer name
*/
char *
irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char buf[256], buf_name[256], *name;
int number;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
/* make C compiler happy */
(void) data;
(void) item;
(void) max_width;
(void) max_height;
if (!window)
window = weechat_current_window;
buf_name[0] = '\0';
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
{
number = weechat_buffer_get_integer (buffer, "number");
irc_buffer_get_server_channel (buffer, &server, &channel);
if (server || channel)
{
if (server && !channel)
{
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
else
{
if (channel)
{
snprintf (buf_name, sizeof (buf_name),
"%s%s%s/%s%s%s(%s%s%s)",
IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
channel->name,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
channel->modes,
IRC_COLOR_BAR_DELIM);
}
}
}
else
{
name = weechat_buffer_get_string (buffer, "name");
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
snprintf (buf, sizeof (buf), "%s%d%s:%s%s",
IRC_COLOR_STATUS_NUMBER,
number,
IRC_COLOR_BAR_DELIM,
IRC_COLOR_STATUS_NAME,
buf_name);
return strdup (buf);
}
return NULL;
}
/*
* irc_bar_item_lag: bar item with lag value
*/
char *
irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char buf[32];
struct t_gui_buffer *buffer;
struct t_irc_server *server;
/* make C compiler happy */
(void) data;
(void) item;
(void) window;
(void) max_width;
(void) max_height;
buffer = weechat_window_get_pointer (window, "buffer");
if (buffer)
{
irc_buffer_get_server_channel (buffer, &server, NULL);
if (server
&& (server->lag >= weechat_config_integer (irc_config_network_lag_min_show) * 1000))
{
snprintf (buf, sizeof (buf),
"%s: %.1f",
_("Lag"),
((float)(server->lag)) / 1000);
return strdup (buf);
}
}
return NULL;
}
/*
* irc_bar_item_init: initialize IRC bar items
*/
void
irc_bar_item_init ()
{
weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL);
weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL);
}
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_IRC_BAR_ITEM_H
#define __WEECHAT_IRC_BAR_ITEM_H 1
extern void irc_bar_item_init ();
#endif /* irc-bar_item.h */
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-buffer.c: manages buffers for IRC protocol */
/* irc-buffer.c: manages buffers for IRC plugin */
#include <stdlib.h>
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-channel.c: manages a chat (channel or private chat) */
/* irc-channel.c: manages a chat (channel or private chat) for IRC plugin */
#include <stdlib.h>
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-color.c: IRC color decoding/encidong in messages */
/* irc-color.c: IRC color decoding/encoding in messages */
#include <stdlib.h>
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-command.c: IRC commands managment */
/* irc-completion.c: completion for IRC commands */
#include <stdlib.h>
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-display.c: display functions for IRC */
/* irc-display.c: display functions for IRC plugin */
#include <stdlib.h>
+2
View File
@@ -206,6 +206,8 @@ irc_mode_channel_set (struct t_irc_server *server,
free (str_modes);
if (argv)
weechat_string_free_exploded (argv);
weechat_bar_item_update ("buffer_name");
}
/*
+1 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-nick.c: manages nick list for channels */
/* irc-nick.c: manages nick list for channels for IRC plugin */
#include <stdlib.h>
+6 -6
View File
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-protocol.c: description of IRC commands, according to RFC 1459, 2810,
2811 2812 */
/* irc-protocol.c: implementation of IRC protocol, according to
RFC 1459, 2810, 2811 2812 */
#ifndef __USE_XOPEN
@@ -989,10 +989,10 @@ irc_protocol_cmd_pong (struct t_irc_server *server, const char *command,
/* calculate lag (time diff with lag check) */
old_lag = server->lag;
gettimeofday (&tv, NULL);
server->lag = (int) weechat_timeval_diff (&(server->lag_check_time), &tv);
/* TODO: update lag indicator */
//if (old_lag != server->lag)
// gui_status_draw (gui_current_window->buffer, 1);
server->lag = (int) weechat_timeval_diff (&(server->lag_check_time),
&tv);
if (old_lag != server->lag)
weechat_bar_item_update ("lag");
/* schedule next lag check */
server->lag_check_time.tv_sec = 0;
+3
View File
@@ -24,6 +24,7 @@
#include "../weechat-plugin.h"
#include "irc.h"
#include "irc-bar-item.h"
#include "irc-command.h"
#include "irc-completion.h"
#include "irc-config.h"
@@ -128,6 +129,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* hook completions */
irc_completion_init ();
irc_bar_item_init ();
/* look at arguments */
auto_connect = 1;
upgrading = 0;
+5
View File
@@ -58,6 +58,11 @@
#define IRC_COLOR_NICKLIST_PREFIX3 weechat_color("nicklist_prefix3")
#define IRC_COLOR_NICKLIST_PREFIX4 weechat_color("nicklist_prefix4")
#define IRC_COLOR_NICKLIST_PREFIX5 weechat_color("nicklist_prefix5")
#define IRC_COLOR_BAR_FG weechat_color("bar_fg")
#define IRC_COLOR_BAR_BG weechat_color("bar_bg")
#define IRC_COLOR_BAR_DELIM weechat_color("bar_delim")
#define IRC_COLOR_STATUS_NUMBER weechat_color("status_number")
#define IRC_COLOR_STATUS_NAME weechat_color("status_name")
extern struct t_weechat_plugin *weechat_irc_plugin;
extern struct t_hook *irc_hook_timer_check_away;
+6 -1
View File
@@ -49,6 +49,7 @@
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
#include "plugin.h"
#include "plugin-api.h"
#include "plugin-config.h"
@@ -399,7 +400,11 @@ plugin_load (const char *filename)
new_plugin->buffer_get_string = &gui_buffer_get_string;
new_plugin->buffer_get_pointer = &gui_buffer_get_pointer;
new_plugin->buffer_set = &gui_buffer_set;
new_plugin->window_get_integer = &gui_window_get_integer;
new_plugin->window_get_string = &gui_window_get_string;
new_plugin->window_get_pointer = &gui_window_get_pointer;
new_plugin->nicklist_add_group = &gui_nicklist_add_group;
new_plugin->nicklist_search_group = &gui_nicklist_search_group;
new_plugin->nicklist_add_nick = &gui_nicklist_add_nick;
+18
View File
@@ -415,6 +415,14 @@ struct t_weechat_plugin
const char *property);
void (*buffer_set) (struct t_gui_buffer *buffer, const char *property,
void *value);
/* windows */
int (*window_get_integer) (struct t_gui_window *window,
const char *property);
char *(*window_get_string) (struct t_gui_window *window,
const char *property);
void *(*window_get_pointer) (struct t_gui_window *window,
const char *property);
/* nicklist */
struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer,
@@ -890,6 +898,16 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_buffer_set(__buffer, __property, __value) \
weechat_plugin->buffer_set(__buffer, __property, __value)
/* windows */
#define weechat_window_get_integer(__window, __property) \
weechat_plugin->window_get_integer(__window, __property)
#define weechat_window_get_string(__window, __property) \
weechat_plugin->window_get_string(__window, __property)
#define weechat_window_get_pointer(__window, __property) \
weechat_plugin->window_get_pointer(__window, __property)
#define weechat_current_window \
weechat_plugin->window_get_pointer(NULL, "current")
/* nicklist */
#define weechat_nicklist_add_group(__buffer, __parent_group, __name, \
__color, __visible) \