File Snooping

From: Pheonix Shadowflame (pheonix@IQ-CORP.COM)
Date: 05/29/98


I'm trying to write a code so if a certain flag, PLR_WATCHED for
example, is affecting a player then everything that player types and
sees is recorded in a file. Basically snoop into a file. I added the
flag and the following in process_output in comm.c:

  if (!t->prompt_mode)          /* && !t->connected) */
    result = write_to_descriptor(t->descriptor, i);
  else
    result = write_to_descriptor(t->descriptor, i + 2);
  /* handle snooping: prepend "% " and send to snooper */
  if (t->snoop_by) {
    SEND_TO_Q("% ", t->snoop_by);
    SEND_TO_Q(t->output, t->snoop_by);
    SEND_TO_Q("%%", t->snoop_by);
  }
> if (PLR_FLAGGED(t->character, PLR_WATCHED)){
>   sprintf(buf, "echo \"%s\" >> ../log/snoop/\"%s\"", t->output, GET_NAME(t->character));
>   system(buf);
> }

And simular in process_input. It crashes the mud as soon as anyone tries
to connect.
However if I put the block inside the  if (t->snoop_by) block then
whenever someone is
snooping a player everything is logged. Like this:
  if (!t->prompt_mode)          /* && !t->connected) */
    result = write_to_descriptor(t->descriptor, i);
  else
    result = write_to_descriptor(t->descriptor, i + 2);
  /* handle snooping: prepend "% " and send to snooper */
  if (t->snoop_by) {
    SEND_TO_Q("% ", t->snoop_by);
    SEND_TO_Q(t->output, t->snoop_by);
    SEND_TO_Q("%%", t->snoop_by);
>   if (PLR_FLAGGED(t->character, PLR_WATCHED)){
>     sprintf(buf, "echo \"%s\" >> ../log/snoop/\"%s\"", t->output, GET_NAME(t->character));
>     system(buf);
>   }
  }

Any way I can get this to work? I think I've seen a code for this
somewhere but I've checked
both the FTP site and the snippits page and no one has it. Any help
would be appreciated.

Pheonix Shadowflame


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST