Detect pings in ACTIONs
This commit is contained in:
		
							parent
							
								
									9167a9d92c
								
							
						
					
					
						commit
						7082820299
					
				
							
								
								
									
										10
									
								
								handle.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								handle.c
									
									
									
									
									
								
							| @ -93,7 +93,8 @@ static bool isSelf(const char *nick, const char *user) { | |||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static bool isPing(const char *mesg) { | static bool isPing(const char *nick, const char *user, const char *mesg) { | ||||||
|  | 	if (isSelf(nick, user)) return false; | ||||||
| 	size_t len = strlen(self.nick); | 	size_t len = strlen(self.nick); | ||||||
| 	const char *match = mesg; | 	const char *match = mesg; | ||||||
| 	while (NULL != (match = strcasestr(match, self.nick))) { | 	while (NULL != (match = strcasestr(match, self.nick))) { | ||||||
| @ -297,9 +298,10 @@ static void handleCTCP(struct Tag tag, char *nick, char *user, char *mesg) { | |||||||
| 	if (strcmp(ctcp, "ACTION")) return; | 	if (strcmp(ctcp, "ACTION")) return; | ||||||
| 	if (!isSelf(nick, user)) tabTouch(tag, nick); | 	if (!isSelf(nick, user)) tabTouch(tag, nick); | ||||||
| 	urlScan(tag, params); | 	urlScan(tag, params); | ||||||
|  | 	bool ping = isPing(nick, user, params); | ||||||
| 	uiFmt( | 	uiFmt( | ||||||
| 		tag, "\3%d* %s\3 %s", | 		tag, "%c\3%d* %s\17 %s", | ||||||
| 		color(user), nick, params | 		ping["\17\26"], color(user), nick, params | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -314,7 +316,7 @@ static void handlePrivmsg(char *prefix, char *params) { | |||||||
| 	if (!isSelf(nick, user)) tabTouch(tag, nick); | 	if (!isSelf(nick, user)) tabTouch(tag, nick); | ||||||
| 	urlScan(tag, mesg); | 	urlScan(tag, mesg); | ||||||
| 	bool self = isSelf(nick, user); | 	bool self = isSelf(nick, user); | ||||||
| 	bool ping = !self && isPing(mesg); | 	bool ping = isPing(nick, user, mesg); | ||||||
| 	uiFmt( | 	uiFmt( | ||||||
| 		tag, "%c\3%d%c%s%c\17 %s", | 		tag, "%c\3%d%c%s%c\17 %s", | ||||||
| 		ping["\17\26"], color(user), self["<("], nick, self[">)"], mesg | 		ping["\17\26"], color(user), self["<("], nick, self[">)"], mesg | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user