Track MODE in replies
This commit is contained in:
		
							parent
							
								
									35ae4121cb
								
							
						
					
					
						commit
						4f40ace9d4
					
				
							
								
								
									
										1
									
								
								chat.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								chat.h
									
									
									
									
									
								
							| @ -187,6 +187,7 @@ extern struct Replies { | |||||||
| 	uint invex; | 	uint invex; | ||||||
| 	uint join; | 	uint join; | ||||||
| 	uint list; | 	uint list; | ||||||
|  | 	uint mode; | ||||||
| 	uint names; | 	uint names; | ||||||
| 	uint topic; | 	uint topic; | ||||||
| 	uint whois; | 	uint whois; | ||||||
|  | |||||||
| @ -185,12 +185,14 @@ static void commandMode(uint id, char *params) { | |||||||
| 			ircFormat("MODE %s %s\r\n", self.nick, params); | 			ircFormat("MODE %s %s\r\n", self.nick, params); | ||||||
| 		} else { | 		} else { | ||||||
| 			ircFormat("MODE %s\r\n", self.nick); | 			ircFormat("MODE %s\r\n", self.nick); | ||||||
|  | 			replies.mode++; | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		if (params) { | 		if (params) { | ||||||
| 			ircFormat("MODE %s %s\r\n", idNames[id], params); | 			ircFormat("MODE %s %s\r\n", idNames[id], params); | ||||||
| 		} else { | 		} else { | ||||||
| 			ircFormat("MODE %s\r\n", idNames[id]); | 			ircFormat("MODE %s\r\n", idNames[id]); | ||||||
|  | 			replies.mode++; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								handle.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								handle.c
									
									
									
									
									
								
							| @ -527,6 +527,9 @@ static const char *UserModes[256] = { | |||||||
| 
 | 
 | ||||||
| static void handleReplyUserModeIs(struct Message *msg) { | static void handleReplyUserModeIs(struct Message *msg) { | ||||||
| 	require(msg, false, 2); | 	require(msg, false, 2); | ||||||
|  | 	if (!replies.mode) return; | ||||||
|  | 	replies.mode--; | ||||||
|  | 
 | ||||||
| 	char buf[1024] = ""; | 	char buf[1024] = ""; | ||||||
| 	for (char *ch = msg->params[1]; *ch; ++ch) { | 	for (char *ch = msg->params[1]; *ch; ++ch) { | ||||||
| 		if (*ch == '+') continue; | 		if (*ch == '+') continue; | ||||||
| @ -560,6 +563,9 @@ static const char *ChanModes[256] = { | |||||||
| 
 | 
 | ||||||
| static void handleReplyChannelModeIs(struct Message *msg) { | static void handleReplyChannelModeIs(struct Message *msg) { | ||||||
| 	require(msg, false, 3); | 	require(msg, false, 3); | ||||||
|  | 	if (!replies.mode) return; | ||||||
|  | 	replies.mode--; | ||||||
|  | 
 | ||||||
| 	uint param = 3; | 	uint param = 3; | ||||||
| 	char buf[1024] = ""; | 	char buf[1024] = ""; | ||||||
| 	for (char *ch = msg->params[2]; *ch; ++ch) { | 	for (char *ch = msg->params[2]; *ch; ++ch) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user