degesch: parse MODES from RPL_ISUPPORT
This commit is contained in:
		
							parent
							
								
									e2a3b48114
								
							
						
					
					
						commit
						178c1b072a
					
				
							
								
								
									
										18
									
								
								degesch.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								degesch.c
									
									
									
									
									
								
							| @ -1073,6 +1073,8 @@ struct server | ||||
| 	char *irc_chanuser_prefixes;        ///< Channel user prefixes
 | ||||
| 	char *irc_chanuser_modes;           ///< Channel user modes
 | ||||
| 
 | ||||
| 	unsigned irc_max_modes;             ///< Max parametrized modes per command
 | ||||
| 
 | ||||
| 	// Events:
 | ||||
| 
 | ||||
| 	struct poller_timer ping_tmr;       ///< We should send a ping
 | ||||
| @ -1111,6 +1113,8 @@ server_init (struct server *self, struct poller *poller) | ||||
| 	self->irc_chanuser_prefixes = xstrdup ("@+"); | ||||
| 	self->irc_chanuser_modes    = xstrdup ("ov"); | ||||
| 
 | ||||
| 	self->irc_max_modes = 3; | ||||
| 
 | ||||
| 	str_map_init (&self->irc_users); | ||||
| 	self->irc_users.key_xfrm = irc_strxfrm; | ||||
| 	str_map_init (&self->irc_channels); | ||||
| @ -5127,6 +5131,16 @@ irc_handle_isupport_chanmodes (struct server *s, char *value) | ||||
| 	str_vector_free (&v); | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| irc_handle_isupport_modes (struct server *s, char *value) | ||||
| { | ||||
| 	unsigned long modes; | ||||
| 	if (!*value) | ||||
| 		s->irc_max_modes = UINT_MAX; | ||||
| 	else if (xstrtoul (&modes, value, 10) && modes && modes <= UINT_MAX) | ||||
| 		s->irc_max_modes = modes; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| unescape_isupport_value (const char *value, struct str *output) | ||||
| { | ||||
| @ -5175,8 +5189,10 @@ irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg) | ||||
| 			irc_handle_isupport_statusmsg   (s, value_unescaped.str); | ||||
| 		else if (!strcmp (param, "CHANMODES")) | ||||
| 			irc_handle_isupport_chanmodes   (s, value_unescaped.str); | ||||
| 		else if (!strcmp (param, "MODES")) | ||||
| 			irc_handle_isupport_modes       (s, value_unescaped.str); | ||||
| 
 | ||||
| 		// TODO: also parse MODES, TARGMAX and make use of them
 | ||||
| 		// TODO: also parse TARGMAX and make use of it
 | ||||
| 		//   to split client commands as necessary
 | ||||
| 
 | ||||
| 		str_free (&value_unescaped); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user