Example #1
0
int 	kill_message (const char *from, const char *cline)
{
	char *poor_sap;
	char *bastard;
	const char *path_to_bastard;
	char *reason;
	char *line;

	line = LOCAL_COPY(cline);
	poor_sap = next_arg(line, &line);

	/* Dalnet kill BBC and doesnt append the period */
	if (!end_strcmp(poor_sap, ".", 1))
		chop(poor_sap, 1);

	/* dalnet kill BBC and doesnt use "From", but "from" */
	if (my_strnicmp(line, "From ", 5))
	{
		yell("Attempted to parse an ill-formed KILL request [%s %s]",
			poor_sap, line);
		return 0;
	}
	line += 5;
	bastard = next_arg(line, &line);

	/* Hybrid BBC and doesn't include the kill-path. */
	/* Fend off future BBC kills */
	if (my_strnicmp(line, "Path: ", 6))
	{
		path_to_bastard = "*";
		reason = line;		/* Hope for the best */
	}
	else
	{
		line += 6;
		path_to_bastard = next_arg(line, &line);
		reason = line;
	}

	return !do_hook(KILL_LIST, "%s %s %s %s %s", from, poor_sap, bastard,
					path_to_bastard, reason);
}
Example #2
0
/**
 * iface_find - find an iface struct given a host
 * @host: hostname to look for
 *
 * Each "interface" has hostnames associated with it,
 * we search for the interface structure that is 
 * associated with this hostname. Mainly used to
 * verify that a hostname is actually valid on this machine.
 **/
const struct iflist *iface_find(const char *host)
{
    struct iflist *l;
    struct iflist *m = NULL;
    int hlen = strlen(host);
    int len;

    assert(host);

    len = strlen(host);
    for (l = iflist; l; l = l->ifi_next)
	if (end_strcmp(l->ifi_host, host, len) == 0) {

	    /* best match */
	    if (strlen(l->ifi_host) == hlen)
		return l;

	    /* else take first match */
	    if (m == NULL)
		m = l;
	}
    return m;
}
Example #3
0
/*
 * help_me:  The big one.  The help procedure that handles working out
 * what was actually requested, sets up the paused topic list if it is
 * needed, does pretty much all the hard work.
 */
static	void	help_me (char *topics, char *args)
{
    char *	ptr;
    glob_t	g;
    int	entries = 0,
        cnt,
        i,
        cols;
    Stat	stat_buf;
    char	path[BIG_BUFFER_SIZE+1];
    int	help_paused_first_call = 0;
    char *	help_paused_path = (char *) 0;
    char *	help_paused_name = (char *) 0;
    char *	temp;
    char	tmp[BIG_BUFFER_SIZE+1];
    char	buffer[BIG_BUFFER_SIZE+1];
    char *	pattern = NULL;

    strlcpy(help_topic_list, topics, sizeof help_topic_list);
    ptr = get_string_var(HELP_PATH_VAR);

    snprintf(path, sizeof path, "%s/%s", ptr, topics);
    for (ptr = path; (ptr = strchr(ptr, ' '));)
        *ptr = '/';

    /*
     * first we check access to the help dir, whinge if we can't, then
     * work out we need to ask them for more help, else we check the
     * args list, and do the stuff
     */
    if (help_show_directory)
    {
        help_show_paused_topic(paused_topic, empty_string);
        help_show_directory = 0;
    }

    finished_help_paging = 0;
    if (access(path, R_OK|X_OK))
    {
        help_put_it(no_help, "*** Cannot access help directory!");
        set_help_screen((Screen *) 0);
        return;
    }

    this_arg = next_arg(args, &args);
    if (!this_arg && *help_topic_list && get_int_var(HELP_PROMPT_VAR))
    {
        if ((temp = strrchr(help_topic_list, ' ')) != NULL)
            *temp = '\0';
        else
            *help_topic_list = '\0';

        snprintf(tmp, sizeof tmp, "%s%sHelp? ", help_topic_list, *help_topic_list ? " " : empty_string);

        if (!dumb_mode)
            add_wait_prompt(tmp, help_me, help_topic_list, WAIT_PROMPT_LINE, 1);
        return;
    }

    if (!this_arg)
    {
        set_help_screen((Screen *) 0);
        return;
    }

    create_help_window();

    if (!help_window)
        return;

    /*
     * This is just a bogus while loop which is intended to allow
     * the user to do '/help alias expressions' without having to
     * include a slash inbetween the topic and subtopic.
     *
     * If all goes well, we 'break' at the bottom of the loop.
     */
    while (this_arg)
    {
        entries = 0;

        if (!*this_arg)
            help_topic(path, NULL);

        if (strcmp(this_arg, "?") == 0)
        {
            this_arg = empty_string;
            if (!dont_pause_topic)
                dont_pause_topic = 1;
        }

        /*
         * entry_size is set to the width of the longest help topic
         * (adjusted for compression extensions, of course.)
         */
        entry_size = 0;

        /*
         * Gather up the names of the files in the help directory.
         */
        {
            size_t size;
#ifndef HAVE_FCHDIR
            char 	opath[MAXPATHLEN + 1];
            getcwd(opath, MAXPATHLEN);
#else
            int 	cwd = open(".", O_RDONLY);
#endif

            size = strlen(path) + 2 + strlen(this_arg) + 3;

            chdir(path);
            pattern = alloca(size);
            snprintf(pattern, size, "%s*", this_arg);
#ifdef GLOB_INSENSITIVE
            bsd_glob(pattern, GLOB_INSENSITIVE, NULL, &g);
#else
            bsd_glob(pattern, 0, NULL, &g);
#endif

#ifndef HAVE_FCHDIR
            chdir(opath);
#else
            fchdir(cwd);
            close(cwd);
#endif
        }

        for (i = 0; i < g.gl_matchc; i++)
        {
            char	*tmp2 = g.gl_pathv[i];
            int 	len = strlen(tmp2);

            if (!end_strcmp(tmp2, ".gz", 3))
                len -= 3;
            entry_size = (len > entry_size) ? len : entry_size;
        }

        /*
         * Right here we need to check for an 'exact match'.
         * An 'exact match' would be sitting in gl_pathv[0],
         * and it is 'exact' if it is identical to what we are
         * looking for, or if it is the same except that it has
         * a compression extension on it
         */
        if (g.gl_matchc > 1)
        {
            char *str1 = g.gl_pathv[0];
            const char *str2 = this_arg;
            int len1 = strlen(str1);
            int len2 = strlen(str2);


            if (len1 == len2 && !my_stricmp(str1, str2))
                entries = 1;
            else if (len1 - 3 == len2 && !my_strnicmp(str1, str2, len2) && !end_strcmp(str1, ".gz", 3))
                entries = 1;
            else if (len1 - 2 == len2 && !my_strnicmp(str1, str2, len2) && !end_strcmp(str1, ".Z", 2))
                entries = 1;
            else if (len1 - 2 == len2 && !my_strnicmp(str1, str2, len2) && !end_strcmp(str1, ".z", 2))
                entries = 1;
        }

        if (!*help_topic_list)
            dont_pause_topic = 1;

        /* reformatted */
        /*
         * entries: -1 means something really died, 0 means there
         * was no help, 1, means it wasn't a directory, and so to
         * show the help file, and the default means to add the
         * stuff to the paused topic list..
         */
        if (!entries)
            entries = g.gl_matchc;

        switch (entries)
        {
        case -1:
        {
            help_put_it(no_help, "*** Error during help function: %s", strerror(errno));
            set_help_screen(NULL);
            if (help_paused_first_call)
            {
                help_topic(help_paused_path, help_paused_name);
                help_paused_first_call = 0;
                new_free(&help_paused_path);
                new_free(&help_paused_name);
            }
            message_from(NULL, LOG_CRAP);
            return;
        }
        case 0:
        {
            help_put_it(this_arg, "*** No help available on %s: Use ? for list of topics", this_arg);
            if (!get_int_var(HELP_PROMPT_VAR))
            {
                set_help_screen(NULL);
                break;
            }
            snprintf(tmp, sizeof tmp, "%s%sHelp? ", help_topic_list, *help_topic_list ? " " : empty_string);
            if (!dumb_mode)
                add_wait_prompt(tmp, help_me, help_topic_list, WAIT_PROMPT_LINE, 1);

            if (help_paused_first_call)
            {
                help_topic(help_paused_path, help_paused_name);
                help_paused_first_call = 0;
                new_free(&help_paused_path);
                new_free(&help_paused_name);
            }

            break;
        }
        case 1:
        {
            snprintf(tmp, sizeof tmp, "%s/%s", path, g.gl_pathv[0]);
            stat(tmp, &stat_buf);
            if (stat_buf.st_mode & S_IFDIR)
            {
                strlcpy(path, tmp, sizeof path);
                if (*help_topic_list)
                    strlcat(help_topic_list, " ", sizeof help_topic_list);

                strlcat(help_topic_list, g.gl_pathv[0], sizeof help_topic_list);

                if (!(this_arg = next_arg(args, &args)))
                {
                    help_paused_first_call = 1;
                    malloc_strcpy(&help_paused_path, path);
                    malloc_strcpy(&help_paused_name, g.gl_pathv[0]);
                    dont_pause_topic = -1;
                    this_arg = "?";
                }
                bsd_globfree(&g);
                continue;
            }
            else
            {
                help_topic(path, g.gl_pathv[0]);
                finished_help_paging = 0;
                break;
            }
        }
        default:
        {
            help_show_directory = 1;
            strlcpy(paused_topic, help_topic_list, sizeof paused_topic);
            help_pause_add_line("*** %s choices:", help_topic_list);
            entry_size += 2;
            cols = (current_term->TI_cols - 10) / entry_size;

            strlcpy(buffer, empty_string, sizeof(buffer));
            cnt = 0;

            for (i = 0; i < entries; i++)
            {
                if (!end_strcmp(g.gl_pathv[i], ".gz", 3))
                    chop(g.gl_pathv[i], 3);
                strlcat(buffer, g.gl_pathv[i], sizeof buffer);

                /*
                 * Since we already know how many columns each
                 * line will contain, we check to see if we have
                 * accumulated that many entries.  If we have, we
                 * output the line to the screen.
                 */
                if (++cnt == cols)
                {
                    help_pause_add_line("%s", buffer);
                    *buffer = 0;
                    cnt = 0;
                }

                /*
                 * If we have not finished this line, then we have
                 * to pad the name length out to the expected width.
                 * 'entry_size' is the column width.  We also have
                 * do adjust for compression extension.
                 */
                else
                    strextend(buffer, ' ', entry_size - strlen(g.gl_pathv[i]));
            }

            help_pause_add_line("%s", buffer);
            if (help_paused_first_call)
            {
                help_topic(help_paused_path, help_paused_name);
                help_paused_first_call = 0;
                new_free(&help_paused_path);
                new_free(&help_paused_name);
            }
            if (dont_pause_topic == 1)
            {
                help_show_paused_topic(paused_topic, empty_string);
                help_show_directory = 0;
            }
            break;
        }
        }
        /* end of reformatting */


        bsd_globfree(&g);
        break;
    }

    /*
     * This one is for when there was never a topic and the prompt
     * never got a topic..  and help_screen was never reset..
     * phone, jan 1993.
     */
    if (!*help_topic_list && finished_help_paging)
        set_help_screen((Screen *) 0);

    message_from(NULL, LOG_CRAP);
}
Example #4
0
static	int  handle_oper_vision(const char *from, char *cline, int *up_status)
{
	char *fr, *for_, *temp, *temp2;
	char *p;
	int done_one = 0;
	char *line;
	unsigned long flags;
	int dcount;
			
	p = fr = for_ = temp = temp2 = NULL;

	if (from_server == -1 || !(flags = get_server_ircop_flags(from_server)))
		return 0;

	line = LOCAL_COPY(cline);
	if (!strncmp(line, "*** Notice -- ", 13)) line += 14, dcount = 14;
	else if (!strncmp(line, "*** \002Notice\002 --", 15)) line += 16, dcount = 16;

	done_one++;
/*
[ss]!irc.cs.cmu.edu D-line active for think[[email protected]]
*/
	set_display_target(NULL, LOG_SNOTE);	
	
	if (!strncmp(line, "Received KILL message for ", 26))
	{
		char *q = line + 26;
		int loc_check = 0;

		for_ = next_arg(q, &q);
		if (!end_strcmp(for_, ".", 1))
			chop(for_, 1);
		q += 5;
		fr = next_arg(q, &q);
		q += 6; 
		check_orig_nick(for_);

		
		if (strchr(fr, '.'))
		{
			nick_collisions++;
			if (!(flags & NICK_COLLIDE))
				goto done;  	
			serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q));
		}
		else 
		{
			oper_kills++;
			if (!(flags & NICK_KILL))
				goto done;  	

			if ((temp2 = next_arg(q, &q)))
				loc_check = charcount(temp2, '!');
			if (q && *q)
				q++; chop(q, 1);
			if (loc_check <= 2)		
				serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_LOCAL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q));
			else
				serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q));
		}
		(*up_status)++;
	}
	else if (!strncmp(line, "Nick collision on", 17) || !strncmp(line, "Nick change collision on", 24))
	{
#if 0
irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <-
               irc.distracted.net[[email protected]])(both killed)
[BitchX]  Nick collision llision killed on
#endif               
		nick_collisions++;
		if (!(flags & NICK_COLLIDE))
			goto done;  	
		if (!strncmp(line+5, "change", 6))
			p = line + 24;
		else
			p = line + 18;
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s", update_clock(GET_TIME), p));
		(*up_status)++;
	}
	else if (!strncmp(line, "IP# Mismatch:", 13))
	{
		if (!(flags & IP_MISMATCH))
			goto done;  	
		for_ = line + 14;
		serversay(1, from_server, "%s", convert_output_format(" IP Mismatch %C$1-", "%s %s", update_clock(GET_TIME), for_));
	}
	else if (!strncmp(line, "Hacked ops on opless channel:", 29))
	{
		if (!(flags & HACK_OPS))
			goto done;  	
		for_ = line + 29;
		serversay(1, from_server, "%s", convert_output_format(" Hacked ops on $0", "%s", for_));
	}
	else if (!strncmp(line, "connect failure:", 16))
	{
		client_connects++;
		client_exits++;
		if (!(flags & SERVER_CRAP))
			goto done;  	
		for_ = line + 16;
		serversay(1, from_server, "%s", convert_output_format(" Connect failure %K[%n$0-%K]", "%s", for_));
	} 
	else if (!strncmp(line, "Identd response differs", 22))
	{
		if (!(flags & IDENTD))
			goto done;  	
		for_ = line + 24;
		serversay(1, from_server, "%s", convert_output_format(" Identd response differs %K[%C$1-%K]", "%s %s", update_clock(GET_TIME), for_));
	}
  	else if (!strncmp(line, "Fake: ", 6)) /* MODE */
  	{
		serv_fakes++;
		if (!(flags & FAKE_MODE))
			goto done;  	
		p = line + 6;
		if ((fr = next_arg(p, &temp)))
		{
			if (lookup_channel(fr, from_server, CHAN_NOUNLINK))
				serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp));
			else 
				serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp));
		}
  	}
  	else if (!strncmp(line, "Unauthorized connection from",28))
  	{
		serv_unauth++;
		if (!(flags & UNAUTHS))
			goto done;  	
		for_ = line + 28;
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_));
	}
  	else if (!strncmp(line, "Too many connections from",25))
  	{
		serv_unauth++;
		if (!(flags & TOO_MANY))
			goto done;  	
		for_ = line + 25;
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_));
	}
	else if (strstr(line, "Entering high-traffic mode -") || !strncmp(line, "still high-traffic mode -", 25))
	{
		char *q;
 		serv_split++;
		if (!(flags & TRAFFIC))
			goto done;  	
		if (!strncmp(line, "Entering", 8))
		{
			p = line + 28;
			for_ = next_arg(p, &p);
			q = temp2 = p;
			if (temp2)
			{
				chop(temp2, 1);
				q = temp2+2;
			}
		}
		else if (!strncmp(line+10, "Entering", 8))
		{
			p = line + 38;
			for_ = next_arg(p, &p);
			q = temp2 = p;
			if (temp2)
			{
				chop(temp2, 1);
				q = temp2+2;
			}
		}
		else
		{
			p = line + 25;
			for_ = next_arg(p, &p);
			q = temp2 = p;
			if (temp2)
			{
				chop(temp2, 1);
				q = temp2+2;
			}
		}
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_HIGH_FSET), "%s %s %s", update_clock(GET_TIME), for_, q));
	}
	else if (!strncmp(line, "Resuming standard operation", 27))
	{
		serv_rejoin++;
		if (!(flags & TRAFFIC))
			goto done;  	
		p = line + 27;
		for_ = next_arg(p, &p);
		if (for_ && *for_ == '-')
			for_ = next_arg(p, &p); 
		temp = next_arg(p, &temp2);
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_NORM_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp, temp2));
	}
	else if (wild_match("% is rehashing Server config*", line))
	{
		serv_rehash++;
		if (!(flags & REHASH))
			goto done;  	
		p = line;
		for_ = next_arg(p, &p);
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_REHASH_FSET), "%s %s", update_clock(GET_TIME), for_));
	}
	else if (wild_match("% added K-Line for *", line))
	{
		char *serv = NULL;
		serv_klines++;

		if (!(flags & KLINE))
			goto done;  	

		p = line;
		for_ = next_arg(p, &p);
		if (!strncmp(p, "from", 4))
		{
			next_arg(p, &p);
			serv = next_arg(p, &p);
		}
		p += 17;
		temp2 = next_arg(p, &temp);
		if (++temp2)
			chop(temp2, 1);
		if (serv)
			serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_GLINE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), for_, temp2, serv, temp));
		else
			serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KLINE_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp2, temp));
	}
	else if (!strncmp(line, "Rejecting vlad/joh/com bot:", 27) || !strncmp(line+14, "Rejecting eggdrop bot:", 20) || !strncmp(line, "Rejecting ojnk/annoy bot", 24))
	{
		client_bot++;
		if (!(flags & POSSIBLE_BOT))
			goto done;
		p = line + 10;
		temp2 = next_arg(p, &p);
		for_ = p + 4;
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2));
	}
	else if (!strncmp(line, "Possible bot ", 13))
	{
		client_bot++;
		if (!(flags & POSSIBLE_BOT))
			goto done;  	
		p = line + 13;
		for_ = next_arg(p, &p);
		if ((temp2 = next_arg(p, &p)))
			chop(temp2, 1);
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2));
	}
	else if (wild_match("Possible % bot *", line))
	{
		char *possible = NULL;
		client_bot++;
		if (!(flags & POSSIBLE_BOT))
			goto done;  	
		p = line;
		possible = next_arg(p, &p);
		next_arg(p, &p);
		for_ = next_arg(p, &p);
		if ((temp2 = next_arg(p, &p)))
		{
			chop(temp2, 1);
			*temp2 = ' ';
		}
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT1_FSET), "%s %s %s %s", update_clock(GET_TIME), possible?possible:"Unknown", for_, temp2));
	}
	else if (wild_match("% % is now operator*", line))
	{
		oper_requests++;
		if (!(flags & OPER_MODE))
			goto done;  	
		p = line;
		fr = next_arg(p, &p);
		if ((temp2 = next_arg(p, &p)))
		{
			chop(temp2, 1);
			if (*temp2 == '(')
				*temp2 = ' ';
		}
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_OPER_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp2));
	} 
	else if (!strncmp(line, "Received SQUIT", 14))
	{
		serv_squits++;
		if (!(flags & SQUIT))
			goto done;  	
		p = line + 14;
		fr = next_arg(p, &p);
		p += 5;
		for_ = next_arg(p, &temp2);
		if (temp2)
		{
			chop(temp2, 1);
			if (*temp2 == '(')
				temp2++;
		}
		serversay(1, from_server, "%s", convert_output_format(" SQUIT of $1 from $2 %K[%R$3-%K]", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2));
	} 
	else if (!strncmp(line, "Received SERVER", 15))
	{
		serv_squits++;
		if (!(flags & SERVER_CONNECT))
			goto done;  	
		p = line + 15;
		fr = next_arg(p, &p);
		p += 5;
		for_ = next_arg(p, &temp2);
		if (temp2)
		{
			chop(temp2, 1);
			if (*temp2 == '(')
				temp2++;
		}
		serversay(1, from_server, "%s", convert_output_format(" Received SERVER %c$1%n from %c$2%n %K[%W$3-%K]", "%s %s %s %s", update_clock(GET_TIME), fr, for_, temp2));
	} 
	else if (!strncmp(line, "Sending SQUIT", 13))
	{
	    serv_squits++;
	    if (!(flags & SQUIT)) goto done;
	    p = line + 13;
	    fr = next_arg(p, &temp2);
	    if (temp2)
	    {
		chop(temp2, 1);
		if (*temp2 == '(') temp2++;
	    }
	    serversay(1, from_server, "%s", convert_output_format(" Sending SQUIT %c$1%n %K[%R$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2));
	}
	else if (!strncmp(line, "Sending SERVER", 14))
	{
	    serv_squits++;
	    if (!(flags & SERVER_CONNECT)) goto done;
	    p = line + 14;
	    fr = next_arg(p, &temp2);
	    if (temp2)
	    {
		chop(temp2, 1);
		if (*temp2 == '(') temp2++;
	    }
	    serversay(1, from_server, "%s", convert_output_format(" Sending SERVER %c$1%n %K[%W$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2));
	}
	else if (!strncmp(line, "WALLOPS :Remote CONNECT", 23))
	{
		serv_connects++;
		if (!(flags & SERVER_CONNECT))
			goto done;  	
		p = line + 23;
		for_ = next_arg(p, &p);
		fr = next_arg(p, &p);
		next_arg(p, &temp2);
		serversay(1, from_server, "%s", convert_output_format(" Remote Connect of $1:$2 from $3", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2));
	}
	else if (!strncmp(line, "Client connecting", 17) || !strncmp(line, "Client exiting", 14))
	{
		char *q = strchr(line, ':');
		char *port = empty_string;
		int conn = !strncmp(line+7, "connect", 7) ? 1 : 0;
		int dalnet = 0, ircnet = 0;

		if (strlen(line) >= 19 && line[18] == ':')
			q = NULL;
		else
			dalnet = (q == NULL);

		if (!dalnet)
		{
		    if ((q = strchr(q + 1, ' ')))
		    {
			    q++;
			    if (conn)
				ircnet = !strcmp(q, "is ");
			    else
				ircnet = !strcmp(q, "was ");
		    }
		}

		if (conn)
			client_connects++;
		else 
			client_exits++;

		if (!(flags & CLIENT_CONNECT))
			goto done;  	
		p = line;
		next_arg(p, &p); next_arg(p, &p);
		if (ircnet)
		{
		    for_ = LOCAL_COPY(p);
		    fr = LOCAL_COPY(p);
		    temp = LOCAL_COPY(p);
		    temp2 = LOCAL_COPY(p);

		    if (conn) sscanf(p, "%s is %s from %s", for_, fr, temp);
		    else sscanf(p, "%s was %s from %s", for_, fr, temp);

		    q = p;
		    sprintf(q, "%s@%s", fr, temp);
		    if (!conn) 
		    {
			port = strstr(temp2, "reason:");
			port += 8;
		    }
		} 
		else if (dalnet && !conn)
		{
			for_ = next_arg(p, &p);			
			q = temp2 = p;
			if (temp2)
			{
				chop(temp2, 1);
				q = temp2+1;
			}
		} 
		else if (conn && dalnet)
		{
			next_arg(p, &p); next_arg(p, &p); 
			port = next_arg(p, &p);
			if (!(for_ = next_arg(p, &p)))
				for_ = port;
			{
				q = temp2 = p;
				chop(port, 1);
				if (temp2)
				{
					chop(temp2, 1);
					q = temp2+1;
				}
			}
		}
		else /* hybrid */
		{
		    for_ = q;
		    if ((q = strchr(q, ' ')))
		    {
			    *q = 0;
			    q += 2;
		    }
		    if ((port = strchr(q, ' ')))
		    {
			    *port = 0;
			    port++;
			    chop(q, 1);
		    }
		}
		
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(conn ? FORMAT_SERVER_NOTICE_CLIENT_CONNECT_FSET : FORMAT_SERVER_NOTICE_CLIENT_EXIT_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, q ? q : empty_string, port ? port : empty_string));
	}
	else if (!strncmp(line, "Terminating client for excess", 29))
	{
		char *q;

		client_floods++;
		if (!(flags & TERM_FLOOD))
			goto done;  	

		p = line + 29;
		for_ = next_arg(p, &p);
		q = temp2 = p;
		if (temp2)
		{
			chop(temp2, 1);
			q = temp2+1;
		}
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_TERM_FSET), "%s %s %s", update_clock(GET_TIME), for_, q));
	}
	else if (!strncmp(line, "Invalid username:"******"%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_INVALID_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2));
	}
	else if (!strncmp(line, "STATS ", 6))
	{

		stats_req++;
		if (!(flags & STATS_REQUEST))
			goto done;  	
		p = line + 6;
		temp = next_arg(p, &p);
		p += 12;
		for_ = next_arg(p, &p);
		if ( (temp2 = ++p) )
			chop(temp2, 1);
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_STATS_FSET), "%s %s %s %s", update_clock(GET_TIME), temp, for_, temp2));
	}
	else if (!strncmp(line, "Nick flooding detected by:", 26))
	{

		if (!(flags & NICK_FLOODING))
			goto done;  	
		p = line + 26;
		serversay(1, from_server, "%s", convert_output_format(" Nick Flooding %K[%B$1-%K]", "%s %s", update_clock(GET_TIME), for_));
	}
	else if (!strncmp(line, "Kill line active for", 20) || !strncmp(line+14, "K-line active for", 17))
	{

		if (!(flags & KILL_ACTIVE))
			goto done;  	
		if (!strncmp(line + 14,"Kill", 4))
			for_ = line + 20;
		else
			for_ = line + 17;
		serversay(1, from_server, "%s", convert_output_format(" Kill line for $1 active", "%s %s", update_clock(GET_TIME), for_));
	}
	else 
	{
		if (!(flags & SERVER_CRAP))
			goto done;  	
		serversay(1, from_server, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME), from, stripansicodes(line)));
		add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, line);
	} 
done:
	reset_display_target();
	return done_one;
}