Factor out ircQuit
This commit is contained in:
		
							parent
							
								
									14c60a15bc
								
							
						
					
					
						commit
						e84c36a0bd
					
				
							
								
								
									
										1
									
								
								chat.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								chat.h
									
									
									
									
									
								
							| @ -111,6 +111,7 @@ int ircConnect(void); | |||||||
| void ircRead(void); | void ircRead(void); | ||||||
| void ircWrite(const char *ptr, size_t len); | void ircWrite(const char *ptr, size_t len); | ||||||
| void ircFmt(const char *format, ...) __attribute__((format(printf, 1, 2))); | void ircFmt(const char *format, ...) __attribute__((format(printf, 1, 2))); | ||||||
|  | void ircQuit(const char *mesg); | ||||||
| 
 | 
 | ||||||
| void uiInit(void); | void uiInit(void); | ||||||
| void uiShow(void); | void uiShow(void); | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								event.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								event.c
									
									
									
									
									
								
							| @ -131,14 +131,10 @@ noreturn void eventLoop(void) { | |||||||
| 
 | 
 | ||||||
| 	for (;;) { | 	for (;;) { | ||||||
| 		if (sig[SIGCHLD]) childWait(); | 		if (sig[SIGCHLD]) childWait(); | ||||||
| 		if (sig[SIGHUP]) { | 		if (sig[SIGHUP]) ircQuit("zzz"); | ||||||
| 			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"); | 			ircQuit("Goodbye"); | ||||||
| 			self.quit = true; |  | ||||||
| 		} | 		} | ||||||
| 		if (sig[SIGWINCH]) { | 		if (sig[SIGWINCH]) { | ||||||
| 			curses.sa_handler(SIGWINCH); | 			curses.sa_handler(SIGWINCH); | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								input.c
									
									
									
									
									
								
							| @ -118,8 +118,11 @@ 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"); | 	if (params) { | ||||||
| 	self.quit = true; | 		ircQuit(params); | ||||||
|  | 	} else { | ||||||
|  | 		ircQuit("Goodbye"); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void inputURL(struct Tag tag, char *params) { | static void inputURL(struct Tag tag, char *params) { | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								irc.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								irc.c
									
									
									
									
									
								
							| @ -117,6 +117,11 @@ void ircFmt(const char *format, ...) { | |||||||
| 	free(buf); | 	free(buf); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void ircQuit(const char *mesg) { | ||||||
|  | 	ircFmt("QUIT :%s\r\n", mesg); | ||||||
|  | 	self.quit = true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void ircRead(void) { | void ircRead(void) { | ||||||
| 	static char buf[4096]; | 	static char buf[4096]; | ||||||
| 	static size_t len; | 	static size_t len; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user