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

k-line comment patch2



Hi,

i've found a +CS version at pain.concentric.net:/pub/cbehrens :)

So here's the new version of the previous patch. If there's a comment in the
'K:'-field of the conf file, It displays the k-line comment instead of 
"K-lined" when a user tries to connect to a server on which he's k-lined.
 
I've tested it a bit locally - works fine so far.

Bye, Kasi

--- cut here ---
diff -cr irc2.9.3b14.old/include/h.h irc2.9.3b14/include/h.h
*** irc2.9.3b14.old/include/h.h	Fri Apr 18 16:31:00 1997
--- irc2.9.3b14/include/h.h	Tue Apr 22 09:08:58 1997
***************
*** 80,86 ****
  extern	aConfItem *find_conf_host __P((Link *, char *, int));
  extern	aConfItem *find_conf_ip __P((Link *, char *, char *, int));
  extern	aConfItem *find_conf_name __P((char *, int));
! extern	int	find_kill __P((aClient *, int));
  extern	int	find_two_masks __P((char *, char *, int));
  extern	int	find_conf_flags __P((char *, char *, int));
  extern	int	find_restrict __P((aClient *));
--- 80,86 ----
  extern	aConfItem *find_conf_host __P((Link *, char *, int));
  extern	aConfItem *find_conf_ip __P((Link *, char *, char *, int));
  extern	aConfItem *find_conf_name __P((char *, int));
! extern	int	find_kill __P((aClient *, int, char **));
  extern	int	find_two_masks __P((char *, char *, int));
  extern	int	find_conf_flags __P((char *, char *, int));
  extern	int	find_restrict __P((aClient *));
diff -cr irc2.9.3b14.old/ircd/ircd.c irc2.9.3b14/ircd/ircd.c
*** irc2.9.3b14.old/ircd/ircd.c	Mon Apr 14 17:04:16 1997
--- irc2.9.3b14/ircd/ircd.c	Tue Apr 22 09:37:05 1997
***************
*** 336,342 ****
  		    {
  			if (IsPerson(cptr))
  			    {
! 				kflag = find_kill(cptr, rehashed);
  #ifdef R_LINES_OFTEN
  				rflag = find_restrict(cptr);
  #endif
--- 336,344 ----
  		    {
  			if (IsPerson(cptr))
  			    {
! 			        char *reason; /* not used here but necessary */
! 
! 				kflag = find_kill(cptr, rehashed, &reason);
  #ifdef R_LINES_OFTEN
  				rflag = find_restrict(cptr);
  #endif
diff -cr irc2.9.3b14.old/ircd/s_conf.c irc2.9.3b14/ircd/s_conf.c
*** irc2.9.3b14.old/ircd/s_conf.c	Mon Apr 21 02:33:11 1997
--- irc2.9.3b14/ircd/s_conf.c	Tue Apr 22 10:04:04 1997
***************
*** 1123,1131 ****
  	return -1;
  }
  
! int	find_kill(cptr, doall)
  aClient	*cptr;
  int	doall;
  {
  	char	reply[256], *host, *name;
  	aConfItem *tmp;
--- 1123,1132 ----
  	return -1;
  }
  
! int	find_kill(cptr, doall, reason)
  aClient	*cptr;
  int	doall;
+ char **reason;
  {
  	char	reply[256], *host, *name;
  	aConfItem *tmp;
***************
*** 1166,1171 ****
--- 1167,1176 ----
  			   ERR_YOUREBANNEDCREEP, cptr->name,
  			   BadPtr(tmp->passwd) ?
  			   "You are not welcome to this server" : tmp->passwd);
+ 
+ 	if (tmp)
+ 	    if (!BadPtr(tmp->passwd) && !isdigit(*tmp->passwd))
+ 		*reason = tmp->passwd;
  
   	return (tmp ? -1 : 0);
  }
Only in irc2.9.3b14/ircd: s_conf.c~
diff -cr irc2.9.3b14.old/ircd/s_user.c irc2.9.3b14/ircd/s_user.c
*** irc2.9.3b14.old/ircd/s_user.c	Fri Apr 18 23:38:55 1997
--- irc2.9.3b14/ircd/s_user.c	Tue Apr 22 09:43:13 1997
***************
*** 340,346 ****
  	aServer	*sp = NULL;
  	anUser	*user = sptr->user;
  	short	oldstatus = sptr->status;
! 	char	*parv[3], prefix;
  	int	i;
  
  	user->last = timeofday;
--- 340,346 ----
  	aServer	*sp = NULL;
  	anUser	*user = sptr->user;
  	short	oldstatus = sptr->status;
! 	char	*parv[3], *reason = NULL, prefix;
  	int	i;
  
  	user->last = timeofday;
***************
*** 446,454 ****
  		    }
  		bzero(sptr->passwd, sizeof(sptr->passwd));
  		/*
! 		 * following block for the benefit of time-dependent K:-lines
! 		 */
! 		if (find_kill(sptr, 1))
  		    {
  			sendto_flag(SCH_LOCAL, "K-lined %s@%s.",
  				    sptr->user->username, sptr->sockhost);
--- 446,459 ----
  		    }
  		bzero(sptr->passwd, sizeof(sptr->passwd));
  		/*
! 		** following block for the benefit of time-dependent K:-lines
! 		**
! 		** Support for k-line comments added.
! 		** If there's a comment in the 'K:'-field of the conf file,
! 		** it will be displayed instead of the string "K-lined".
! 		** Inspired by comstud's +CS version.        22/04/97 -Kasi
! 		*/
! 		if (find_kill(sptr, 1, &reason))
  		    {
  			sendto_flag(SCH_LOCAL, "K-lined %s@%s.",
  				    sptr->user->username, sptr->sockhost);
***************
*** 463,469 ****
  			sendto_flog(sptr, " K lined ", 0, sptr->user->username,
  				    sptr->user->host);
  #endif
! 			return exit_client(cptr, sptr, &me, "K-lined");
  		    }
  #ifdef R_LINES
  		if (find_restrict(sptr))
--- 468,475 ----
  			sendto_flog(sptr, " K lined ", 0, sptr->user->username,
  				    sptr->user->host);
  #endif
! 			return exit_client(cptr, sptr, &me, (reason) ?
! 					   reason : "K-lined");
  		    }
  #ifdef R_LINES
  		if (find_restrict(sptr))
--- cut here ---

-- 
Kaspar Landsberg, <kl@xxxxxxxxxxxxxxx>