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