Show error if disconnected unintentionally
This commit is contained in:
		
							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); | ||||
|  | ||||
							
								
								
									
										13
									
								
								handle.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								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.
 | ||||
| 	uiExit(); | ||||
| 	exit(EX_OK); | ||||
| 	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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user