/* Version 1.0 */

AUTOSNOOP By the Mage for ROM 2.4b4a

This is release under the GNU license.  Please use it..  If you wish
to give me credit.. I would appreciate it.

This function allows you to save autosnoop information on a user any
time that character logs on.

file: comm.c
in process_output();
Add the following declaration variables:
    char temp_str[150];
    int found=0;
    char temp_buf[70000];
    FILE *fp;
    int i;

Between Short Circuit and the regular snoop place this:
    /*
     * Auto-Snoop-o-rama.
     */
    if (d->character != NULL) {
	found = 0;
	for (i=0; i < MAX_NUM_AUTOSNOOP; i++) {
	    if (!strcmp(as_string[i],d->character->name)) {
		found = i;
	    }
	}
	if (found) {
	    sprintf(temp_str,"%s/%s.txt",AS_DIR_STRING,as_string[found]);
	    if ((fp = fopen(temp_str,"a")) != NULL) {
		fprintf(fp, d->character->name);
		fprintf(fp, "> ");
		sprintf(temp_buf,"\n%s\n",d->outbuf);
		fwrite(temp_buf, strlen(temp_buf), 1, fp);
		fclose(fp);
	    } else {
		perror("Autosnoop Failed to open File.");
	    }
	}
    }

file: interp.c
Add these interface funcs.
    { "as",		do_as,		POS_DEAD,	ML,  LOG_ALWAYS, 0 },
    { "aslist",		do_aslist,	POS_DEAD,	ML,  LOG_ALWAYS, 0 },

Add this between log and regular snoop:
    /* Autosnoop */
    if (ch->desc != NULL) {
	found = 0;
	for (i=0; i < MAX_NUM_AUTOSNOOP; i++) {
	    if (!strcmp(as_string[i],ch->name)) {
		found = i;
	    }
	}
	sprintf(temp_str,"%s/%s.txt",AS_DIR_STRING,as_string[found]);
	if ((fp = fopen(temp_str,"a")) != NULL) {
	    fprintf(fp,"%\n");
	    fwrite(logline, strlen(logline), 1, fp);
	    fprintf(fp,"\n\r");
	    fclose(fp);
	}
    }


file: interp.h
DECLARE_DO_FUN( do_as		);
DECLARE_DO_FUN( do_aslist	);

file: act_comm.c
Add the following:
char	as_string[MAX_NUM_AUTOSNOOP][70];

void do_as(CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *gch;
    char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH];
    char temp_buf[200];
    int position=-1;
    argument = one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char( "That is not a valid number\n\r", ch );
	printf("#1");
	return;
    }

    position = atoi(arg);
    if ((position < 0)||(position >= MAX_NUM_AUTOSNOOP)){
	send_to_char("Position is outta range\n\r", ch);
	printf("#3");
	return;
    }
    sprintf(temp_buf,"{GSwitching from useing %s to use %s{x\n\r",as_string[position],argument);
    strcpy(as_string[position],argument);
    send_to_char(temp_buf,ch);
    return;
}

void do_aslist(CHAR_DATA *ch, char *argument)
{
    int i;

    send_to_char ("{RAUTOSNOOPING THE FOLLOWING:{x\n\r", ch);
    for (i=0; i < MAX_NUM_AUTOSNOOP; i++) {
	send_to_char("{C",ch);
	send_to_char(as_string[i], ch);
	send_to_char("{x\n\r", ch);
    }
}

file: merc.h
MAX_NUM_AUTOSNOOP is the amount of poeple your can do concureently.
Add this to the act_comm.c

#define AS_DIR_STRING "/master/log"
#define MAX_NUM_AUTOSNOOP 5
extern	char		as_string[MAX_NUM_AUTOSNOOP][70];

