[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggestion for mode requests from outside !channels



As you all know, it is possible to see modes from outside a # channel
by e.g. the following:

mode #channel
mode #channel +b

However, if the modes on a ! channel are desired, as things currently
stand the only way of learning these modes is to join the channel at
least once so the chanID becomes known.

I've knocked together a little patch which changes this behaviour so
that the MODE command accepts the shortname for a !channel, but only if
the caller of the MODE command is not on that channel.

Wull@IRCnet.
diff -rcN irc2.10.3/ircd/channel.c irc2.10.3.modefix/ircd/channel.c
*** irc2.10.3/ircd/channel.c	Fri Aug 13 18:30:16 1999
--- irc2.10.3.modefix/ircd/channel.c	Fri Sep 03 07:37:52 1999
***************
*** 855,860 ****
--- 855,892 ----
  	    {
  		clean_channelname(name);
  		chptr = find_channel(name, NullChn);
+ 
+ 				/* Start mode patch */
+             if (MyClient(sptr) && (chptr == NullChn) && (*name == '!'))
+               {
+ 			/* We've been fed what looks like the shortname for a
+ 			 * channel. First - check we're not already on such
+ 			 * a channel.
+ 			 */
+ 			Reg	Link	*lp;
+ 			int notonchan = 1;
+ 			for (lp = sptr->user->channel; lp; lp = lp->next)
+ 				if (
+ 					(*(lp->value.chptr->chname) == '!') &&
+ 					(mycmp((lp->value.chptr->chname + CHIDLEN + 1), (name + 1)) == 0) 
+ 				    )
+ 				    {
+ 					notonchan = 0;
+ 					break;
+ 				    }
+ 
+ 			if (notonchan)
+ 			   {
+ 				if (chptr = hash_find_channels(name+1, NULL))
+ 				  name = chptr->chname;
+ 				else
+ 				  chptr = NullChn;
+ 				penalty += 1;
+ 			   }
+ 			penalty += 1;
+ 		  }
+ 				/* End mode patch */
+ 
  		if (chptr == NullChn)
  		    {
  			parv[1] = name;