From: tigeba <tigeba@sprintmail.com>
Subject: reply function for boards

Thanks, I completely had a mental block there.  Anyway, without
further ado here is my shameless hack of the board.c code, and
a little function that allows players to reply to board messages 
feel free to use it if you like it.  I think all the changes are
contained in boards.c so let me know if I forgot anything.

Enjoy, 

Tigeba@sprintmail.com


Ok, add the following function to boards.c and make sure to prototype 
it at the top of the file

void Board_reply_message(int board_type, struct char_data * ch, char *arg)
{
  char *tmstr;
  int len, msg, ind;
  time_t ct;
  char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
  char number[MAX_STRING_LENGTH];

  one_argument(arg, number);
  
  if (GET_LEVEL(ch) < WRITE_LVL(board_type)) {
    send_to_char("You are not holy enough to write on this board.\r\n", ch);
    return;
  }
  if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) {
    send_to_char("The board is full.\r\n", ch);
    return;
  }
  if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) {
    send_to_char("The board is malfunctioning - sorry.\r\n", ch);
    log("SYSERR: Board: failed to find empty slot on write.");
    return;
  }
  /* skip blanks */
  if (!*number)
    return;
  if (!isdigit(*number) || (!(msg = atoi(number))))
    return;

  if (GET_LEVEL(ch) < READ_LVL(board_type)) {
    send_to_char("You try to reply but fail in your sneaky tactic.\r\n",ch);
    return;
    }

 if (!num_of_msgs[board_type]) {
    send_to_char("The board is empty!\r\n", ch);
    return;
  }

  if (msg < 1 || msg > num_of_msgs[board_type]) {
    send_to_char("That message exists only in your imagination.\r\n",
                 ch);
    return;
  }

 ind = msg -1;
  if (MSG_SLOTNUM(board_type, ind) < 0 ||
      MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) {
    send_to_char("Sorry, the board is not working.\r\n", ch);
    log("SYSERR: Board is screwed up.");
    return;
  }

  if (!(MSG_HEADING(board_type, ind))) {
    send_to_char("That message appears to be screwed up.\r\n", ch);
    return;
  }

  if (!(msg_storage[MSG_SLOTNUM(board_type, ind)])) {
    send_to_char("That message seems to be empty.\r\n", ch);
    return;
  }
  ct = time(0);
  tmstr = (char *) asctime(localtime(&ct));
  *(tmstr + strlen(tmstr) - 1) = '\0';


  sprintf(buf2, "(%s)", GET_NAME(ch));
  
  sprintf(buf, "%6.10s %-12s :: Re: %s", tmstr, buf2, 
        (MSG_HEADING(board_type, ind)+26));
  len = strlen(buf) + 1;
  if (!(NEW_MSG_INDEX(board_type).heading = (char *) malloc(sizeof(char) * len))) {
    send_to_char("The board is malfunctioning - sorry.\r\n", ch);
    return;
  }
  strcpy(NEW_MSG_INDEX(board_type).heading, buf);
  NEW_MSG_INDEX(board_type).heading[len - 1] = '\0';
  NEW_MSG_INDEX(board_type).level = GET_LEVEL(ch);

  send_to_char("Write your message.  (/s saves /h for help)\r\n\r\n",ch);
  act("$n starts to write a message.", TRUE, ch, 0, 0, TO_ROOM);

  if (!IS_NPC(ch))
    SET_BIT(PLR_FLAGS(ch), PLR_WRITING);

  ch->desc->str = &(msg_storage[NEW_MSG_INDEX(board_type).slot_num]);
  ch->desc->max_str = MAX_MESSAGE_LENGTH;
  ch->desc->mail_to = board_type + BOARD_MAGIC;

  num_of_msgs[board_type]++;
}



Next, make the following changes to the SPECIAL(gen_board);


Search for:

  CMD_READ = find_command("read");
  CMD_WRITE = find_command("write");
  CMD_REMOVE = find_command("remove");
  CMD_LOOK = find_command("look");
  CMD_EXAMINE = find_command("examine");
  CMD_REPLY = find_command("reply");   <------ add

Directly below:

  if (cmd != CMD_WRITE && cmd != CMD_LOOK && cmd != CMD_EXAMINE &&
      cmd != CMD_READ && cmd != CMD_REMOVE && cmd != CMD_REPLY) <-----
add
    return 0;


Search for:  

  Board_write_message(board_type, ch, argument);
    return 1;
 } else if (cmd == CMD_REPLY){                           <---- Add
    (Board_reply_message(board_type, ch, argument));     <---- Add
    return 1;
 } else if (cmd == CMD_LOOK || cmd == CMD_EXAMINE)
    return (Board_show_board(board_type, ch, argument));



Compile and that should be it..
