summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-08-17 16:12:52 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-08-17 16:12:52 +0000
commit440214d098da2e581f4a60c70788e1f0beeb9b2b (patch)
treeed0c8a0194a14e73a8ece459955245d33f97daf7 /src
parent17fdaf83d37e54dbdc09545bef36568dae5489ae (diff)
downloadweechat-440214d098da2e581f4a60c70788e1f0beeb9b2b.zip
Added send of "quit" message to server when using /disconnect
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c1
-rw-r--r--src/gui/curses/gui-curses-status.c3
-rw-r--r--src/irc/irc-send.c46
-rw-r--r--src/irc/irc.h1
4 files changed, 32 insertions, 19 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 72eac51a3..adc43f673 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -2217,6 +2217,7 @@ weechat_cmd_disconnect (t_irc_server *server, t_irc_channel *channel,
gui_printf (ptr_server->buffer,
_("Auto-reconnection is cancelled\n"));
}
+ irc_send_quit_server (ptr_server, NULL);
server_disconnect (ptr_server, 0);
gui_status_draw (buffer, 1);
}
diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c
index ad77dfcd9..76c477f7b 100644
--- a/src/gui/curses/gui-curses-status.c
+++ b/src/gui/curses/gui-curses-status.c
@@ -150,8 +150,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
wprintw (GUI_CURSES(ptr_win)->win_status, ":");
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
COLOR_WIN_STATUS_CHANNEL);
- if (((CHANNEL(ptr_win->buffer)->type != CHANNEL_TYPE_PRIVATE)
- && (CHANNEL(ptr_win->buffer)->type != CHANNEL_TYPE_DCC_CHAT)
+ if (((CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_CHANNEL)
&& (!CHANNEL(ptr_win->buffer)->nicks))
|| ((CHANNEL(ptr_win->buffer)->type == CHANNEL_TYPE_DCC_CHAT)
&& (CHANNEL(ptr_win->buffer)->dcc_chat)
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 354eb065a..b49b6efc9 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -1700,6 +1700,34 @@ irc_cmd_send_query (t_irc_server *server, t_irc_channel *channel,
}
/*
+ * irc_send_quit_server: send QUIT to a server
+ */
+
+void
+irc_send_quit_server (t_irc_server *server, char *arguments)
+{
+ char *ptr_arg, *buf;
+
+ if (server->is_connected)
+ {
+ ptr_arg = (arguments) ? arguments :
+ (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) ?
+ cfg_irc_default_msg_quit : NULL;
+
+ if (ptr_arg)
+ {
+ buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION);
+ server_sendf (server, "QUIT :%s\r\n",
+ (buf) ? buf : ptr_arg);
+ if (buf)
+ free (buf);
+ }
+ else
+ server_sendf (server, "QUIT\r\n");
+ }
+}
+
+/*
* irc_cmd_send_quit: disconnect from all servers and quit WeeChat
*/
@@ -1708,31 +1736,15 @@ irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel,
char *arguments)
{
t_irc_server *ptr_server;
- char *ptr_arg, *buf;
/* make gcc happy */
(void) server;
(void) channel;
- ptr_arg = (arguments) ? arguments :
- (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) ?
- cfg_irc_default_msg_quit : NULL;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
- if (ptr_server->is_connected)
- {
- if (ptr_arg)
- {
- buf = weechat_strreplace (ptr_arg, "%v", PACKAGE_VERSION);
- server_sendf (ptr_server, "QUIT :%s\r\n",
- (buf) ? buf : ptr_arg);
- if (buf)
- free (buf);
- }
- else
- server_sendf (ptr_server, "QUIT\r\n");
- }
+ irc_send_quit_server (ptr_server, arguments);
}
quit_weechat = 1;
return 0;
diff --git a/src/irc/irc.h b/src/irc/irc.h
index e7dfa863a..3b1469046 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -480,6 +480,7 @@ extern int irc_cmd_send_part (t_irc_server *, t_irc_channel *, char *);
extern int irc_cmd_send_ping (t_irc_server *, t_irc_channel *, char *);
extern int irc_cmd_send_pong (t_irc_server *, t_irc_channel *, char *);
extern int irc_cmd_send_query (t_irc_server *, t_irc_channel *, char *);
+extern void irc_send_quit_server (t_irc_server *, char *);
extern int irc_cmd_send_quit (t_irc_server *, t_irc_channel *, char *);
extern int irc_cmd_send_quote (t_irc_server *, t_irc_channel *, char *);
extern int irc_cmd_send_rehash (t_irc_server *, t_irc_channel *, char *);