Show error if disconnected unintentionally
parent
b1427dd169
commit
638be4e775
1
chat.h
1
chat.h
|
@ -44,6 +44,7 @@ struct {
|
|||
char *join;
|
||||
bool verbose;
|
||||
bool notify;
|
||||
bool quit;
|
||||
} self;
|
||||
|
||||
void eventWait(const char *argv[static 2]);
|
||||
|
|
6
event.c
6
event.c
|
@ -131,10 +131,14 @@ noreturn void eventLoop(void) {
|
|||
|
||||
for (;;) {
|
||||
if (sig[SIGCHLD]) childWait();
|
||||
if (sig[SIGHUP]) ircFmt("QUIT :zzz\r\n");
|
||||
if (sig[SIGHUP]) {
|
||||
ircFmt("QUIT :zzz\r\n");
|
||||
self.quit = true;
|
||||
}
|
||||
if (sig[SIGINT]) {
|
||||
signal(SIGINT, SIG_DFL);
|
||||
ircFmt("QUIT :Goodbye\r\n");
|
||||
self.quit = true;
|
||||
}
|
||||
if (sig[SIGWINCH]) {
|
||||
curses.sa_handler(SIGWINCH);
|
||||
|
|
9
handle.c
9
handle.c
|
@ -95,11 +95,14 @@ static void handlePing(char *prefix, char *params) {
|
|||
}
|
||||
|
||||
static void handleError(char *prefix, char *params) {
|
||||
(void)prefix;
|
||||
(void)params;
|
||||
// TODO: Show error if unintended disconnect.
|
||||
char *mesg;
|
||||
parse(prefix, NULL, NULL, NULL, params, 1, 0, &mesg);
|
||||
if (self.quit) {
|
||||
uiExit();
|
||||
exit(EX_OK);
|
||||
} else {
|
||||
errx(EX_PROTOCOL, "%s", mesg);
|
||||
}
|
||||
}
|
||||
|
||||
static void handleErrorErroneousNickname(char *prefix, char *params) {
|
||||
|
|
Loading…
Reference in New Issue