[CODE] Autoreceiving Mudmail

From: Ryan Linn (rlinn@hubcap.clemson.edu)
Date: 01/26/97

well while I was playing with the mail code ... I was bored enough to 
write code so that you will automatically receive mudmail when you are in 
the mud.  I have tested this, and ON MY MUDS, it had no problems.  I give 
it no garantees and can only say it worked with my stuff.  So here it is, 
mail me if there are any problems with it:

To mail.c
to voids at top:
 void pmail_check (void);

to externs at top:
extern struct descriptor_data *descriptor_list;

to bottom of file:
void pmail_check (void) {

sh_int obj_vnum = NOTHING;
struct descriptor_data *d;
struct obj_data *obj, *mail_obj;
struct char_data *ch;

for (d = descriptor_list; d; d = d->next) {

   if (has_mail(GET_IDNUM(d->character))){
    ch = d->character;
    while (has_mail(GET_IDNUM(ch))) {
    	obj = create_obj();
    	obj->item_number = NOTHING;
    	obj->name = str_dup("postcard card mail letter");
    	obj->short_description = str_dup("A Postcard");
    	obj->description = str_dup("A postcard gathers dust here.");

    	GET_OBJ_WEIGHT(obj) = 1;
    	GET_OBJ_COST(obj) = 30;
    	GET_OBJ_RENT(obj) = 10;
    	obj->action_description = read_delete(GET_IDNUM(ch), &obj_vnum);

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

    obj_to_char(obj, ch);
/* If you do not have the object mailing patch installed DON'T ADD THIS!*/
    if (obj_vnum != NOTHING && real_object(obj_vnum) != NOTHING) {
      mail_obj = read_object(real_object(obj_vnum), REAL);
      obj_to_char(mail_obj, ch);
        send_to_char("Wow... your mail has an attachment!\r\n",ch);
/* Ok finish with the rest of it now */

    act("A fairy pops in and hands you a Postcard.",FALSE,ch,0 , 0, TO_CHAR);
    act("A fairy drops in and gives $n a Postcard.", FALSE, ch, 0, 0, TO_ROOM);

to comm.c
to external voids:
void pmail_check(void);

somewhere in heartbeat:
  if (!(pulse % (15 * PASSES_PER_SEC)))         /* 15 seconds */

This should be it... like I said ... if you have problems with it... it 
should only be something small but please don't flame me if you have 
problems with it.  Also ... I know it is sorta sloppy... and I 
appologize, but if someone wants to clean it up and make it prettier, go 

Ryan Linn
Apollo - Imp Ruins cyberplayce.com 8000
	 Imp ROR login.greatbasin.com 4000
	 Imp ShadowMud cyberplayce.com 4567

| 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