+ case '+':
+ case '-':
+ if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
+ {
+ /* Action modifier ("+"/"-") must be changed ... */
+ len = strlen( the_modes ) - 1;
+ if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' ))
+ {
+ /* Adjust last action modifier in result */
+ the_modes[len] = *mode_ptr;
+ }
+ else
+ {
+ /* Append modifier character to result string */
+ x[0] = *mode_ptr;
+ strlcat( the_modes, x, sizeof( the_modes ));
+ }
+ if( *mode_ptr == '+' ) set = true;
+ else set = false;
+ }
+ continue;
+ }
+
+ /* Are there arguments left? */
+ if( arg_arg >= Req->argc ) arg_arg = -1;
+
+ /* Validate modes */
+ x[0] = '\0';
+ argadd[0] = '\0';
+ client = NULL;
+ switch( *mode_ptr )
+ {
+ /* --- Channel modes --- */
+
+ case 'i': /* Invite only */
+ case 'm': /* Moderated */
+ case 'n': /* Only members can write */
+ case 's': /* Secret channel */
+ case 't': /* Topic locked */
+ if( modeok ) x[0] = *mode_ptr;
+ else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
+ break;
+
+ case 'k': /* Channel key */
+ if( ! set )
+ {
+ if( modeok ) x[0] = *mode_ptr;
+ else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
+ break;
+ }
+ if( arg_arg > mode_arg )