Re: Mud Mail question: How does it work?! from "Nitelite" at Sep 5, 98 08:26:57 am

From: Andrew Helm (ashe@IGLOU.COM)
Date: 09/05/98

On Sat, 5 Sep 1998 Nitelite wrote:
>  I have been going over the mud mail system (mail.c), and still don't
>really understand what it is doing. Could someone give me an idea how you
>would, say, send every new player that enters the game a mudmail that just
>says "Welcome". I do not want to actually implement this, but am very
>curious how it would be done.

Even if you don't understand the all the code in mail.c you
can still read the name and arguments of a function for an
idea of what it does. Let's look over mail.c for some canidates:

 void write_to_file(void *buf, int size, long filepos)
 void store_mail(long to, long from, char *message_pointer)
 void postmaster_send_mail(struct char_data * ch, struct char_data *mailman,
                           int cmd, char *arg)

postmaster_send_mail() seems to be called from the postmaster special.
It would require that the sender is logged on and that the sender
types out the message himself. Obviously not what you want.

That leaves write_to_file() and store_mail(). write_to_file() takes
a buf, a size, and a file position. That seems a bit low level for
our purposes. store_mail() takes a to, a from, and a message. Aha!

Examining store_mail() more carefully, we see that to and from
are the respective player's idnums and message_pointer is a
pointer to the pointer to the begining char of the message.
You now have all the info you need to write a function that
sends a message to a player.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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