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

Re: Suggestion for mode requests from outside !channels



Piotr Kucharski wrote:
> 
> On Fri, Sep 03, 1999 at 07:56:01AM +0100, wnelson wrote:
> > the only way of learning these modes is to join the channel at
> > least once so the chanID becomes known.
> 
> Wrong. Client can do 'LIST !channel' and get all !PREFXchannel

Fair enough...I stand corrected.

Having to do a list or a join to find out the chanID of a channel I'm
not on - just to be able to list modes - is still (to my mind) a bit
long-winded. It was with that thought in mind that I tinkered about
the code and came up with that patch. I just thought it would help make
the ! channels a bit friendlier for a lot of people.

> > 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.
> 
> Which is wrong, as there can be more than one channel with same
> shortname.

Good point - so there's now an extra check to take this into account.

Thanks for your comments,

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 22:31:24 1999
***************
*** 855,860 ****
--- 855,898 ----
  	    {
  		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)) &&
+ 					(hash_find_channels(name+1, chptr) == NULL)
+ 				   )
+ 				   {
+  					name = chptr->chname;
+ 					penalty += 1;
+ 				   }
+  				else
+  				  chptr = NullChn;
+  				penalty += 1;
+  			   }
+  			penalty += 1;
+  		  }
+  				/* End mode patch */
+ 
  		if (chptr == NullChn)
  		    {
  			parv[1] = name;