Re: [CoDe] Mail

From: Daniel Koepke (dkoepke@california.com)
Date: 01/07/97


On Tue, 7 Jan 1997, Corey Hoitsma wrote:

> Hmm, does anyone know how to use the header_data stuff for mail?
> 
> I'm trying to make it so that the mail's short desc includes
> the name of the sender. Like:
> 
> 	A piece of mail from Jack.
> 
> Rather than just a piece of mail. Thanks for any help!

It'll take some twisting and turning of read_delete().  Here's some
instructions (caution: written inside mailer, use at your own risk...I
think we can make a new acronym "CWIN" [caution: written in mailer]
so I don't have to keep typing this)...Note that if you're using my 
obj_mail patch you'll have to change this a little...

  char *read_mail(long recipient, char **from) {
    .
    .
    .
    tmstr = asctime(localtime(&header.header_data.mail_time));
    *(tmstr + strlen(tmstr) - 1) = '\0';

    // ADD THE FOLLOWING
    *from = get_name_by_id(header.header_data.from);

    sprintf(buf, " * * * * Midgaard Mail System * * * *\r\n"
    .
    .
    .
  }

Now, down in postmaster_receive_mail(), change the function as follows:

  char buf[256];
  struct obj_data *obj;
  char *from;

  .
  .
  .

  while (has_mail(GET_IDNUM(ch))) {
    obj = create_obj();
    obj->item_number = NOTHING;
    obj->name = str_dup("mail paper letter");
    obj->action_description = read_delete(GET_IDNUM(ch), &from);
    sprintf(buf, "a piece of mail from %s", from);
    obj->short_description = str_dup(buf);

    .
    .
    .
    GET_OBJ_RENT(obj) = 10;
    
    if (obj->action_description == NULL)
      obj->action_description =
        str_dup("Mail system error - please report.  Error #11.\r\n");

    .
    .
    .

Note that the three periods stands for the lines inbetween the prior
code block and the next one.  The above should do it.  Not sure,
though...


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


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



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