summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-26 20:37:03 +0200
commitdfdf42e27b033730178bf8884e2f4a1e6c960791 (patch)
tree6f7a25f6df49089832aabc6448bd6e527de2ea0e /src/plugins/irc
parent2a83aae85e68a8c7431f372f39131b09fea7bca1 (diff)
downloadweechat-dfdf42e27b033730178bf8884e2f4a1e6c960791.zip
core: remove unneeded whitespace
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-bar-item.c116
-rw-r--r--src/plugins/irc/irc-buffer.c30
-rw-r--r--src/plugins/irc/irc-channel.c134
-rw-r--r--src/plugins/irc/irc-color.c34
-rw-r--r--src/plugins/irc/irc-command.c740
-rw-r--r--src/plugins/irc/irc-completion.c112
-rw-r--r--src/plugins/irc/irc-config.c236
-rw-r--r--src/plugins/irc/irc-ctcp.c156
-rw-r--r--src/plugins/irc/irc-debug.c8
-rw-r--r--src/plugins/irc/irc-display.c6
-rw-r--r--src/plugins/irc/irc-ignore.c72
-rw-r--r--src/plugins/irc/irc-ignore.h2
-rw-r--r--src/plugins/irc/irc-info.c48
-rw-r--r--src/plugins/irc/irc-input.c52
-rw-r--r--src/plugins/irc/irc-message.c110
-rw-r--r--src/plugins/irc/irc-mode.c18
-rw-r--r--src/plugins/irc/irc-msgbuffer.c16
-rw-r--r--src/plugins/irc/irc-nick.c184
-rw-r--r--src/plugins/irc/irc-notify.c118
-rw-r--r--src/plugins/irc/irc-notify.h2
-rw-r--r--src/plugins/irc/irc-protocol.c768
-rw-r--r--src/plugins/irc/irc-raw.c60
-rw-r--r--src/plugins/irc/irc-redirect.c176
-rw-r--r--src/plugins/irc/irc-sasl.c38
-rw-r--r--src/plugins/irc/irc-server.c560
-rw-r--r--src/plugins/irc/irc-server.h2
-rw-r--r--src/plugins/irc/irc-upgrade.c36
-rw-r--r--src/plugins/irc/irc.c64
28 files changed, 1949 insertions, 1949 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 42fc5abd3..fd166842b 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -47,22 +47,22 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
struct t_irc_server *server;
char *buf, *message;
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
buf = NULL;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
-
+
if (server && server->is_away)
{
if (weechat_config_boolean (irc_config_look_item_away_message)
@@ -88,7 +88,7 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
}
}
}
-
+
return buf;
}
@@ -103,29 +103,29 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
const char *title;
char *title_color;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
title = weechat_buffer_get_string (buffer, "title");
if (!title)
return NULL;
-
+
title_color = irc_color_decode (title,
(weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
0 : 1);
-
+
return (title_color) ? title_color : strdup (title);
}
-
+
return NULL;
}
@@ -143,16 +143,16 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
const char *name;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin");
@@ -180,7 +180,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
}
return strdup (buf);
}
-
+
return NULL;
}
@@ -198,21 +198,21 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buf_name[0] = '\0';
modes[0] = '\0';
-
+
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
@@ -282,14 +282,14 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
-
+
snprintf (buf, sizeof (buf), "%s%s%s",
(server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
-
+
return NULL;
}
@@ -307,21 +307,21 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
struct t_gui_buffer *buffer;
struct t_irc_server *server;
struct t_irc_channel *channel;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buf_name[0] = '\0';
modes[0] = '\0';
-
+
display_server = (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_NAME);
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
@@ -363,14 +363,14 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
if (name)
snprintf (buf_name, sizeof (buf_name), "%s", name);
}
-
+
snprintf (buf, sizeof (buf), "%s%s%s",
IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
}
-
+
return NULL;
}
@@ -385,20 +385,20 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
char buf[128];
struct t_gui_buffer *buffer;
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, NULL);
-
+
if (server
&& (server->lag >= weechat_config_integer (irc_config_network_lag_min_show)))
{
@@ -430,22 +430,22 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_irc_nick *ptr_nick;
char *buf, str_prefix[64];
int length;
-
+
/* make C compiler happy */
(void) data;
(void) item;
-
+
if (!window)
window = weechat_current_window ();
-
+
buffer = weechat_window_get_pointer (window, "buffer");
-
+
if (buffer)
{
irc_buffer_get_server_and_channel (buffer, &server, &channel);
if (!server || !server->nick)
return NULL;
-
+
/* build prefix */
str_prefix[0] = '\0';
if (weechat_config_boolean (irc_config_look_item_nick_prefix)
@@ -463,11 +463,11 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
}
}
}
-
+
/* build bar item */
length = 64 + strlen (server->nick) + 64 +
((server->nick_modes) ? strlen (server->nick_modes) : 0) + 64 + 1;
-
+
buf = malloc (length);
if (buf)
{
@@ -491,10 +491,10 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
server->nick);
}
}
-
+
return buf;
}
-
+
return NULL;
}
@@ -511,22 +511,22 @@ irc_bar_item_focus_buffer_nicklist (void *data,
struct t_gui_buffer *buffer;
struct t_irc_nick *ptr_nick;
const char *str_buffer, *nick;
-
+
str_buffer = weechat_hashtable_get (info, "_buffer");
if (!str_buffer || !str_buffer[0])
return NULL;
-
+
rc = sscanf (str_buffer, "%lx", &value);
if ((rc == EOF) || (rc == 0))
return NULL;
-
+
buffer = (struct t_gui_buffer *)value;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (ptr_server && ptr_channel)
{
nick = weechat_hashtable_get (info, "nick");
@@ -540,7 +540,7 @@ irc_bar_item_focus_buffer_nicklist (void *data,
}
}
}
-
+
return NULL;
}
@@ -558,14 +558,14 @@ irc_bar_item_buffer_switch (void *data, const char *signal,
(void) signal;
(void) type_data;
(void) signal_data;
-
+
weechat_bar_item_update ("away");
weechat_bar_item_update ("buffer_title");
weechat_bar_item_update ("buffer_name");
weechat_bar_item_update ("irc_channel");
weechat_bar_item_update ("lag");
weechat_bar_item_update ("input_prompt");
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index a62c6d07a..328fa6ae5 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -49,15 +49,15 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
if (server)
*server = NULL;
if (channel)
*channel = NULL;
-
+
if (!buffer)
return;
-
+
/* look for a server or channel using this buffer */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -68,7 +68,7 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
*server = ptr_server;
return;
}
-
+
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -82,7 +82,7 @@ irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
}
}
}
-
+
/* no server or channel found */
}
@@ -94,18 +94,18 @@ char *
irc_buffer_build_name (const char *server, const char *channel)
{
static char buffer[128];
-
+
buffer[0] = '\0';
-
+
if (!server && !channel)
return buffer;
-
+
if (server && channel)
snprintf (buffer, sizeof (buffer), "%s.%s", server, channel);
else
snprintf (buffer, sizeof (buffer), "%s",
(server) ? server : channel);
-
+
return buffer;
}
@@ -117,12 +117,12 @@ int
irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
struct t_irc_channel *next_channel;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (buffer == irc_raw_buffer)
{
irc_raw_buffer = NULL;
@@ -156,7 +156,7 @@ irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -172,10 +172,10 @@ irc_buffer_search_first_for_all_servers ()
struct t_gui_buffer *ptr_buffer;
struct t_irc_server *ptr_server;
int number, number_found;
-
+
ptr_buffer = NULL;
number_found = INT_MAX;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index ef89392a5..48d133d45 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -50,17 +50,17 @@ int
irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server)
return 0;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel == channel)
return 1;
}
-
+
/* channel not found */
return 0;
}
@@ -77,12 +77,12 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
int number_found;
char str_number[32];
struct t_irc_channel *ptr_channel;
-
+
number = weechat_buffer_get_integer (buffer, "number");
number_last_channel = 0;
number_last_private = 0;
number_found = 0;
-
+
if (server->channels)
{
/* search last channel/pv number for server */
@@ -106,7 +106,7 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
}
}
}
-
+
/* use last channel/pv number + 1 */
switch (channel_type)
{
@@ -130,7 +130,7 @@ irc_channel_move_near_server (struct t_irc_server *server, int channel_type,
number_found = weechat_buffer_get_integer (server->buffer, "number") + 1;
}
}
-
+
/* switch to number found */
if ((number_found >= 1) && (number_found != number))
{
@@ -154,7 +154,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
int i, buffer_created, current_buffer_number, buffer_position, manual_join;
char *buffer_name, str_number[32], str_group[32], *channel_name_lower;
const char *prefix_modes;
-
+
/* alloc memory for new channel */
if ((new_channel = malloc (sizeof (*new_channel))) == NULL)
{
@@ -163,7 +163,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return NULL;
}
-
+
/* create buffer for channel (or use existing one) */
buffer_created = 0;
buffer_name = irc_buffer_build_name (server->name, channel_name);
@@ -206,7 +206,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
}
buffer_created = 1;
}
-
+
if (buffer_created)
{
if (!weechat_buffer_get_integer (new_buffer, "short_name_is_set"))
@@ -227,7 +227,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_buffer_set (new_buffer, "nicklist", "1");
weechat_buffer_set (new_buffer, "nicklist_display_groups", "0");
}
-
+
/* set highlights settings on channel buffer */
weechat_buffer_set(new_buffer, "highlight_words_add", "$nick");
if (weechat_config_string (irc_config_look_highlight_tags)
@@ -237,7 +237,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_config_string (irc_config_look_highlight_tags));
}
}
-
+
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -253,7 +253,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
weechat_nicklist_add_group (new_buffer, NULL, str_group,
"weechat.color.nicklist_group", 1);
}
-
+
/* initialize new channel */
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
@@ -279,7 +279,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->last_nick_speaking_time = NULL;
new_channel->buffer = new_buffer;
new_channel->buffer_as_string = NULL;
-
+
/* add new channel to channels list */
new_channel->prev_channel = server->last_channel;
new_channel->next_channel = NULL;
@@ -288,7 +288,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
else
server->channels = new_channel;
server->last_channel = new_channel;
-
+
manual_join = 0;
channel_name_lower = NULL;
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -301,7 +301,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
channel_name_lower);
}
}
-
+
if (switch_to_channel)
{
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -310,23 +310,23 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
|| (!manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin)))
switch_to_channel = 0;
}
-
+
if (switch_to_channel)
{
weechat_buffer_set (new_buffer, "display",
(auto_switch) ? "auto" : "1");
}
}
-
+
if (manual_join)
weechat_hashtable_remove (server->manual_joins, channel_name_lower);
if (channel_name_lower)
free (channel_name_lower);
-
+
weechat_hook_signal_send ((channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
"irc_channel_opened" : "irc_pv_opened",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
-
+
/* all is ok, return address of new channel */
return new_channel;
}
@@ -340,7 +340,7 @@ irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
{
if (channel->topic)
free (channel->topic);
-
+
channel->topic = (topic) ? strdup (topic) : NULL;
weechat_buffer_set (channel->buffer, "title",
(channel->topic) ? channel->topic : "");
@@ -354,10 +354,10 @@ struct t_irc_channel *
irc_channel_search (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server || !channel_name)
return NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -375,10 +375,10 @@ int
irc_channel_is_channel (const char *string)
{
char first_char[2];
-
+
if (!string)
return 0;
-
+
first_char[0] = string[0];
first_char[1] = '\0';
return (strpbrk (first_char, IRC_CHANNEL_PREFIX)) ? 1 : 0;
@@ -393,7 +393,7 @@ irc_channel_remove_away (struct t_irc_server *server,
struct t_irc_channel *channel)
{
struct t_irc_nick *ptr_nick;
-
+
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
@@ -436,7 +436,7 @@ irc_channel_set_away (struct t_irc_server *server,
int is_away)
{
struct t_irc_nick *ptr_nick;
-
+
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
ptr_nick = irc_nick_search (channel, nick_name);
@@ -456,21 +456,21 @@ irc_channel_nick_speaking_add_to_list (struct t_irc_channel *channel,
{
int size, to_remove, i;
struct t_weelist_item *ptr_item;
-
+
/* create list if it does not exist */
if (!channel->nicks_speaking[highlight])
channel->nicks_speaking[highlight] = weechat_list_new ();
-
+
/* remove item if it was already in list */
ptr_item = weechat_list_casesearch (channel->nicks_speaking[highlight],
nick_name);
if (ptr_item)
weechat_list_remove (channel->nicks_speaking[highlight], ptr_item);
-
+
/* add nick in list */
weechat_list_add (channel->nicks_speaking[highlight], nick_name,
WEECHAT_LIST_POS_END, NULL);
-
+
/* reduce list size if it's too big */
size = weechat_list_size (channel->nicks_speaking[highlight]);
if (size > IRC_CHANNEL_NICKS_SPEAKING_LIMIT)
@@ -498,7 +498,7 @@ irc_channel_nick_speaking_add (struct t_irc_channel *channel,
highlight = 1;
if (highlight)
irc_channel_nick_speaking_add_to_list (channel, nick_name, 1);
-
+
irc_channel_nick_speaking_add_to_list (channel, nick_name, 0);
}
@@ -537,10 +537,10 @@ irc_channel_nick_speaking_time_search (struct t_irc_channel *channel,
{
struct t_irc_channel_speaking *ptr_nick;
time_t time_limit;
-
+
time_limit = time (NULL) -
(weechat_config_integer (irc_config_look_smart_filter_delay) * 60);
-
+
for (ptr_nick = channel->nicks_speaking_time; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
@@ -551,7 +551,7 @@ irc_channel_nick_speaking_time_search (struct t_irc_channel *channel,
return ptr_nick;
}
}
-
+
/* nick speaking time not found */
return NULL;
}
@@ -567,7 +567,7 @@ irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
/* free data */
if (nick_speaking->nick)
free (nick_speaking->nick);
-
+
/* remove nick from list */
if (nick_speaking->prev_nick)
(nick_speaking->prev_nick)->next_nick = nick_speaking->next_nick;
@@ -577,7 +577,7 @@ irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
channel->nicks_speaking_time = nick_speaking->next_nick;
if (channel->last_nick_speaking_time == nick_speaking)
channel->last_nick_speaking_time = nick_speaking->prev_nick;
-
+
free (nick_speaking);
}
@@ -603,7 +603,7 @@ void
irc_channel_nick_speaking_time_remove_old (struct t_irc_channel *channel)
{
time_t time_limit;
-
+
time_limit = time (NULL) -
(weechat_config_integer (irc_config_look_smart_filter_delay) * 60);
@@ -611,7 +611,7 @@ irc_channel_nick_speaking_time_remove_old (struct t_irc_channel *channel)
{
if (channel->last_nick_speaking_time->time_last_message >= time_limit)
break;
-
+
irc_channel_nick_speaking_time_free (channel,
channel->last_nick_speaking_time);
}
@@ -627,17 +627,17 @@ irc_channel_nick_speaking_time_add (struct t_irc_channel *channel,
time_t time_last_message)
{
struct t_irc_channel_speaking *ptr_nick, *new_nick;
-
+
ptr_nick = irc_channel_nick_speaking_time_search (channel, nick_name, 0);
if (ptr_nick)
irc_channel_nick_speaking_time_free (channel, ptr_nick);
-
+
new_nick = malloc (sizeof (*new_nick));
if (new_nick)
{
new_nick->nick = strdup (nick_name);
new_nick->time_last_message = time_last_message;
-
+
/* insert nick at beginning of list */
new_nick->prev_nick = NULL;
new_nick->next_nick = channel->nicks_speaking_time;
@@ -660,7 +660,7 @@ irc_channel_nick_speaking_time_rename (struct t_irc_channel *channel,
const char *new_nick)
{
struct t_irc_channel_speaking *ptr_nick;
-
+
if (channel->nicks_speaking_time)
{
ptr_nick = irc_channel_nick_speaking_time_search (channel, old_nick, 0);
@@ -680,12 +680,12 @@ void
irc_channel_rejoin (struct t_irc_server *server, struct t_irc_channel *channel)
{
char join_args[256];
-
+
snprintf (join_args, sizeof (join_args), "%s%s%s",
channel->name,
(channel->key) ? " " : "",
(channel->key) ? channel->key : "");
-
+
irc_command_join_server (server, join_args, 0);
}
@@ -698,12 +698,12 @@ irc_channel_autorejoin_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server, *ptr_server_found;
struct t_irc_channel *ptr_channel_arg, *ptr_channel;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
ptr_channel_arg = (struct t_irc_channel *)data;
-
+
ptr_server_found = NULL;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -718,13 +718,13 @@ irc_channel_autorejoin_cb (void *data, int remaining_calls)
}
}
}
-
+
if (ptr_server_found && (ptr_channel_arg->hook_autorejoin))
{
irc_channel_rejoin (ptr_server_found, ptr_channel_arg);
ptr_channel_arg->hook_autorejoin = NULL;
}
-
+
return WEECHAT_RC_OK;
}
@@ -740,10 +740,10 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
const char *nickname)
{
struct t_irc_channel *ptr_channel;
-
+
if (!server || (!nick && !nickname))
return;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -777,10 +777,10 @@ void
irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
{
struct t_irc_channel *new_channels;
-
+
if (!server || !channel)
return;
-
+
/* remove channel from channels list */
if (server->last_channel == channel)
server->last_channel = channel->prev_channel;
@@ -791,10 +791,10 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
}
else
new_channels = channel->next_channel;
-
+
if (channel->next_channel)
(channel->next_channel)->prev_channel = channel->prev_channel;
-
+
/* free data */
if (channel->name)
free (channel->name);
@@ -818,9 +818,9 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
irc_channel_nick_speaking_time_free_all (channel);
if (channel->buffer_as_string)
free (channel->buffer_as_string);
-
+
free (channel);
-
+
server->channels = new_channels;
}
@@ -845,10 +845,10 @@ struct t_hdata *
irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
if (hdata)
{
@@ -889,10 +889,10 @@ struct t_hdata *
irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
@@ -918,14 +918,14 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
struct t_irc_channel_speaking *ptr_nick;
char option_name[64];
int i, index;
-
+
if (!infolist || !channel)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", channel->buffer))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "buffer_name",
@@ -1003,7 +1003,7 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
i++;
}
}
-
+
return 1;
}
@@ -1018,7 +1018,7 @@ irc_channel_print_log (struct t_irc_channel *channel)
struct t_irc_channel_speaking *ptr_nick_speaking;
int i, index;
struct t_irc_nick *ptr_nick;
-
+
weechat_log_printf ("");
weechat_log_printf (" => channel %s (addr:0x%lx):", channel->name, channel);
weechat_log_printf (" type . . . . . . . . . . : %d", channel->type);
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index 1b9f26aee..9b019e73f 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -66,17 +66,17 @@ irc_color_decode (const char *string, int keep_colors)
int out_length, length, out_pos;
char str_fg[3], str_bg[3], str_color[128];
int fg, bg, bold, reverse, italic, underline, rc;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
bold = 0;
reverse = 0;
italic = 0;
underline = 0;
-
+
ptr_string = (unsigned char *)string;
out[0] = '\0';
while (ptr_string && ptr_string[0])
@@ -197,7 +197,7 @@ irc_color_decode (const char *string, int keep_colors)
break;
}
}
-
+
return (char *)out;
}
@@ -212,12 +212,12 @@ irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
@@ -261,9 +261,9 @@ irc_color_decode_for_user_entry (const char *string)
ptr_string += length;
}
}
-
+
out[out_pos] = '\0';
-
+
return (char *)out;
}
@@ -280,12 +280,12 @@ irc_color_encode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
-
+
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
-
+
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
@@ -356,9 +356,9 @@ irc_color_encode (const char *string, int keep_colors)
ptr_string += length;
}
}
-
+
out[out_pos] = '\0';
-
+
return (char *)out;
}
@@ -374,18 +374,18 @@ irc_color_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
int keep_colors;
-
+
/* make C compiler happy */
(void) data;
-
+
keep_colors = (modifier_data && (strcmp (modifier_data, "1") == 0)) ? 1 : 0;
-
+
if (strcmp (modifier, "irc_color_decode") == 0)
return irc_color_decode (string, keep_colors);
-
+
if (strcmp (modifier, "irc_color_encode") == 0)
return irc_color_encode (string, keep_colors);
-
+
/* unknown modifier */
return NULL;
}
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index f0417e0bf..3eacbcb4c 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -59,7 +59,7 @@ irc_command_mode_nicks (struct t_irc_server *server, const char *channel,
{
int i, length;
char *command;
-
+
length = 0;
for (i = 1; i < argc; i++)
length += strlen (argv[i]) + 1;
@@ -95,7 +95,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -106,7 +106,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"ADMIN");
}
-
+
return WEECHAT_RC_OK;
}
@@ -125,7 +125,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
struct t_irc_channel *ptr_channel;
char **channels, *str_command;
int num_channels, length, excluded, i;
-
+
if (!command || !command[0])
return;
@@ -137,13 +137,13 @@ irc_command_exec_all_channels (struct t_irc_server *server,
}
else
str_command = strdup (command);
-
+
if (!str_command)
return;
-
+
channels = (exclude_channels && exclude_channels[0]) ?
weechat_string_split (exclude_channels, ",", 0, 0, &num_channels) : NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -178,7 +178,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
}
}
}
-
+
free (str_command);
if (channels)
weechat_string_free_split (channels);
@@ -195,12 +195,12 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
{
int i, current_server;
const char *ptr_exclude_channels, *ptr_command;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
current_server = 0;
@@ -221,7 +221,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
else
break;
}
-
+
if (ptr_command && ptr_command[0])
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -244,7 +244,7 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
struct t_irc_server *ptr_server;
char **servers, *str_command;
int num_servers, length, excluded, i;
-
+
if (!command || !command[0])
return;
@@ -256,13 +256,13 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
}
else
str_command = strdup (command);
-
+
if (!str_command)
return;
-
+
servers = (exclude_servers && exclude_servers[0]) ?
weechat_string_split (exclude_servers, ",", 0, 0, &num_servers) : NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -287,7 +287,7 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
}
}
}
-
+
free (str_command);
if (servers)
weechat_string_free_split (servers);
@@ -303,11 +303,11 @@ irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc,
{
int i;
const char *ptr_exclude_servers, *ptr_command;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
-
+
if (argc > 1)
{
ptr_exclude_servers = NULL;
@@ -322,7 +322,7 @@ irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc,
else
break;
}
-
+
if (ptr_command && ptr_command[0])
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -343,7 +343,7 @@ irc_command_me_channel_display (struct t_irc_server *server,
const char *arguments)
{
char *string;
-
+
string = (arguments && arguments[0]) ?
irc_color_decode (arguments,
weechat_config_boolean (irc_config_network_colors_receive)) : NULL;
@@ -374,7 +374,7 @@ irc_command_me_channel (struct t_irc_server *server,
int number;
char hash_key[32];
const char *str_args;
-
+
hashtable = irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
@@ -405,7 +405,7 @@ void
irc_command_me_all_channels (struct t_irc_server *server, const char *arguments)
{
struct t_irc_channel *ptr_channel;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -425,16 +425,16 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
char *string, buffer[4096];
time_t time_now, elapsed;
struct t_irc_channel *ptr_channel;
-
+
if (!server)
return;
-
+
if (arguments)
{
if (server->away_message)
free (server->away_message);
server->away_message = strdup (arguments);
-
+
/* if server is connected, send away command now */
if (server->is_connected)
{
@@ -459,7 +459,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
free (string);
}
irc_server_set_away (server, server->nick, 1);
-
+
/* reset "unread" indicator on server and channels/pv buffers */
if (reset_unread_marker)
{
@@ -472,7 +472,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
weechat_buffer_set (ptr_channel->buffer, "unread", "");
}
}
-
+
/* ask refresh for "away" item */
weechat_bar_item_update ("away");
}
@@ -499,7 +499,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
free (server->away_message);
server->away_message = NULL;
}
-
+
/* if server is connected, send away command now */
if (server->is_connected)
{
@@ -535,7 +535,7 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
}
}
irc_server_set_away (server, server->nick, 0);
-
+
/* ask refresh for "away" item */
weechat_bar_item_update ("away");
}
@@ -561,10 +561,10 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if ((argc >= 2) && (weechat_strcasecmp (argv[1], "-all") == 0))
{
weechat_buffer_set (NULL, "hotlist", "-");
@@ -589,7 +589,7 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
weechat_buffer_set (NULL, "hotlist", "+");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -603,20 +603,20 @@ irc_command_run_away (void *data, struct t_gui_buffer *buffer,
{
int argc;
char **argv, **argv_eol;
-
+
argv = weechat_string_split (command, " ", 0, 0, &argc);
argv_eol = weechat_string_split (command, " ", 1, 0, NULL);
-
+
if (argv && argv_eol)
{
irc_command_away (data, buffer, argc, argv, argv_eol);
}
-
+
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
-
+
return WEECHAT_RC_OK;
}
@@ -630,14 +630,14 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel;
int pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("ban", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -650,7 +650,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -698,7 +698,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MODE %s +b", ptr_channel->name);
}
-
+
return WEECHAT_RC_OK;
}
@@ -713,7 +713,7 @@ irc_command_connect_one_server (struct t_irc_server *server,
{
if (!server)
return 0;
-
+
if (server->is_connected)
{
weechat_printf (NULL,
@@ -732,19 +732,19 @@ irc_command_connect_one_server (struct t_irc_server *server,
server->name);
return 0;
}
-
+
if (switch_address)
irc_server_switch_address (server, 0);
-
+
server->disable_autojoin = no_join;
-
+
if (irc_server_connect (server))
{
server->reconnect_delay = 0;
server->reconnect_start = 0;
server->reconnect_join = (server->channels) ? 1 : 0;
}
-
+
/* connect ok */
return 1;
}
@@ -760,15 +760,15 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
int i, nb_connect, connect_ok, all_servers, all_opened, switch_address;
int no_join;
char *name;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
connect_ok = 1;
-
+
all_servers = 0;
all_opened = 0;
switch_address = 0;
@@ -784,7 +784,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
else if (weechat_strcasecmp (argv[i], "-nojoin") == 0)
no_join = 1;
}
-
+
if (all_opened)
{
for (ptr_server = irc_servers; ptr_server;
@@ -883,10 +883,10 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
no_join);
}
}
-
+
if (!connect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -900,10 +900,10 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
{
char *irc_cmd, str_time[512];
struct timeval tv;
-
+
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ctcp", 1);
-
+
/* make C compiler happy */
(void) data;
@@ -912,9 +912,9 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
irc_cmd = strdup (argv[2]);
if (!irc_cmd)
return WEECHAT_RC_ERROR;
-
+
weechat_string_toupper (irc_cmd);
-
+
if ((weechat_strcasecmp (argv[2], "ping") == 0) && !argv_eol[3])
{
gettimeofday (&tv, NULL);
@@ -955,13 +955,13 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
(argv_eol[3]) ? " " : "",
(argv_eol[3]) ? argv_eol[3] : "");
}
-
+
free (irc_cmd);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/*
* irc_command_cycle: leave and rejoin a channel
*/
@@ -974,14 +974,14 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
const char *version, *ptr_arg, *msg_part;
char **channels;
int i, num_channels;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("cycle", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -1014,11 +1014,11 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
"cycle");
return WEECHAT_RC_OK;
}
-
+
/* does nothing on private buffer (cycle has no sense!) */
if (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
return WEECHAT_RC_OK;
-
+
channel_name = ptr_channel->name;
pos_args = argv_eol[1];
ptr_channel->cycle = 1;
@@ -1034,21 +1034,21 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "part");
return WEECHAT_RC_OK;
}
-
+
/* does nothing on private buffer (cycle has no sense!) */
if (ptr_channel->type != IRC_CHANNEL_TYPE_CHANNEL)
return WEECHAT_RC_OK;
-
+
channel_name = ptr_channel->name;
pos_args = NULL;
ptr_channel->cycle = 1;
}
-
+
msg_part = IRC_SERVER_OPTION_STRING(ptr_server,
IRC_SERVER_OPTION_DEFAULT_MSG_PART);
ptr_arg = (pos_args) ? pos_args :
((msg_part && msg_part[0]) ? msg_part : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -1062,7 +1062,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
else
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PART %s", channel_name);
-
+
return WEECHAT_RC_OK;
}
@@ -1080,13 +1080,13 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
struct t_infolist *infolist;
struct t_infolist_item *item;
char str_address[128], charset_modifier[256];
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("dcc", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
/* use the local interface, from the server socket */
@@ -1095,7 +1095,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
getsockname (ptr_server->sock, (struct sockaddr *) &addr, &length);
addr.sin_family = AF_INET;
address = ntohl (addr.sin_addr.s_addr);
-
+
/* DCC SEND file */
if (weechat_strcasecmp (argv[1], "send") == 0)
{
@@ -1171,7 +1171,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "dcc");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1185,11 +1185,11 @@ irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("dehalfop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1226,11 +1226,11 @@ irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("deop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1267,11 +1267,11 @@ irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("devoice", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1308,11 +1308,11 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("die", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1323,7 +1323,7 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"DIE");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1336,17 +1336,17 @@ irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
const char *ptr_arg, *version, *msg_quit;
char *buf;
-
+
if (!server)
return;
-
+
if (server->is_connected)
{
msg_quit = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_DEFAULT_MSG_QUIT);
ptr_arg = (arguments) ? arguments :
((msg_quit && msg_quit[0]) ? msg_quit : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -1373,7 +1373,7 @@ irc_command_disconnect_one_server (struct t_irc_server *server,
{
if (!server)
return 0;
-
+
if ((!server->is_connected) && (!server->hook_connect)
&& (!server->hook_fd) && (server->reconnect_start == 0))
{
@@ -1391,7 +1391,7 @@ irc_command_disconnect_one_server (struct t_irc_server *server,
}
irc_command_quit_server (server, reason);
irc_server_disconnect (server, 0, 0);
-
+
/* disconnect ok */
return 1;
}
@@ -1406,20 +1406,20 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
{
int disconnect_ok;
const char *reason;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
reason = (argc > 2) ? argv_eol[2] : NULL;
-
+
if (argc < 2)
disconnect_ok = irc_command_disconnect_one_server (ptr_server, reason);
else
{
disconnect_ok = 1;
-
+
if (weechat_strcasecmp (argv[1], "-all") == 0)
{
for (ptr_server = irc_servers; ptr_server;
@@ -1452,10 +1452,10 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
}
}
}
-
+
if (!disconnect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -1469,11 +1469,11 @@ irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("halfop", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -1508,9 +1508,9 @@ void
irc_command_ignore_display (struct t_irc_ignore *ignore)
{
char *mask;
-
+
mask = weechat_strndup (ignore->mask + 1, strlen (ignore->mask) - 2);
-
+
weechat_printf (NULL,
_(" %s[%s%d%s]%s mask: %s / server: %s / channel: %s"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -1521,7 +1521,7 @@ irc_command_ignore_display (struct t_irc_ignore *ignore)
(mask) ? mask : ignore->mask,
(ignore->server) ? ignore->server : "*",
(ignore->channel) ? ignore->channel : "*");
-
+
if (mask)
free (mask);
}
@@ -1537,12 +1537,12 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
struct t_irc_ignore *ptr_ignore;
char *mask, *regex, *ptr_regex, *server, *channel, *error;
long number;
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if ((argc == 1)
|| ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0)))
{
@@ -1559,10 +1559,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
}
else
weechat_printf (NULL, _("%s: no ignore in list"), IRC_PLUGIN_NAME);
-
+
return WEECHAT_RC_OK;
}
-
+
/* add ignore */
if (weechat_strcasecmp (argv[1], "add") == 0)
{
@@ -1575,11 +1575,11 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
"ignore add");
return WEECHAT_RC_OK;
}
-
+
mask = argv[2];
server = (argc > 3) ? argv[3] : NULL;
channel = (argc > 4) ? argv[4] : NULL;
-
+
if (strncmp (mask, "re:", 3) == 0)
{
regex = NULL;
@@ -1590,7 +1590,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
regex = weechat_string_mask_to_regex (mask);
ptr_regex = (regex) ? regex : mask;
}
-
+
if (irc_ignore_search (ptr_regex, server, channel))
{
weechat_printf (NULL,
@@ -1598,12 +1598,12 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
ptr_ignore = irc_ignore_new (ptr_regex, server, channel);
-
+
if (regex)
free (regex);
-
+
if (ptr_ignore)
{
weechat_printf (NULL, "");
@@ -1615,10 +1615,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
weechat_printf (NULL, _("%s%s: error adding ignore"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete ignore */
if (weechat_strcasecmp (argv[1], "del") == 0)
{
@@ -1631,7 +1631,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
"ignore del");
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[2], "-all") == 0)
{
if (irc_ignore_list)
@@ -1675,10 +1675,10 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" "
"command"),
@@ -1696,11 +1696,11 @@ irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("info", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1711,7 +1711,7 @@ irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"INFO");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1725,11 +1725,11 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("invite", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1754,7 +1754,7 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1768,11 +1768,11 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ison", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1782,7 +1782,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "ison");
}
-
+
return WEECHAT_RC_OK;
}
@@ -1798,7 +1798,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
int i, num_channels, length;
int time_now;
struct t_irc_channel *ptr_channel;
-
+
if (server->sock < 0)
{
weechat_printf (NULL,
@@ -1808,7 +1808,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
"join");
return;
}
-
+
/* split channels */
channels = NULL;
pos_space = strchr (arguments, ' ');
@@ -1822,7 +1822,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
&num_channels);
free (new_args);
}
-
+
/*
* add "#" in front of each channel if no prefix is given
* (exception if there is only "0", which is a special join argument to
@@ -1868,10 +1868,10 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
}
if (pos_space)
strcat (new_args, pos_space);
-
+
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"JOIN %s", new_args);
-
+
free (new_args);
}
weechat_string_free_split (channels);
@@ -1887,10 +1887,10 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if ((argc >= 4) && (weechat_strcasecmp (argv[1], "-server") == 0))
@@ -1919,7 +1919,7 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "join");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1932,13 +1932,13 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *pos_comment;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("kick", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -1974,7 +1974,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (pos_comment)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -1992,7 +1992,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kick");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2006,10 +2006,10 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel, *pos_nick, *nick_only, *pos_comment, *pos, *mask;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("kickban", 1);
-
+
/* make C compiler happy */
(void) data;
@@ -2048,7 +2048,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
/* kick nick from channel */
nick_only = strdup (pos_nick);
if (nick_only)
@@ -2059,7 +2059,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
pos = strchr (nick_only, '!');
if (pos)
pos[0] = '\0';
-
+
if (strcmp (nick_only, "*") == 0)
{
weechat_printf (ptr_server->buffer,
@@ -2067,7 +2067,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
/* set ban for nick(+host) on channel */
if (strchr (pos_nick, '@'))
{
@@ -2092,7 +2092,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
"MODE %s +b %s",
pos_channel, pos_nick);
}
-
+
/* kick nick */
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"KICK %s %s%s%s",
@@ -2107,7 +2107,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kickban");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2121,10 +2121,10 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("kill", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2134,7 +2134,7 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "kill");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2149,11 +2149,11 @@ irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("links", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2164,7 +2164,7 @@ irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LINKS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2178,20 +2178,20 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
{
char buf[512], *ptr_channel_name, *ptr_server_name, *ptr_regex;
int i, ret;
-
+
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("list", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (ptr_server->cmd_list_regexp)
{
regfree (ptr_server->cmd_list_regexp);
free (ptr_server->cmd_list_regexp);
ptr_server->cmd_list_regexp = NULL;
}
-
+
if (argc > 1)
{
ptr_channel_name = NULL;
@@ -2262,7 +2262,7 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LIST");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2276,11 +2276,11 @@ irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("lusers", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2291,7 +2291,7 @@ irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"LUSERS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2305,11 +2305,11 @@ irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("map", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2320,7 +2320,7 @@ irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MAP");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2334,11 +2334,11 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("me", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (!ptr_channel)
{
weechat_printf (ptr_server->buffer,
@@ -2349,7 +2349,7 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
}
irc_command_me_channel (ptr_server, ptr_channel,
(argc > 1) ? argv_eol[1] : NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -2388,10 +2388,10 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("mode", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if ((argv[1][0] == '+') || (argv[1][0] == '-'))
@@ -2418,7 +2418,7 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "mode");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2432,11 +2432,11 @@ irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("motd", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2447,7 +2447,7 @@ irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"MOTD");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2463,21 +2463,21 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
int num_targets, i, arg_target, arg_text;
char *msg_pwd_hidden;
char *string;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc <= 2)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"msg");
}
-
+
arg_target = 1;
arg_text = 2;
-
+
if ((argc >= 5) && (weechat_strcasecmp (argv[1], "-server") == 0))
{
ptr_server = irc_server_search (argv[2]);
@@ -2485,9 +2485,9 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
arg_target = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("msg", 1);
-
+
targets = weechat_string_split (argv[arg_target], ",", 0, 0,
&num_targets);
if (targets)
@@ -2514,7 +2514,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
(string) ? string : argv_eol[arg_text]);
if (string)
free (string);
-
+
irc_server_sendf (ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :%s",
@@ -2606,7 +2606,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
}
weechat_string_free_split (targets);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2620,11 +2620,11 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("names", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2647,7 +2647,7 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2660,7 +2660,7 @@ irc_send_nick_server (struct t_irc_server *server, const char *nickname)
{
if (!server)
return;
-
+
if (server->is_connected)
{
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -2680,11 +2680,11 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("nick", 0);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 2)
{
if (weechat_strcasecmp (argv[1], "-all") != 0)
@@ -2709,7 +2709,7 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "nick");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2725,12 +2725,12 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
int arg_nick, arg_text, number;
struct t_irc_channel *ptr_channel;
struct t_hashtable *hashtable;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
arg_nick = 1;
@@ -2741,7 +2741,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
arg_nick = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("notice", 1);
ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]);
hashtable = irc_server_sendf (ptr_server,
@@ -2785,7 +2785,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"notice");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2799,21 +2799,21 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
{
struct t_irc_notify *ptr_notify;
int i, check_away;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
/* display notify status for users on server */
if (argc == 1)
{
irc_notify_display_list (ptr_server);
return WEECHAT_RC_OK;
}
-
+
/* add notify */
if (weechat_strcasecmp (argv[1], "add") == 0)
{
@@ -2826,9 +2826,9 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
"notify add");
return WEECHAT_RC_OK;
}
-
+
check_away = 0;
-
+
if (argc > 3)
{
ptr_server = irc_server_search (argv[3]);
@@ -2841,7 +2841,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (!ptr_server)
{
weechat_printf (NULL,
@@ -2850,7 +2850,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (argc > 4)
{
for (i = 4; i < argc; i++)
@@ -2868,7 +2868,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
ptr_notify = irc_notify_new (ptr_server, argv[2], check_away);
if (ptr_notify)
{
@@ -2884,10 +2884,10 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_printf (NULL, _("%s%s: error adding notification"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
return WEECHAT_RC_OK;
}
-
+
/* delete notify */
if (weechat_strcasecmp (argv[1], "del") == 0)
{
@@ -2913,7 +2913,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (!ptr_server)
{
weechat_printf (NULL,
@@ -2922,7 +2922,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[2], "-all") == 0)
{
if (ptr_server->notify_list)
@@ -2956,10 +2956,10 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" "
"command"),
@@ -2977,11 +2977,11 @@ irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("op", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -3018,7 +3018,7 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("oper", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -3032,7 +3032,7 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "oper");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3046,12 +3046,12 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
{
const char *ptr_arg, *version, *msg_part;
char *buf;
-
+
msg_part = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_DEFAULT_MSG_PART);
ptr_arg = (part_message) ? part_message :
((msg_part && msg_part[0]) ? msg_part : NULL);
-
+
if (ptr_arg)
{
version = weechat_info_get ("version", "");
@@ -3079,13 +3079,13 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *channel_name, *pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("part", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -3128,9 +3128,9 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
channel_name = ptr_channel->name;
pos_args = NULL;
}
-
+
irc_command_part_channel (ptr_server, channel_name, pos_args);
-
+
return WEECHAT_RC_OK;
}
@@ -3144,7 +3144,7 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ping", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -3158,7 +3158,7 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "ping");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3172,11 +3172,11 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("pong", 0);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3186,7 +3186,7 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "pong");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3200,12 +3200,12 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
{
char *string;
int arg_nick, arg_text;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
arg_nick = 1;
@@ -3216,9 +3216,9 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
arg_nick = 3;
arg_text = 4;
}
-
+
IRC_COMMAND_CHECK_SERVER("query", 1);
-
+
/* create private window if not already opened */
ptr_channel = irc_channel_search (ptr_server, argv[arg_nick]);
if (!ptr_channel)
@@ -3237,7 +3237,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
}
}
weechat_buffer_set (ptr_channel->buffer, "display", "1");
-
+
/* display text if given */
if (argv_eol[arg_text])
{
@@ -3257,7 +3257,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"query");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3270,7 +3270,7 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
@@ -3297,7 +3297,7 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS((ptr_server) ? ptr_server->buffer : NULL,
"quote");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3311,12 +3311,12 @@ irc_command_reconnect_one_server (struct t_irc_server *server,
int switch_address, int no_join)
{
int switch_done;
-
+
if (!server)
return 0;
-
+
switch_done = 0;
-
+
if ((server->is_connected) || (server->hook_connect) || (server->hook_fd))
{
/* disconnect from server */
@@ -3324,19 +3324,19 @@ irc_command_reconnect_one_server (struct t_irc_server *server,
irc_server_disconnect (server, switch_address, 0);
switch_done = 1;
}
-
+
if (switch_address && !switch_done)
irc_server_switch_address (server, 0);
-
+
server->disable_autojoin = no_join;
-
+
if (irc_server_connect (server))
{
server->reconnect_delay = 0;
server->reconnect_start = 0;
server->reconnect_join = (server->channels) ? 1 : 0;
}
-
+
/* reconnect ok */
return 1;
}
@@ -3350,15 +3350,15 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
int i, nb_reconnect, reconnect_ok, all_servers, switch_address, no_join;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
reconnect_ok = 1;
-
+
all_servers = 0;
switch_address = 0;
no_join = 0;
@@ -3371,7 +3371,7 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
else if (weechat_strcasecmp (argv[i], "-nojoin") == 0)
no_join = 1;
}
-
+
if (all_servers)
{
for (ptr_server = irc_servers; ptr_server;
@@ -3426,10 +3426,10 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
no_join);
}
}
-
+
if (!reconnect_ok)
return WEECHAT_RC_ERROR;
-
+
return WEECHAT_RC_OK;
}
@@ -3443,11 +3443,11 @@ irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("rehash", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3458,7 +3458,7 @@ irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"REHASH");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3472,11 +3472,11 @@ irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("restart", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3487,7 +3487,7 @@ irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"RESTART");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3501,10 +3501,10 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sajoin", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3514,7 +3514,7 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sajoin");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3528,10 +3528,10 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("samode", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3541,7 +3541,7 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "samode");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3555,10 +3555,10 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sanick", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3568,7 +3568,7 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sanick");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3582,10 +3582,10 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sapart", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3595,7 +3595,7 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "sapart");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3609,10 +3609,10 @@ irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("saquit", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 2)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -3622,7 +3622,7 @@ irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "saquit");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3637,14 +3637,14 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
int i, detailed_list, one_server_found;
struct t_irc_server *ptr_server2, *server_found, *new_server;
char *server_name;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
-
+
if ((argc == 1)
|| (weechat_strcasecmp (argv[1], "list") == 0)
|| (weechat_strcasecmp (argv[1], "listfull") == 0))
@@ -3703,10 +3703,10 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
_("No server found with \"%s\""),
server_name);
}
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "add") == 0)
{
if (argc < 4)
@@ -3729,7 +3729,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
new_server = irc_server_alloc (argv[2]);
if (!new_server)
{
@@ -3738,34 +3738,34 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES],
argv[3], 1);
irc_server_apply_command_line_options (new_server, argc, argv);
-
+
weechat_printf (NULL,
_("%s: server %s%s%s created"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
new_server->name,
IRC_COLOR_RESET);
-
+
/* do not connect to server after creating it */
/*
if (IRC_SERVER_OPTION_BOOLEAN(new_server, IRC_SERVER_OPTION_AUTOCONNECT))
irc_server_connect (new_server);
*/
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "copy") == 0)
{
if (argc < 4)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3777,7 +3777,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server copy");
return WEECHAT_RC_OK;
}
-
+
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
@@ -3788,7 +3788,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[3], "server copy");
return WEECHAT_RC_OK;
}
-
+
/* copy server */
new_server = irc_server_copy (server_found, argv[3]);
if (new_server)
@@ -3805,7 +3805,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_ERROR;
}
@@ -3815,7 +3815,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3827,7 +3827,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server rename");
return WEECHAT_RC_OK;
}
-
+
/* check if target name already exists */
if (irc_server_search (argv[3]))
{
@@ -3838,7 +3838,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[3], "server rename");
return WEECHAT_RC_OK;
}
-
+
/* rename server */
if (irc_server_rename (server_found, argv[3]))
{
@@ -3854,17 +3854,17 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_ERROR;
}
-
+
if (weechat_strcasecmp (argv[1], "keep") == 0)
{
if (argc < 3)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server keep");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3876,7 +3876,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server keep");
return WEECHAT_RC_OK;
}
-
+
/* check that is it temporary server */
if (!server_found->temp_server)
{
@@ -3886,27 +3886,27 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], "server keep");
return WEECHAT_RC_OK;
}
-
+
/* remove temporary flag on server */
server_found->temp_server = 0;
-
+
weechat_printf (NULL,
_("%s: server %s%s%s is not temporary any more"),
IRC_PLUGIN_NAME,
IRC_COLOR_CHAT_SERVER,
argv[2],
IRC_COLOR_RESET);
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "del") == 0)
{
if (argc < 3)
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server del");
}
-
+
/* look for server by name */
server_found = irc_server_search (argv[2]);
if (!server_found)
@@ -3928,7 +3928,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
argv[2], argv[2]);
return WEECHAT_RC_OK;
}
-
+
server_name = strdup (server_found->name);
irc_server_free (server_found);
weechat_printf (NULL,
@@ -3939,10 +3939,10 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_RESET);
if (server_name)
free (server_name);
-
+
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "deloutq") == 0)
{
for (ptr_server2 = irc_servers; ptr_server2;
@@ -3960,24 +3960,24 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_PLUGIN_NAME);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "raw") == 0)
{
irc_raw_open (1);
return WEECHAT_RC_OK;
}
-
+
if (weechat_strcasecmp (argv[1], "jump") == 0)
{
if (ptr_server && ptr_server->buffer)
weechat_buffer_set (ptr_server->buffer, "display", "1");
return WEECHAT_RC_OK;
}
-
+
weechat_printf (NULL,
_("%s%s: unknown option for \"%s\" command"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, "server");
-
+
return WEECHAT_RC_OK;
}
@@ -3991,7 +3991,7 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("service", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
@@ -4005,7 +4005,7 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "service");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4019,11 +4019,11 @@ irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("servlist", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4034,7 +4034,7 @@ irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"SERVLIST");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4048,10 +4048,10 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squery", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (argc > 2)
@@ -4069,7 +4069,7 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "squery");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4083,18 +4083,18 @@ irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squit", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
irc_server_sendf (ptr_server, 0, NULL, "SQUIT %s", argv_eol[1]);
else
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "squit");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4108,11 +4108,11 @@ irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("stats", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4123,7 +4123,7 @@ irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"STATS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4138,11 +4138,11 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("summon", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4152,7 +4152,7 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "summon");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4166,11 +4166,11 @@ irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("time", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4181,7 +4181,7 @@ irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TIME");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4194,17 +4194,17 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *channel_name, *new_topic, *new_topic_color;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("topic", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
channel_name = NULL;
new_topic = NULL;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4215,7 +4215,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
else
new_topic = argv_eol[1];
}
-
+
/* look for current channel if not specified */
if (!channel_name)
{
@@ -4231,7 +4231,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
if (new_topic)
{
if (weechat_strcasecmp (new_topic, "-delete") == 0)
@@ -4252,7 +4252,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
else
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TOPIC %s", channel_name);
-
+
return WEECHAT_RC_OK;
}
@@ -4266,11 +4266,11 @@ irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("trace", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4281,7 +4281,7 @@ irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"TRACE");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4295,14 +4295,14 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
{
char *pos_channel;
int pos_args;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("unban", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4315,7 +4315,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -4331,7 +4331,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
/* loop on users */
while (argv[pos_args])
{
@@ -4348,7 +4348,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "unban");
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -4362,11 +4362,11 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("userhost", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4376,7 +4376,7 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "userhost");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4390,11 +4390,11 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("users", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4405,7 +4405,7 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"USERS");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4420,11 +4420,11 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("version", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (argc > 1)
{
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
@@ -4444,7 +4444,7 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"VERSION");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4458,11 +4458,11 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("voice", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv_eol;
-
+
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
if (argc < 2)
@@ -4484,7 +4484,7 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "voice");
return WEECHAT_RC_OK;
}
-
+
return WEECHAT_RC_OK;
}
@@ -4500,13 +4500,13 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
int pos_args;
const char *support_wallchops, *support_statusmsg;
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("wallchops", 1);
-
+
/* make C compiler happy */
(void) data;
-
+
if (argc > 1)
{
if (irc_channel_is_channel (argv[1]))
@@ -4519,7 +4519,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel = NULL;
pos_args = 1;
}
-
+
/* channel not given, use default buffer */
if (!pos_channel)
{
@@ -4535,7 +4535,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
}
-
+
ptr_channel = irc_channel_search (ptr_server, pos_channel);
if (!ptr_channel)
{
@@ -4545,7 +4545,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
pos_channel);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_channel->buffer,
"%s%s%sOp%s -> %s%s%s: %s",
weechat_prefix ("network"),
@@ -4557,7 +4557,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
ptr_channel->name,
IRC_COLOR_RESET,
argv_eol[pos_args]);
-
+
support_wallchops = irc_server_get_isupport_value (ptr_server,
"WALLCHOPS");
support_statusmsg = irc_server_get_isupport_value (ptr_server,
@@ -4597,7 +4597,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallchops");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4612,11 +4612,11 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("wallops", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4626,7 +4626,7 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "wallops");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4640,11 +4640,11 @@ irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("who", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4655,7 +4655,7 @@ irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"WHO");
}
-
+
return WEECHAT_RC_OK;
}
@@ -4669,11 +4669,11 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("whois", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4692,7 +4692,7 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whois");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4706,11 +4706,11 @@ irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("whowas", 1);
-
+
/* make C compiler happy */
(void) data;
(void) argv;
-
+
if (argc > 1)
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
@@ -4720,7 +4720,7 @@ irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
{
IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "whowas");
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index d13de4638..b3e705d59 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -48,17 +48,17 @@ irc_completion_server_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
weechat_hook_completion_list_add (completion, ptr_server->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -73,17 +73,17 @@ irc_completion_server_nick_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server && ptr_server->nick)
{
weechat_hook_completion_list_add (completion, ptr_server->nick,
1, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -98,14 +98,14 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_channel *ptr_channel;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (ptr_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
@@ -118,7 +118,7 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -133,14 +133,14 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_channel *ptr_channel;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
if (ptr_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
@@ -153,7 +153,7 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -169,13 +169,13 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
{
struct t_irc_channel *ptr_channel2;
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
for (ptr_channel2 = ptr_server->channels; ptr_channel2;
@@ -191,12 +191,12 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
}
}
}
-
+
/* add self nick at the end */
weechat_hook_completion_list_add (completion, ptr_server->nick,
1, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -210,19 +210,19 @@ irc_completion_servers_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
weechat_hook_completion_list_add (completion, ptr_server->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -236,17 +236,17 @@ irc_completion_channel_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
weechat_hook_completion_list_add (completion, ptr_channel->name,
0, WEECHAT_LIST_POS_SORT);
}
-
+
return WEECHAT_RC_OK;
}
@@ -262,7 +262,7 @@ irc_completion_channel_nicks_add_speakers (struct t_gui_completion *completion,
{
int list_size, i;
const char *nick;
-
+
if (channel->nicks_speaking[highlight])
{
list_size = weechat_list_size (channel->nicks_speaking[highlight]);
@@ -291,13 +291,13 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_nick *ptr_nick;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
switch (ptr_channel->type)
@@ -342,7 +342,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
}
ptr_channel->nick_completion_reset = 0;
}
-
+
return WEECHAT_RC_OK;
}
@@ -359,13 +359,13 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
struct t_irc_nick *ptr_nick;
char *buf;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel)
{
switch (ptr_channel->type)
@@ -404,7 +404,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -420,13 +420,13 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
{
char *topic, *topic_color;
int length;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_channel && ptr_channel->topic && ptr_channel->topic[0])
{
if (weechat_strncasecmp (ptr_channel->topic, ptr_channel->name,
@@ -449,7 +449,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
}
else
topic = strdup (ptr_channel->topic);
-
+
topic_color = irc_color_decode_for_user_entry ((topic) ? topic : ptr_channel->topic);
weechat_hook_completion_list_add (completion,
(topic_color) ? topic_color : ((topic) ? topic : ptr_channel->topic),
@@ -459,7 +459,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
if (topic)
free (topic);
}
-
+
return WEECHAT_RC_OK;
}
@@ -475,12 +475,12 @@ irc_completion_channels_cb (void *data, const char *completion_item,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -494,7 +494,7 @@ irc_completion_channels_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -510,12 +510,12 @@ irc_completion_privates_cb (void *data, const char *completion_item,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -529,7 +529,7 @@ irc_completion_privates_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -543,13 +543,13 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
const char *msg_part;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
msg_part = IRC_SERVER_OPTION_STRING(ptr_server,
@@ -560,7 +560,7 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
0, WEECHAT_LIST_POS_SORT);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -576,12 +576,12 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
{
struct t_irc_ignore *ptr_ignore;
char str_number[32];
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
(void) buffer;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -589,7 +589,7 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
weechat_hook_completion_list_add (completion, str_number,
0, WEECHAT_LIST_POS_END);
}
-
+
return WEECHAT_RC_OK;
}
@@ -604,13 +604,13 @@ irc_completion_notify_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_notify *ptr_notify;
-
+
IRC_BUFFER_GET_SERVER(buffer);
-
+
/* make C compiler happy */
(void) data;
(void) completion_item;
-
+
if (ptr_server)
{
for (ptr_notify = ptr_server->notify_list; ptr_notify;
@@ -633,7 +633,7 @@ irc_completion_notify_nicks_cb (void *data, const char *completion_item,
}
}
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 66c2c9b0a..1fede24b7 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -144,9 +144,9 @@ irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
-
+
ptr_server = NULL;
-
+
if (name)
{
pos_option = strrchr (name, '.');
@@ -160,7 +160,7 @@ irc_config_get_server_from_option_name (const char *name)
}
}
}
-
+
return ptr_server;
}
@@ -175,7 +175,7 @@ irc_config_compute_nick_colors ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -199,7 +199,7 @@ irc_config_compute_nick_colors ()
}
}
}
-
+
/* if colors are displayed for nicks in nicklist, refresh them */
if (weechat_config_boolean(irc_config_look_color_nicks_in_nicklist))
irc_nick_nicklist_set_color_all ();
@@ -219,7 +219,7 @@ irc_config_set_nick_colors ()
irc_config_nick_colors = NULL;
irc_config_num_nick_colors = 0;
}
-
+
irc_config_nick_colors =
weechat_string_split (weechat_config_string (weechat_config_get ("weechat.color.chat_nick_colors")),
",", 0, 0,
@@ -239,10 +239,10 @@ irc_config_change_nick_colors_cb (void *data, const char *option,
(void) data;
(void) option;
(void) value;
-
+
irc_config_set_nick_colors ();
irc_config_compute_nick_colors ();
-
+
return WEECHAT_RC_OK;
}
@@ -259,7 +259,7 @@ irc_config_change_look_color_nicks_in_nicklist (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_nick_nicklist_set_color_all ();
}
@@ -274,7 +274,7 @@ irc_config_change_look_server_buffer (void *data,
{
struct t_irc_server *ptr_server;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) option;
@@ -297,7 +297,7 @@ irc_config_change_look_server_buffer (void *data,
(weechat_config_integer (irc_config_look_server_buffer) ==
IRC_CONFIG_LOOK_SERVER_BUFFER_MERGE_WITH_CORE) ?
weechat_buffer_search_main () : irc_buffer_search_first_for_all_servers ();
-
+
if (ptr_buffer)
{
for (ptr_server = irc_servers; ptr_server;
@@ -322,7 +322,7 @@ irc_config_change_look_item_away_message (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("away");
}
@@ -338,7 +338,7 @@ irc_config_change_look_item_channel_modes (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -356,7 +356,7 @@ irc_config_change_look_item_channel_modes_hide_key (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -372,7 +372,7 @@ irc_config_change_look_item_nick_modes (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -388,7 +388,7 @@ irc_config_change_look_item_nick_prefix (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -403,11 +403,11 @@ irc_config_change_look_highlight_tags (void *data,
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -439,7 +439,7 @@ irc_config_change_look_nick_color_force (void *data,
{
char **items, *pos;
int num_items, i;
-
+
/* make C compiler happy */
(void) data;
(void) option;
@@ -454,7 +454,7 @@ irc_config_change_look_nick_color_force (void *data,
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_color_force);
-
+
items = weechat_string_split (weechat_config_string (irc_config_look_nick_color_force),
";", 0, 0, &num_items);
if (items)
@@ -472,7 +472,7 @@ irc_config_change_look_nick_color_force (void *data,
}
weechat_string_free_split (items);
}
-
+
irc_config_compute_nick_colors ();
}
@@ -488,7 +488,7 @@ irc_config_change_look_nick_color_stop_chars (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_config_compute_nick_colors ();
}
@@ -522,7 +522,7 @@ irc_config_change_look_topic_strip_colors (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_title");
}
@@ -538,7 +538,7 @@ irc_config_change_color_input_nick (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -554,7 +554,7 @@ irc_config_change_color_item_away (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("away");
}
@@ -570,7 +570,7 @@ irc_config_change_color_item_buffer_name (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("buffer_name");
}
@@ -586,7 +586,7 @@ irc_config_change_color_item_lag (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("lag");
}
@@ -601,11 +601,11 @@ irc_config_change_color_nick_prefixes (void *data,
{
char **items, *pos;
int num_items, i;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!irc_config_hashtable_nick_prefixes)
{
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (8,
@@ -616,7 +616,7 @@ irc_config_change_color_nick_prefixes (void *data,
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_prefixes);
-
+
items = weechat_string_split (weechat_config_string (irc_config_color_nick_prefixes),
";", 0, 0, &num_items);
if (items)
@@ -634,9 +634,9 @@ irc_config_change_color_nick_prefixes (void *data,
}
weechat_string_free_split (items);
}
-
+
irc_nick_nicklist_set_prefix_color_all ();
-
+
weechat_bar_item_update ("input_prompt");
weechat_bar_item_update ("nicklist");
}
@@ -651,14 +651,14 @@ irc_config_change_network_lag_check (void *data,
{
time_t time_next_check;
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
time_next_check = (weechat_config_integer (irc_config_network_lag_check) > 0) ?
time (NULL) : 0;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -678,7 +678,7 @@ irc_config_change_network_lag_min_show (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
weechat_bar_item_update ("lag");
}
@@ -694,7 +694,7 @@ irc_config_change_network_notify_check_ison (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_notify_hook_timer_ison ();
}
@@ -710,7 +710,7 @@ irc_config_change_network_notify_check_whois (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
irc_notify_hook_timer_whois ();
}
@@ -726,15 +726,15 @@ irc_config_change_network_send_unknown_commands (void *data,
char value[2];
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
(void) option;
-
+
strcpy (value,
(weechat_config_boolean (irc_config_network_send_unknown_commands)) ?
"1" : "0");
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -744,7 +744,7 @@ irc_config_change_network_send_unknown_commands (void *data,
"input_get_unknown_commands", value);
}
}
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -770,7 +770,7 @@ irc_config_server_default_change_cb (void *data, struct t_config_option *option)
{
int index_option;
struct t_irc_server *ptr_server;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -820,7 +820,7 @@ irc_config_check_gnutls_priorities (const char *priorities)
gnutls_priority_t priority_cache;
const char *pos_error;
int rc;
-
+
if (!priorities || !priorities[0])
return NULL;
@@ -850,10 +850,10 @@ irc_config_server_check_value_cb (void *data,
{
int index_option;
const char *pos_error;
-
+
/* make C compiler happy */
(void) option;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -873,7 +873,7 @@ irc_config_server_check_value_cb (void *data,
break;
}
}
-
+
return 1;
}
@@ -887,7 +887,7 @@ irc_config_server_change_cb (void *data, struct t_config_option *option)
int index_option;
char *name;
struct t_irc_server *ptr_server;
-
+
index_option = irc_server_search_option (data);
if (index_option >= 0)
{
@@ -938,10 +938,10 @@ irc_config_server_default_check_notify (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (value && value[0])
return 0;
-
+
return 1;
}
@@ -954,26 +954,26 @@ irc_config_reload (void *data, struct t_config_file *config_file)
{
int rc;
struct t_irc_server *ptr_server, *next_server;
-
+
/* make C compiler happy */
(void) data;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
ptr_server->reloading_from_config = 1;
ptr_server->reloaded_from_config = 0;
}
-
+
irc_ignore_free_all ();
-
+
rc = weechat_config_reload (config_file);
-
+
ptr_server = irc_servers;
while (ptr_server)
{
next_server = ptr_server->next_server;
-
+
if (!ptr_server->reloaded_from_config)
{
if (ptr_server->is_connected)
@@ -988,10 +988,10 @@ irc_config_reload (void *data, struct t_config_file *config_file)
else
irc_server_free (ptr_server);
}
-
+
ptr_server = next_server;
}
-
+
return rc;
}
@@ -1007,12 +1007,12 @@ irc_config_msgbuffer_create_option (void *data,
{
struct t_config_option *ptr_option;
int rc;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -1045,7 +1045,7 @@ irc_config_msgbuffer_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1053,7 +1053,7 @@ irc_config_msgbuffer_create_option (void *data,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -1071,12 +1071,12 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
const char *default_value;
static char empty_value[1] = { '\0' };
const char *pos_name;
-
+
/* make C compiler happy */
(void) data;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
@@ -1097,11 +1097,11 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
{
pos_name = strchr (option_name, '.');
pos_name = (pos_name) ? pos_name + 1 : option_name;
-
+
default_value = irc_ctcp_get_default_reply (pos_name);
if (!default_value)
default_value = empty_value;
-
+
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
@@ -1124,7 +1124,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1132,7 +1132,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name, value);
}
-
+
return rc;
}
@@ -1149,12 +1149,12 @@ irc_config_ignore_read_cb (void *data,
{
char **argv, **argv_eol;
int argc;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
if (option_name)
{
if (value && value[0])
@@ -1171,7 +1171,7 @@ irc_config_ignore_read_cb (void *data,
weechat_string_free_split (argv_eol);
}
}
-
+
return 1;
}
@@ -1184,13 +1184,13 @@ irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_irc_ignore *ptr_ignore;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -1202,7 +1202,7 @@ irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
ptr_ignore->mask))
return WEECHAT_CONFIG_WRITE_ERROR;
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1218,13 +1218,13 @@ irc_config_server_write_default_cb (void *data,
{
int i;
char option_name[128];
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
snprintf (option_name, sizeof (option_name),
@@ -1246,7 +1246,7 @@ irc_config_server_write_default_cb (void *data,
break;
}
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1271,9 +1271,9 @@ irc_config_server_new_option (struct t_config_file *config_file,
void *callback_change_data)
{
struct t_config_option *new_option;
-
+
new_option = NULL;
-
+
switch (index_option)
{
case IRC_SERVER_OPTION_ADDRESSES:
@@ -1701,7 +1701,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
case IRC_SERVER_NUM_OPTIONS:
break;
}
-
+
return new_option;
}
@@ -1717,14 +1717,14 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
struct t_irc_server *ptr_server;
int index_option, rc, i;
char *pos_option, *server_name;
-
+
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
-
+
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
-
+
if (option_name)
{
pos_option = strrchr (option_name, '.');
@@ -1769,7 +1769,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
}
}
}
-
+
if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
@@ -1777,7 +1777,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
weechat_prefix ("error"), IRC_PLUGIN_NAME,
option_name);
}
-
+
return rc;
}
@@ -1791,13 +1791,13 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
{
struct t_irc_server *ptr_server;
int i;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!weechat_config_write_line (config_file, section_name, NULL))
return WEECHAT_CONFIG_WRITE_ERROR;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -1811,7 +1811,7 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
}
}
}
-
+
return WEECHAT_CONFIG_WRITE_OK;
}
@@ -1825,11 +1825,11 @@ irc_config_server_create_default_options (struct t_config_section *section)
int i, length;
char *nicks, *username, *realname, *default_value;
struct passwd *my_passwd;
-
+
nicks = NULL;
username = NULL;
realname = strdup ("");
-
+
/* Get the user's name from /etc/passwd */
if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
@@ -1852,7 +1852,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
nicks = strdup (IRC_SERVER_DEFAULT_NICKS);
username = strdup ("weechat");
}
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
default_value = NULL;
@@ -1870,7 +1870,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
}
if (!default_value)
default_value = irc_server_option_default[i];
-
+
irc_config_server_default[i] = irc_config_server_new_option (
irc_config_file,
section,
@@ -1884,7 +1884,7 @@ irc_config_server_create_default_options (struct t_config_section *section)
&irc_config_server_default_change_cb,
irc_server_option_string[i]);
}
-
+
if (nicks)
free (nicks);
if (username)
@@ -1902,7 +1902,7 @@ int
irc_config_init ()
{
struct t_config_section *ptr_section;
-
+
irc_config_hashtable_nick_color_force = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -1913,12 +1913,12 @@ irc_config_init ()
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
-
+
irc_config_file = weechat_config_new (IRC_CONFIG_NAME,
&irc_config_reload, NULL);
if (!irc_config_file)
return 0;
-
+
/* look */
ptr_section = weechat_config_new_section (irc_config_file, "look",
0, 0,
@@ -2216,7 +2216,7 @@ irc_config_init ()
N_("strip colors in topic (used only when displaying buffer title)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL,
&irc_config_change_look_topic_strip_colors, NULL, NULL, NULL);
-
+
/* color */
ptr_section = weechat_config_new_section (irc_config_file, "color",
0, 0,
@@ -2228,7 +2228,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
irc_config_color_message_join = weechat_config_new_option (
irc_config_file, ptr_section,
"message_join", "color",
@@ -2321,7 +2321,7 @@ irc_config_init ()
N_("color for new channel topic (when topic is changed)"),
NULL, -1, 0, "white", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
-
+
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
@@ -2333,7 +2333,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
irc_config_network_autoreconnect_delay_growing = weechat_config_new_option (
irc_config_file, ptr_section,
"autoreconnect_delay_growing", "integer",
@@ -2404,7 +2404,7 @@ irc_config_init ()
"(in minutes)"),
NULL, 1, 60 * 24 * 7, "5", NULL, 0, NULL, NULL,
&irc_config_change_network_notify_check_whois, NULL, NULL, NULL);
-
+
/* msgbuffer */
ptr_section = weechat_config_new_section (irc_config_file, "msgbuffer",
1, 1,
@@ -2418,7 +2418,7 @@ irc_config_init ()
return 0;
}
irc_config_section_msgbuffer = ptr_section;
-
+
/* CTCP */
ptr_section = weechat_config_new_section (irc_config_file, "ctcp",
1, 1,
@@ -2432,7 +2432,7 @@ irc_config_init ()
return 0;
}
irc_config_section_ctcp = ptr_section;
-
+
/* ignore */
ptr_section = weechat_config_new_section (irc_config_file, "ignore",
0, 0,
@@ -2445,7 +2445,7 @@ irc_config_init ()
weechat_config_free (irc_config_file);
return 0;
}
-
+
/* server_default */
ptr_section = weechat_config_new_section (irc_config_file, "server_default",
0, 0,
@@ -2458,9 +2458,9 @@ irc_config_init ()
return 0;
}
irc_config_section_server_default = ptr_section;
-
+
irc_config_server_create_default_options (ptr_section);
-
+
/* server */
ptr_section = weechat_config_new_section (irc_config_file, "server",
0, 0,
@@ -2475,10 +2475,10 @@ irc_config_init ()
return 0;
}
irc_config_section_server = ptr_section;
-
+
irc_config_hook_config_nick_colors = weechat_hook_config ("weechat.color.chat_nick_colors",
&irc_config_change_nick_colors_cb, NULL);
-
+
return 1;
}
@@ -2490,7 +2490,7 @@ int
irc_config_read ()
{
int rc;
-
+
rc = weechat_config_read (irc_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
{
@@ -2511,7 +2511,7 @@ int
irc_config_write (int write_temp_servers)
{
irc_config_write_temp_servers = write_temp_servers;
-
+
return weechat_config_write (irc_config_file);
}
@@ -2523,7 +2523,7 @@ void
irc_config_free ()
{
weechat_config_free (irc_config_file);
-
+
if (irc_config_hook_config_nick_colors)
{
weechat_unhook (irc_config_hook_config_nick_colors);
@@ -2535,13 +2535,13 @@ irc_config_free ()
irc_config_nick_colors = NULL;
irc_config_num_nick_colors = 0;
}
-
+
if (irc_config_hashtable_nick_color_force)
{
weechat_hashtable_free (irc_config_hashtable_nick_color_force);
irc_config_hashtable_nick_color_force = NULL;
}
-
+
if (irc_config_hashtable_nick_prefixes)
{
weechat_hashtable_free (irc_config_hashtable_nick_prefixes);
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index e4202698c..d853058e3 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -59,13 +59,13 @@ const char *
irc_ctcp_get_default_reply (const char *ctcp)
{
int i;
-
+
for (i = 0; irc_ctcp_default_reply[i].name; i++)
{
if (weechat_strcasecmp (irc_ctcp_default_reply[i].name, ctcp) == 0)
return irc_ctcp_default_reply[i].reply;
}
-
+
/* unknown CTCP */
return NULL;
}
@@ -81,21 +81,21 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
char option_name[512];
snprintf (option_name, sizeof (option_name), "%s.%s", server->name, ctcp);
-
+
/* search for CTCP in config file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
option_name);
if (ptr_option)
return weechat_config_string (ptr_option);
-
+
/* search for CTCP in config file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
ctcp);
if (ptr_option)
return weechat_config_string (ptr_option);
-
+
/*
* no CTCP reply found in config, then return default reply, or NULL
* for unknown CTCP
@@ -119,7 +119,7 @@ irc_ctcp_display_request (struct t_irc_server *server,
if (reply && !reply[0]
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
-
+
weechat_printf_tags ((channel) ? channel->buffer : server->buffer,
irc_protocol_tags (command, "irc_ctcp", NULL),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
@@ -147,13 +147,13 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
char *pos_end, *pos_space, *pos_args, *pos_usec;
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
-
+
while (arguments && arguments[0])
{
pos_end = strchr (arguments + 1, '\01');
if (pos_end)
pos_end[0] = '\0';
-
+
pos_space = strchr (arguments + 1, ' ');
if (pos_space)
{
@@ -169,16 +169,16 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
if (pos_usec)
{
pos_usec[0] = '\0';
-
+
gettimeofday (&tv, NULL);
sec1 = atol (pos_args);
usec1 = atol (pos_usec + 1);
sec2 = tv.tv_sec;
usec2 = tv.tv_usec;
-
+
difftime = ((sec2 * 1000000) + usec2) -
((sec1 * 1000000) + usec1);
-
+
weechat_printf_tags (server->buffer,
irc_protocol_tags (command,
"irc_ctcp",
@@ -196,7 +196,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
(difftime % 1000000) / 1000,
(NG_("second", "seconds",
(difftime / 1000000))));
-
+
pos_usec[0] = ' ';
}
}
@@ -234,10 +234,10 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
"",
"");
}
-
+
if (pos_end)
pos_end[0] = '\01';
-
+
arguments = (pos_end) ? pos_end + 1 : NULL;
}
}
@@ -257,7 +257,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
int number;
char hash_key[32];
const char *str_args;
-
+
hashtable = irc_server_sendf (server,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_HASHTABLE,
NULL,
@@ -265,7 +265,7 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server,
nick, ctcp,
(arguments) ? " " : "",
(arguments) ? arguments : "");
-
+
if (hashtable)
{
if (weechat_config_boolean (irc_config_look_display_ctcp_reply))
@@ -311,7 +311,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
time_t now;
char buf[1024];
struct utsname *buf_uname;
-
+
/* clientinfo */
temp = weechat_string_replace (format, "$clientinfo",
"ACTION DCC CLIENTINFO FINGER PING SOURCE "
@@ -319,7 +319,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* version */
info = weechat_info_get ("version", "");
temp = weechat_string_replace (res, "$version", info);
@@ -327,7 +327,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* compilation date */
info = weechat_info_get ("date", "");
temp = weechat_string_replace (res, "$compilation", info);
@@ -335,7 +335,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* info about OS */
buf_uname = (struct utsname *)malloc (sizeof (struct utsname));
if (buf_uname && (uname (buf_uname) >= 0))
@@ -350,7 +350,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
return NULL;
res = temp;
}
-
+
/* site */
info = weechat_info_get ("weechat_site", "");
temp = weechat_string_replace (res, "$site", info);
@@ -358,7 +358,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* site (download page) */
info = weechat_info_get ("weechat_site_download", "");
temp = weechat_string_replace (res, "$download", info);
@@ -366,7 +366,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* time */
now = time (NULL);
snprintf (buf, sizeof (buf), "%s", ctime (&now));
@@ -376,7 +376,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* username */
temp = weechat_string_replace (res, "$username",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME));
@@ -384,7 +384,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* realname */
temp = weechat_string_replace (res, "$realname",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME));
@@ -392,7 +392,7 @@ irc_ctcp_replace_variables (struct t_irc_server *server, const char *format)
if (!temp)
return NULL;
res = temp;
-
+
/* return result */
return res;
}
@@ -429,10 +429,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
struct t_infolist *infolist;
struct t_infolist_item *item;
char charset_modifier[256];
-
+
if (!arguments || !arguments[0])
return;
-
+
if (strncmp (arguments, "SEND ", 5) == 0)
{
arguments += 5;
@@ -441,7 +441,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -451,14 +451,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
IRC_PLUGIN_NAME, "privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for file size */
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
@@ -470,7 +470,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_size;
pos_size++;
while (pos[0] == ' ')
@@ -478,7 +478,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -490,7 +490,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_port;
pos_port++;
while (pos[0] == ' ')
@@ -498,7 +498,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC IP address */
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
@@ -510,7 +510,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
pos = pos_addr;
pos_addr++;
while (pos[0] == ' ')
@@ -518,10 +518,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* add DCC file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -548,14 +548,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "RESUME ", 7) == 0)
@@ -566,7 +566,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -576,14 +576,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
IRC_PLUGIN_NAME, "privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
@@ -602,7 +602,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -621,10 +621,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* accept resume via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -645,14 +645,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "ACCEPT ", 7) == 0)
@@ -663,7 +663,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -673,14 +673,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"privmsg");
return;
}
-
+
/* DCC filename */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
@@ -699,7 +699,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
@@ -718,10 +718,10 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
pos--;
}
pos[1] = '\0';
-
+
/* remove double quotes around filename */
filename = irc_ctcp_dcc_filename_without_quotes (pos_file);
-
+
/* resume file via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -742,14 +742,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (filename)
free (filename);
-
+
free (dcc_args);
}
else if (strncmp (arguments, "CHAT ", 5) == 0)
@@ -760,7 +760,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
arguments++;
}
dcc_args = strdup (arguments);
-
+
if (!dcc_args)
{
weechat_printf (server->buffer,
@@ -770,14 +770,14 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
"privmsg");
return;
}
-
+
/* CHAT type */
pos_file = dcc_args;
while (pos_file[0] == ' ')
{
pos_file++;
}
-
+
/* DCC IP address */
pos_addr = strchr (pos_file, ' ');
if (!pos_addr)
@@ -795,7 +795,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
{
pos_addr++;
}
-
+
/* look for DCC port */
pos_port = strchr (pos_addr, ' ');
if (!pos_port)
@@ -813,7 +813,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
{
pos_port++;
}
-
+
if (weechat_strcasecmp (pos_file, "chat") != 0)
{
weechat_printf (server->buffer,
@@ -828,7 +828,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
free (dcc_args);
return;
}
-
+
/* add DCC chat via xfer plugin */
infolist = weechat_infolist_new ();
if (infolist)
@@ -854,11 +854,11 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
}
weechat_infolist_free (infolist);
}
-
+
weechat_hook_signal_send ("irc_dcc",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
free (dcc_args);
}
}
@@ -879,13 +879,13 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
int nick_is_me;
-
+
while (arguments && arguments[0])
{
pos_end = strrchr (arguments + 1, '\01');
if (pos_end)
pos_end[0] = '\0';
-
+
pos_args = NULL;
pos_space = strchr (arguments + 1, ' ');
if (pos_space)
@@ -897,14 +897,14 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
pos_args++;
}
}
-
+
/* CTCP ACTION */
if (strcmp (arguments + 1, "ACTION") == 0)
{
if (channel)
{
ptr_nick = irc_nick_search (channel, nick);
-
+
irc_channel_nick_speaking_add (channel,
nick,
(pos_args) ?
@@ -913,7 +913,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
irc_channel_nick_speaking_time_remove_old (channel);
irc_channel_nick_speaking_time_add (channel, nick,
time (NULL));
-
+
weechat_printf_tags (channel->buffer,
irc_protocol_tags (command,
"irc_action,notify_message",
@@ -948,7 +948,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
@@ -994,7 +994,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
irc_ctcp_display_request (server, command, channel, nick,
arguments + 1, pos_args, reply);
-
+
if (reply[0])
{
decoded_reply = irc_ctcp_replace_variables (server, reply);
@@ -1028,17 +1028,17 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
}
}
}
-
+
weechat_hook_signal_send ("irc_ctcp",
WEECHAT_HOOK_SIGNAL_STRING,
message);
-
+
if (pos_space)
pos_space[0] = ' ';
-
+
if (pos_end)
pos_end[0] = '\01';
-
+
arguments = (pos_end) ? pos_end + 1 : NULL;
}
}
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index 6c48a5a21..1bf81cbff 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -44,23 +44,23 @@ irc_debug_signal_debug_dump_cb (void *data, const char *signal,
(void) data;
(void) signal;
(void) type_data;
-
+
if (!signal_data
|| (weechat_strcasecmp ((char *)signal_data, IRC_PLUGIN_NAME) == 0))
{
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
weechat_plugin->name);
-
+
irc_server_print_log ();
irc_ignore_print_log ();
irc_redirect_pattern_print_log ();
-
+
weechat_log_printf ("");
weechat_log_printf ("***** End of \"%s\" plugin dump *****",
weechat_plugin->name);
}
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index 6e6962593..87bfd88e9 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -46,7 +46,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
{
char *pos_nickserv, *pos, *pos_pwd, *pos_space;
int char_size;
-
+
pos = string;
while (pos)
{
@@ -110,7 +110,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
{
pos_pwd++;
}
-
+
while (pos_pwd && pos_pwd[0] && (pos_pwd[0] != ' '))
{
char_size = weechat_utf8_char_size (pos_pwd);
@@ -132,7 +132,7 @@ irc_display_away (struct t_irc_server *server, const char *string1,
const char *string2)
{
struct t_irc_channel *ptr_channel;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index ee9350c9b..4657d12f4 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -46,17 +46,17 @@ int
irc_ignore_valid (struct t_irc_ignore *ignore)
{
struct t_irc_ignore *ptr_ignore;
-
+
if (!ignore)
return 0;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
if (ptr_ignore == ignore)
return 1;
}
-
+
/* ignore not found */
return 0;
}
@@ -70,12 +70,12 @@ irc_ignore_search (const char *mask, const char *server, const char *channel)
{
struct t_irc_ignore *ptr_ignore;
char any[2] = "*";
-
+
if (!server)
server = any;
if (!channel)
channel = any;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
@@ -86,7 +86,7 @@ irc_ignore_search (const char *mask, const char *server, const char *channel)
return ptr_ignore;
}
}
-
+
/* ignore not found */
return NULL;
}
@@ -99,14 +99,14 @@ struct t_irc_ignore *
irc_ignore_search_by_number (int number)
{
struct t_irc_ignore *ptr_ignore;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
if (ptr_ignore->number == number)
return ptr_ignore;
}
-
+
/* ignore not found */
return NULL;
}
@@ -121,14 +121,14 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
struct t_irc_ignore *new_ignore;
regex_t *regex;
char *complete_mask;
-
+
if (!mask || !mask[0])
return NULL;
-
+
complete_mask = malloc (1 + strlen (mask) + 1 + 1);
if (!complete_mask)
return NULL;
-
+
if (mask[0] == '^')
strcpy (complete_mask, mask);
else
@@ -145,14 +145,14 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
free (complete_mask);
return NULL;
}
-
+
if (regcomp (regex, complete_mask, REG_NOSUB | REG_ICASE) != 0)
{
free (regex);
free (complete_mask);
return NULL;
}
-
+
new_ignore = malloc (sizeof (*new_ignore));
if (new_ignore)
{
@@ -161,7 +161,7 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
new_ignore->regex_mask = regex;
new_ignore->server = (server) ? strdup (server) : strdup ("*");
new_ignore->channel = (channel) ? strdup (channel) : strdup ("*");
-
+
/* add ignore to ignore list */
new_ignore->prev_ignore = last_irc_ignore;
if (irc_ignore_list)
@@ -171,9 +171,9 @@ irc_ignore_new (const char *mask, const char *server, const char *channel)
last_irc_ignore = new_ignore;
new_ignore->next_ignore = NULL;
}
-
+
free (complete_mask);
-
+
return new_ignore;
}
@@ -190,29 +190,29 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
{
struct t_irc_ignore *ptr_ignore;
int server_match, channel_match;
-
+
if (!server)
return 0;
-
+
/*
* if nick is the same as server, then we will not ignore
* (it is possible when connected to an irc proxy)
*/
if (nick && server->nick && (strcmp (server->nick, nick) == 0))
return 0;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
server_match = 0;
channel_match = 0;
-
+
if (!server || (strcmp (ptr_ignore->server, "*") == 0))
server_match = 1;
else
server_match = (weechat_strcasecmp (ptr_ignore->server,
server->name) == 0);
-
+
if (!channel || (strcmp (ptr_ignore->channel, "*") == 0))
channel_match = 1;
else
@@ -228,7 +228,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
nick) == 0);
}
}
-
+
if (server_match && channel_match)
{
if (nick && (regexec (ptr_ignore->regex_mask, nick, 0, NULL, 0) == 0))
@@ -237,7 +237,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
return 1;
}
}
-
+
return 0;
}
@@ -249,17 +249,17 @@ void
irc_ignore_free (struct t_irc_ignore *ignore)
{
struct t_irc_ignore *ptr_ignore;
-
+
weechat_hook_signal_send ("irc_ignore_removing",
WEECHAT_HOOK_SIGNAL_POINTER, ignore);
-
+
/* decrement number for all ignore after this one */
for (ptr_ignore = ignore->next_ignore; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
ptr_ignore->number--;
}
-
+
/* free data */
if (ignore->mask)
free (ignore->mask);
@@ -272,7 +272,7 @@ irc_ignore_free (struct t_irc_ignore *ignore)
free (ignore->server);
if (ignore->channel)
free (ignore->channel);
-
+
/* remove ignore from list */
if (ignore->prev_ignore)
(ignore->prev_ignore)->next_ignore = ignore->next_ignore;
@@ -282,9 +282,9 @@ irc_ignore_free (struct t_irc_ignore *ignore)
irc_ignore_list = ignore->next_ignore;
if (last_irc_ignore == ignore)
last_irc_ignore = ignore->prev_ignore;
-
+
free (ignore);
-
+
weechat_hook_signal_send ("irc_ignore_removed",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -310,10 +310,10 @@ struct t_hdata *
irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
if (hdata)
{
@@ -340,21 +340,21 @@ irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !ignore)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "mask", ignore->mask))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "server", ignore->server))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "channel", ignore->channel))
return 0;
-
+
return 1;
}
@@ -366,7 +366,7 @@ void
irc_ignore_print_log ()
{
struct t_irc_ignore *ptr_ignore;
-
+
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
diff --git a/src/plugins/irc/irc-ignore.h b/src/plugins/irc/irc-ignore.h
index e52300e59..953c1cafa 100644
--- a/src/plugins/irc/irc-ignore.h
+++ b/src/plugins/irc/irc-ignore.h
@@ -56,5 +56,5 @@ extern struct t_hdata *irc_ignore_hdata_ignore_cb (void *data,
extern int irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore);
extern void irc_ignore_print_log ();
-
+
#endif /* __WEECHAT_IRC_IGNORE_H */
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c
index 262b9f3b8..2be3bf3e9 100644
--- a/src/plugins/irc/irc-info.c
+++ b/src/plugins/irc/irc-info.c
@@ -74,10 +74,10 @@ irc_info_get_info_cb (void *data, const char *info_name,
static char str_true[2] = "1";
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
-
+
/* make C compiler happy */
(void) data;
-
+
if (weechat_strcasecmp (info_name, "irc_is_channel") == 0)
{
if (irc_channel_is_channel (arguments))
@@ -118,7 +118,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
host = NULL;
ptr_server = NULL;
ptr_channel = NULL;
-
+
pos_comma = strchr (arguments, ',');
if (pos_comma)
{
@@ -140,7 +140,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
else
server = strdup (arguments);
}
-
+
/*
* replace channel by nick in host if channel is not a channel
* (private ?)
@@ -154,10 +154,10 @@ irc_info_get_info_cb (void *data, const char *info_name,
nick = irc_message_get_nick_from_host (host);
if (nick)
channel = strdup (nick);
-
+
}
}
-
+
/* search for server or channel buffer */
if (server)
{
@@ -165,14 +165,14 @@ irc_info_get_info_cb (void *data, const char *info_name,
if (ptr_server && channel)
ptr_channel = irc_channel_search (ptr_server, channel);
}
-
+
if (server)
free (server);
if (channel)
free (channel);
if (host)
free (host);
-
+
if (ptr_channel)
{
irc_info_create_string_with_pointer (&ptr_channel->buffer_as_string,
@@ -227,7 +227,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
}
return isupport_value;
}
-
+
return NULL;
}
@@ -243,13 +243,13 @@ irc_info_get_info_hashtable_cb (void *data, const char *info_name,
const char *server, *message;
struct t_irc_server *ptr_server;
struct t_hashtable *value;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!hashtable)
return NULL;
-
+
if (weechat_strcasecmp (info_name, "irc_message_parse") == 0)
{
message = weechat_hashtable_get (hashtable, "message");
@@ -270,7 +270,7 @@ irc_info_get_info_hashtable_cb (void *data, const char *info_name,
return value;
}
}
-
+
return NULL;
}
@@ -290,18 +290,18 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
struct t_irc_notify *ptr_notify;
char **argv;
int argc;
-
+
/* make C compiler happy */
(void) data;
-
+
if (!infolist_name || !infolist_name[0])
return NULL;
-
+
if (weechat_strcasecmp (infolist_name, "irc_server") == 0)
{
if (pointer && !irc_server_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -367,7 +367,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_channel_valid (ptr_server, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -441,7 +441,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_nick_valid (ptr_channel, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -480,7 +480,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_ignore_valid (pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -514,7 +514,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
{
if (pointer && !irc_notify_valid (NULL, pointer))
return NULL;
-
+
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
@@ -553,7 +553,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
}
}
}
-
+
return NULL;
}
@@ -601,7 +601,7 @@ irc_info_init ()
N_("value of feature, if supported by server (from IRC message 005)"),
N_("server,feature"),
&irc_info_get_info_cb, NULL);
-
+
/* info_hashtable hooks */
weechat_hook_info_hashtable ("irc_message_parse",
N_("parse an IRC message"),
@@ -622,7 +622,7 @@ irc_info_init ()
"messages, "
"\"count\": number of messages"),
&irc_info_get_info_hashtable_cb, NULL);
-
+
/* infolist hooks */
weechat_hook_infolist ("irc_server",
N_("list of IRC servers"),
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index 0a1b7b5ec..97d40c4cb 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -46,19 +46,19 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
-
+
text_decoded = irc_color_decode (text,
weechat_config_boolean (irc_config_network_colors_send));
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick);
else
ptr_nick = NULL;
-
+
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg",
"notify_none,no_highlight",
@@ -70,7 +70,7 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
IRC_COLOR_CHAT_NICK_SELF),
(text_decoded) ? text_decoded : text);
}
-
+
if (text_decoded)
free (text_decoded);
}
@@ -89,12 +89,12 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
int number;
char hash_key[32], *str_args;
struct t_hashtable *hashtable;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (!ptr_server || !ptr_channel || !message || !message[0])
return;
-
+
if (!ptr_server->is_connected)
{
weechat_printf (buffer,
@@ -132,9 +132,9 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
{
const char *ptr_data;
char *data_with_colors, *msg;
-
+
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
-
+
if (buffer == irc_raw_buffer)
{
if (weechat_strcasecmp (input_data, "q") == 0)
@@ -156,7 +156,7 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
}
return WEECHAT_RC_OK;
}
-
+
if (ptr_channel)
{
ptr_data = weechat_string_input_for_buffer (input_data);
@@ -164,14 +164,14 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
ptr_data = input_data;
data_with_colors = irc_color_encode (ptr_data,
weechat_config_boolean (irc_config_network_colors_send));
-
+
msg = strdup ((data_with_colors) ? data_with_colors : ptr_data);
if (msg)
{
irc_input_send_user_message (buffer, flags, NULL, msg);
free (msg);
}
-
+
if (data_with_colors)
free (data_with_colors);
}
@@ -182,7 +182,7 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -196,7 +196,7 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
{
/* make C compiler happy */
(void) data;
-
+
return irc_input_data (buffer, input_data, IRC_SERVER_SEND_OUTQ_PRIO_HIGH);
}
@@ -226,14 +226,14 @@ irc_input_send_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
ptr_string = (const char *)signal_data;
-
+
server = NULL;
channel = NULL;
flags = NULL;
@@ -241,7 +241,7 @@ irc_input_send_cb (void *data, const char *signal,
ptr_message = NULL;
ptr_server = NULL;
ptr_channel = NULL;
-
+
pos_semicol1 = strchr (ptr_string, ';');
if (pos_semicol1)
{
@@ -278,7 +278,7 @@ irc_input_send_cb (void *data, const char *signal,
}
}
}
-
+
flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH;
if (flags)
{
@@ -287,7 +287,7 @@ irc_input_send_cb (void *data, const char *signal,
if (flags_value < 0)
flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH;
}
-
+
if (server && ptr_message)
{
ptr_server = irc_server_search (server);
@@ -300,10 +300,10 @@ irc_input_send_cb (void *data, const char *signal,
if (ptr_channel)
ptr_buffer = ptr_channel->buffer;
}
-
+
/* set tags to use by default */
irc_server_set_send_default_tags (tags);
-
+
/* send text to buffer, or execute command */
if (weechat_string_input_for_buffer (ptr_message))
{
@@ -320,12 +320,12 @@ irc_input_send_cb (void *data, const char *signal,
if (data_with_colors)
free (data_with_colors);
}
-
+
/* reset tags to use by default */
irc_server_set_send_default_tags (NULL);
}
}
-
+
if (server)
free (server);
if (channel)
@@ -334,6 +334,6 @@ irc_input_send_cb (void *data, const char *signal,
free (flags);
if (tags)
free (tags);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c
index dcb7105e2..404c947b9 100644
--- a/src/plugins/irc/irc-message.c
+++ b/src/plugins/irc/irc-message.c
@@ -41,7 +41,7 @@ irc_message_parse (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
const char *pos, *pos2, *pos3, *pos4, *pos5;
-
+
if (nick)
*nick = NULL;
if (host)
@@ -52,10 +52,10 @@ irc_message_parse (const char *message, char **nick, char **host,
*channel = NULL;
if (arguments)
*arguments = NULL;
-
+
if (!message)
return;
-
+
/*
* we will use this message as example:
* :FlashCode!n=FlashCod@host.com PRIVMSG #channel :hello!
@@ -177,9 +177,9 @@ irc_message_parse_to_hashtable (const char *message)
char *nick, *host, *command, *channel, *arguments;
char empty_str[1] = { '\0' };
struct t_hashtable *hashtable;
-
+
irc_message_parse (message, &nick, &host, &command, &channel, &arguments);
-
+
hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -187,13 +187,13 @@ irc_message_parse_to_hashtable (const char *message)
NULL);
if (!hashtable)
return NULL;
-
+
weechat_hashtable_set (hashtable, "nick", (nick) ? nick : empty_str);
weechat_hashtable_set (hashtable, "host", (host) ? host : empty_str);
weechat_hashtable_set (hashtable, "command", (command) ? command : empty_str);
weechat_hashtable_set (hashtable, "channel", (channel) ? channel : empty_str);
weechat_hashtable_set (hashtable, "arguments", (arguments) ? arguments : empty_str);
-
+
if (nick)
free (nick);
if (host)
@@ -204,7 +204,7 @@ irc_message_parse_to_hashtable (const char *message)
free (channel);
if (arguments)
free (arguments);
-
+
return hashtable;
}
@@ -218,10 +218,10 @@ irc_message_get_nick_from_host (const char *host)
static char nick[128];
char host2[128], *pos_space, *pos;
const char *ptr_host;
-
+
if (!host)
return NULL;
-
+
nick[0] = '\0';
if (host)
{
@@ -238,10 +238,10 @@ irc_message_get_nick_from_host (const char *host)
snprintf (host2, sizeof (host2), "%s", host);
ptr_host = host2;
}
-
+
if (ptr_host[0] == ':')
ptr_host++;
-
+
pos = strchr (ptr_host, '!');
if (pos && (pos - ptr_host < (int)sizeof (nick)))
{
@@ -253,7 +253,7 @@ irc_message_get_nick_from_host (const char *host)
snprintf (nick, sizeof (nick), "%s", ptr_host);
}
}
-
+
return nick;
}
@@ -267,7 +267,7 @@ irc_message_get_address_from_host (const char *host)
static char address[256];
char host2[256], *pos_space, *pos;
const char *ptr_host;
-
+
address[0] = '\0';
if (host)
{
@@ -284,7 +284,7 @@ irc_message_get_address_from_host (const char *host)
snprintf (host2, sizeof (host2), "%s", host);
ptr_host = host2;
}
-
+
if (ptr_host[0] == ':')
ptr_host++;
pos = strchr (ptr_host, '!');
@@ -293,7 +293,7 @@ irc_message_get_address_from_host (const char *host)
else
snprintf (address, sizeof (address), "%s", ptr_host);
}
-
+
return address;
}
@@ -310,31 +310,31 @@ irc_message_replace_vars (struct t_irc_server *server,
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
char *res, *temp;
-
+
var_nick = (server && server->nick) ? server->nick : empty_string;
var_channel = (channel) ? channel->name : empty_string;
var_server = (server) ? server->name : empty_string;
-
+
/* replace nick */
temp = weechat_string_replace (string, "$nick", var_nick);
if (!temp)
return NULL;
res = temp;
-
+
/* replace channel */
temp = weechat_string_replace (res, "$channel", var_channel);
free (res);
if (!temp)
return NULL;
res = temp;
-
+
/* replace server */
temp = weechat_string_replace (res, "$server", var_server);
free (res);
if (!temp)
return NULL;
res = temp;
-
+
/* return result */
return res;
}
@@ -348,7 +348,7 @@ irc_message_split_add (struct t_hashtable *hashtable, int number,
const char *message, const char *arguments)
{
char key[32], value[32];
-
+
if (message)
{
snprintf (key, sizeof (key), "msg%d", number);
@@ -398,7 +398,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
const char *pos, *pos_max, *pos_next, *pos_last_delim;
char message[1024], *dup_arguments;
int max_length, number;
-
+
/*
* Examples of arguments for this function:
*
@@ -420,7 +420,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
* arguments: "is eating"
* suffix : "\01"
*/
-
+
max_length = 510;
if (max_length_host >= 0)
max_length -= max_length_host;
@@ -433,10 +433,10 @@ irc_message_split_string (struct t_hashtable *hashtable,
max_length -= strlen (prefix);
if (suffix)
max_length -= strlen (suffix);
-
+
if (max_length < 2)
return 0;
-
+
/* debug message */
if (weechat_irc_plugin->debug >= 2)
{
@@ -447,9 +447,9 @@ irc_message_split_string (struct t_hashtable *hashtable,
host, command, target, prefix, arguments, suffix,
max_length);
}
-
+
number = 1;
-
+
if (!arguments || !arguments[0])
{
snprintf (message, sizeof (message), "%s%s%s %s%s%s%s",
@@ -463,7 +463,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
irc_message_split_add (hashtable, 1, message, "");
return 1;
}
-
+
while (arguments && arguments[0])
{
pos = arguments;
@@ -498,7 +498,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
}
arguments = (pos == pos_last_delim) ? pos + 1 : pos;
}
-
+
return 1;
}
@@ -516,14 +516,14 @@ irc_message_split_join (struct t_hashtable *hashtable,
int length_to_add, index_channel;
char **channels, **keys, *pos, *str;
char msg_to_send[2048], keys_to_add[2048];
-
+
number = 1;
-
+
channels = NULL;
channels_count = 0;
keys = NULL;
keys_count = 0;
-
+
pos = strchr (arguments, ' ');
if (pos)
{
@@ -543,7 +543,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
{
channels = weechat_string_split (arguments, ",", 0, 0, &channels_count);
}
-
+
snprintf (msg_to_send, sizeof (msg_to_send), "%s%sJOIN",
(host) ? host : "",
(host) ? " " : "");
@@ -589,7 +589,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
keys_to_add[0] = '\0';
}
}
-
+
if (length > length_no_channel)
{
strcat (msg_to_send, keys_to_add);
@@ -597,12 +597,12 @@ irc_message_split_join (struct t_hashtable *hashtable,
msg_to_send,
msg_to_send + length_no_channel + 1);
}
-
+
if (channels)
weechat_string_free_split (channels);
if (keys)
weechat_string_free_split (keys);
-
+
return 1;
}
@@ -620,7 +620,7 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
{
char prefix[512], suffix[2], *pos, saved_char;
int length, rc;
-
+
/*
* message sent looks like:
* PRIVMSG #channel :hello world!
@@ -628,7 +628,7 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
* when IRC server sends message to other people, message looks like:
* :nick!user@host.com PRIVMSG #channel :hello world!
*/
-
+
/* for CTCP, prefix will be ":\01xxxx " and suffix "\01" */
prefix[0] = '\0';
suffix[0] = '\0';
@@ -652,11 +652,11 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
}
if (!prefix[0])
strcpy (prefix, ":");
-
+
rc = irc_message_split_string (hashtable, host, command, target,
prefix, arguments, suffix,
' ', max_length_host);
-
+
return rc;
}
@@ -670,7 +670,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
char *host, char *command, char *target, char *arguments)
{
char *pos, suffix[512];
-
+
/*
* 005 message looks like:
* :server 005 mynick MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10
@@ -678,7 +678,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
* CHANTYPES=# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer
* :are available on this server
*/
-
+
/* search suffix */
suffix[0] = '\0';
pos = strstr (arguments, " :");
@@ -687,7 +687,7 @@ irc_message_split_005 (struct t_hashtable *hashtable,
snprintf (suffix, sizeof (suffix), "%s", pos);
pos[0] = '\0';
}
-
+
return irc_message_split_string (hashtable, host, command, target,
NULL, arguments, suffix, ' ', -1);
}
@@ -713,7 +713,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
struct t_hashtable *hashtable;
char **argv, **argv_eol, *host, *command, *arguments, target[512];
int split_ok, argc, index_args, max_length_nick, max_length_host;
-
+
split_ok = 0;
host = NULL;
command = NULL;
@@ -721,11 +721,11 @@ irc_message_split (struct t_irc_server *server, const char *message)
index_args = 0;
argv = NULL;
argv_eol = NULL;
-
+
/* debug message */
if (weechat_irc_plugin->debug >= 2)
weechat_printf (NULL, "irc_message_split: message='%s'", message);
-
+
hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -733,16 +733,16 @@ irc_message_split (struct t_irc_server *server, const char *message)
NULL);
if (!hashtable)
return NULL;
-
+
if (!message || !message[0])
goto end;
-
+
argv = weechat_string_split (message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (message, " ", 2, 0, NULL);
-
+
if (argc < 2)
goto end;
-
+
if (argv[0][0] == ':')
{
if (argc < 3)
@@ -758,7 +758,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
arguments = argv_eol[1];
index_args = 1;
}
-
+
max_length_nick = (server && (server->nick_max_length > 0)) ?
server->nick_max_length : 16;
max_length_host = 1 + /* ":" */
@@ -841,18 +841,18 @@ irc_message_split (struct t_irc_server *server, const char *message)
}
}
}
-
+
end:
if (!split_ok
|| (weechat_hashtable_get_integer (hashtable, "items_count") == 0))
{
irc_message_split_add (hashtable, 1, message, arguments);
}
-
+
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
-
+
return hashtable;
}
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 009a4e5e5..86fd13290 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -46,12 +46,12 @@ irc_mode_channel_set (struct t_irc_server *server,
char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg;
int modes_count, channel_modes_updated, argc, current_arg;
struct t_irc_nick *ptr_nick;
-
+
if (!server || !channel || !modes)
return 0;
-
+
channel_modes_updated = 0;
-
+
argc = 0;
argv = NULL;
pos_args = strchr (modes, ' ');
@@ -85,7 +85,7 @@ irc_mode_channel_set (struct t_irc_server *server,
pos++;
}
current_arg = argc - modes_count;
-
+
if (str_modes && str_modes[0])
{
set_flag = '+';
@@ -158,14 +158,14 @@ irc_mode_channel_set (struct t_irc_server *server,
pos++;
}
}
-
+
if (str_modes)
free (str_modes);
if (argv)
weechat_string_free_split (argv);
-
+
weechat_bar_item_update ("buffer_name");
-
+
return channel_modes_updated;
}
@@ -180,7 +180,7 @@ irc_mode_user_add (struct t_irc_server *server, char mode)
str_mode[0] = mode;
str_mode[1] = '\0';
-
+
if (server->nick_modes)
{
if (!strchr (server->nick_modes, mode))
@@ -218,7 +218,7 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
{
char *pos, *nick_modes2;
int new_size;
-
+
if (server->nick_modes)
{
pos = strchr (server->nick_modes, mode);
diff --git a/src/plugins/irc/irc-msgbuffer.c b/src/plugins/irc/irc-msgbuffer.c
index 0e5291cc0..651e41000 100644
--- a/src/plugins/irc/irc-msgbuffer.c
+++ b/src/plugins/irc/irc-msgbuffer.c
@@ -50,7 +50,7 @@ irc_msgbuffer_get_option (struct t_irc_server *server, const char *message)
{
snprintf (option_name, sizeof (option_name),
"%s.%s", server->name, message);
-
+
/* search for msgbuffer in config file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_msgbuffer,
@@ -58,14 +58,14 @@ irc_msgbuffer_get_option (struct t_irc_server *server, const char *message)
if (ptr_option)
return ptr_option;
}
-
+
/* search for msgbuffer in config file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_msgbuffer,
message);
if (ptr_option)
return ptr_option;
-
+
/* no msgbuffer found in config */
return NULL;
}
@@ -92,18 +92,18 @@ irc_msgbuffer_get_target_buffer (struct t_irc_server *server, const char *nick,
struct t_gui_buffer *ptr_buffer;
struct t_irc_channel *ptr_channel;
struct t_weechat_plugin *buffer_plugin;
-
+
ptr_option = irc_msgbuffer_get_option (server, message);
if (!ptr_option && alias && alias[0])
ptr_option = irc_msgbuffer_get_option (server, alias);
-
+
if (!ptr_option)
{
if (default_buffer)
return default_buffer;
return (server) ? server->buffer : NULL;
}
-
+
target = weechat_config_integer (ptr_option);
switch (target)
{
@@ -129,11 +129,11 @@ irc_msgbuffer_get_target_buffer (struct t_irc_server *server, const char *nick,
return (server) ? server->buffer : NULL;
break;
}
-
+
ptr_buffer = weechat_current_buffer ();
buffer_plugin = weechat_buffer_get_pointer (ptr_buffer, "plugin");
if (buffer_plugin == weechat_irc_plugin)
return ptr_buffer;
-
+
return (server) ? server->buffer : NULL;
}
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index eeb7042bf..9d94e28c3 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -47,16 +47,16 @@ int
irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick)
{
struct t_irc_nick *ptr_nick;
-
+
if (!channel)
return 0;
-
+
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
if (ptr_nick == nick)
return 1;
}
-
+
/* nick not found */
return 0;
}
@@ -71,22 +71,22 @@ int
irc_nick_is_nick (const char *string)
{
const char *ptr;
-
+
if (!string || !string[0])
return 0;
-
+
/* first char must not be a number or hyphen */
ptr = string;
if (strchr ("0123456789-", *ptr))
return 0;
-
+
while (ptr && ptr[0])
{
if (!strchr (IRC_NICK_VALID_CHARS, *ptr))
return 0;
ptr++;
}
-
+
return 1;
}
@@ -100,7 +100,7 @@ irc_nick_strdup_for_color (const char *nickname)
{
int char_size, other_char_seen;
char *result, *pos, utf_char[16];
-
+
result = malloc (strlen (nickname) + 1);
pos = result;
other_char_seen = 0;
@@ -109,7 +109,7 @@ irc_nick_strdup_for_color (const char *nickname)
char_size = weechat_utf8_char_size (nickname);
memcpy (utf_char, nickname, char_size);
utf_char[char_size] = '\0';
-
+
if (strstr (weechat_config_string (irc_config_look_nick_color_stop_chars),
utf_char))
{
@@ -125,7 +125,7 @@ irc_nick_strdup_for_color (const char *nickname)
}
memcpy (pos, utf_char, char_size);
pos += char_size;
-
+
nickname += char_size;
}
pos[0] = '\0';
@@ -141,13 +141,13 @@ irc_nick_hash_color (const char *nickname)
{
int color;
const char *ptr_nick;
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return 0;
-
+
color = 0;
ptr_nick = nickname;
while (ptr_nick && ptr_nick[0])
@@ -155,7 +155,7 @@ irc_nick_hash_color (const char *nickname)
color += weechat_utf8_char_int (ptr_nick);
ptr_nick = weechat_utf8_next_char (ptr_nick);
}
-
+
return (color % irc_config_num_nick_colors);
}
@@ -170,15 +170,15 @@ irc_nick_find_color (const char *nickname)
int color;
char *nickname2;
const char *forced_color, *str_color;
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return weechat_color ("default");
-
+
nickname2 = irc_nick_strdup_for_color (nickname);
-
+
/* look if color is forced */
forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force,
(nickname2) ? nickname2 : nickname);
@@ -192,12 +192,12 @@ irc_nick_find_color (const char *nickname)
return forced_color;
}
}
-
+
/* hash nickname to get color */
color = irc_nick_hash_color ((nickname2) ? nickname2 : nickname);
if (nickname2)
free (nickname2);
-
+
/* return color */
str_color = weechat_color (irc_config_nick_colors[color]);
return (str_color[0]) ? str_color : weechat_color("default");
@@ -215,15 +215,15 @@ irc_nick_find_color_name (const char *nickname)
char *nickname2;
const char *forced_color;
static char *default_color = "default";
-
+
if (!irc_config_nick_colors)
irc_config_set_nick_colors ();
-
+
if (irc_config_num_nick_colors == 0)
return default_color;
-
+
nickname2 = irc_nick_strdup_for_color (nickname);
-
+
/* look if color is forced */
forced_color = weechat_hashtable_get (irc_config_hashtable_nick_color_force,
(nickname2) ? nickname2 : nickname);
@@ -233,12 +233,12 @@ irc_nick_find_color_name (const char *nickname)
free (nickname2);
return forced_color;
}
-
+
/* hash nickname to get color */
color = irc_nick_hash_color ((nickname2) ? nickname2 : nickname);
if (nickname2)
free (nickname2);
-
+
/* return color name */
return irc_config_nick_colors[color];
}
@@ -252,7 +252,7 @@ void
irc_nick_set_current_prefix (struct t_irc_nick *nick)
{
char *ptr_prefixes;
-
+
nick->prefix[0] = ' ';
for (ptr_prefixes = nick->prefixes; ptr_prefixes[0]; ptr_prefixes++)
{
@@ -275,7 +275,7 @@ irc_nick_set_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
int set, char prefix)
{
int index;
-
+
index = irc_server_get_prefix_char_index (server, prefix);
if (index >= 0)
{
@@ -293,10 +293,10 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
const char *prefixes)
{
const char *ptr_prefixes;
-
+
/* reset all prefixes in nick */
memset (nick->prefixes, ' ', strlen (nick->prefixes));
-
+
/* add prefixes in nick */
if (prefixes)
{
@@ -305,7 +305,7 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
irc_nick_set_prefix (server, nick, 1, ptr_prefixes[0]);
}
}
-
+
/* set current prefix */
irc_nick_set_current_prefix (nick);
}
@@ -319,14 +319,14 @@ int
irc_nick_is_op (struct t_irc_server *server, struct t_irc_nick *nick)
{
int index;
-
+
if (nick->prefix[0] == ' ')
return 0;
-
+
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
if (index < 0)
return 0;
-
+
return (index <= irc_server_get_prefix_mode_index (server, 'o')) ? 1 : 0;
}
@@ -342,11 +342,11 @@ irc_nick_has_prefix_mode (struct t_irc_server *server, struct t_irc_nick *nick,
char prefix_mode)
{
char prefix_char;
-
+
prefix_char = irc_server_get_prefix_char_for_mode (server, prefix_mode);
if (prefix_char == ' ')
return 0;
-
+
return (strchr (nick->prefixes, prefix_char)) ? 1 : 0;
}
@@ -363,10 +363,10 @@ irc_nick_get_nicklist_group (struct t_irc_server *server,
char str_group[2];
const char *prefix_modes;
struct t_gui_nick_group *ptr_group;
-
+
if (!server || !buffer || !nick)
return NULL;
-
+
ptr_group = NULL;
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
if (index < 0)
@@ -381,7 +381,7 @@ irc_nick_get_nicklist_group (struct t_irc_server *server,
str_group[1] = '\0';
ptr_group = weechat_nicklist_search_group (buffer, NULL, str_group);
}
-
+
return ptr_group;
}
@@ -397,7 +397,7 @@ irc_nick_get_prefix_color_name (struct t_irc_server *server,
const char *prefix_modes, *color;
char mode[2];
int i, index;
-
+
if (irc_config_hashtable_nick_prefixes)
{
index = irc_server_get_prefix_char_index (server, nick->prefix[0]);
@@ -425,7 +425,7 @@ irc_nick_get_prefix_color_name (struct t_irc_server *server,
return color;
}
}
-
+
/* no color by default */
return default_color;
}
@@ -441,10 +441,10 @@ irc_nick_get_color_for_nicklist (struct t_irc_server *server,
static char *nick_color_bar_fg = "bar_fg";
static char *nick_color_self = "weechat.color.chat_nick_self";
static char *nick_color_away = "weechat.color.nicklist_away";
-
+
if (nick->away)
return nick_color_away;
-
+
if (weechat_config_boolean(irc_config_look_color_nicks_in_nicklist))
{
if (weechat_strcasecmp (nick->name, server->nick) == 0)
@@ -452,7 +452,7 @@ irc_nick_get_color_for_nicklist (struct t_irc_server *server,
else
return irc_nick_find_color_name (nick->name);
}
-
+
return nick_color_bar_fg;
}
@@ -466,7 +466,7 @@ irc_nick_nicklist_add (struct t_irc_server *server,
struct t_irc_nick *nick)
{
struct t_gui_nick_group *ptr_group;
-
+
ptr_group = irc_nick_get_nicklist_group (server, channel->buffer, nick);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
nick->name,
@@ -486,7 +486,7 @@ irc_nick_nicklist_remove (struct t_irc_server *server,
struct t_irc_nick *nick)
{
struct t_gui_nick_group *ptr_group;
-
+
ptr_group = irc_nick_get_nicklist_group (server, channel->buffer, nick);
weechat_nicklist_remove_nick (channel->buffer,
weechat_nicklist_search_nick (channel->buffer,
@@ -523,7 +523,7 @@ irc_nick_nicklist_set_prefix_color_all ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -552,7 +552,7 @@ irc_nick_nicklist_set_color_all ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -580,28 +580,28 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
{
struct t_irc_nick *new_nick, *ptr_nick;
int length;
-
+
/* nick already exists on this channel? */
ptr_nick = irc_nick_search (channel, nickname);
if (ptr_nick)
{
/* remove old nick from nicklist */
irc_nick_nicklist_remove (server, channel, ptr_nick);
-
+
/* update nick */
irc_nick_set_prefixes (server, ptr_nick, prefixes);
ptr_nick->away = away;
-
+
/* add new nick in nicklist */
irc_nick_nicklist_add (server, channel, ptr_nick);
-
+
return ptr_nick;
}
-
+
/* alloc memory for new nick */
if ((new_nick = malloc (sizeof (*new_nick))) == NULL)
return NULL;
-
+
/* initialize new nick */
new_nick->name = strdup (nickname);
new_nick->host = NULL;
@@ -620,7 +620,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
new_nick->color = strdup (IRC_COLOR_CHAT_NICK_SELF);
else
new_nick->color = strdup (irc_nick_find_color (new_nick->name));
-
+
/* add nick to end of list */
new_nick->prev_nick = channel->last_nick;
if (channel->nicks)
@@ -629,14 +629,14 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
channel->nicks = new_nick;
channel->last_nick = new_nick;
new_nick->next_nick = NULL;
-
+
channel->nicks_count++;
-
+
channel->nick_completion_reset = 1;
-
+
/* add nick to buffer nicklist */
irc_nick_nicklist_add (server, channel, new_nick);
-
+
/* all is ok, return address of new nick */
return new_nick;
}
@@ -650,15 +650,15 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick, const char *new_nick)
{
int nick_is_me;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* update nicks speaking */
nick_is_me = (strcmp (nick->name, server->nick) == 0) ? 1 : 0;
if (!nick_is_me)
irc_channel_nick_speaking_rename (channel, nick->name, new_nick);
-
+
/* change nickname */
if (nick->name)
free (nick->name);
@@ -669,7 +669,7 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
nick->color = strdup (IRC_COLOR_CHAT_NICK_SELF);
else
nick->color = strdup (irc_nick_find_color (nick->name));
-
+
/* add nick in nicklist */
irc_nick_nicklist_add (server, channel, nick);
}
@@ -684,21 +684,21 @@ irc_nick_set_mode (struct t_irc_server *server, struct t_irc_channel *channel,
{
int index;
const char *prefix_chars;
-
+
index = irc_server_get_prefix_mode_index (server, mode);
if (index < 0)
return;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* set flag */
prefix_chars = irc_server_get_prefix_chars (server);
irc_nick_set_prefix (server, nick, set, prefix_chars[index]);
-
+
/* add nick in nicklist */
irc_nick_nicklist_add (server, channel, nick);
-
+
if (strcmp (nick->name, server->nick) == 0)
weechat_bar_item_update ("input_prompt");
}
@@ -712,13 +712,13 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick)
{
struct t_irc_nick *new_nicks;
-
+
if (!channel || !nick)
return;
-
+
/* remove nick from nicklist */
irc_nick_nicklist_remove (server, channel, nick);
-
+
/* remove nick */
if (channel->last_nick == nick)
channel->last_nick = nick->prev_nick;
@@ -729,12 +729,12 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
}
else
new_nicks = nick->next_nick;
-
+
if (nick->next_nick)
(nick->next_nick)->prev_nick = nick->prev_nick;
-
+
channel->nicks_count--;
-
+
/* free data */
if (nick->name)
free (nick->name);
@@ -744,9 +744,9 @@ irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel,
free (nick->prefixes);
if (nick->color)
free (nick->color);
-
+
free (nick);
-
+
channel->nicks = new_nicks;
channel->nick_completion_reset = 1;
}
@@ -760,13 +760,13 @@ irc_nick_free_all (struct t_irc_server *server, struct t_irc_channel *channel)
{
if (!channel)
return;
-
+
/* remove all nicks for the channel */
while (channel->nicks)
{
irc_nick_free (server, channel, channel->nicks);
}
-
+
/* sould be zero, but prevent any bug :D */
channel->nicks_count = 0;
}
@@ -779,17 +779,17 @@ struct t_irc_nick *
irc_nick_search (struct t_irc_channel *channel, const char *nickname)
{
struct t_irc_nick *ptr_nick;
-
+
if (!channel || !nickname)
return NULL;
-
+
for (ptr_nick = channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
if (weechat_strcasecmp (ptr_nick->name, nickname) == 0)
return ptr_nick;
}
-
+
/* nick not found */
return NULL;
}
@@ -804,7 +804,7 @@ irc_nick_count (struct t_irc_server *server, struct t_irc_channel *channel,
int *count_normal)
{
struct t_irc_nick *ptr_nick;
-
+
(*total) = 0;
(*count_op) = 0;
(*count_halfop) = 0;
@@ -865,7 +865,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
static char result[256];
char prefix[2];
const char *str_prefix_color;
-
+
prefix[0] = (nick) ? nick->prefix[0] : '\0';
prefix[1] = '\0';
if (weechat_config_boolean (weechat_config_get ("weechat.look.nickmode")))
@@ -889,7 +889,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
prefix[0] = '\0';
str_prefix_color = IRC_COLOR_RESET;
}
-
+
snprintf (result, sizeof (result), "%s%s%s%s%s%s%s%s\t",
(weechat_config_string (irc_config_look_nick_prefix)
&& weechat_config_string (irc_config_look_nick_prefix)[0]) ?
@@ -907,7 +907,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
(weechat_config_string (irc_config_look_nick_suffix)
&& weechat_config_string (irc_config_look_nick_suffix)[0]) ?
weechat_config_string (irc_config_look_nick_suffix) : "");
-
+
return result;
}
@@ -925,7 +925,7 @@ irc_nick_color_for_pv (struct t_irc_channel *channel, const char *nickname)
if (channel->pv_remote_nick_color)
return channel->pv_remote_nick_color;
}
-
+
return IRC_COLOR_CHAT_NICK_OTHER;
}
@@ -937,10 +937,10 @@ struct t_hdata *
irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
@@ -966,14 +966,14 @@ irc_nick_add_to_infolist (struct t_infolist *infolist,
struct t_irc_nick *nick)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !nick)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", nick->name))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "host", nick->host))
@@ -986,7 +986,7 @@ irc_nick_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "color", nick->color))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 3ed15fb5b..bbdb43788 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -56,7 +56,7 @@ irc_notify_valid (struct t_irc_server *server, struct t_irc_notify *notify)
{
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify;
-
+
if (!notify)
return 0;
@@ -82,7 +82,7 @@ irc_notify_valid (struct t_irc_server *server, struct t_irc_notify *notify)
}
}
}
-
+
/* notify not found */
return 0;
}
@@ -95,17 +95,17 @@ struct t_irc_notify *
irc_notify_search (struct t_irc_server *server, const char *nick)
{
struct t_irc_notify *ptr_notify;
-
+
if (!server || !nick)
return NULL;
-
+
for (ptr_notify = server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
{
if (strcmp (ptr_notify->nick, nick) == 0)
return ptr_notify;
}
-
+
/* notify not found */
return NULL;
}
@@ -121,7 +121,7 @@ irc_notify_set_server_option (struct t_irc_server *server)
char *str, *str2;
struct t_irc_notify *ptr_notify;
int total_length, length;
-
+
if (!server)
return;
@@ -183,10 +183,10 @@ struct t_irc_notify *
irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
{
struct t_irc_notify *new_notify;
-
+
if (!server || !nick || !nick[0])
return NULL;
-
+
new_notify = malloc (sizeof (*new_notify));
if (new_notify)
{
@@ -196,7 +196,7 @@ irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
new_notify->is_on_server = 0;
new_notify->away_message = NULL;
new_notify->ison_received = 0;
-
+
/* add notify to notify list on server */
new_notify->prev_notify = server->last_notify;
if (server->notify_list)
@@ -206,7 +206,7 @@ irc_notify_new (struct t_irc_server *server, const char *nick, int check_away)
server->last_notify = new_notify;
new_notify->next_notify = NULL;
}
-
+
return new_notify;
}
@@ -221,14 +221,14 @@ irc_notify_new_for_server (struct t_irc_server *server)
const char *notify;
char **items, *pos_params, **params;
int i, j, num_items, num_params, check_away;
-
+
irc_notify_free_all (server);
-
+
notify = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NOTIFY);
-
+
if (!notify || !notify[0])
return;
-
+
items = weechat_string_split (notify, ",", 0, 0, &num_items);
if (items)
@@ -272,7 +272,7 @@ void
irc_notify_new_for_all_servers ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -289,13 +289,13 @@ irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify)
{
weechat_hook_signal_send ("irc_notify_removing",
WEECHAT_HOOK_SIGNAL_POINTER, notify);
-
+
/* free data */
if (notify->nick)
free (notify->nick);
if (notify->away_message)
free (notify->away_message);
-
+
/* remove notify from list */
if (notify->prev_notify)
(notify->prev_notify)->next_notify = notify->next_notify;
@@ -305,9 +305,9 @@ irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify)
server->notify_list = notify->next_notify;
if (server->last_notify == notify)
server->last_notify = notify->prev_notify;
-
+
free (notify);
-
+
weechat_hook_signal_send ("irc_notify_removed",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
@@ -436,13 +436,13 @@ irc_notify_get_tags (struct t_config_option *option)
{
static char string[1024];
const char *tags;
-
+
tags = weechat_config_string (option);
-
+
snprintf (string, sizeof (string), "irc_notify%s%s",
(tags && tags[0]) ? "," : "",
(tags && tags[0]) ? tags : "");
-
+
return string;
}
@@ -457,11 +457,11 @@ irc_notify_set_is_on_server (struct t_irc_notify *notify,
{
if (!notify)
return;
-
+
/* same status, then do nothing */
if (notify->is_on_server == is_on_server)
return;
-
+
notify->is_on_server = is_on_server;
weechat_printf_tags (notify->server->buffer,
@@ -489,13 +489,13 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
{
if (!notify)
return;
-
+
/* same away message, then do nothing */
if ((!notify->away_message && !away_message)
|| (notify->away_message && away_message
&& (strcmp (notify->away_message, away_message) == 0)))
return;
-
+
if (!notify->away_message && away_message)
{
weechat_printf_tags (notify->server->buffer,
@@ -528,7 +528,7 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
IRC_COLOR_RESET,
away_message);
}
-
+
if (notify->away_message)
free (notify->away_message);
notify->away_message = (away_message) ? strdup (away_message) : NULL;
@@ -550,30 +550,30 @@ irc_notify_hsignal_cb (void *data, const char *signal,
int away_message_updated, no_such_nick;
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
error = weechat_hashtable_get (hashtable, "error");
server = weechat_hashtable_get (hashtable, "server");
pattern = weechat_hashtable_get (hashtable, "pattern");
command = weechat_hashtable_get (hashtable, "command");
output = weechat_hashtable_get (hashtable, "output");
-
+
/* if there is an error on redirection, just ignore result */
if (error && error[0])
return WEECHAT_RC_OK;
-
+
/* missing things in redirection */
if (!server || !pattern || !command || !output)
return WEECHAT_RC_OK;
-
+
/* search server */
ptr_server = irc_server_search (server);
if (!ptr_server)
return WEECHAT_RC_OK;
-
+
/* search for start of arguments in command sent to server */
ptr_args = strchr (command, ' ');
if (!ptr_args)
@@ -585,7 +585,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
}
if (!ptr_args[0])
return WEECHAT_RC_OK;
-
+
/* read output of command */
if (strcmp (pattern, "ison") == 0)
{
@@ -663,7 +663,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
irc_notify_set_is_on_server (ptr_notify, 0);
}
}
-
+
}
weechat_string_free_split (messages);
}
@@ -716,7 +716,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -733,11 +733,11 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify, *ptr_next_notify;
struct t_hashtable *hashtable;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -746,16 +746,16 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
message = malloc (7);
if (!message)
continue;
-
+
snprintf (message, 7, "ISON :");
total_length = 7;
nicks_added = 0;
-
+
ptr_notify = ptr_server->notify_list;
while (ptr_notify)
{
ptr_next_notify = ptr_notify->next_notify;
-
+
length = strlen (ptr_notify->nick);
total_length += length + 1;
message2 = realloc (message, total_length);
@@ -771,10 +771,10 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
strcat (message, " ");
strcat (message, ptr_notify->nick);
nicks_added++;
-
+
ptr_notify = ptr_next_notify;
}
-
+
if (message && (nicks_added > 0))
{
hashtable = irc_message_split (ptr_server, message);
@@ -798,12 +798,12 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
weechat_hashtable_free (hashtable);
}
}
-
+
if (message)
free (message);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -816,11 +816,11 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
{
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify, *ptr_next_notify;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -830,7 +830,7 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
while (ptr_notify)
{
ptr_next_notify = ptr_notify->next_notify;
-
+
if (ptr_notify->check_away)
{
/*
@@ -844,12 +844,12 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL,
"WHOIS :%s", ptr_notify->nick);
}
-
+
ptr_notify = ptr_next_notify;
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -861,10 +861,10 @@ struct t_hdata *
irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
if (hdata)
{
@@ -890,10 +890,10 @@ irc_notify_add_to_infolist (struct t_infolist *infolist,
struct t_irc_notify *notify)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !notify)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
@@ -910,7 +910,7 @@ irc_notify_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "away_message", notify->away_message))
return 0;
-
+
return 1;
}
@@ -922,7 +922,7 @@ void
irc_notify_print_log (struct t_irc_server *server)
{
struct t_irc_notify *ptr_notify;
-
+
for (ptr_notify = server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
{
@@ -948,7 +948,7 @@ irc_notify_hook_timer_ison ()
{
if (irc_notify_timer_ison)
weechat_unhook (irc_notify_timer_ison);
-
+
irc_notify_timer_ison = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_ison),
0, 0, &irc_notify_timer_ison_cb, NULL);
@@ -963,7 +963,7 @@ irc_notify_hook_timer_whois ()
{
if (irc_notify_timer_whois)
weechat_unhook (irc_notify_timer_whois);
-
+
irc_notify_timer_whois = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_whois),
0, 0, &irc_notify_timer_whois_cb, NULL);
@@ -978,7 +978,7 @@ irc_notify_init ()
{
irc_notify_hook_timer_ison ();
irc_notify_hook_timer_whois ();
-
+
irc_notify_hsignal = weechat_hook_hsignal ("irc_redirection_notify_*",
&irc_notify_hsignal_cb,
NULL);
diff --git a/src/plugins/irc/irc-notify.h b/src/plugins/irc/irc-notify.h
index c348c9ae3..0274d5b83 100644
--- a/src/plugins/irc/irc-notify.h
+++ b/src/plugins/irc/irc-notify.h
@@ -64,5 +64,5 @@ extern void irc_notify_hook_timer_ison ();
extern void irc_notify_hook_timer_whois ();
extern void irc_notify_init ();
extern void irc_notify_end ();
-
+
#endif /* __WEECHAT_IRC_NOTIFY_H */
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index f8c5684da..65b903219 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -77,19 +77,19 @@ irc_protocol_log_level_for_command (const char *command)
{
if (!command || !command[0])
return 0;
-
+
if ((strcmp (command, "privmsg") == 0)
|| (strcmp (command, "notice") == 0))
return 1;
-
+
if (strcmp (command, "nick") == 0)
return 2;
-
+
if ((strcmp (command, "join") == 0)
|| (strcmp (command, "part") == 0)
|| (strcmp (command, "quit") == 0))
return 4;
-
+
return 3;
}
@@ -104,12 +104,12 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
static char string[1024];
int log_level;
char str_log_level[32];
-
+
str_log_level[0] = '\0';
-
+
if (!command && !tags && !nick)
return NULL;
-
+
if (command && command[0])
{
log_level = irc_protocol_log_level_for_command (command);
@@ -119,7 +119,7 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
",log%d", log_level);
}
}
-
+
snprintf (string, sizeof (string),
"%s%s%s%s%s%s%s",
(command && command[0]) ? "irc_" : "",
@@ -129,7 +129,7 @@ irc_protocol_tags (const char *command, const char *tags, const char *nick)
(nick && nick[0]) ? ",nick_" : "",
(nick && nick[0]) ? nick : "",
str_log_level);
-
+
return string;
}
@@ -141,15 +141,15 @@ IRC_PROTOCOL_CALLBACK(authenticate)
{
const char *sasl_username, *sasl_password;
char *answer;
-
+
/*
* AUTHENTICATE message looks like:
* AUTHENTICATE +
* AUTHENTICATE QQDaUzXAmVffxuzFy77XWBGwABBQAgdinelBrKZaR3wE7nsIETuTVY=
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
sasl_username = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_USERNAME);
sasl_password = IRC_SERVER_OPTION_STRING(server,
@@ -186,7 +186,7 @@ IRC_PROTOCOL_CALLBACK(authenticate)
irc_server_sendf (server, 0, NULL, "CAP END");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -198,16 +198,16 @@ IRC_PROTOCOL_CALLBACK(cap)
{
char *ptr_caps, **items;
int num_items, sasl, i, timeout;
-
+
/*
* CAP message looks like:
* :server CAP * LS :identify-msg multi-prefix sasl
* :server CAP * ACK :sasl
* :server CAP * NAK :sasl
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
if (strcmp (argv[3], "LS") == 0)
{
if (argc > 4)
@@ -309,7 +309,7 @@ IRC_PROTOCOL_CALLBACK(cap)
irc_server_sendf (server, 0, NULL, "CAP END");
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -320,16 +320,16 @@ IRC_PROTOCOL_CALLBACK(cap)
IRC_PROTOCOL_CALLBACK(error)
{
char *ptr_args;
-
+
/*
* ERROR message looks like:
* ERROR :Closing Link: irc.server.org (Bad Password)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
ptr_args = (argv_eol[1][0] == ':') ? argv_eol[1] + 1 : argv_eol[1];
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -337,12 +337,12 @@ IRC_PROTOCOL_CALLBACK(error)
"%s%s",
weechat_prefix ("error"),
ptr_args);
-
+
if (strncmp (ptr_args, "Closing Link", 12) == 0)
{
irc_server_disconnect (server, !server->is_connected, 1);
}
-
+
return WEECHAT_RC_OK;
}
@@ -357,16 +357,16 @@ IRC_PROTOCOL_CALLBACK(generic_error)
char *chan_nick, *args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* example of error:
* :server 404 nick #channel :Cannot send to channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
first_arg = (strcmp (argv[2], server->nick) == 0) ? 3 : 2;
-
+
if ((argv[first_arg][0] != ':') && argv[first_arg + 1])
{
chan_nick = argv[first_arg];
@@ -379,13 +379,13 @@ IRC_PROTOCOL_CALLBACK(generic_error)
}
if (args[0] == ':')
args++;
-
+
ptr_channel = NULL;
if (chan_nick)
ptr_channel = irc_channel_search (server, chan_nick);
-
+
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
ptr_buffer),
@@ -399,7 +399,7 @@ IRC_PROTOCOL_CALLBACK(generic_error)
IRC_COLOR_RESET,
(chan_nick) ? ": " : "",
args);
-
+
return WEECHAT_RC_OK;
}
@@ -413,10 +413,10 @@ IRC_PROTOCOL_CALLBACK(invite)
* INVITE message looks like:
* :nick!user@host INVITE mynick :#channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
if (!ignored)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
@@ -447,19 +447,19 @@ IRC_PROTOCOL_CALLBACK(join)
struct t_irc_channel_speaking *ptr_nick_speaking;
char *pos_channel;
int local_join, display_host;
-
+
/*
* JOIN message looks like:
* :nick!user@host JOIN :#channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
local_join = (strcmp (nick, server->nick) == 0);
-
+
pos_channel = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
-
+
ptr_channel = irc_channel_search (server, pos_channel);
if (ptr_channel)
{
@@ -473,7 +473,7 @@ IRC_PROTOCOL_CALLBACK(join)
*/
if (!local_join)
return WEECHAT_RC_OK;
-
+
ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_CHANNEL,
pos_channel, 1, 1);
if (!ptr_channel)
@@ -485,19 +485,19 @@ IRC_PROTOCOL_CALLBACK(join)
return WEECHAT_RC_ERROR;
}
}
-
+
/* remove topic and display channel creation date if joining new channel */
if (!ptr_channel->nicks)
{
irc_channel_set_topic (ptr_channel, NULL);
ptr_channel->display_creation_date = 1;
}
-
+
/* add nick in channel */
ptr_nick = irc_nick_new (server, ptr_channel, nick, NULL, 0);
if (ptr_nick)
ptr_nick->host = strdup (address);
-
+
if (!ignored)
{
ptr_nick_speaking = ((weechat_config_boolean (irc_config_look_smart_filter))
@@ -530,12 +530,12 @@ IRC_PROTOCOL_CALLBACK(join)
IRC_COLOR_CHAT_CHANNEL,
pos_channel,
IRC_COLOR_MESSAGE_JOIN);
-
+
/* display message in private if private has flag "has_quit_server" */
if (!local_join)
irc_channel_display_nick_back_in_pv (server, ptr_nick, nick);
}
-
+
return WEECHAT_RC_OK;
}
@@ -548,25 +548,25 @@ IRC_PROTOCOL_CALLBACK(kick)
char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick, *ptr_nick_kicked;
-
+
/*
* KICK message looks like:
* :nick1!user@host KICK #channel nick2 :kick reason
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[2]);
if (!ptr_channel)
return WEECHAT_RC_OK;
-
+
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_nick_kicked = irc_nick_search (ptr_channel, argv[3]);
-
+
if (!ignored)
{
if (pos_comment)
@@ -604,7 +604,7 @@ IRC_PROTOCOL_CALLBACK(kick)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
if (strcmp (argv[3], server->nick) == 0)
{
/*
@@ -639,7 +639,7 @@ IRC_PROTOCOL_CALLBACK(kick)
if (ptr_nick_kicked)
irc_nick_free (server, ptr_channel, ptr_nick_kicked);
}
-
+
return WEECHAT_RC_OK;
}
@@ -652,24 +652,24 @@ IRC_PROTOCOL_CALLBACK(kill)
char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick, *ptr_nick_killed;
-
+
/*
* KILL message looks like:
* :nick1!user@host KILL mynick :kill reason
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_nick_killed = irc_nick_search (ptr_channel, argv[2]);
-
+
if (!ignored)
{
if (pos_comment)
@@ -703,7 +703,7 @@ IRC_PROTOCOL_CALLBACK(kill)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
if (strcmp (argv[2], server->nick) == 0)
{
/*
@@ -722,7 +722,7 @@ IRC_PROTOCOL_CALLBACK(kill)
irc_nick_free (server, ptr_channel, ptr_nick_killed);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -736,17 +736,17 @@ IRC_PROTOCOL_CALLBACK(mode)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* MODE message looks like:
* :nick!user@host MODE #test +o nick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_modes = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
-
+
if (irc_channel_is_channel (argv[2]))
{
ptr_channel = irc_channel_search (server, argv[2]);
@@ -799,7 +799,7 @@ IRC_PROTOCOL_CALLBACK(mode)
}
irc_mode_user_set (server, pos_modes, 0);
}
-
+
return WEECHAT_RC_OK;
}
@@ -814,24 +814,24 @@ IRC_PROTOCOL_CALLBACK(nick)
char *new_nick, *old_color, *buffer_name;
int local_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
-
+
/*
* NICK message looks like:
* :oldnick!user@host NICK :newnick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
new_nick = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
-
+
local_nick = (strcmp (nick, server->nick) == 0) ? 1 : 0;
-
+
if (local_nick)
irc_server_set_nick (server, new_nick);
-
+
ptr_nick_found = NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -863,14 +863,14 @@ IRC_PROTOCOL_CALLBACK(nick)
if (ptr_nick)
{
ptr_nick_found = ptr_nick;
-
+
/* temporary disable hotlist */
weechat_buffer_set (NULL, "hotlist", "-");
-
+
/* set host for nick if needed */
if (ptr_nick && !ptr_nick->host)
ptr_nick->host = strdup (address);
-
+
/* change nick and display message on all channels */
old_color = strdup (ptr_nick->color);
irc_nick_change (server, ptr_channel, ptr_nick, new_nick);
@@ -916,20 +916,20 @@ IRC_PROTOCOL_CALLBACK(nick)
irc_channel_nick_speaking_time_rename (ptr_channel,
nick, new_nick);
}
-
+
if (old_color)
free (old_color);
-
+
/* enable hotlist */
weechat_buffer_set (NULL, "hotlist", "+");
}
break;
}
}
-
+
if (!local_nick)
irc_channel_display_nick_back_in_pv (server, ptr_nick_found, new_nick);
-
+
return WEECHAT_RC_OK;
}
@@ -944,21 +944,21 @@ IRC_PROTOCOL_CALLBACK(notice)
struct t_irc_nick *ptr_nick;
int notify_private, notice_op;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* NOTICE message looks like:
* NOTICE AUTH :*** Looking up your hostname...
* :nick!user@host NOTICE mynick :notice text
* :nick!user@host NOTICE #channel :notice text
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
notice_op = 0;
-
+
if (argv[0][0] == ':')
{
if (argc < 4)
@@ -978,7 +978,7 @@ IRC_PROTOCOL_CALLBACK(notice)
pos_target = NULL;
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
-
+
if (nick && (pos_args[0] == '\01')
&& (pos_args[strlen (pos_args) - 1] == '\01'))
{
@@ -1019,7 +1019,7 @@ IRC_PROTOCOL_CALLBACK(notice)
{
notify_private = 1;
}
-
+
ptr_channel = NULL;
if (nick && weechat_config_integer (irc_config_look_notice_as_pv) != IRC_CONFIG_LOOK_NOTICE_AS_PV_NEVER)
{
@@ -1137,7 +1137,7 @@ IRC_PROTOCOL_CALLBACK(notice)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1152,7 +1152,7 @@ IRC_PROTOCOL_CALLBACK(part)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
-
+
/*
* PART message looks like:
* :nick!user@host PART #channel :part message
@@ -1160,13 +1160,13 @@ IRC_PROTOCOL_CALLBACK(part)
* :nick!user@host PART :#channel
* :nick!user@host PART #channel :part message
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
ptr_channel = irc_channel_search (server,
(argv[2][0] == ':') ? argv[2] + 1 : argv[2]);
if (ptr_channel)
@@ -1175,7 +1175,7 @@ IRC_PROTOCOL_CALLBACK(part)
if (ptr_nick)
{
local_part = (strcmp (nick, server->nick) == 0);
-
+
/* display part message */
if (!ignored)
{
@@ -1250,12 +1250,12 @@ IRC_PROTOCOL_CALLBACK(part)
IRC_COLOR_MESSAGE_QUIT);
}
}
-
+
/* part request was issued by local client ? */
if (local_part)
{
irc_nick_free_all (server, ptr_channel);
-
+
/* cycling ? => rejoin channel immediately */
if (ptr_channel->cycle)
{
@@ -1291,7 +1291,7 @@ IRC_PROTOCOL_CALLBACK(part)
irc_nick_free (server, ptr_channel, ptr_nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1305,12 +1305,12 @@ IRC_PROTOCOL_CALLBACK(ping)
* PING message looks like:
* PING :server
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
-
+
irc_server_sendf (server, 0, NULL, "PONG :%s",
(argv[1][0] == ':') ? argv[1] + 1 : argv[1]);
-
+
return WEECHAT_RC_OK;
}
@@ -1322,9 +1322,9 @@ IRC_PROTOCOL_CALLBACK(pong)
{
struct timeval tv;
int old_lag;
-
+
IRC_PROTOCOL_MIN_ARGS(0);
-
+
if (server->lag_check_time.tv_sec != 0)
{
/* calculate lag (time diff with lag check) */
@@ -1334,14 +1334,14 @@ IRC_PROTOCOL_CALLBACK(pong)
&tv);
if (old_lag != server->lag)
weechat_bar_item_update ("lag");
-
+
/* schedule next lag check */
server->lag_check_time.tv_sec = 0;
server->lag_check_time.tv_usec = 0;
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1356,7 +1356,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
int nick_is_me;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* PRIVMSG message looks like:
* :nick!user@host PRIVMSG #channel :message for channel here
@@ -1367,15 +1367,15 @@ IRC_PROTOCOL_CALLBACK(privmsg)
* :nick!user@host PRIVMSG mynick :\01VERSION\01
* :nick!user@host PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
-
+
/* receiver is a channel ? */
if (irc_channel_is_channel (argv[2]))
{
@@ -1391,13 +1391,13 @@ IRC_PROTOCOL_CALLBACK(privmsg)
argv_eol[0]);
return WEECHAT_RC_OK;
}
-
+
/* other message */
ptr_nick = irc_nick_search (ptr_channel, nick);
-
+
if (ptr_nick && !ptr_nick->host)
ptr_nick->host = strdup (address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
"notify_message",
@@ -1407,7 +1407,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
(ptr_nick) ? NULL : nick,
NULL),
pos_args);
-
+
irc_channel_nick_speaking_add (ptr_channel,
nick,
weechat_string_has_highlight (pos_args,
@@ -1420,9 +1420,9 @@ IRC_PROTOCOL_CALLBACK(privmsg)
else
{
nick_is_me = (strcmp (server->nick, nick) == 0);
-
+
remote_nick = (nick_is_me) ? argv[2] : nick;
-
+
/* CTCP to user */
if ((pos_args[0] == '\01')
&& (pos_args[strlen (pos_args) - 1] == '\01'))
@@ -1432,10 +1432,10 @@ IRC_PROTOCOL_CALLBACK(privmsg)
argv_eol[0]);
return WEECHAT_RC_OK;
}
-
+
/* private message received => display it */
ptr_channel = irc_channel_search (server, remote_nick);
-
+
if (!ptr_channel)
{
ptr_channel = irc_channel_new (server,
@@ -1452,7 +1452,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
}
irc_channel_set_topic (ptr_channel, address);
-
+
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
@@ -1464,15 +1464,15 @@ IRC_PROTOCOL_CALLBACK(privmsg)
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)),
pos_args);
-
+
if (ptr_channel->has_quit_server)
ptr_channel->has_quit_server = 0;
-
+
weechat_hook_signal_send ("irc_pv",
WEECHAT_HOOK_SIGNAL_STRING,
argv_eol[0]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -1487,18 +1487,18 @@ IRC_PROTOCOL_CALLBACK(quit)
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
int local_quit, display_host;
-
+
/*
* QUIT message looks like:
* :nick!user@host QUIT :quit message
*/
-
+
IRC_PROTOCOL_MIN_ARGS(2);
IRC_PROTOCOL_CHECK_HOST;
-
+
pos_comment = (argc > 2) ?
((argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]) : NULL;
-
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -1506,7 +1506,7 @@ IRC_PROTOCOL_CALLBACK(quit)
ptr_nick = NULL;
else
ptr_nick = irc_nick_search (ptr_channel, nick);
-
+
if (ptr_nick || (weechat_strcasecmp (ptr_channel->name, nick) == 0))
{
/* display quit message */
@@ -1587,7 +1587,7 @@ IRC_PROTOCOL_CALLBACK(quit)
irc_nick_free (server, ptr_channel, ptr_nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -1599,9 +1599,9 @@ IRC_PROTOCOL_CALLBACK(quit)
IRC_PROTOCOL_CALLBACK(server_mode_reason)
{
char *pos_mode, *pos_args;
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
/* skip nickname if at beginning of server message */
if (strcmp (server->nick, argv[2]) == 0)
{
@@ -1613,7 +1613,7 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
pos_mode = argv[2];
pos_args = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
}
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -1622,7 +1622,7 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
weechat_prefix ("network"),
pos_mode,
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -1633,9 +1633,9 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
IRC_PROTOCOL_CALLBACK(numeric)
{
char *pos_args;
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (weechat_strcasecmp (server->nick, argv[2]) == 0)
{
pos_args = (argc > 3) ?
@@ -1645,7 +1645,7 @@ IRC_PROTOCOL_CALLBACK(numeric)
{
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL,
NULL),
@@ -1653,7 +1653,7 @@ IRC_PROTOCOL_CALLBACK(numeric)
"%s%s",
weechat_prefix ("network"),
pos_args);
-
+
return WEECHAT_RC_OK;
}
@@ -1667,14 +1667,14 @@ IRC_PROTOCOL_CALLBACK(topic)
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* TOPIC message looks like:
* :nick!user@host TOPIC #channel :new topic for channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (!irc_channel_is_channel (argv[2]))
{
weechat_printf (server->buffer,
@@ -1682,14 +1682,14 @@ IRC_PROTOCOL_CALLBACK(topic)
weechat_prefix ("error"), IRC_PLUGIN_NAME, "topic");
return WEECHAT_RC_OK;
}
-
+
pos_topic = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[2]);
ptr_nick = irc_nick_search (ptr_channel, nick);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
-
+
if (!ignored)
{
if (pos_topic && pos_topic[0])
@@ -1788,10 +1788,10 @@ IRC_PROTOCOL_CALLBACK(topic)
}
}
}
-
+
if (ptr_channel)
irc_channel_set_topic (ptr_channel, pos_topic);
-
+
return WEECHAT_RC_OK;
}
@@ -1805,12 +1805,12 @@ IRC_PROTOCOL_CALLBACK(wallops)
* WALLOPS message looks like:
* :nick!user@host WALLOPS :message from admin
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (ignored)
return WEECHAT_RC_OK;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
command, NULL,
NULL),
@@ -1825,7 +1825,7 @@ IRC_PROTOCOL_CALLBACK(wallops)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]);
-
+
return WEECHAT_RC_OK;
}
@@ -1843,16 +1843,16 @@ IRC_PROTOCOL_CALLBACK(001)
* 001 message looks like:
* :server 001 mynick :Welcome to the dancer-ircd Network
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (strcmp (server->nick, argv[2]) != 0)
irc_server_set_nick (server, argv[2]);
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
/* connection to IRC server is ok! */
server->is_connected = 1;
server->reconnect_delay = 0;
@@ -1864,7 +1864,7 @@ IRC_PROTOCOL_CALLBACK(001)
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
irc_server_set_buffer_title (server);
-
+
/* set away message if user was away (before disconnection for example) */
if (server->away_message && server->away_message[0])
{
@@ -1875,11 +1875,11 @@ IRC_PROTOCOL_CALLBACK(001)
free (away_msg);
}
}
-
+
/* send signal "irc_server_connected" with server name */
weechat_hook_signal_send ("irc_server_connected",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
-
+
/* execute command when connected */
ptr_command = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND);
if (ptr_command && ptr_command[0])
@@ -1907,7 +1907,7 @@ IRC_PROTOCOL_CALLBACK(001)
}
else
irc_server_autojoin_channels (server);
-
+
return WEECHAT_RC_OK;
}
@@ -1919,7 +1919,7 @@ IRC_PROTOCOL_CALLBACK(005)
{
char *pos, *pos2, *pos_start, *error, *isupport2;
int length_isupport, length, nick_max_length;
-
+
/*
* 005 message looks like:
* :server 005 mynick MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10
@@ -1927,9 +1927,9 @@ IRC_PROTOCOL_CALLBACK(005)
* CHANTYPES=# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer
* :are available on this server
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
@@ -1946,7 +1946,7 @@ IRC_PROTOCOL_CALLBACK(005)
if (pos2)
pos2[0] = ' ';
}
-
+
/* save max nick length */
pos = strstr (argv_eol[3], "NICKLEN=");
if (pos)
@@ -1962,7 +1962,7 @@ IRC_PROTOCOL_CALLBACK(005)
if (pos2)
pos2[0] = ' ';
}
-
+
/* save whole message (concatenate to existing isupport, if any) */
pos_start = NULL;
pos = strstr (argv_eol[3], " :");
@@ -1992,7 +1992,7 @@ IRC_PROTOCOL_CALLBACK(005)
memcpy (pos_start + 1, argv_eol[3], length);
pos_start[length + 1] = '\0';
}
-
+
return WEECHAT_RC_OK;
}
@@ -2006,9 +2006,9 @@ IRC_PROTOCOL_CALLBACK(221)
* 221 message looks like:
* :server 221 nick :+s
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[2],
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -2021,11 +2021,11 @@ IRC_PROTOCOL_CALLBACK(221)
IRC_COLOR_RESET,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3],
IRC_COLOR_CHAT_DELIMITERS);
-
+
irc_mode_user_set (server,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3],
1);
-
+
return WEECHAT_RC_OK;
}
@@ -2040,18 +2040,18 @@ IRC_PROTOCOL_CALLBACK(301)
char *pos_away_msg;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 301 message looks like:
* :server 301 mynick nick :away message for nick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 4)
{
pos_away_msg = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
-
+
/* look for private buffer to display message */
ptr_channel = irc_channel_search (server, argv[3]);
if (!weechat_config_boolean (irc_config_look_display_pv_away_once)
@@ -2080,7 +2080,7 @@ IRC_PROTOCOL_CALLBACK(301)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2094,9 +2094,9 @@ IRC_PROTOCOL_CALLBACK(303)
* 303 message looks like:
* :server 303 mynick :nick1 nick2
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -2104,7 +2104,7 @@ IRC_PROTOCOL_CALLBACK(303)
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
-
+
return WEECHAT_RC_OK;
}
@@ -2118,9 +2118,9 @@ IRC_PROTOCOL_CALLBACK(305)
* 305 message looks like:
* :server 305 mynick :Does this mean you're really back?
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 3)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -2131,12 +2131,12 @@ IRC_PROTOCOL_CALLBACK(305)
weechat_prefix ("network"),
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
}
-
+
server->is_away = 0;
server->away_time = 0;
-
+
weechat_bar_item_update ("away");
-
+
return WEECHAT_RC_OK;
}
@@ -2150,9 +2150,9 @@ IRC_PROTOCOL_CALLBACK(306)
* 306 message looks like:
* :server 306 mynick :We'll miss you
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argc > 3)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -2163,12 +2163,12 @@ IRC_PROTOCOL_CALLBACK(306)
weechat_prefix ("network"),
(argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
}
-
+
server->is_away = 1;
server->away_time = time (NULL);
-
+
weechat_bar_item_update ("away");
-
+
return WEECHAT_RC_OK;
}
@@ -2182,9 +2182,9 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
* messages look like:
* :server 319 flashy FlashCode :some text here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2197,7 +2197,7 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -2211,9 +2211,9 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
* messages look like:
* :server 369 flashy FlashCode :some text here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whowas",
NULL),
@@ -2226,7 +2226,7 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -2240,9 +2240,9 @@ IRC_PROTOCOL_CALLBACK(311)
* 311 message looks like:
* :server 311 mynick nick user host * :realname here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(8);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2259,7 +2259,7 @@ IRC_PROTOCOL_CALLBACK(311)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]);
-
+
return WEECHAT_RC_OK;
}
@@ -2273,9 +2273,9 @@ IRC_PROTOCOL_CALLBACK(312)
* 312 message looks like:
* :server 312 mynick nick irc.freenode.net :http://freenode.net/
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -2292,7 +2292,7 @@ IRC_PROTOCOL_CALLBACK(312)
IRC_COLOR_RESET,
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
IRC_COLOR_CHAT_DELIMITERS);
-
+
return WEECHAT_RC_OK;
}
@@ -2306,9 +2306,9 @@ IRC_PROTOCOL_CALLBACK(314)
* 314 message looks like:
* :server 314 mynick nick user host * :realname here
*/
-
+
IRC_PROTOCOL_MIN_ARGS(8);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whowas",
NULL),
@@ -2325,7 +2325,7 @@ IRC_PROTOCOL_CALLBACK(314)
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[7][0] == ':') ? argv_eol[7] + 1 : argv_eol[7]);
-
+
return WEECHAT_RC_OK;
}
@@ -2336,14 +2336,14 @@ IRC_PROTOCOL_CALLBACK(314)
IRC_PROTOCOL_CALLBACK(315)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 315 message looks like:
* :server 315 mynick #channel :End of /WHO list.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && (ptr_channel->checking_away > 0))
{
@@ -2364,7 +2364,7 @@ IRC_PROTOCOL_CALLBACK(315)
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2377,25 +2377,25 @@ IRC_PROTOCOL_CALLBACK(317)
int idle_time, day, hour, min, sec;
time_t datetime;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 317 message looks like:
* :server 317 mynick nick 122877 1205327880 :seconds idle, signon time
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
idle_time = atoi (argv[4]);
day = idle_time / (60 * 60 * 24);
hour = (idle_time % (60 * 60 * 24)) / (60 * 60);
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
-
+
datetime = (time_t)(atol (argv[5]));
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois", NULL);
-
+
if (day > 0)
{
weechat_printf_tags (ptr_buffer,
@@ -2456,7 +2456,7 @@ IRC_PROTOCOL_CALLBACK(317)
IRC_COLOR_CHAT_CHANNEL,
weechat_util_get_time_string (&datetime));
}
-
+
return WEECHAT_RC_OK;
}
@@ -2467,17 +2467,17 @@ IRC_PROTOCOL_CALLBACK(317)
IRC_PROTOCOL_CALLBACK(321)
{
char *pos_args;
-
+
/*
* 321 message looks like:
* :server 321 mynick Channel :Users Name
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "list",
NULL),
@@ -2487,7 +2487,7 @@ IRC_PROTOCOL_CALLBACK(321)
argv[3],
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -2498,17 +2498,17 @@ IRC_PROTOCOL_CALLBACK(321)
IRC_PROTOCOL_CALLBACK(322)
{
char *pos_topic;
-
+
/*
* 322 message looks like:
* :server 322 mynick #channel 3 :topic of channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
pos_topic = (argc > 5) ?
((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL;
-
+
if (!server->cmd_list_regexp ||
(regexec (server->cmd_list_regexp, argv[3], 0, NULL, 0) == 0))
{
@@ -2528,7 +2528,7 @@ IRC_PROTOCOL_CALLBACK(322)
(pos_topic && pos_topic[0]) ? ": " : "",
(pos_topic && pos_topic[0]) ? pos_topic : "");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2539,17 +2539,17 @@ IRC_PROTOCOL_CALLBACK(322)
IRC_PROTOCOL_CALLBACK(323)
{
char *pos_args;
-
+
/*
* 323 message looks like:
* :server 323 mynick :End of /LIST
*/
-
+
IRC_PROTOCOL_MIN_ARGS(3);
-
+
pos_args = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "list",
NULL),
@@ -2557,7 +2557,7 @@ IRC_PROTOCOL_CALLBACK(323)
"%s%s",
weechat_prefix ("network"),
(pos_args && pos_args[0]) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -2568,14 +2568,14 @@ IRC_PROTOCOL_CALLBACK(323)
IRC_PROTOCOL_CALLBACK(324)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 324 message looks like:
* :server 324 mynick #channel +nt
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel)
{
@@ -2612,7 +2612,7 @@ IRC_PROTOCOL_CALLBACK(324)
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : "",
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2624,20 +2624,20 @@ IRC_PROTOCOL_CALLBACK(327)
{
char *pos_realname;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 327 message looks like:
* :server 327 mynick nick host ip :real hostname/ip
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
pos_realname = (argc > 6) ?
((argv_eol[6][0] == ':') ? argv_eol[6] + 1 : argv_eol[6]) : NULL;
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois", NULL);
-
+
if (pos_realname && pos_realname[0])
{
weechat_printf_tags (ptr_buffer,
@@ -2670,7 +2670,7 @@ IRC_PROTOCOL_CALLBACK(327)
argv[4],
argv[5]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2681,14 +2681,14 @@ IRC_PROTOCOL_CALLBACK(327)
IRC_PROTOCOL_CALLBACK(328)
{
struct t_irc_channel *ptr_channel;
-
+
/*
* 328 message looks like:
* :server 328 mynick #channel :http://sample.url.com/
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel)
{
@@ -2704,7 +2704,7 @@ IRC_PROTOCOL_CALLBACK(328)
(argv_eol[4][0] == ':') ?
argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2716,19 +2716,19 @@ IRC_PROTOCOL_CALLBACK(329)
{
struct t_irc_channel *ptr_channel;
time_t datetime;
-
+
/*
* 329 message looks like:
* :server 329 mynick #channel 1205327894
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
-
+
datetime = (time_t)(atol ((argv_eol[4][0] == ':') ?
argv_eol[4] + 1 : argv_eol[4]));
-
+
if (ptr_channel)
{
if (ptr_channel->display_creation_date)
@@ -2758,7 +2758,7 @@ IRC_PROTOCOL_CALLBACK(329)
IRC_COLOR_RESET,
weechat_util_get_time_string (&datetime));
}
-
+
return WEECHAT_RC_OK;
}
@@ -2771,7 +2771,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
{
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 330 message looks like:
* :server 330 mynick nick1 nick2 :is logged in as
@@ -2780,7 +2780,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
* 343 message looks like:
* :server 343 mynick nick1 nick2 :is opered as
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
if (argc >= 6)
@@ -2818,7 +2818,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2830,14 +2830,14 @@ IRC_PROTOCOL_CALLBACK(331)
{
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 331 message looks like:
* :server 331 mynick #channel :There isn't a topic.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
@@ -2848,7 +2848,7 @@ IRC_PROTOCOL_CALLBACK(331)
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
argv[3]);
-
+
return WEECHAT_RC_OK;
}
@@ -2861,20 +2861,20 @@ IRC_PROTOCOL_CALLBACK(332)
char *pos_topic, *topic_no_color, *topic_color;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 332 message looks like:
* :server 332 mynick #channel :topic of channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_topic = NULL;
if (argc >= 5)
pos_topic = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
-
+
ptr_channel = irc_channel_search (server, argv[3]);
-
+
if (ptr_channel && ptr_channel->nicks)
{
if (pos_topic)
@@ -2890,7 +2890,7 @@ IRC_PROTOCOL_CALLBACK(332)
}
else
ptr_buffer = server->buffer;
-
+
topic_color = NULL;
if (pos_topic)
{
@@ -2910,7 +2910,7 @@ IRC_PROTOCOL_CALLBACK(332)
IRC_COLOR_RESET);
if (topic_color)
free (topic_color);
-
+
return WEECHAT_RC_OK;
}
@@ -2925,30 +2925,30 @@ IRC_PROTOCOL_CALLBACK(333)
time_t datetime;
const char *topic_nick, *topic_address;
int arg_date;
-
+
/*
* 333 message looks like:
* :server 333 mynick #channel nick!user@host 1205428096
* or:
* :server 333 mynick #channel 1205428096
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
topic_nick = (argc > 5) ? irc_message_get_nick_from_host (argv[4]) : NULL;
topic_address = (argc > 5) ? irc_message_get_address_from_host (argv[4]) : NULL;
if (topic_nick && topic_address && strcmp (topic_nick, topic_address) == 0)
topic_address = NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_nick = (ptr_channel) ? irc_nick_search (ptr_channel, topic_nick) : NULL;
arg_date = (argc > 5) ? 5 : 4;
datetime = (time_t)(atol ((argv_eol[arg_date][0] == ':') ?
argv_eol[arg_date] + 1 : argv_eol[arg_date]));
-
+
if (!topic_nick && (datetime == 0))
return WEECHAT_RC_OK;
-
+
if (ptr_channel && ptr_channel->nicks)
{
if (topic_nick)
@@ -3023,7 +3023,7 @@ IRC_PROTOCOL_CALLBACK(333)
weechat_util_get_time_string (&datetime));
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -3037,9 +3037,9 @@ IRC_PROTOCOL_CALLBACK(338)
* 338 message looks like:
* :server 338 mynick nick host :actually using host
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, "whois",
NULL),
@@ -3054,7 +3054,7 @@ IRC_PROTOCOL_CALLBACK(338)
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
IRC_COLOR_CHAT_HOST,
argv[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3068,9 +3068,9 @@ IRC_PROTOCOL_CALLBACK(341)
* 341 message looks like:
* :server 341 mynick nick #channel
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[2],
command, NULL, NULL),
irc_protocol_tags (command, "irc_numeric", NULL),
@@ -3085,7 +3085,7 @@ IRC_PROTOCOL_CALLBACK(341)
IRC_COLOR_CHAT_CHANNEL,
argv[4],
IRC_COLOR_RESET);
-
+
return WEECHAT_RC_OK;
}
@@ -3099,9 +3099,9 @@ IRC_PROTOCOL_CALLBACK(344)
* 344 message looks like:
* :server 344 mynick #channel nick!user@host
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "reop",
NULL),
@@ -3113,7 +3113,7 @@ IRC_PROTOCOL_CALLBACK(344)
IRC_COLOR_RESET,
IRC_COLOR_CHAT_HOST,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3127,9 +3127,9 @@ IRC_PROTOCOL_CALLBACK(345)
* 345 message looks like:
* :server 345 mynick #channel :End of Channel Reop List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
command, "reop",
NULL),
@@ -3140,7 +3140,7 @@ IRC_PROTOCOL_CALLBACK(345)
argv[3],
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
-
+
return WEECHAT_RC_OK;
}
@@ -3153,14 +3153,14 @@ IRC_PROTOCOL_CALLBACK(346)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 346 message looks like:
* :server 346 mynick #channel invitemask nick!user@host 1205590879
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3214,7 +3214,7 @@ IRC_PROTOCOL_CALLBACK(346)
irc_message_get_address_from_host (argv[5]),
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3227,17 +3227,17 @@ IRC_PROTOCOL_CALLBACK(347)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 347 message looks like:
* :server 347 mynick #channel :End of Channel Invite List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3254,7 +3254,7 @@ IRC_PROTOCOL_CALLBACK(347)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3267,15 +3267,15 @@ IRC_PROTOCOL_CALLBACK(348)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 348 message looks like:
* :server 348 mynick #channel nick1!user1@host1 nick2!user2@host2 1205585109
* (nick2 is nick who set exception on nick1)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3323,7 +3323,7 @@ IRC_PROTOCOL_CALLBACK(348)
IRC_COLOR_CHAT_HOST,
argv[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3336,17 +3336,17 @@ IRC_PROTOCOL_CALLBACK(349)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 349 message looks like:
* :server 349 mynick #channel :End of Channel Exception List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3363,7 +3363,7 @@ IRC_PROTOCOL_CALLBACK(349)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3374,17 +3374,17 @@ IRC_PROTOCOL_CALLBACK(349)
IRC_PROTOCOL_CALLBACK(351)
{
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 351 message looks like:
* :server 351 mynick dancer-ircd-1.0.36(2006/07/23_13:11:50). server :iMZ dncrTS/v4
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL, command, NULL,
NULL);
-
+
if (argc > 5)
{
weechat_printf_tags (ptr_buffer,
@@ -3404,7 +3404,7 @@ IRC_PROTOCOL_CALLBACK(351)
argv[3],
argv[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3418,16 +3418,16 @@ IRC_PROTOCOL_CALLBACK(352)
int arg_start, length;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* 352 message looks like:
* :server 352 mynick #channel user host server nick (*) (H/G) :0 flashcode
*/
-
+
arg_start = (strcmp (argv[8], "*") == 0) ? 9 : 8;
-
+
IRC_PROTOCOL_MIN_ARGS(arg_start + 1);
-
+
if (argv[arg_start][0] == ':')
{
pos_attr = NULL;
@@ -3440,10 +3440,10 @@ IRC_PROTOCOL_CALLBACK(352)
pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;
pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;
}
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_nick = (ptr_channel) ? irc_nick_search (ptr_channel, argv[7]) : NULL;
-
+
/* update host for nick */
if (ptr_nick)
{
@@ -3454,7 +3454,7 @@ IRC_PROTOCOL_CALLBACK(352)
if (ptr_nick->host)
snprintf (ptr_nick->host, length, "%s@%s", argv[4], argv[5]);
}
-
+
if (ptr_channel && (ptr_channel->checking_away > 0))
{
if (ptr_nick && pos_attr)
@@ -3492,7 +3492,7 @@ IRC_PROTOCOL_CALLBACK(352)
(pos_hopcount) ? " " : "",
(pos_realname) ? pos_realname : "");
}
-
+
return WEECHAT_RC_OK;
}
@@ -3507,14 +3507,14 @@ IRC_PROTOCOL_CALLBACK(353)
int args, i, away;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/*
* 353 message looks like:
* :server 353 mynick = #channel :mynick nick1 @nick2 +nick3
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
if (irc_channel_is_channel (argv[3]))
{
pos_channel = argv[3];
@@ -3525,32 +3525,32 @@ IRC_PROTOCOL_CALLBACK(353)
pos_channel = argv[4];
args = 5;
}
-
+
IRC_PROTOCOL_MIN_ARGS(args + 1);
-
+
ptr_channel = irc_channel_search (server, pos_channel);
-
+
if (ptr_channel && ptr_channel->nicks)
{
for (i = args; i < argc; i++)
{
pos_nick = (argv[i][0] == ':') ? argv[i] + 1 : argv[i];
pos_nick_orig = pos_nick;
-
+
/* skip prefix(es) */
while (pos_nick[0]
&& (irc_server_get_prefix_char_index (server, pos_nick[0]) >= 0))
{
pos_nick++;
}
-
+
/* extract nick from host */
pos_host = strchr (pos_nick, '!');
if (pos_host)
nickname = weechat_strndup (pos_nick, pos_host - pos_nick);
else
nickname = strdup (pos_nick);
-
+
/* add or update nick on channel */
if (nickname)
{
@@ -3573,7 +3573,7 @@ IRC_PROTOCOL_CALLBACK(353)
}
}
}
-
+
if (!ptr_channel)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -3591,7 +3591,7 @@ IRC_PROTOCOL_CALLBACK(353)
argv_eol[args] + 1 : argv_eol[args],
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3607,14 +3607,14 @@ IRC_PROTOCOL_CALLBACK(366)
int num_nicks, num_op, num_halfop, num_voice, num_normal, length, i;
char *string;
const char *prefix, *prefix_color, *nickname;
-
+
/*
* 366 message looks like:
* :server 366 mynick #channel :End of /NAMES list.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && ptr_channel->nicks)
{
@@ -3704,7 +3704,7 @@ IRC_PROTOCOL_CALLBACK(366)
}
weechat_infolist_free (infolist);
}
-
+
/* display number of nicks, ops, halfops & voices on the channel */
irc_nick_count (server, ptr_channel, &num_nicks, &num_op, &num_halfop,
&num_voice, &num_normal);
@@ -3740,7 +3740,7 @@ IRC_PROTOCOL_CALLBACK(366)
IRC_COLOR_RESET,
NG_("normal", "normals", num_normal),
IRC_COLOR_CHAT_DELIMITERS);
-
+
irc_command_mode_server (server, ptr_channel, NULL);
irc_channel_check_away (server, ptr_channel);
}
@@ -3757,7 +3757,7 @@ IRC_PROTOCOL_CALLBACK(366)
IRC_COLOR_RESET,
(argv[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3770,14 +3770,14 @@ IRC_PROTOCOL_CALLBACK(367)
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
time_t datetime;
-
+
/*
* 367 message looks like:
* :server 367 mynick #channel banmask nick!user@host 1205590879
*/
-
+
IRC_PROTOCOL_MIN_ARGS(5);
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3831,7 +3831,7 @@ IRC_PROTOCOL_CALLBACK(367)
irc_message_get_address_from_host (argv[5]),
IRC_COLOR_CHAT_DELIMITERS);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3844,17 +3844,17 @@ IRC_PROTOCOL_CALLBACK(368)
char *pos_args;
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 368 message looks like:
* :server 368 mynick #channel :End of Channel Ban List
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
pos_args = (argc > 4) ?
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
-
+
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel && ptr_channel->nicks) ?
ptr_channel->buffer : server->buffer;
@@ -3871,7 +3871,7 @@ IRC_PROTOCOL_CALLBACK(368)
IRC_COLOR_RESET,
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
-
+
return WEECHAT_RC_OK;
}
@@ -3883,27 +3883,27 @@ IRC_PROTOCOL_CALLBACK(432)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 432 message looks like:
* :server 432 * mynick :Erroneous Nickname
*/
-
+
irc_protocol_cb_generic_error (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
nick_index = irc_server_get_nick_index (server);
if (nick_index < 0)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -3915,19 +3915,19 @@ IRC_PROTOCOL_CALLBACK(432)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is invalid, "
"trying nickname #%d (\"%s\")"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3939,12 +3939,12 @@ IRC_PROTOCOL_CALLBACK(433)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 433 message looks like:
* :server 433 * mynick :Nickname is already in use.
*/
-
+
if (!server->is_connected)
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
@@ -3955,7 +3955,7 @@ IRC_PROTOCOL_CALLBACK(433)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -3967,15 +3967,15 @@ IRC_PROTOCOL_CALLBACK(433)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s: nickname \"%s\" is already in use, "
"trying nickname #%d (\"%s\")"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
else
@@ -3984,7 +3984,7 @@ IRC_PROTOCOL_CALLBACK(433)
nick, address, host, command,
ignored, argc, argv, argv_eol);
}
-
+
return WEECHAT_RC_OK;
}
@@ -3997,29 +3997,29 @@ IRC_PROTOCOL_CALLBACK(437)
{
int nick_index;
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 437 message looks like:
* :server 437 * mynick :Nick/channel is temporarily unavailable
*/
-
+
irc_protocol_cb_generic_error (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
{
if ((argc >= 4) && (strcmp (server->nick, argv[3]) == 0))
{
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
nick_index = irc_server_get_nick_index (server);
if (nick_index < 0)
nick_index = 0;
else
nick_index = (nick_index + 1) % server->nicks_count;
-
+
if (nick_index == server->nick_first_tried)
{
weechat_printf (ptr_buffer,
@@ -4031,20 +4031,20 @@ IRC_PROTOCOL_CALLBACK(437)
irc_server_disconnect (server, 0, 1);
return WEECHAT_RC_OK;
}
-
+
weechat_printf (ptr_buffer,
_("%s%s: nickname \"%s\" is unavailable, "
"trying nickname #%d (\"%s\")"),
weechat_prefix ("error"),
IRC_PLUGIN_NAME, server->nick, nick_index + 1,
server->nicks_array[nick_index]);
-
+
irc_server_set_nick (server, server->nicks_array[nick_index]);
-
+
irc_server_sendf (server, 0, NULL, "NICK %s", server->nick);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -4056,17 +4056,17 @@ IRC_PROTOCOL_CALLBACK(437)
IRC_PROTOCOL_CALLBACK(438)
{
struct t_gui_buffer *ptr_buffer;
-
+
/*
* 438 message looks like:
* :server 438 mynick newnick :Nick change too fast. Please wait 30 seconds.
*/
-
+
IRC_PROTOCOL_MIN_ARGS(4);
-
+
ptr_buffer = irc_msgbuffer_get_target_buffer (server, NULL,
command, NULL, NULL);
-
+
if (argc >= 5)
{
weechat_printf_tags (ptr_buffer,
@@ -4086,7 +4086,7 @@ IRC_PROTOCOL_CALLBACK(438)
argv[2],
argv[3]);
}
-
+
return WEECHAT_RC_OK;
}
@@ -4100,9 +4100,9 @@ IRC_PROTOCOL_CALLBACK(900)
* 900 message looks like:
* :server 900 mynick nick!user@host mynick :You are now logged in as mynick
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
command, NULL,
NULL),
@@ -4114,7 +4114,7 @@ IRC_PROTOCOL_CALLBACK(900)
IRC_COLOR_CHAT_HOST,
argv[3],
IRC_COLOR_CHAT_DELIMITERS);
-
+
return WEECHAT_RC_OK;
}
@@ -4128,9 +4128,9 @@ IRC_PROTOCOL_CALLBACK(901)
* 901 message looks like:
* :server 901 mynick nick user host :You are now logged in. (id nick, username user, hostname host)
*/
-
+
IRC_PROTOCOL_MIN_ARGS(6);
-
+
if (argc >= 7)
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, NULL,
@@ -4147,7 +4147,7 @@ IRC_PROTOCOL_CALLBACK(901)
nick, address, host, command,
ignored, argc, argv, argv_eol);
}
-
+
return WEECHAT_RC_OK;
}
@@ -4163,14 +4163,14 @@ IRC_PROTOCOL_CALLBACK(sasl_end)
* 904 message looks like:
* :server 904 nick :SASL authentication failed
*/
-
+
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
if (!server->is_connected)
irc_server_sendf (server, 0, NULL, "CAP END");
-
+
return WEECHAT_RC_OK;
}
@@ -4335,14 +4335,14 @@ irc_protocol_recv_command (struct t_irc_server *server,
{ "975", /* whois (secure connection) */ 1, &irc_protocol_cb_server_mode_reason },
{ NULL, 0, NULL }
};
-
+
if (!msg_command)
return;
-
+
dup_irc_message = NULL;
argv = NULL;
argv_eol = NULL;
-
+
/* get nick/host/address from IRC message */
nick1 = NULL;
address1 = NULL;
@@ -4362,7 +4362,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
if (pos_space)
pos_space[0] = '\0';
}
-
+
/* check if message is ignored or not */
ptr_channel = NULL;
if (msg_channel)
@@ -4370,18 +4370,18 @@ irc_protocol_recv_command (struct t_irc_server *server,
message_ignored = irc_ignore_check (server,
(ptr_channel) ? ptr_channel->name : msg_channel,
nick, host);
-
+
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in", msg_command,
irc_message, NULL);
-
+
/* send signal with received command, only if message is not ignored */
if (!message_ignored)
{
irc_server_send_signal (server, "irc_in", msg_command,
irc_message, NULL);
}
-
+
/* look for IRC command */
cmd_found = -1;
for (i = 0; irc_protocol_messages[i].name; i++)
@@ -4392,7 +4392,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
break;
}
}
-
+
/* command not found */
if (cmd_found < 0)
{
@@ -4421,7 +4421,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
decode_color = irc_protocol_messages[cmd_found].decode_color;
cmd_recv_func = irc_protocol_messages[cmd_found].recv_function;
}
-
+
if (cmd_recv_func != NULL)
{
if (irc_message)
@@ -4436,12 +4436,12 @@ irc_protocol_recv_command (struct t_irc_server *server,
dup_irc_message = NULL;
argv = weechat_string_split (dup_irc_message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (dup_irc_message, " ", 1, 0, NULL);
-
+
return_code = (int) (cmd_recv_func) (server,
nick, address, host, cmd_name,
message_ignored,
argc, argv, argv_eol);
-
+
if (return_code == WEECHAT_RC_ERROR)
{
weechat_printf (server->buffer,
@@ -4453,7 +4453,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
"%s%s",
weechat_prefix ("error"), irc_message);
}
-
+
/* send signal with received command (if message is not ignored) */
if (!message_ignored)
{
@@ -4461,11 +4461,11 @@ irc_protocol_recv_command (struct t_irc_server *server,
irc_message, NULL);
}
}
-
+
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in2", msg_command,
irc_message, NULL);
-
+
end:
if (nick)
free (nick);
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 051c85667..a5f5a5117 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -67,7 +67,7 @@ void
irc_raw_open (int switch_to_buffer)
{
struct t_irc_raw_message *ptr_raw_message;
-
+
if (!irc_raw_buffer)
{
irc_raw_buffer = weechat_buffer_search (IRC_PLUGIN_NAME,
@@ -77,14 +77,14 @@ irc_raw_open (int switch_to_buffer)
irc_raw_buffer = weechat_buffer_new (IRC_RAW_BUFFER_NAME,
&irc_input_data_cb, NULL,
&irc_buffer_close_cb, NULL);
-
+
/* failed to create buffer ? then return */
if (!irc_raw_buffer)
return;
-
+
weechat_buffer_set (irc_raw_buffer,
"title", _("IRC raw messages"));
-
+
if (!weechat_buffer_get_integer (irc_raw_buffer, "short_name_is_set"))
{
weechat_buffer_set (irc_raw_buffer, "short_name",
@@ -94,7 +94,7 @@ irc_raw_open (int switch_to_buffer)
weechat_buffer_set (irc_raw_buffer, "localvar_set_server", IRC_RAW_BUFFER_NAME);
weechat_buffer_set (irc_raw_buffer, "localvar_set_channel", IRC_RAW_BUFFER_NAME);
weechat_buffer_set (irc_raw_buffer, "localvar_set_no_log", "1");
-
+
/* disable all highlights on this buffer */
weechat_buffer_set (irc_raw_buffer, "highlight_words", "-");
@@ -106,7 +106,7 @@ irc_raw_open (int switch_to_buffer)
}
}
}
-
+
if (irc_raw_buffer && switch_to_buffer)
weechat_buffer_set (irc_raw_buffer, "display", "1");
}
@@ -119,7 +119,7 @@ void
irc_raw_message_free (struct t_irc_raw_message *raw_message)
{
struct t_irc_raw_message *new_raw_messages;
-
+
/* remove message from raw messages list */
if (last_irc_raw_message == raw_message)
last_irc_raw_message = raw_message->prev_message;
@@ -130,20 +130,20 @@ irc_raw_message_free (struct t_irc_raw_message *raw_message)
}
else
new_raw_messages = raw_message->next_message;
-
+
if (raw_message->next_message)
(raw_message->next_message)->prev_message = raw_message->prev_message;
-
+
/* free data */
if (raw_message->prefix)
free (raw_message->prefix);
if (raw_message->message)
free (raw_message->message);
-
+
free (raw_message);
-
+
irc_raw_messages = new_raw_messages;
-
+
irc_raw_messages_count--;
}
@@ -168,7 +168,7 @@ void
irc_raw_message_remove_old ()
{
int max_messages;
-
+
max_messages = weechat_config_integer (irc_config_look_raw_messages);
while (irc_raw_messages && (irc_raw_messages_count >= max_messages))
{
@@ -185,19 +185,19 @@ irc_raw_message_add_to_list (time_t date, const char *prefix,
const char *message)
{
struct t_irc_raw_message *new_raw_message;
-
+
if (!prefix || !message)
return NULL;
-
+
irc_raw_message_remove_old ();
-
+
new_raw_message = malloc (sizeof (*new_raw_message));
if (new_raw_message)
{
new_raw_message->date = date;
new_raw_message->prefix = strdup (prefix);
new_raw_message->message = strdup (message);
-
+
/* add message to list */
new_raw_message->prev_message = last_irc_raw_message;
new_raw_message->next_message = NULL;
@@ -206,10 +206,10 @@ irc_raw_message_add_to_list (time_t date, const char *prefix,
else
irc_raw_messages = new_raw_message;
last_irc_raw_message = new_raw_message;
-
+
irc_raw_messages_count++;
}
-
+
return new_raw_message;
}
@@ -226,7 +226,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
const char *hexa = "0123456789ABCDEF";
int pos_buf, pos_buf2, char_size, i;
struct t_irc_raw_message *new_raw_message;
-
+
buf = weechat_iconv_to_internal (NULL, message);
buf2 = malloc ((strlen (buf) * 3) + 1);
if (buf2)
@@ -282,7 +282,7 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
strcpy (prefix_arrow, IRC_RAW_PREFIX_SEND);
break;
}
-
+
snprintf (prefix, sizeof (prefix), "%s%s%s%s%s",
(server) ? weechat_color ("chat_server") : "",
(server) ? server->name : "",
@@ -291,16 +291,16 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
weechat_color ("chat_prefix_quit") :
weechat_color ("chat_prefix_join"),
prefix_arrow);
-
+
new_raw_message = irc_raw_message_add_to_list (time (NULL),
prefix,
(buf2) ? buf2 : ((buf) ? buf : message));
-
+
if (buf)
free (buf);
if (buf2)
free (buf2);
-
+
return new_raw_message;
}
@@ -313,14 +313,14 @@ irc_raw_print (struct t_irc_server *server, int flags,
const char *message)
{
struct t_irc_raw_message *new_raw_message;
-
+
if (!message)
return;
/* auto-open IRC raw buffer if debug for irc plugin is >= 1 */
if (!irc_raw_buffer && (weechat_irc_plugin->debug >= 1))
irc_raw_open (0);
-
+
new_raw_message = irc_raw_message_add (server, flags, message);
if (new_raw_message)
{
@@ -341,20 +341,20 @@ irc_raw_add_to_infolist (struct t_infolist *infolist,
struct t_irc_raw_message *raw_message)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !raw_message)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_time (ptr_item, "date", raw_message->date))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "prefix", raw_message->prefix))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "message", raw_message->message))
return 0;
-
+
return 1;
}
diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c
index bb1ecf2aa..2b26dbcad 100644
--- a/src/plugins/irc/irc-redirect.c
+++ b/src/plugins/irc/irc-redirect.c
@@ -249,17 +249,17 @@ struct t_irc_redirect_pattern *
irc_redirect_pattern_search (const char *name)
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
-
+
if (!name)
return NULL;
-
+
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
{
if (strcmp (ptr_redirect_pattern->name, name) == 0)
return ptr_redirect_pattern;
}
-
+
/* redirect pattern not found */
return NULL;
}
@@ -274,10 +274,10 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
const char *cmd_extra)
{
struct t_irc_redirect_pattern *ptr_redirect_pattern, *new_redirect_pattern;
-
+
if (!name)
return NULL;
-
+
if (!cmd_stop || !cmd_stop[0])
{
weechat_printf (NULL,
@@ -286,7 +286,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
"cmd_stop");
return NULL;
}
-
+
/* check if redirect pattern already exists */
ptr_redirect_pattern = irc_redirect_pattern_search (name);
if (ptr_redirect_pattern)
@@ -297,11 +297,11 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
name);
return NULL;
}
-
+
new_redirect_pattern = malloc (sizeof (*new_redirect_pattern));
if (!new_redirect_pattern)
return NULL;
-
+
/* initialize new redirect */
new_redirect_pattern->name = strdup (name);
new_redirect_pattern->temp_pattern = temp_pattern;
@@ -309,7 +309,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
new_redirect_pattern->cmd_start = (cmd_start) ? strdup (cmd_start) : NULL;
new_redirect_pattern->cmd_stop = strdup (cmd_stop);
new_redirect_pattern->cmd_extra = (cmd_extra) ? strdup (cmd_extra) : NULL;
-
+
/* add redirect pattern to end of list */
new_redirect_pattern->prev_redirect = last_irc_redirect_pattern;
if (irc_redirect_patterns)
@@ -318,7 +318,7 @@ irc_redirect_pattern_new (const char *name, int temp_pattern, int timeout,
irc_redirect_patterns = new_redirect_pattern;
last_irc_redirect_pattern = new_redirect_pattern;
new_redirect_pattern->next_redirect = NULL;
-
+
return new_redirect_pattern;
}
@@ -330,10 +330,10 @@ void
irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
{
struct t_irc_redirect_pattern *new_redirect_patterns;
-
+
if (!redirect_pattern)
return;
-
+
/* remove redirect */
if (last_irc_redirect_pattern == redirect_pattern)
last_irc_redirect_pattern = redirect_pattern->prev_redirect;
@@ -344,10 +344,10 @@ irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
}
else
new_redirect_patterns = redirect_pattern->next_redirect;
-
+
if (redirect_pattern->next_redirect)
(redirect_pattern->next_redirect)->prev_redirect = redirect_pattern->prev_redirect;
-
+
/* free data */
if (redirect_pattern->name)
free (redirect_pattern->name);
@@ -357,9 +357,9 @@ irc_redirect_pattern_free (struct t_irc_redirect_pattern *redirect_pattern)
free (redirect_pattern->cmd_stop);
if (redirect_pattern->cmd_extra)
free (redirect_pattern->cmd_extra);
-
+
free (redirect_pattern);
-
+
irc_redirect_patterns = new_redirect_patterns;
}
@@ -396,11 +396,11 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
int i, j, num_items[4];
long value;
struct t_hashtable *hash_cmd[4];
-
+
new_redirect = malloc (sizeof (*new_redirect));
if (!new_redirect)
return NULL;
-
+
/* create hashtables with commands */
for (i = 0; i < 4; i++)
{
@@ -448,7 +448,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
weechat_string_free_split (items[i]);
}
}
-
+
/* initialize new redirect */
new_redirect->server = server;
new_redirect->pattern = strdup (pattern);
@@ -467,7 +467,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
new_redirect->cmd_filter = hash_cmd[3];
new_redirect->output = NULL;
new_redirect->output_size = 0;
-
+
/* add redirect to end of list */
new_redirect->prev_redirect = server->last_redirect;
if (server->redirects)
@@ -476,7 +476,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
server->redirects = new_redirect;
server->last_redirect = new_redirect;
new_redirect->next_redirect = NULL;
-
+
return new_redirect;
}
@@ -492,7 +492,7 @@ irc_redirect_new (struct t_irc_server *server,
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
struct t_irc_redirect *new_redirect;
-
+
if (!server->is_connected)
{
weechat_printf (NULL,
@@ -501,7 +501,7 @@ irc_redirect_new (struct t_irc_server *server,
server->name);
return NULL;
}
-
+
if (!pattern || !pattern[0])
{
weechat_printf (NULL, _("%s%s: missing argument \"%s\" for redirect"),
@@ -514,7 +514,7 @@ irc_redirect_new (struct t_irc_server *server,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "signal");
return NULL;
}
-
+
ptr_redirect_pattern = irc_redirect_pattern_search (pattern);
if (!ptr_redirect_pattern)
{
@@ -523,7 +523,7 @@ irc_redirect_new (struct t_irc_server *server,
pattern);
return NULL;
}
-
+
new_redirect = irc_redirect_new_with_commands (server, pattern, signal,
count, string,
(timeout > 0) ? timeout : ptr_redirect_pattern->timeout,
@@ -531,14 +531,14 @@ irc_redirect_new (struct t_irc_server *server,
ptr_redirect_pattern->cmd_stop,
ptr_redirect_pattern->cmd_extra,
cmd_filter);
-
+
/*
* remove redirect pattern if it is temporary (created by external
* plugin/script)
*/
if (new_redirect && ptr_redirect_pattern->temp_pattern)
irc_redirect_pattern_free (ptr_redirect_pattern);
-
+
return new_redirect;
}
@@ -550,17 +550,17 @@ struct t_irc_redirect *
irc_redirect_search_available (struct t_irc_server *server)
{
struct t_irc_redirect *ptr_redirect;
-
+
if (!server)
return NULL;
-
+
for (ptr_redirect = server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
{
if (ptr_redirect->start_time == 0)
return ptr_redirect;
}
-
+
/* no redirect available */
return NULL;
}
@@ -575,10 +575,10 @@ irc_redirect_init_command (struct t_irc_redirect *redirect,
const char *command)
{
char *pos;
-
+
if (!redirect)
return;
-
+
if (command)
{
pos = strchr (command, '\r');
@@ -591,9 +591,9 @@ irc_redirect_init_command (struct t_irc_redirect *redirect,
}
else
redirect->command = NULL;
-
+
redirect->start_time = time (NULL);
-
+
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (redirect->server->buffer,
@@ -618,11 +618,11 @@ irc_redirect_message_match_hash (struct t_irc_redirect *redirect,
struct t_hashtable *cmd_hash)
{
int *value;
-
+
value = weechat_hashtable_get (cmd_hash, command);
if (!value)
return 0;
-
+
/*
* if string is in redirect and that this command requires string to
* be in message, then search for this string
@@ -631,11 +631,11 @@ irc_redirect_message_match_hash (struct t_irc_redirect *redirect,
{
if (!arguments_argv || (*value >= arguments_argc))
return 0;
-
+
if (weechat_strcasecmp (arguments_argv[*value], redirect->string) != 0)
return 0;
}
-
+
return 1;
}
@@ -648,7 +648,7 @@ irc_redirect_message_add (struct t_irc_redirect *redirect, const char *message,
const char *command)
{
char *output2;
-
+
/*
* if command is not for output, then don't add message
* (it is silently ignored)
@@ -656,7 +656,7 @@ irc_redirect_message_add (struct t_irc_redirect *redirect, const char *message,
if (redirect->cmd_filter
&& !weechat_hashtable_has_key (redirect->cmd_filter, command))
return;
-
+
/* add message to output */
if (redirect->output)
{
@@ -716,21 +716,21 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error)
(redirect->output) ? redirect->output : "");
snprintf (str_int, sizeof (str_int), "%d", redirect->output_size);
weechat_hashtable_set (hashtable, "output_size", str_int);
-
+
/* set some other fields with values from redirect */
weechat_hashtable_set (hashtable, "server", redirect->server->name);
weechat_hashtable_set (hashtable, "pattern", redirect->pattern);
weechat_hashtable_set (hashtable, "signal", redirect->signal);
weechat_hashtable_set (hashtable, "command", redirect->command);
}
-
+
snprintf (signal_name, sizeof (signal_name), "irc_redirection_%s_%s",
redirect->signal, redirect->pattern);
weechat_hook_hsignal_send (signal_name, hashtable);
-
+
if (hashtable)
weechat_hashtable_free (hashtable);
-
+
irc_redirect_free (redirect);
}
else
@@ -760,10 +760,10 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
struct t_irc_redirect *ptr_redirect, *ptr_next_redirect;
int rc, match_stop, arguments_argc;
char **arguments_argv;
-
+
if (!server || !server->redirects || !message || !command)
return 0;
-
+
rc = 0;
if (arguments && arguments[0])
@@ -776,12 +776,12 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
arguments_argv = NULL;
arguments_argc = 0;
}
-
+
ptr_redirect = server->redirects;
while (ptr_redirect)
{
ptr_next_redirect = ptr_redirect->next_redirect;
-
+
if (ptr_redirect->start_time > 0)
{
if (ptr_redirect->cmd_stop_received)
@@ -870,14 +870,14 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
}
}
}
-
+
ptr_redirect = ptr_next_redirect;
}
-
+
end:
if (arguments_argv)
weechat_string_free_split (arguments_argv);
-
+
return rc;
}
@@ -892,12 +892,12 @@ irc_redirect_free (struct t_irc_redirect *redirect)
struct t_irc_redirect *new_redirects;
int priority;
struct t_irc_outqueue *ptr_outqueue;
-
+
if (!redirect)
return;
-
+
server = redirect->server;
-
+
/* remove redirect */
if (server->last_redirect == redirect)
server->last_redirect = redirect->prev_redirect;
@@ -908,10 +908,10 @@ irc_redirect_free (struct t_irc_redirect *redirect)
}
else
new_redirects = redirect->next_redirect;
-
+
if (redirect->next_redirect)
(redirect->next_redirect)->prev_redirect = redirect->prev_redirect;
-
+
/* remove any pointer to this redirect */
for (priority = 0; priority < IRC_SERVER_NUM_OUTQUEUES_PRIO; priority++)
{
@@ -922,7 +922,7 @@ irc_redirect_free (struct t_irc_redirect *redirect)
ptr_outqueue->redirect = NULL;
}
}
-
+
/* free data */
if (redirect->pattern)
free (redirect->pattern);
@@ -942,9 +942,9 @@ irc_redirect_free (struct t_irc_redirect *redirect)
weechat_hashtable_free (redirect->cmd_filter);
if (redirect->output)
free (redirect->output);
-
+
free (redirect);
-
+
server->redirects = new_redirects;
}
@@ -969,10 +969,10 @@ struct t_hdata *
irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
@@ -998,10 +998,10 @@ struct t_hdata *
irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
@@ -1038,14 +1038,14 @@ irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect_pattern *redirect_pattern)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !redirect_pattern)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", redirect_pattern->name))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "temp_pattern", redirect_pattern->temp_pattern))
@@ -1058,7 +1058,7 @@ irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "cmd_extra", redirect_pattern->cmd_extra))
return 0;
-
+
return 1;
}
@@ -1072,14 +1072,14 @@ irc_redirect_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect *redirect)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !redirect)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_pointer (ptr_item, "server", redirect->server))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "server_name", redirect->server->name))
@@ -1116,7 +1116,7 @@ irc_redirect_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "output_size", redirect->output_size))
return 0;
-
+
return 1;
}
@@ -1129,7 +1129,7 @@ void
irc_redirect_pattern_print_log ()
{
struct t_irc_redirect_pattern *ptr_redirect_pattern;
-
+
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
{
@@ -1154,7 +1154,7 @@ void
irc_redirect_print_log (struct t_irc_server *server)
{
struct t_irc_redirect *ptr_redirect;
-
+
for (ptr_redirect = server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
{
@@ -1205,20 +1205,20 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra;
char *error;
int number, timeout;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (!hashtable)
return WEECHAT_RC_ERROR;
-
+
pattern = weechat_hashtable_get (hashtable, "pattern");
str_timeout = weechat_hashtable_get (hashtable, "timeout");
cmd_start = weechat_hashtable_get (hashtable, "cmd_start");
cmd_stop = weechat_hashtable_get (hashtable, "cmd_stop");
cmd_extra = weechat_hashtable_get (hashtable, "cmd_extra");
-
+
if (!pattern || !pattern[0])
{
weechat_printf (NULL,
@@ -1236,7 +1236,7 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
weechat_prefix ("error"), IRC_PLUGIN_NAME, "cmd_stop");
return WEECHAT_RC_ERROR;
}
-
+
timeout = 0;
if (str_timeout && str_timeout[0])
{
@@ -1244,14 +1244,14 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
timeout = number;
}
-
+
/*
* create a temporary redirect pattern (it will be removed when a
* redirect will use it)
*/
irc_redirect_pattern_new (pattern, 1, timeout,
cmd_start, cmd_stop, cmd_extra);
-
+
return WEECHAT_RC_OK;
}
@@ -1271,14 +1271,14 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
char *error;
struct t_irc_server *ptr_server;
int number, count, timeout;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (!hashtable)
return WEECHAT_RC_ERROR;
-
+
server = weechat_hashtable_get (hashtable, "server");
pattern = weechat_hashtable_get (hashtable, "pattern");
redirect_signal = weechat_hashtable_get (hashtable, "signal");
@@ -1286,7 +1286,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
string = weechat_hashtable_get (hashtable, "string");
str_timeout = weechat_hashtable_get (hashtable, "timeout");
cmd_filter = weechat_hashtable_get (hashtable, "cmd_filter");
-
+
if (!server || !server[0])
{
weechat_printf (NULL,
@@ -1302,7 +1302,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
weechat_prefix ("error"), IRC_PLUGIN_NAME, server);
return WEECHAT_RC_ERROR;
}
-
+
count = 1;
if (str_count && str_count[0])
{
@@ -1310,7 +1310,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
count = number;
}
-
+
timeout = 0;
if (str_timeout && str_timeout[0])
{
@@ -1318,10 +1318,10 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
if (error && !error[0])
timeout = number;
}
-
+
irc_redirect_new (ptr_server, pattern, redirect_signal,
count, string, timeout, cmd_filter);
-
+
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c
index e54013945..5a7265140 100644
--- a/src/plugins/irc/irc-sasl.c
+++ b/src/plugins/irc/irc-sasl.c
@@ -51,7 +51,7 @@ irc_sasl_mechanism_plain (const char *sasl_username, const char *sasl_password)
{
char *string, *answer_base64;
int length_username, length;
-
+
answer_base64 = NULL;
length_username = strlen (sasl_username);
length = ((length_username + 1) * 2) + strlen (sasl_password) + 1;
@@ -62,14 +62,14 @@ irc_sasl_mechanism_plain (const char *sasl_username, const char *sasl_password)
sasl_username, sasl_username, sasl_password);
string[length_username] = '\0';
string[(length_username * 2) + 1] = '\0';
-
+
answer_base64 = malloc (length * 4);
if (answer_base64)
weechat_string_encode_base64 (string, length - 1, answer_base64);
-
+
free (string);
}
-
+
return answer_base64;
}
@@ -101,7 +101,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_t data_prime_number, data_generator_number, data_server_pub_key;
gcry_mpi_t pub_key, priv_key, secret_mpi;
gcry_cipher_hd_t gcrypt_handle;
-
+
data = NULL;
secret_bin = NULL;
public_bin = NULL;
@@ -109,12 +109,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
password_crypted = NULL;
answer = NULL;
answer_base64 = NULL;
-
+
/* decode data */
data = malloc (strlen (data_base64) + 1);
length_data = weechat_string_decode_base64 (data_base64, data);
ptr_data = (unsigned char *)data;
-
+
/* extract prime number */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -126,7 +126,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
num_bits_prime_number = gcry_mpi_get_nbits (data_prime_number);
ptr_data += size;
length_data -= size;
-
+
/* extract generator number */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -137,7 +137,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_scan (&data_generator_number, GCRYMPI_FMT_USG, ptr_data, size, NULL);
ptr_data += size;
length_data -= size;
-
+
/* extract server-generated public key */
size = ntohs ((((unsigned int)ptr_data[1]) << 8) | ptr_data[0]);
ptr_data += 2;
@@ -146,14 +146,14 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
goto end;
data_server_pub_key = gcry_mpi_new (size * 8);
gcry_mpi_scan (&data_server_pub_key, GCRYMPI_FMT_USG, ptr_data, size, NULL);
-
+
/* generate keys */
pub_key = gcry_mpi_new (num_bits_prime_number);
priv_key = gcry_mpi_new (num_bits_prime_number);
gcry_mpi_randomize (priv_key, num_bits_prime_number, GCRY_STRONG_RANDOM);
/* pub_key = (g ^ priv_key) % p */
gcry_mpi_powm (pub_key, data_generator_number, priv_key, data_prime_number);
-
+
/* compute secret_bin */
length_key = num_bits_prime_number / 8;
secret_bin = malloc (length_key);
@@ -162,12 +162,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
gcry_mpi_powm (secret_mpi, data_server_pub_key, priv_key, data_prime_number);
gcry_mpi_print (GCRYMPI_FMT_USG, secret_bin, length_key,
&num_written, secret_mpi);
-
+
/* create public_bin */
public_bin = malloc (length_key);
gcry_mpi_print (GCRYMPI_FMT_USG, public_bin, length_key,
&num_written, pub_key);
-
+
/* create password buffers (clear and crypted) */
length_password = strlen (sasl_password) +
((8 - (strlen (sasl_password) % 8)) % 8);
@@ -176,7 +176,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
memset (password_clear, 0, length_password);
memset (password_crypted, 0, length_password);
memcpy (password_clear, sasl_password, strlen (sasl_password));
-
+
/* crypt password using blowfish */
if (gcry_cipher_open (&gcrypt_handle, GCRY_CIPHER_BLOWFISH,
GCRY_CIPHER_MODE_ECB, 0) != 0)
@@ -187,7 +187,7 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
password_crypted, length_password,
password_clear, length_password) != 0)
goto end;
-
+
/*
* build answer for server, it is concatenation of:
* 1. key length (2 bytes)
@@ -206,12 +206,12 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
memcpy (ptr_answer, sasl_username, length_username + 1);
ptr_answer += length_username + 1;
memcpy (ptr_answer, password_crypted, length_password);
-
+
/* encode answer to base64 */
answer_base64 = malloc (length_answer * 4);
if (answer_base64)
weechat_string_encode_base64 (answer, length_answer, answer_base64);
-
+
end:
if (data)
free (data);
@@ -225,14 +225,14 @@ end:
free (password_crypted);
if (answer)
free (answer);
-
+
return answer_base64;
#else
/* make C compiler happy */
(void) data_base64;
(void) sasl_username;
(void) sasl_password;
-
+
return NULL;
#endif
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index b747ef940..d4ce9ae41 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -116,17 +116,17 @@ int
irc_server_valid (struct t_irc_server *server)
{
struct t_irc_server *ptr_server;
-
+
if (!server)
return 0;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server == server)
return 1;
}
-
+
/* server not found */
return 0;
}
@@ -142,17 +142,17 @@ int
irc_server_search_option (const char *option_name)
{
int i;
-
+
if (!option_name)
return -1;
-
+
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
if (weechat_strcasecmp (irc_server_option_string[i],
option_name) == 0)
return i;
}
-
+
/* server option not found */
return -1;
}
@@ -166,12 +166,12 @@ int
irc_server_sasl_enabled (struct t_irc_server *server)
{
const char *sasl_username, *sasl_password;
-
+
sasl_username = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_USERNAME);
sasl_password = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SASL_PASSWORD);
-
+
/* SASL is enabled if username AND password are set */
return (sasl_username && sasl_username[0]
&& sasl_password && sasl_password[0]) ? 1 : 0;
@@ -186,14 +186,14 @@ char *
irc_server_get_name_without_port (const char *name)
{
char *pos;
-
+
if (!name)
return NULL;
-
+
pos = strchr (name, '/');
if (pos && (pos != name))
return weechat_strndup (name, pos - name);
-
+
return strdup (name);
}
@@ -207,7 +207,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
int i;
char *pos, *error;
long number;
-
+
/* free data */
server->addresses_count = 0;
if (server->addresses_array)
@@ -220,7 +220,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
free (server->ports_array);
server->ports_array = NULL;
}
-
+
/* set new addresses/ports */
if (addresses && addresses[0])
{
@@ -261,7 +261,7 @@ irc_server_set_index_current_address (struct t_irc_server *server, int index)
server->current_address = NULL;
}
server->current_port = 0;
-
+
if (index < server->addresses_count)
{
server->index_current_address = index;
@@ -286,7 +286,7 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
weechat_string_free_split (server->nicks_array);
server->nicks_array = NULL;
}
-
+
/* set new nicks */
server->nicks_array = weechat_string_split ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS,
",", 0, 0,
@@ -301,11 +301,11 @@ void
irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->nick)
free (server->nick);
server->nick = (nick) ? strdup (nick) : NULL;
-
+
/* set local variable "nick" for server and all channels/pv */
weechat_buffer_set (server->buffer, "localvar_set_nick", nick);
for (ptr_channel = server->channels; ptr_channel;
@@ -313,7 +313,7 @@ irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
weechat_buffer_set (ptr_channel->buffer, "localvar_set_nick", nick);
}
-
+
weechat_bar_item_update ("input_prompt");
}
@@ -327,10 +327,10 @@ int
irc_server_get_nick_index (struct t_irc_server *server)
{
int i;
-
+
if (!server->nick)
return -1;
-
+
for (i = 0; i < server->nicks_count; i++)
{
if (strcmp (server->nick, server->nicks_array[i]) == 0)
@@ -338,7 +338,7 @@ irc_server_get_nick_index (struct t_irc_server *server)
return i;
}
}
-
+
/* nick not found */
return -1;
}
@@ -357,7 +357,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
char feature2[64], *pos_feature, *pos_equal, *pos_space;
int length;
static char value[256];
-
+
if (!server || !server->isupport || !feature)
return NULL;
@@ -380,7 +380,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
value[length] = '\0';
return value;
}
-
+
/* search feature without value */
feature2[strlen (feature2) - 1] = ' ';
pos_feature = strstr (server->isupport, feature2);
@@ -389,7 +389,7 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
value[0] = '\0';
return value;
}
-
+
/* feature not found in isupport */
return NULL;
}
@@ -409,10 +409,10 @@ irc_server_set_prefix_modes_chars (struct t_irc_server *server,
{
char *pos;
int i, length_modes, length_chars;
-
+
if (!server || !prefix)
return;
-
+
/* free previous values */
if (server->prefix_modes)
{
@@ -424,7 +424,7 @@ irc_server_set_prefix_modes_chars (struct t_irc_server *server,
free (server->prefix_chars);
server->prefix_chars = NULL;
}
-
+
/* assign new values */
pos = strchr (prefix, ')');
if (pos)
@@ -488,7 +488,7 @@ irc_server_get_prefix_mode_index (struct t_irc_server *server, char mode)
{
const char *prefix_modes;
char *pos;
-
+
if (server)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -496,7 +496,7 @@ irc_server_get_prefix_mode_index (struct t_irc_server *server, char mode)
if (pos)
return pos - prefix_modes;
}
-
+
return -1;
}
@@ -512,7 +512,7 @@ irc_server_get_prefix_char_index (struct t_irc_server *server,
{
const char *prefix_chars;
char *pos;
-
+
if (server)
{
prefix_chars = irc_server_get_prefix_chars (server);
@@ -520,7 +520,7 @@ irc_server_get_prefix_char_index (struct t_irc_server *server,
if (pos)
return pos - prefix_chars;
}
-
+
return -1;
}
@@ -536,7 +536,7 @@ irc_server_get_prefix_mode_for_char (struct t_irc_server *server,
{
const char *prefix_modes;
int index;
-
+
if (server)
{
prefix_modes = irc_server_get_prefix_modes (server);
@@ -544,7 +544,7 @@ irc_server_get_prefix_mode_for_char (struct t_irc_server *server,
if (index >= 0)
return prefix_modes[index];
}
-
+
return ' ';
}
@@ -558,7 +558,7 @@ irc_server_get_prefix_char_for_mode (struct t_irc_server *server, char mode)
{
const char *prefix_chars;
int index;
-
+
if (server)
{
prefix_chars = irc_server_get_prefix_chars (server);
@@ -566,7 +566,7 @@ irc_server_get_prefix_char_for_mode (struct t_irc_server *server, char mode)
if (index >= 0)
return prefix_chars[index];
}
-
+
return ' ';
}
@@ -580,10 +580,10 @@ irc_server_alloc (const char *name)
struct t_irc_server *new_server;
int i, length;
char *option_name;
-
+
if (irc_server_search (name))
return NULL;
-
+
/* alloc memory for new server */
new_server = malloc (sizeof (*new_server));
if (!new_server)
@@ -593,7 +593,7 @@ irc_server_alloc (const char *name)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return NULL;
}
-
+
/* add new server to queue */
new_server->prev_server = last_irc_server;
new_server->next_server = NULL;
@@ -602,10 +602,10 @@ irc_server_alloc (const char *name)
else
irc_servers = new_server;
last_irc_server = new_server;
-
+
/* set name */
new_server->name = strdup (name);
-
+
/* internal vars */
new_server->temp_server = 0;
new_server->reloading_from_config = 0;
@@ -669,7 +669,7 @@ irc_server_alloc (const char *name)
new_server->buffer_as_string = NULL;
new_server->channels = NULL;
new_server->last_channel = NULL;
-
+
/* create options with null value */
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
@@ -698,7 +698,7 @@ irc_server_alloc (const char *name)
free (option_name);
}
}
-
+
return new_server;
}
@@ -717,21 +717,21 @@ irc_server_alloc_with_url (const char *irc_url)
char *server_address, *server_nicks, *server_autojoin;
int ipv6, ssl, length;
struct t_irc_server *ptr_server;
-
+
irc_url2 = strdup (irc_url);
if (!irc_url2)
return 0;
-
+
pos_server = NULL;
pos_nick = NULL;
pos_password = NULL;
pos_address = NULL;
pos_port = NULL;
pos_channel = NULL;
-
+
ipv6 = 0;
ssl = 0;
-
+
pos_server = strstr (irc_url2, "://");
if (!pos_server)
{
@@ -740,7 +740,7 @@ irc_server_alloc_with_url (const char *irc_url)
}
pos_server[0] = '\0';
pos_server += 3;
-
+
pos_channel = strstr (pos_server, "/");
if (pos_channel)
{
@@ -751,7 +751,7 @@ irc_server_alloc_with_url (const char *irc_url)
pos_channel++;
}
}
-
+
/* check for SSL / IPv6 */
if (weechat_strcasecmp (irc_url2, "irc6") == 0)
{
@@ -767,7 +767,7 @@ irc_server_alloc_with_url (const char *irc_url)
ipv6 = 1;
ssl = 1;
}
-
+
/* search for nick, password, address+port */
pos_address = strchr (pos_server, '@');
if (pos_address)
@@ -784,7 +784,7 @@ irc_server_alloc_with_url (const char *irc_url)
}
else
pos_address = pos_server;
-
+
/*
* search for port in address, and skip optional [ ] around address
* (can be used to indicate IPv6 port, after ']')
@@ -816,7 +816,7 @@ irc_server_alloc_with_url (const char *irc_url)
pos_port++;
}
}
-
+
ptr_server = irc_server_alloc (pos_address);
if (ptr_server)
{
@@ -897,9 +897,9 @@ irc_server_alloc_with_url (const char *irc_url)
weechat_prefix ("error"), IRC_PLUGIN_NAME,
pos_address);
}
-
+
free (irc_url2);
-
+
return (ptr_server) ? 1 : 0;
}
@@ -919,7 +919,7 @@ irc_server_apply_command_line_options (struct t_irc_server *server,
{
int i, index_option;
char *pos, *option_name, *ptr_value, *value_boolean[2] = { "off", "on" };
-
+
for (i = 0; i < argc; i++)
{
if (argv[i][0] == '-')
@@ -981,7 +981,7 @@ irc_server_outqueue_add (struct t_irc_server *server, int priority,
new_outqueue->modified = modified;
new_outqueue->tags = (tags) ? strdup (tags) : NULL;
new_outqueue->redirect = redirect;
-
+
new_outqueue->prev_outqueue = server->last_outqueue[priority];
new_outqueue->next_outqueue = NULL;
if (server->outqueue[priority])
@@ -1002,7 +1002,7 @@ irc_server_outqueue_free (struct t_irc_server *server,
struct t_irc_outqueue *outqueue)
{
struct t_irc_outqueue *new_outqueue;
-
+
/* remove outqueue message */
if (server->last_outqueue[priority] == outqueue)
server->last_outqueue[priority] = outqueue->prev_outqueue;
@@ -1013,10 +1013,10 @@ irc_server_outqueue_free (struct t_irc_server *server,
}
else
new_outqueue = outqueue->next_outqueue;
-
+
if (outqueue->next_outqueue)
(outqueue->next_outqueue)->prev_outqueue = outqueue->prev_outqueue;
-
+
/* free data */
if (outqueue->command)
free (outqueue->command);
@@ -1052,10 +1052,10 @@ void
irc_server_free_data (struct t_irc_server *server)
{
int i;
-
+
if (!server)
return;
-
+
/* free data */
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
@@ -1122,13 +1122,13 @@ void
irc_server_free (struct t_irc_server *server)
{
struct t_irc_server *new_irc_servers;
-
+
if (!server)
return;
-
+
/* close all channels/privates */
irc_channel_free_all (server);
-
+
/* remove server from queue */
if (last_irc_server == server)
last_irc_server = server->prev_server;
@@ -1139,10 +1139,10 @@ irc_server_free (struct t_irc_server *server)
}
else
new_irc_servers = server->next_server;
-
+
if (server->next_server)
(server->next_server)->prev_server = server->prev_server;
-
+
irc_server_free_data (server);
free (server);
irc_servers = new_irc_servers;
@@ -1175,11 +1175,11 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
char *mask, *pos;
const char *option_name;
int length, index_option;
-
+
/* check if another server exists with this name */
if (irc_server_search (new_name))
return NULL;
-
+
new_server = irc_server_alloc (new_name);
if (new_server)
{
@@ -1214,7 +1214,7 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
weechat_infolist_free (infolist);
}
}
-
+
return new_server;
}
@@ -1233,11 +1233,11 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
struct t_infolist *infolist;
struct t_config_option *ptr_option;
struct t_irc_channel *ptr_channel;
-
+
/* check if another server exists with this name */
if (irc_server_search (new_server_name))
return 0;
-
+
/* rename options */
length = 32 + strlen (server->name) + 1;
mask = malloc (length);
@@ -1278,12 +1278,12 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
}
weechat_infolist_free (infolist);
}
-
+
/* rename server */
if (server->name)
free (server->name);
server->name = strdup (new_server_name);
-
+
/* change name and local variables on buffers */
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -1310,7 +1310,7 @@ irc_server_rename (struct t_irc_server *server, const char *new_server_name)
weechat_buffer_set (server->buffer, "localvar_set_charset_modifier",
charset_modifier);
}
-
+
return 1;
}
@@ -1325,7 +1325,7 @@ irc_server_send_signal (struct t_irc_server *server, const char *signal,
{
int length;
char *str_signal, *full_message_tags;
-
+
length = strlen (server->name) + 1 + strlen (signal) + 1 + strlen (command) + 1;
str_signal = malloc (length);
if (str_signal)
@@ -1364,7 +1364,7 @@ int
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
-
+
if (!server)
{
weechat_printf (NULL,
@@ -1382,14 +1382,14 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
-
+
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf);
else
#endif
rc = send (server->sock, buffer, size_buf, 0);
-
+
if (rc < 0)
{
#ifdef HAVE_GNUTLS
@@ -1411,7 +1411,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
strerror (errno));
}
}
-
+
return rc;
}
@@ -1437,16 +1437,16 @@ irc_server_get_tags_to_send (const char *tags)
{
int length;
char *buf;
-
+
if (!tags && !irc_server_send_default_tags)
return NULL;
-
+
if (!tags)
return strdup (irc_server_send_default_tags);
-
+
if (!irc_server_send_default_tags)
return strdup (tags);
-
+
/* concatenate tags and irc_server_send_default_tags */
length = strlen (tags) + 1 + strlen (irc_server_send_default_tags) + 1;
buf = malloc (length);
@@ -1465,13 +1465,13 @@ irc_server_outqueue_send (struct t_irc_server *server)
time_t time_now;
char *pos, *tags_to_send;
int priority, anti_flood;
-
+
time_now = time (NULL);
-
+
/* detect if system clock has been changed (now lower than before) */
if (server->last_user_message > time_now)
server->last_user_message = time_now;
-
+
for (priority = 0; priority < IRC_SERVER_NUM_OUTQUEUES_PRIO; priority++)
{
switch (priority)
@@ -1508,7 +1508,7 @@ irc_server_outqueue_send (struct t_irc_server *server)
server->outqueue[priority]->message_after_mod);
if (pos)
pos[0] = '\r';
-
+
/* send signal with command that will be sent to server */
irc_server_send_signal (server, "irc_out",
server->outqueue[priority]->command,
@@ -1521,7 +1521,7 @@ irc_server_outqueue_send (struct t_irc_server *server)
(tags_to_send) ? tags_to_send : "");
if (tags_to_send)
free (tags_to_send);
-
+
/* send command */
irc_server_send (server, server->outqueue[priority]->message_after_mod,
strlen (server->outqueue[priority]->message_after_mod));
@@ -1565,9 +1565,9 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
int rc, queue_msg, add_to_queue, first_message, anti_flood;
time_t time_now;
struct t_irc_redirect *ptr_redirect;
-
+
rc = 1;
-
+
irc_message_parse (message, &nick, NULL, &command, &channel, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_out_%s",
@@ -1575,14 +1575,14 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
new_msg = weechat_hook_modifier_exec (str_modifier,
server->name,
message);
-
+
/* no changes in new message */
if (new_msg && (strcmp (message, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
}
-
+
/* message not dropped? */
if (!new_msg || new_msg[0])
{
@@ -1609,32 +1609,32 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
msg_encoded = weechat_hook_modifier_exec ("charset_encode",
modifier_data,
ptr_msg);
-
+
if (msg_encoded)
ptr_msg = msg_encoded;
-
+
while (rc && ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
-
+
snprintf (buffer, sizeof (buffer) - 1, "%s\r\n", ptr_msg);
/* anti-flood: look whether we should queue outgoing message or not */
time_now = time (NULL);
-
+
/* detect if system clock has been changed (now lower than before) */
if (server->last_user_message > time_now)
server->last_user_message = time_now;
-
+
/* get queue from flags */
queue_msg = 0;
if (flags & IRC_SERVER_SEND_OUTQ_PRIO_HIGH)
queue_msg = 1;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_LOW)
queue_msg = 2;
-
+
switch (queue_msg - 1)
{
case 0:
@@ -1644,7 +1644,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
anti_flood = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW);
break;
}
-
+
add_to_queue = 0;
if ((queue_msg > 0)
&& (server->outqueue[queue_msg - 1]
@@ -1653,11 +1653,11 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
{
add_to_queue = queue_msg;
}
-
+
tags_to_send = irc_server_get_tags_to_send (tags);
-
+
ptr_redirect = irc_redirect_search_available (server);
-
+
if (add_to_queue > 0)
{
/* queue message (do not send anything now) */
@@ -1680,7 +1680,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
IRC_RAW_FLAG_SEND | IRC_RAW_FLAG_MODIFIED,
ptr_msg);
}
-
+
/* send signal with command that will be sent to server */
irc_server_send_signal (server, "irc_out",
(command) ? command : "unknown",
@@ -1690,7 +1690,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
(command) ? command : "unknown",
ptr_msg,
(tags_to_send) ? tags_to_send : "");
-
+
if (irc_server_send (server, buffer, strlen (buffer)) <= 0)
rc = 0;
else
@@ -1701,10 +1701,10 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
if (ptr_redirect)
irc_redirect_init_command (ptr_redirect, buffer);
}
-
+
if (tags_to_send)
free (tags_to_send);
-
+
if (pos)
{
pos[0] = '\n';
@@ -1712,7 +1712,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
}
else
ptr_msg = NULL;
-
+
first_message = 0;
}
if (msg_encoded)
@@ -1723,7 +1723,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
irc_raw_print (server, IRC_RAW_FLAG_SEND | IRC_RAW_FLAG_MODIFIED,
_("(message dropped)"));
}
-
+
if (nick)
free (nick);
if (command)
@@ -1732,7 +1732,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
free (channel);
if (new_msg)
free (new_msg);
-
+
return rc;
}
@@ -1753,14 +1753,14 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
const char *str_message, *str_args;
int i, items_count, number, ret_number, rc;
struct t_hashtable *hashtable, *ret_hashtable;
-
+
if (!server)
return NULL;
-
+
weechat_va_format (format);
if (!vbuffer)
return NULL;
-
+
ret_hashtable = NULL;
ret_number = 1;
if (flags & IRC_SERVER_SEND_RETURN_HASHTABLE)
@@ -1771,7 +1771,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
NULL,
NULL);
}
-
+
rc = 1;
items = weechat_string_split (vbuffer, "\n", 0, 0, &items_count);
for (i = 0; i < items_count; i++)
@@ -1789,11 +1789,11 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
break;
snprintf (hash_key, sizeof (hash_key), "args%d", number);
str_args = weechat_hashtable_get (hashtable, hash_key);
-
+
rc = irc_server_send_one_msg (server, flags, str_message, tags);
if (!rc)
break;
-
+
if (ret_hashtable)
{
snprintf (hash_key, sizeof (hash_key), "msg%d", ret_number);
@@ -1819,9 +1819,9 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
}
if (items)
weechat_string_free_split (items);
-
+
free (vbuffer);
-
+
return ret_hashtable;
}
@@ -1833,10 +1833,10 @@ void
irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
{
struct t_irc_message *message;
-
+
if (!server->unterminated_message && !msg[0])
return;
-
+
message = malloc (sizeof (*message));
if (!message)
{
@@ -1866,9 +1866,9 @@ irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
}
else
message->data = strdup (msg);
-
+
message->next_message = NULL;
-
+
if (irc_msgq_last_msg)
{
irc_msgq_last_msg->next_message = message;
@@ -1889,10 +1889,10 @@ void
irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string)
{
char *unterminated_message2;
-
+
if (!string[0])
return;
-
+
if (server->unterminated_message)
{
unterminated_message2 =
@@ -1936,14 +1936,14 @@ irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
{
pos_cr = strchr (buffer, '\r');
pos_lf = strchr (buffer, '\n');
-
+
if (!pos_cr && !pos_lf)
{
/* no CR/LF found => add to unterminated and return */
irc_server_msgq_add_unterminated (server, buffer);
return;
}
-
+
if (pos_cr && ((!pos_lf) || (pos_lf > pos_cr)))
{
/* found '\r' first => ignore this char */
@@ -1973,7 +1973,7 @@ irc_server_msgq_flush ()
char *nick, *host, *command, *channel, *arguments;
char *msg_decoded, *msg_decoded_without_color;
char str_modifier[64], modifier_data[256];
-
+
while (irc_recv_msgq)
{
if (irc_recv_msgq->data)
@@ -1986,12 +1986,12 @@ irc_server_msgq_flush ()
{
ptr_data++;
}
-
+
if (ptr_data[0])
{
irc_raw_print (irc_recv_msgq->server, IRC_RAW_FLAG_RECV,
ptr_data);
-
+
irc_message_parse (ptr_data, NULL, NULL, &command, NULL, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_in_%s",
@@ -2001,36 +2001,36 @@ irc_server_msgq_flush ()
ptr_data);
if (command)
free (command);
-
+
/* no changes in new message */
if (new_msg && (strcmp (ptr_data, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
}
-
+
/* message not dropped? */
if (!new_msg || new_msg[0])
{
/* use new message (returned by plugin) */
ptr_msg = (new_msg) ? new_msg : ptr_data;
-
+
while (ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
-
+
if (new_msg)
{
irc_raw_print (irc_recv_msgq->server,
IRC_RAW_FLAG_RECV | IRC_RAW_FLAG_MODIFIED,
ptr_msg);
}
-
+
irc_message_parse (ptr_msg, &nick, &host, &command,
&channel, &arguments);
-
+
/* convert charset for message */
if (channel && irc_channel_is_channel (channel))
{
@@ -2061,12 +2061,12 @@ irc_server_msgq_flush ()
msg_decoded = weechat_hook_modifier_exec ("charset_decode",
modifier_data,
ptr_msg);
-
+
/* replace WeeChat internal color codes by "?" */
msg_decoded_without_color =
weechat_string_remove_color ((msg_decoded) ? msg_decoded : ptr_msg,
"?");
-
+
/* call modifier after charset */
ptr_msg2 = (msg_decoded_without_color) ?
msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg);
@@ -2081,14 +2081,14 @@ irc_server_msgq_flush ()
free (new_msg2);
new_msg2 = NULL;
}
-
+
/* message not dropped? */
if (!new_msg2 || new_msg2[0])
{
/* use new message (returned by plugin) */
if (new_msg2)
ptr_msg2 = new_msg2;
-
+
/* parse and execute command */
if (irc_redirect_message (irc_recv_msgq->server,
ptr_msg2, command,
@@ -2104,7 +2104,7 @@ irc_server_msgq_flush ()
channel);
}
}
-
+
if (new_msg2)
free (new_msg2);
if (nick)
@@ -2121,7 +2121,7 @@ irc_server_msgq_flush ()
free (msg_decoded);
if (msg_decoded_without_color)
free (msg_decoded_without_color);
-
+
if (pos)
{
pos[0] = '\n';
@@ -2143,7 +2143,7 @@ irc_server_msgq_flush ()
}
free (irc_recv_msgq->data);
}
-
+
next = irc_recv_msgq->next_message;
free (irc_recv_msgq);
irc_recv_msgq = next;
@@ -2162,15 +2162,15 @@ irc_server_recv_cb (void *data, int fd)
struct t_irc_server *server;
static char buffer[4096 + 2];
int num_read;
-
+
/* make C compiler happy */
(void) fd;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
num_read = gnutls_record_recv (server->gnutls_sess, buffer,
@@ -2178,7 +2178,7 @@ irc_server_recv_cb (void *data, int fd)
else
#endif
num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0);
-
+
if (num_read > 0)
{
buffer[num_read] = '\0';
@@ -2224,7 +2224,7 @@ irc_server_recv_cb (void *data, int fd)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2238,17 +2238,17 @@ int
irc_server_timer_connection_cb (void *data, int remaining_calls)
{
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
server->hook_timer_connection = NULL;
-
+
if (!server->is_connected)
{
weechat_printf (server->buffer,
@@ -2256,7 +2256,7 @@ irc_server_timer_connection_cb (void *data, int remaining_calls)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
irc_server_disconnect (server, !server->is_connected, 1);
}
-
+
return WEECHAT_RC_OK;
}
@@ -2273,17 +2273,17 @@ int
irc_server_timer_sasl_cb (void *data, int remaining_calls)
{
struct t_irc_server *server;
-
+
/* make C compiler happy */
(void) remaining_calls;
-
+
server = (struct t_irc_server *)data;
-
+
if (!server)
return WEECHAT_RC_ERROR;
-
+
server->hook_timer_sasl = NULL;
-
+
if (!server->is_connected)
{
weechat_printf (server->buffer,
@@ -2291,7 +2291,7 @@ irc_server_timer_sasl_cb (void *data, int remaining_calls)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
irc_server_sendf (server, 0, NULL, "CAP END");
}
-
+
return WEECHAT_RC_OK;
}
@@ -2306,7 +2306,7 @@ irc_server_check_manual_joins_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_irc_server *server;
-
+
server = (struct t_irc_server *)data;
if (server)
{
@@ -2328,13 +2328,13 @@ irc_server_timer_cb (void *data, int remaining_calls)
time_t current_time;
static struct timeval tv;
int away_check;
-
+
/* make C compiler happy */
(void) data;
(void) remaining_calls;
-
+
current_time = time (NULL);
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -2351,7 +2351,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
{
/* send queued messages */
irc_server_outqueue_send (ptr_server);
-
+
/* check for lag */
if ((weechat_config_integer (irc_config_network_lag_check) > 0)
&& (ptr_server->lag_check_time.tv_sec == 0)
@@ -2377,7 +2377,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
}
}
}
-
+
/* check if it's time to autojoin channels (after command delay) */
if ((ptr_server->command_time != 0)
&& (current_time >= ptr_server->command_time +
@@ -2386,7 +2386,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
irc_server_autojoin_channels (ptr_server);
ptr_server->command_time = 0;
}
-
+
/* compute lag */
if (ptr_server->lag_check_time.tv_sec != 0)
{
@@ -2412,22 +2412,22 @@ irc_server_timer_cb (void *data, int remaining_calls)
irc_server_disconnect (ptr_server, 0, 1);
}
}
-
+
/* remove redirects if timeout occurs */
ptr_redirect = ptr_server->redirects;
while (ptr_redirect)
{
ptr_next_redirect = ptr_redirect->next_redirect;
-
+
if ((ptr_redirect->start_time > 0)
&& (ptr_redirect->start_time + ptr_redirect->timeout < current_time))
{
irc_redirect_stop (ptr_redirect, "timeout");
}
-
+
ptr_redirect = ptr_next_redirect;
}
-
+
/* remove old channels in "manual_joins" (each 60 seconds) */
if (current_time > irc_server_last_check_manual_joins + 60)
{
@@ -2438,7 +2438,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
}
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -2450,25 +2450,25 @@ void
irc_server_close_connection (struct t_irc_server *server)
{
int i;
-
+
if (server->hook_timer_connection)
{
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = NULL;
}
-
+
if (server->hook_timer_sasl)
{
weechat_unhook (server->hook_timer_sasl);
server->hook_timer_sasl = NULL;
}
-
+
if (server->hook_fd)
{
weechat_unhook (server->hook_fd);
server->hook_fd = NULL;
}
-
+
if (server->hook_connect)
{
weechat_unhook (server->hook_connect);
@@ -2496,7 +2496,7 @@ irc_server_close_connection (struct t_irc_server *server)
#endif
server->sock = -1;
}
-
+
/* free any pending message */
if (server->unterminated_message)
{
@@ -2507,13 +2507,13 @@ irc_server_close_connection (struct t_irc_server *server)
{
irc_server_outqueue_free_all (server, i);
}
-
+
/* remove all redirects */
irc_redirect_free_all (server);
-
+
/* remove all manual joins */
weechat_hashtable_remove_all (server->manual_joins);
-
+
/* server is now disconnected */
server->is_connected = 0;
server->ssl_connected = 0;
@@ -2527,7 +2527,7 @@ void
irc_server_reconnect_schedule (struct t_irc_server *server)
{
int minutes, seconds;
-
+
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))
{
/* growing reconnect delay */
@@ -2538,9 +2538,9 @@ irc_server_reconnect_schedule (struct t_irc_server *server)
if ((weechat_config_integer (irc_config_network_autoreconnect_delay_max) > 0)
&& (server->reconnect_delay > weechat_config_integer (irc_config_network_autoreconnect_delay_max)))
server->reconnect_delay = weechat_config_integer (irc_config_network_autoreconnect_delay_max);
-
+
server->reconnect_start = time (NULL);
-
+
minutes = server->reconnect_delay / 60;
seconds = server->reconnect_delay % 60;
if ((minutes > 0) && (seconds > 0))
@@ -2585,14 +2585,14 @@ void
irc_server_login (struct t_irc_server *server)
{
const char *password, *username, *realname;
-
+
password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD);
username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME);
realname = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME);
-
+
if (password && password[0])
irc_server_sendf (server, 0, NULL, "PASS %s", password);
-
+
if (!server->nick)
{
irc_server_set_nick (server,
@@ -2602,12 +2602,12 @@ irc_server_login (struct t_irc_server *server)
}
else
server->nick_first_tried = irc_server_get_nick_index (server);
-
+
if (irc_server_sasl_enabled (server))
{
irc_server_sendf (server, 0, NULL, "CAP LS");
}
-
+
irc_server_sendf (server, 0, NULL,
"NICK %s\n"
"USER %s %s %s :%s",
@@ -2616,7 +2616,7 @@ irc_server_login (struct t_irc_server *server)
(username && username[0]) ? username : "weechat",
server->current_address,
(realname && realname[0]) ? realname : ((username && username[0]) ? username : "weechat"));
-
+
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);
server->hook_timer_connection = weechat_hook_timer (
@@ -2668,13 +2668,13 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
{
struct t_irc_server *server;
const char *proxy;
-
+
server = (struct t_irc_server *)data;
-
+
proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY);
-
+
server->hook_connect = NULL;
-
+
switch (status)
{
case WEECHAT_HOOK_CONNECT_OK:
@@ -2833,7 +2833,7 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc,
irc_server_reconnect_schedule (server);
break;
}
-
+
return WEECHAT_RC_OK;
}
@@ -2846,7 +2846,7 @@ irc_server_set_buffer_title (struct t_irc_server *server)
{
char *title;
int length;
-
+
if (server && server->buffer)
{
if (server->is_connected)
@@ -2881,7 +2881,7 @@ irc_server_create_buffer (struct t_irc_server *server)
{
char buffer_name[256], charset_modifier[256];
struct t_gui_buffer *ptr_buffer_for_merge;
-
+
ptr_buffer_for_merge = NULL;
switch (weechat_config_integer (irc_config_look_server_buffer))
{
@@ -2894,7 +2894,7 @@ irc_server_create_buffer (struct t_irc_server *server)
ptr_buffer_for_merge = irc_buffer_search_first_for_all_servers ();
break;
}
-
+
snprintf (buffer_name, sizeof (buffer_name),
"server.%s", server->name);
server->buffer = weechat_buffer_new (buffer_name,
@@ -2912,13 +2912,13 @@ irc_server_create_buffer (struct t_irc_server *server)
"irc.%s", server->name);
weechat_buffer_set (server->buffer, "localvar_set_charset_modifier",
charset_modifier);
-
+
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, server->buffer);
-
+
if (weechat_config_boolean (irc_config_network_send_unknown_commands))
weechat_buffer_set (server->buffer, "input_get_unknown_commands", "1");
-
+
/* set highlights settings on server buffer */
weechat_buffer_set (server->buffer, "highlight_words_add", "$nick");
if (weechat_config_string (irc_config_look_highlight_tags)
@@ -2927,9 +2927,9 @@ irc_server_create_buffer (struct t_irc_server *server)
weechat_buffer_set (server->buffer, "highlight_tags",
weechat_config_string (irc_config_look_highlight_tags));
}
-
+
irc_server_set_buffer_title (server);
-
+
/*
* merge buffer if needed: if merge with(out) core set, and if no layout
* number is assigned for this buffer (if layout number is assigned, then
@@ -2940,7 +2940,7 @@ irc_server_create_buffer (struct t_irc_server *server)
{
weechat_buffer_merge (server->buffer, ptr_buffer_for_merge);
}
-
+
return server->buffer;
}
@@ -2985,16 +2985,16 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
(void) nreq;
(void) pk_algos;
(void) pk_algos_len;
-
+
rc = 0;
-
+
if (!data)
return -1;
-
+
server = (struct t_irc_server *) data;
hostname = server->current_address;
hostname_match = 0;
-
+
if (action == WEECHAT_HOOK_CONNECT_GNUTLS_CB_VERIFY_CERT)
{
weechat_printf (server->buffer,
@@ -3038,7 +3038,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
weechat_prefix ("error"));
rc = -1;
}
-
+
/* check certificates */
if (gnutls_x509_crt_init (&cert_temp) >= 0)
{
@@ -3118,7 +3118,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
cert_path1 = weechat_string_replace (cert_path0, "%h", weechat_dir);
cert_path2 = (cert_path1) ?
weechat_string_expand_home (cert_path1) : NULL;
-
+
if (cert_path2)
{
cert_str = weechat_file_get_content (cert_path2);
@@ -3126,15 +3126,15 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
{
weechat_printf (server->buffer,
_("gnutls: sending one certificate"));
-
+
filedatum.data = (unsigned char *) cert_str;
filedatum.size = strlen (cert_str);
-
+
/* certificate */
gnutls_x509_crt_init (&server->tls_cert);
gnutls_x509_crt_import (server->tls_cert, &filedatum,
GNUTLS_X509_FMT_PEM);
-
+
/* key */
gnutls_x509_privkey_init (&server->tls_cert_key);
ret = gnutls_x509_privkey_import (server->tls_cert_key,
@@ -3201,21 +3201,21 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
weechat_prefix ("error"), cert_path2);
}
}
-
+
if (cert_path1)
free (cert_path1);
if (cert_path2)
free (cert_path2);
}
}
-
+
/* an error should stop the handshake unless the user doesn't care */
if ((rc == -1)
&& (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY) == 0))
{
rc = 0;
}
-
+
return rc;
}
#endif
@@ -3233,19 +3233,19 @@ irc_server_connect (struct t_irc_server *server)
char *option_name;
struct t_config_option *proxy_type, *proxy_ipv6, *proxy_address, *proxy_port;
const char *proxy, *str_proxy_type, *str_proxy_address;
-
+
if (!server->buffer)
{
if (!irc_server_create_buffer (server))
return 0;
weechat_buffer_set (server->buffer, "display", "auto");
}
-
+
weechat_bar_item_update ("buffer_name");
-
+
irc_server_set_index_current_address (server,
server->index_current_address);
-
+
if (!server->current_address)
{
weechat_printf (server->buffer,
@@ -3255,7 +3255,7 @@ irc_server_connect (struct t_irc_server *server)
server->name);
return 0;
}
-
+
/* free some old values (from a previous connection to server) */
if (server->isupport)
{
@@ -3272,14 +3272,14 @@ irc_server_connect (struct t_irc_server *server)
free (server->prefix_chars);
server->prefix_chars = NULL;
}
-
+
proxy_type = NULL;
proxy_ipv6 = NULL;
proxy_address = NULL;
proxy_port = NULL;
str_proxy_type = NULL;
str_proxy_address = NULL;
-
+
proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY);
if (proxy && proxy[0])
{
@@ -3322,7 +3322,7 @@ irc_server_connect (struct t_irc_server *server)
return 0;
}
}
-
+
if (!server->nicks_array)
{
weechat_printf (server->buffer,
@@ -3332,7 +3332,7 @@ irc_server_connect (struct t_irc_server *server)
server->name);
return 0;
}
-
+
#ifndef HAVE_GNUTLS
if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))
{
@@ -3393,10 +3393,10 @@ irc_server_connect (struct t_irc_server *server)
(IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ?
" (SSL)" : "");
}
-
+
/* close connection if opened */
irc_server_close_connection (server);
-
+
/* create socket and set options */
if (proxy_type)
{
@@ -3417,7 +3417,7 @@ irc_server_connect (struct t_irc_server *server)
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
-
+
/* set SO_REUSEADDR option for socket */
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
@@ -3428,7 +3428,7 @@ irc_server_connect (struct t_irc_server *server)
"\"SO_REUSEADDR\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
/* set SO_KEEPALIVE option for socket */
set = 1;
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
@@ -3439,7 +3439,7 @@ irc_server_connect (struct t_irc_server *server)
"\"SO_KEEPALIVE\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
}
-
+
/* init SSL if asked and connect */
server->ssl_connected = 0;
#ifdef HAVE_GNUTLS
@@ -3468,11 +3468,11 @@ irc_server_connect (struct t_irc_server *server)
&irc_server_connect_cb,
server);
#endif
-
+
/* send signal "irc_server_connecting" with server name */
weechat_hook_signal_send ("irc_server_connecting",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
-
+
return 1;
}
@@ -3486,9 +3486,9 @@ irc_server_reconnect (struct t_irc_server *server)
weechat_printf (server->buffer,
_("%s: reconnecting to server..."),
IRC_PLUGIN_NAME);
-
+
server->reconnect_start = 0;
-
+
if (irc_server_connect (server))
server->reconnect_join = 1;
else
@@ -3503,7 +3503,7 @@ void
irc_server_auto_connect ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -3524,7 +3524,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
int reconnect)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
/*
@@ -3541,21 +3541,21 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
IRC_PLUGIN_NAME);
}
}
-
+
irc_server_close_connection (server);
-
+
if (server->buffer)
{
weechat_printf (server->buffer,
_("%s: disconnected from server"),
IRC_PLUGIN_NAME);
}
-
+
if (switch_address)
irc_server_switch_address (server, 0);
else
irc_server_set_index_current_address(server, 0);
-
+
if (server->nick_modes)
{
free (server->nick_modes);
@@ -3570,7 +3570,7 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
server->lag_next_check = time (NULL) +
weechat_config_integer (irc_config_network_lag_check);
server->lag_last_refresh = 0;
-
+
if (reconnect
&& IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))
irc_server_reconnect_schedule (server);
@@ -3579,13 +3579,13 @@ irc_server_disconnect (struct t_irc_server *server, int switch_address,
server->reconnect_delay = 0;
server->reconnect_start = 0;
}
-
+
/* discard current nick if no reconnection asked */
if (!reconnect && server->nick)
irc_server_set_nick (server, NULL);
-
+
irc_server_set_buffer_title (server);
-
+
/* send signal "irc_server_disconnected" with server name */
weechat_hook_signal_send ("irc_server_disconnected",
WEECHAT_HOOK_SIGNAL_STRING, server->name);
@@ -3599,7 +3599,7 @@ void
irc_server_disconnect_all ()
{
struct t_irc_server *ptr_server;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -3616,7 +3616,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
const char *autojoin;
-
+
/* auto-join after disconnection (only rejoins opened channels) */
if (!server->disable_autojoin && server->reconnect_join && server->channels)
{
@@ -3651,7 +3651,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
if (!server->disable_autojoin && autojoin && autojoin[0])
irc_command_join_server (server, autojoin, 0);
}
-
+
server->disable_autojoin = 0;
}
@@ -3663,17 +3663,17 @@ struct t_irc_server *
irc_server_search (const char *server_name)
{
struct t_irc_server *ptr_server;
-
+
if (!server_name)
return NULL;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (strcmp (ptr_server->name, server_name) == 0)
return ptr_server;
}
-
+
/* server not found */
return NULL;
}
@@ -3687,7 +3687,7 @@ irc_server_get_number_connected ()
{
struct t_irc_server *ptr_server;
int number;
-
+
number = 0;
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
@@ -3707,7 +3707,7 @@ irc_server_get_number_buffer (struct t_irc_server *server,
int *server_pos, int *server_total)
{
struct t_irc_server *ptr_server;
-
+
*server_pos = 0;
*server_total = 0;
for (ptr_server = irc_servers; ptr_server;
@@ -3731,7 +3731,7 @@ irc_server_get_channel_count (struct t_irc_server *server)
{
int count;
struct t_irc_channel *ptr_channel;
-
+
count = 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -3751,7 +3751,7 @@ irc_server_get_pv_count (struct t_irc_server *server)
{
int count;
struct t_irc_channel *ptr_channel;
-
+
count = 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -3770,7 +3770,7 @@ void
irc_server_remove_away (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
for (ptr_channel = server->channels; ptr_channel;
@@ -3791,7 +3791,7 @@ void
irc_server_check_away (struct t_irc_server *server)
{
struct t_irc_channel *ptr_channel;
-
+
if (server->is_connected)
{
for (ptr_channel = server->channels; ptr_channel;
@@ -3826,13 +3826,13 @@ irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
weechat_buffer_set (server->buffer,
"localvar_del_away", "");
}
-
+
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
{
/* set away flag for nick on channel */
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
irc_channel_set_away (server, ptr_channel, nick, is_away);
-
+
/* set/del "away" local variable on channel buffer */
if (is_away)
{
@@ -3864,14 +3864,14 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *type, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -3913,9 +3913,9 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -3935,14 +3935,14 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -3966,9 +3966,9 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -3989,14 +3989,14 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
struct t_irc_server *ptr_server;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
-
+
infolist = (struct t_infolist *)signal_data;
-
+
if (weechat_infolist_next (infolist))
{
plugin_name = weechat_infolist_string (infolist, "plugin_name");
@@ -4020,9 +4020,9 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
}
}
}
-
+
weechat_infolist_reset_item_cursor (infolist);
-
+
return WEECHAT_RC_OK;
}
@@ -4034,10 +4034,10 @@ struct t_hdata *
irc_server_hdata_server_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
-
+
/* make C compiler happy */
(void) data;
-
+
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server");
if (hdata)
{
@@ -4119,14 +4119,14 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
struct t_irc_server *server)
{
struct t_infolist_item *ptr_item;
-
+
if (!infolist || !server)
return 0;
-
+
ptr_item = weechat_infolist_new_item (infolist);
if (!ptr_item)
return 0;
-
+
if (!weechat_infolist_new_var_string (ptr_item, "name", server->name))
return 0;
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", server->buffer))
@@ -4290,7 +4290,7 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_time (ptr_item, "last_away_check", server->last_away_check))
return 0;
-
+
return 1;
}
@@ -4304,7 +4304,7 @@ irc_server_print_log ()
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
int i;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -4599,11 +4599,11 @@ irc_server_print_log ()
weechat_log_printf (" last_channel . . . . : 0x%lx", ptr_server->last_channel);
weechat_log_printf (" prev_server. . . . . : 0x%lx", ptr_server->prev_server);
weechat_log_printf (" next_server. . . . . : 0x%lx", ptr_server->next_server);
-
+
irc_redirect_print_log (ptr_server);
-
+
irc_notify_print_log (ptr_server);
-
+
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 01ec048bd..14c58802d 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -121,7 +121,7 @@ struct t_irc_server
/* user choices */
char *name; /* internal name of server */
struct t_config_option *options[IRC_SERVER_NUM_OPTIONS];
-
+
/* internal vars */
int temp_server; /* temporary server (not saved) */
int reloading_from_config; /* 1 if reloading from config file */
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 2842a1243..231421066 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -59,7 +59,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
struct t_irc_notify *ptr_notify;
struct t_irc_raw_message *ptr_raw_message;
int rc;
-
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -78,7 +78,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
weechat_infolist_free (infolist);
if (!rc)
return 0;
-
+
/* save server channels and nicks */
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -98,7 +98,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
weechat_infolist_free (infolist);
if (!rc)
return 0;
-
+
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
@@ -119,7 +119,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
/* save server redirects */
for (ptr_redirect = ptr_server->redirects; ptr_redirect;
ptr_redirect = ptr_redirect->next_redirect)
@@ -139,7 +139,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save server notify list */
for (ptr_notify = ptr_server->notify_list; ptr_notify;
ptr_notify = ptr_notify->next_notify)
@@ -160,7 +160,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
/* save raw messages */
for (ptr_raw_message = irc_raw_messages; ptr_raw_message;
ptr_raw_message = ptr_raw_message->next_message)
@@ -180,7 +180,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
if (!rc)
return 0;
}
-
+
/* save redirect patterns */
for (ptr_redirect_pattern = irc_redirect_patterns; ptr_redirect_pattern;
ptr_redirect_pattern = ptr_redirect_pattern->next_redirect)
@@ -204,7 +204,7 @@ irc_upgrade_save_all_data (struct t_upgrade_file *upgrade_file)
return 0;
}
}
-
+
return 1;
}
@@ -218,15 +218,15 @@ irc_upgrade_save ()
{
int rc;
struct t_upgrade_file *upgrade_file;
-
+
upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 1);
if (!upgrade_file)
return 0;
-
+
rc = irc_upgrade_save_all_data (upgrade_file);
-
+
weechat_upgrade_close (upgrade_file);
-
+
return rc;
}
@@ -240,7 +240,7 @@ irc_upgrade_set_buffer_callbacks ()
{
struct t_infolist *infolist;
struct t_gui_buffer *ptr_buffer;
-
+
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
{
@@ -279,11 +279,11 @@ irc_upgrade_read_cb (void *data,
struct t_irc_redirect *ptr_redirect;
struct t_irc_notify *ptr_notify;
struct t_gui_buffer *ptr_buffer;
-
+
/* make C compiler happy */
(void) data;
(void) upgrade_file;
-
+
weechat_infolist_reset_item_cursor (infolist);
while (weechat_infolist_next (infolist))
{
@@ -603,7 +603,7 @@ irc_upgrade_read_cb (void *data,
break;
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -619,10 +619,10 @@ irc_upgrade_load ()
struct t_upgrade_file *upgrade_file;
irc_upgrade_set_buffer_callbacks ();
-
+
upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 0);
rc = weechat_upgrade_read (upgrade_file, &irc_upgrade_read_cb, NULL);
-
+
return rc;
}
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index 4ad1fbb6e..0703273a8 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -68,11 +68,11 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
-
+
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
for (ptr_server = irc_servers; ptr_server;
@@ -82,7 +82,7 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
(signal_data) ? (char *)signal_data : NULL);
}
}
-
+
return WEECHAT_RC_OK;
}
@@ -96,15 +96,15 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
{
struct t_irc_server *ptr_server;
int disconnected;
-
+
/* make C compiler happy */
(void) data;
(void) signal;
(void) type_data;
(void) signal_data;
-
+
irc_signal_upgrade_received = 1;
-
+
/*
* FIXME: it's not possible to upgrade with SSL servers connected (GnuTLS
* lib can't reload data after upgrade), so we close connection for
@@ -142,7 +142,7 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
disconnected,
NG_("server", "servers", disconnected));
}
-
+
return WEECHAT_RC_OK;
}
@@ -154,23 +154,23 @@ int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
int i, auto_connect, upgrading;
-
+
weechat_plugin = plugin;
-
+
if (!irc_config_init ())
return WEECHAT_RC_ERROR;
-
+
if (irc_config_read () < 0)
return WEECHAT_RC_ERROR;
-
+
irc_command_init ();
-
+
irc_info_init ();
-
+
irc_redirect_init ();
-
+
irc_notify_init ();
-
+
/* hook some signals */
irc_debug_init ();
weechat_hook_signal ("quit", &irc_signal_quit_cb, NULL);
@@ -179,20 +179,20 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_signal ("xfer_resume_ready", &irc_server_xfer_resume_ready_cb, NULL);
weechat_hook_signal ("xfer_send_accept_resume", &irc_server_xfer_send_accept_resume_cb, NULL);
weechat_hook_signal ("irc_input_send", &irc_input_send_cb, NULL);
-
+
/* hook hsignals for redirection */
weechat_hook_hsignal ("irc_redirect_pattern", &irc_redirect_pattern_hsignal_cb, NULL);
weechat_hook_hsignal ("irc_redirect_command", &irc_redirect_command_hsignal_cb, NULL);
-
+
/* modifiers */
weechat_hook_modifier ("irc_color_decode", &irc_color_modifier_cb, NULL);
weechat_hook_modifier ("irc_color_encode", &irc_color_modifier_cb, NULL);
-
+
/* hook completions */
irc_completion_init ();
-
+
irc_bar_item_init ();
-
+
/* look at arguments */
auto_connect = 1;
upgrading = 0;
@@ -219,7 +219,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
upgrading = 1;
}
}
-
+
if (upgrading)
{
if (!irc_upgrade_load ())
@@ -236,10 +236,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
if (auto_connect)
irc_server_auto_connect ();
}
-
+
irc_hook_timer = weechat_hook_timer (1 * 1000, 0, 0,
&irc_server_timer_cb, NULL);
-
+
return WEECHAT_RC_OK;
}
@@ -252,10 +252,10 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* make C compiler happy */
(void) plugin;
-
+
if (irc_hook_timer)
weechat_unhook (irc_hook_timer);
-
+
if (irc_signal_upgrade_received)
{
irc_config_write (1);
@@ -266,18 +266,18 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
irc_config_write (0);
irc_server_disconnect_all ();
}
-
+
irc_ignore_free_all ();
-
+
irc_raw_message_free_all ();
-
+
irc_server_free_all ();
-
+
irc_config_free ();
-
+
irc_notify_end ();
-
+
irc_redirect_end ();
-
+
return WEECHAT_RC_OK;
}