summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-08-21 09:49:58 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-08-21 09:49:58 +0000
commit84b1a27265bdd967e9be1df8d195925ba6ea5c75 (patch)
tree33e4d59c745d4080d0f5b735b973b04112c86edf
parent51322e79179249f4a84b7c8c5e331572f3c8213a (diff)
downloadweechat-84b1a27265bdd967e9be1df8d195925ba6ea5c75.zip
Fixed empty private buffer when unknown CTCP is received
-rw-r--r--src/irc/irc-recv.c42
-rw-r--r--weechat/src/irc/irc-recv.c42
2 files changed, 58 insertions, 26 deletions
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 1e831c9f0..781e0db9a 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -1809,23 +1809,24 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* private message received => display it */
ptr_channel = channel_search (server, host);
- if (!ptr_channel)
+
+ if (strncmp (pos, "\01ACTION ", 8) == 0)
{
- ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot create new private window \"%s\"\n"),
- WEECHAT_ERROR, host);
- return -1;
+ ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, host);
+ return -1;
+ }
}
- }
- if (!ptr_channel->topic)
- ptr_channel->topic = strdup (host2);
-
- if (strncmp (pos, "\01ACTION ", 8) == 0)
- {
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
pos += 8;
pos2 = strchr (pos, '\01');
if (pos2)
@@ -1889,6 +1890,21 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
+ if (!ptr_channel)
+ {
+ ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, host);
+ return -1;
+ }
+ }
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c
index 1e831c9f0..781e0db9a 100644
--- a/weechat/src/irc/irc-recv.c
+++ b/weechat/src/irc/irc-recv.c
@@ -1809,23 +1809,24 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* private message received => display it */
ptr_channel = channel_search (server, host);
- if (!ptr_channel)
+
+ if (strncmp (pos, "\01ACTION ", 8) == 0)
{
- ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot create new private window \"%s\"\n"),
- WEECHAT_ERROR, host);
- return -1;
+ ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, host);
+ return -1;
+ }
}
- }
- if (!ptr_channel->topic)
- ptr_channel->topic = strdup (host2);
-
- if (strncmp (pos, "\01ACTION ", 8) == 0)
- {
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
pos += 8;
pos2 = strchr (pos, '\01');
if (pos2)
@@ -1889,6 +1890,21 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
+ if (!ptr_channel)
+ {
+ ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, host);
+ return -1;
+ }
+ }
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");