commit c2706198e6962487be8b185ba1bf4be0538a15d9
parent b1066506d3fd35218ebedc12afd43d509f0d7529
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sat, 22 Jul 2017 22:41:46 +0200
Tell the server when disconnect.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/circo.c b/circo.c
@@ -214,11 +214,11 @@ cmd_msg(char *cmd, char *s) {
void
cmd_quit(char *cmd, char *s) {
- /* XXX implements proper QUIT command */
+ if(srv)
+ sout("QUIT%s%s", s ? " :" : "", s ? s : "");
running = 0;
}
-
void
cmd_server(char *cmd, char *s) {
char *h, *p;
@@ -233,10 +233,11 @@ cmd_server(char *cmd, char *s) {
printb(getbuf("status"), "Usage: /%s [host] [port]\n", cmd);
return;
}
- /* XXX if srv then disconnect */
+ if(srv)
+ sout("QUIT");
srv = fdopen(dial(h, p), "r+");
if(!srv) {
- printb(getbuf("status"), "cannot connect to %s on port %s\n", h, p);
+ printb(getbuf("status"), "Cannot connect to %s on port %s\n", h, p);
drawbuf();
return;
}