Mail code

From: Jerry Billings (Jubjubsoft@aol.com)
Date: 02/06/00


I'm trying to add the ability to mail someone without being in the post
office, i took the postmaster special and tried to rewrite it like everyone
said but i'm coming to a brick wall, the command is sorta working, only it
says everyone isnt registered so i think its not checking the palyerfile
right. here is the command. I put it in mail.c

ACMD(do_mail)

{
  long recipient;
  char buf[256], **write;
  char buf2[256];
  int price = STAMP_PRICE;
  struct obj_data *obj;
  extern struct index_data *obj_index;

  obj = NULL;


  two_arguments(arg, buf, buf2);

  if (!*buf) {          /* you'll get no argument from me! */
    send_to_char("You need to specify an addressee!\r\n", ch);
    return;
  }

  if (*buf2 && (obj = get_obj_in_list_vis(ch, buf2, ch->carrying))) {
    send_to_char("Your attachment jumps into a black hole.\r\n", ch);
    price += STAMP_PRICE*0;
    price += GET_OBJ_WEIGHT(obj)*0;
  }

  if (GET_GOLD(ch) < price) {
    send_to_char("A stamp costs 0 chits.\r\n", ch);
    return;
  }

  if (obj != NULL) {
    ch->desc->mail_vnum = GET_OBJ_VNUM(obj);
    extract_obj(obj);
  } else
    ch->desc->mail_vnum = NOTHING;


  if ((recipient = get_id_by_name(buf)) < 0) {
    send_to_char("No one by that name is registered here!", ch);
    return;
  }
  send_to_room("starts to write some mail.", ch->in_room);
  send_to_char("Write your message, use @ on a new line when done.", ch);

  GET_GOLD(ch) -= price;
  SET_BIT(PLR_FLAGS(ch), PLR_MAILING);  /* string_write() sets writing. */

  /* Start writing! */
  CREATE(write, char *, 1);
  string_write(ch->desc, write, MAX_MAIL_SIZE, recipient, NULL);
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-
          5th Dimention -- 5d.dynip.com:4000   http://5d.dynip.com/5d
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT