1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

Fixed bug #16369: fixed crash when multiple pv have same name: now it's forbidden and pv buffer is not renamed (when a nick changes) if another exists with same name

This commit is contained in:
Sebastien Helleu
2006-04-23 09:22:53 +00:00
parent 6021ee85cb
commit 23f3622f2c
12 changed files with 80 additions and 16 deletions
+4 -1
View File
@@ -1,9 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-04-21
ChangeLog - 2006-04-23
Version 0.1.9 (under dev!):
* fixed crash when multiple pv have same name: now it's forbidden
and pv buffer is not renamed (when a nick changes) if another
exists with same name
* command /clear [-all] now clears hotlist
* fixed crash after /upgrade if a line in history is empty
* fixed many crashes with DCC chat
+5 -4
View File
@@ -1371,7 +1371,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
buffer->server = NULL;
gui_window_switch_server (window);
}
gui_status_draw (gui_current_window->buffer, 1);
gui_input_draw (gui_current_window->buffer, 1);
}
else
{
@@ -1381,8 +1382,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
ptr_channel = CHANNEL(buffer);
gui_buffer_free (ptr_channel->buffer, 1);
channel_free (SERVER(buffer), ptr_channel);
gui_status_draw (buffer, 1);
gui_input_draw (buffer, 1);
gui_status_draw (gui_current_window->buffer, 1);
gui_input_draw (gui_current_window->buffer, 1);
}
else
{
@@ -1412,9 +1413,9 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
}
else
gui_buffer_free (buffer, 1);
gui_status_draw (gui_current_window->buffer, 1);
}
}
gui_status_draw (buffer, 1);
}
else if (ascii_strcasecmp (argv[0], "notify") == 0)
{
+1 -1
View File
@@ -1403,7 +1403,7 @@ session_load_buffer (FILE *file)
if (channel_name)
{
ptr_channel = channel_search_any (ptr_server, channel_name);
ptr_channel = channel_search_any_without_buffer (ptr_server, channel_name);
if (!ptr_channel)
{
session_crash (file, _("channel not found for buffer"));
+23
View File
@@ -185,6 +185,29 @@ channel_search_any (t_irc_server *server, char *channel_name)
return NULL;
}
/*
* channel_search_any_without_buffer: returns pointer on a channel with name
* looks only for channels without buffer
*/
t_irc_channel *
channel_search_any_without_buffer (t_irc_server *server, char *channel_name)
{
t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (!ptr_channel->buffer
&& (ascii_strcasecmp (ptr_channel->name, channel_name) == 0))
return ptr_channel;
}
return NULL;
}
/*
* channel_search_dcc: returns pointer on a DCC chat channel with name
*/
+6 -2
View File
@@ -1288,8 +1288,12 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments
if ((CHANNEL(ptr_buffer)->name)
&& (ascii_strcasecmp (nick, CHANNEL(ptr_buffer)->name) == 0))
{
free (CHANNEL(ptr_buffer)->name);
CHANNEL(ptr_buffer)->name = strdup (arguments);
ptr_channel = channel_search_any (server, arguments);
if (!ptr_channel)
{
free (CHANNEL(ptr_buffer)->name);
CHANNEL(ptr_buffer)->name = strdup (arguments);
}
}
}
}
+1
View File
@@ -371,6 +371,7 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
extern void channel_free_all (t_irc_server *);
extern t_irc_channel *channel_search (t_irc_server *, char *);
extern t_irc_channel *channel_search_any (t_irc_server *, char *);
extern t_irc_channel *channel_search_any_without_buffer (t_irc_server *, char *);
extern t_irc_channel *channel_search_dcc (t_irc_server *, char *);
extern int string_is_channel (char *);
extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *);
+4 -1
View File
@@ -1,9 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-04-21
ChangeLog - 2006-04-23
Version 0.1.9 (under dev!):
* fixed crash when multiple pv have same name: now it's forbidden
and pv buffer is not renamed (when a nick changes) if another
exists with same name
* command /clear [-all] now clears hotlist
* fixed crash after /upgrade if a line in history is empty
* fixed many crashes with DCC chat
+5 -4
View File
@@ -1371,7 +1371,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
buffer->server = NULL;
gui_window_switch_server (window);
}
gui_status_draw (gui_current_window->buffer, 1);
gui_input_draw (gui_current_window->buffer, 1);
}
else
{
@@ -1381,8 +1382,8 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
ptr_channel = CHANNEL(buffer);
gui_buffer_free (ptr_channel->buffer, 1);
channel_free (SERVER(buffer), ptr_channel);
gui_status_draw (buffer, 1);
gui_input_draw (buffer, 1);
gui_status_draw (gui_current_window->buffer, 1);
gui_input_draw (gui_current_window->buffer, 1);
}
else
{
@@ -1412,9 +1413,9 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
}
else
gui_buffer_free (buffer, 1);
gui_status_draw (gui_current_window->buffer, 1);
}
}
gui_status_draw (buffer, 1);
}
else if (ascii_strcasecmp (argv[0], "notify") == 0)
{
+1 -1
View File
@@ -1403,7 +1403,7 @@ session_load_buffer (FILE *file)
if (channel_name)
{
ptr_channel = channel_search_any (ptr_server, channel_name);
ptr_channel = channel_search_any_without_buffer (ptr_server, channel_name);
if (!ptr_channel)
{
session_crash (file, _("channel not found for buffer"));
+23
View File
@@ -185,6 +185,29 @@ channel_search_any (t_irc_server *server, char *channel_name)
return NULL;
}
/*
* channel_search_any_without_buffer: returns pointer on a channel with name
* looks only for channels without buffer
*/
t_irc_channel *
channel_search_any_without_buffer (t_irc_server *server, char *channel_name)
{
t_irc_channel *ptr_channel;
if (!server || !channel_name)
return NULL;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (!ptr_channel->buffer
&& (ascii_strcasecmp (ptr_channel->name, channel_name) == 0))
return ptr_channel;
}
return NULL;
}
/*
* channel_search_dcc: returns pointer on a DCC chat channel with name
*/
+6 -2
View File
@@ -1288,8 +1288,12 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments
if ((CHANNEL(ptr_buffer)->name)
&& (ascii_strcasecmp (nick, CHANNEL(ptr_buffer)->name) == 0))
{
free (CHANNEL(ptr_buffer)->name);
CHANNEL(ptr_buffer)->name = strdup (arguments);
ptr_channel = channel_search_any (server, arguments);
if (!ptr_channel)
{
free (CHANNEL(ptr_buffer)->name);
CHANNEL(ptr_buffer)->name = strdup (arguments);
}
}
}
}
+1
View File
@@ -371,6 +371,7 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
extern void channel_free_all (t_irc_server *);
extern t_irc_channel *channel_search (t_irc_server *, char *);
extern t_irc_channel *channel_search_any (t_irc_server *, char *);
extern t_irc_channel *channel_search_any_without_buffer (t_irc_server *, char *);
extern t_irc_channel *channel_search_dcc (t_irc_server *, char *);
extern int string_is_channel (char *);
extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *);