#include "copyright.h"
#include "config.h"
#include "db.h"
Include dependency graph for mail.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | |
struct | mail_selector |
struct | muser |
struct | mail_entry |
Defines | |
#define | M_ISREAD 0x0001 |
#define | M_UNREAD 0x0FFE |
#define | M_CLEARED 0x0002 |
#define | M_URGENT 0x0004 |
#define | M_MASS 0x0008 |
#define | M_SAFE 0x0010 |
#define | M_RECEIPT 0x0020 |
#define | M_TAG 0x0040 |
#define | M_FORWARD 0x0080 |
#define | M_FMASK 0xF0FF |
#define | M_ALL 0x1000 |
#define | M_MSUNREAD 0x2000 |
#define | MAX_FOLDERS 15 |
#define | FOLDER_NAME_LEN MBUF_SIZE |
#define | FolderBit(f) (256 * (f)) |
#define | Urgent(m) (m->read & M_URGENT) |
#define | Mass(m) (m->read & M_MASS) |
#define | M_Safe(m) (m->read & M_SAFE) |
#define | Receipt(m) (m->read & M_RECEIPT) |
#define | Forward(m) (m->read & M_FORWARD) |
#define | Tagged(m) (m->read & M_TAG) |
#define | Folder(m) ((m->read & ~M_FMASK) >> 8) |
#define | Read(m) (m->read & M_ISREAD) |
#define | Cleared(m) (m->read & M_CLEARED) |
#define | Unread(m) (!Read(m)) |
#define | All(ms) (ms.flags & M_ALL) |
#define | ExpMail(x) (Wizard(x)) |
#define | MA_INC 2 |
#define | DASH_LINE "---------------------------------------------------------------------------" |
#define | MAIL_ITER_ALL(mp, thing) |
#define | MAIL_ITER_SAFE(mp, thing, nextp) |
Typedefs | |
typedef unsigned int | mail_flag |
typedef mail_entry | MENT |
Functions | |
void | set_player_folder (dbref, int) |
void | do_malias_send (dbref, char *, char *, char *, int, mail_flag, int) |
malias * | get_malias (dbref, char *) |
void | load_malias (FILE *) |
void | save_malias (FILE *) |
void | malias_read (FILE *) |
void | malias_write (FILE *) |
void | do_malias_chown (dbref, char *, char *) |
void | do_malias_desc (dbref, char *, char *) |
void | do_expmail_start (dbref, char *, char *) |
void | do_expmail_stop (dbref, int) |
void | do_mail_quick (dbref, char *, char *) |
void | do_malias_rename (dbref, char *, char *) |
void | do_malias_adminlist (dbref) |
void | do_malias_delete (dbref, char *) |
void | do_malias_status (dbref) |
void | do_malias_create (dbref, char *, char *) |
void | do_malias_list (dbref, char *) |
void | do_malias_list_all (dbref) |
void | do_malias_add (dbref, char *, char *) |
void | do_malias_remove (dbref, char *, char *) |
void | check_mail_expiration (void) |
void | check_mail (dbref, int, int) |
void | do_mail_purge (dbref) |
#define All | ( | ms | ) | (ms.flags & M_ALL) |
#define Cleared | ( | m | ) | (m->read & M_CLEARED) |
Definition at line 41 of file mail.h.
Referenced by count_mail(), do_mail_purge(), do_mail_stats(), status_chars(), and status_string().
#define DASH_LINE "---------------------------------------------------------------------------" |
Definition at line 48 of file mail.h.
Referenced by do_mail_list(), do_mail_proof(), do_mail_read(), and do_mail_review().
Definition at line 44 of file mail.h.
Referenced by do_malias_add(), do_malias_adminlist(), do_malias_chown(), do_malias_delete(), do_malias_desc(), do_malias_list(), do_malias_remove(), do_malias_rename(), do_malias_status(), and get_malias().
#define Folder | ( | m | ) | ((m->read & ~M_FMASK) >> 8) |
Definition at line 39 of file mail.h.
Referenced by count_mail(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_read(), mail_fetch(), and urgent_mail().
#define FOLDER_NAME_LEN MBUF_SIZE |
#define FolderBit | ( | f | ) | (256 * (f)) |
#define Forward | ( | m | ) | (m->read & M_FORWARD) |
#define M_ALL 0x1000 |
#define M_CLEARED 0x0002 |
Definition at line 16 of file mail.h.
Referenced by do_mail_clear(), do_mail_flags(), do_mail_unclear(), and parse_msglist().
#define M_FMASK 0xF0FF |
#define M_FORWARD 0x0080 |
#define M_ISREAD 0x0001 |
#define M_MASS 0x0008 |
#define M_MSUNREAD 0x2000 |
#define M_Safe | ( | m | ) | (m->read & M_SAFE) |
Definition at line 35 of file mail.h.
Referenced by check_mail_expiration(), status_chars(), and status_string().
#define M_SAFE 0x0010 |
#define M_TAG 0x0040 |
Definition at line 21 of file mail.h.
Referenced by do_mail_flags(), do_mail_tag(), do_mail_untag(), and parse_msglist().
#define M_URGENT 0x0004 |
#define MA_INC 2 |
#define MAIL_ITER_ALL | ( | mp, | |||
thing | ) |
Value:
for((thing)=0; (thing)<mudstate.db_top; (thing)++) \ for (mp = (struct mail *)nhashfind((int)thing, &mudstate.mail_htab); mp != NULL; mp = mp->next)
Definition at line 51 of file mail.h.
Referenced by do_mail_debug(), and do_mail_stats().
#define MAIL_ITER_SAFE | ( | mp, | |||
thing, | |||||
nextp | ) |
Value:
for((thing)=0; (thing)<mudstate.db_top; (thing)++) \ for (mp = (struct mail *)nhashfind((int)thing, &mudstate.mail_htab); mp != NULL; mp = nextp)
Definition at line 58 of file mail.h.
Referenced by check_mail_expiration(), do_mail_debug(), and do_mail_nuke().
#define Mass | ( | m | ) | (m->read & M_MASS) |
#define MAX_FOLDERS 15 |
#define Read | ( | m | ) | (m->read & M_ISREAD) |
Definition at line 40 of file mail.h.
Referenced by count_mail(), do_mail_stats(), mail_match(), status_chars(), status_string(), and urgent_mail().
#define Tagged | ( | m | ) | (m->read & M_TAG) |
#define Unread | ( | m | ) | (!Read(m)) |
Definition at line 42 of file mail.h.
Referenced by do_mail_flags(), do_mail_read(), and do_mail_retract().
#define Urgent | ( | m | ) | (m->read & M_URGENT) |
Definition at line 33 of file mail.h.
Referenced by status_chars(), status_string(), and urgent_mail().
typedef struct mail_entry MENT |
void check_mail | ( | dbref | , | |
int | , | |||
int | ||||
) |
void check_mail_expiration | ( | void | ) |
Definition at line 2101 of file mail.c.
References delete_mail_message(), do_convtime(), M_Safe, confdata::mail_expiration, statedata::mail_htab, MAIL_ITER_SAFE, mudconf, mudstate, mail::next, nhashrepl(), mail::number, mail::prev, mail::subject, mail::time, time(), mail::to, and mail::tolist.
Referenced by fork_and_dump().
02102 { 02103 struct mail *mp, *nextp; 02104 struct tm then_tm = { 0 }; 02105 time_t then, now = time(0); 02106 time_t expire_secs = mudconf.mail_expiration * 86400; 02107 dbref thing; 02108 02109 /* 02110 * negative values for expirations never expire 02111 */ 02112 if(0 > mudconf.mail_expiration) 02113 return; 02114 02115 MAIL_ITER_SAFE(mp, thing, nextp) { 02116 if(do_convtime((char *) mp->time, &then_tm)) { 02117 then = timelocal(&then_tm); 02118 if(((now - then) > expire_secs) && !(M_Safe(mp))) { 02119 /* 02120 * Delete this one 02121 */ 02122 /* 02123 * head and tail of the list are special 02124 */ 02125 if(mp->prev == NULL) 02126 nhashrepl((int) mp->to, (int *) mp->next, 02127 &mudstate.mail_htab); 02128 else if(mp->next == NULL) 02129 mp->prev->next = NULL; 02130 /* 02131 * relink the list 02132 */ 02133 if(mp->prev != NULL) 02134 mp->prev->next = mp->next; 02135 if(mp->next != NULL) 02136 mp->next->prev = mp->prev; 02137 /* 02138 * save the pointer 02139 */ 02140 nextp = mp->next; 02141 /* 02142 * then wipe 02143 */ 02144 free((char *) mp->subject); 02145 delete_mail_message(mp->number); 02146 free((char *) mp->tolist); 02147 free((char *) mp->time); 02148 free(mp); 02149 } else 02150 nextp = mp->next; 02151 } else 02152 nextp = mp->next; 02153 } 02154 }
void do_expmail_start | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 2633 of file mail.c.
References A_MAILFLAGS, A_MAILMSG, A_MAILSUB, A_MAILTO, atr_add_raw(), atr_clr(), Flags2, free_lbuf, make_namelist(), make_numlist(), names, notify, notify_printf(), and PLAYER_MAILS.
Referenced by do_mail_fwd(), and do_mail_stub().
02634 { 02635 char *tolist, *names; 02636 02637 if(!arg || !*arg) { 02638 notify(player, "MAIL: I do not know whom you want to mail."); 02639 return; 02640 } 02641 if(!subject || !*subject) { 02642 notify(player, "MAIL: No subject."); 02643 return; 02644 } 02645 if(Flags2(player) & PLAYER_MAILS) { 02646 notify(player, "MAIL: Mail message already in progress."); 02647 return; 02648 } 02649 if(!(tolist = make_numlist(player, arg))) { 02650 return; 02651 } 02652 atr_add_raw(player, A_MAILTO, tolist); 02653 atr_add_raw(player, A_MAILSUB, subject); 02654 atr_add_raw(player, A_MAILFLAGS, "0"); 02655 atr_clr(player, A_MAILMSG); 02656 Flags2(player) |= PLAYER_MAILS; 02657 names = make_namelist(player, tolist); 02658 notify_printf(player, "MAIL: You are sending mail to '%s'.", names); 02659 free_lbuf(names); 02660 free_lbuf(tolist); 02661 }
void do_expmail_stop | ( | dbref | , | |
int | ||||
) |
Definition at line 2913 of file mail.c.
References A_MAILFLAGS, A_MAILMSG, A_MAILSUB, A_MAILTO, atr_get(), Flags2, free_lbuf, mail_to_list(), notify, and PLAYER_MAILS.
Referenced by do_mail(), and do_postpend().
02914 { 02915 char *tolist, *mailsub, *mailmsg, *mailflags; 02916 dbref aowner; 02917 dbref aflags; 02918 02919 tolist = atr_get(player, A_MAILTO, &aowner, &aflags); 02920 mailmsg = atr_get(player, A_MAILMSG, &aowner, &aflags); 02921 mailsub = atr_get(player, A_MAILSUB, &aowner, &aflags); 02922 mailflags = atr_get(player, A_MAILFLAGS, &aowner, &aflags); 02923 02924 if(!*tolist || !*mailmsg || !(Flags2(player) & PLAYER_MAILS)) { 02925 notify(player, "MAIL: No such message to send."); 02926 free_lbuf(tolist); 02927 } else { 02928 mail_to_list(player, tolist, mailsub, mailmsg, 02929 flags | atoi(mailflags), 0); 02930 } 02931 free_lbuf(mailflags); 02932 free_lbuf(mailmsg); 02933 free_lbuf(mailsub); 02934 Flags2(player) &= ~PLAYER_MAILS; 02935 }
void do_mail_purge | ( | dbref | ) |
Definition at line 765 of file mail.c.
References Cleared, delete_mail_message(), statedata::mail_htab, mudstate, mail::next, nhashdelete(), nhashfind(), nhashrepl(), and notify.
Referenced by announce_disconnect(), destroy_player(), do_mail(), do_mail_debug(), and do_mail_stub().
00766 { 00767 struct mail *mp, *nextp; 00768 00769 /* 00770 * Go through player's mail, and remove anything marked cleared 00771 */ 00772 for(mp = (struct mail *) nhashfind((int) player, &mudstate.mail_htab); 00773 mp; mp = nextp) { 00774 if(Cleared(mp)) { 00775 /* 00776 * Delete this one 00777 */ 00778 /* 00779 * head and tail of the list are special 00780 */ 00781 if(mp->prev == NULL) 00782 nhashrepl((int) player, (int *) mp->next, 00783 &mudstate.mail_htab); 00784 else if(mp->next == NULL) 00785 mp->prev->next = NULL; 00786 00787 /* 00788 * relink the list 00789 */ 00790 if(mp->prev != NULL) 00791 mp->prev->next = mp->next; 00792 if(mp->next != NULL) 00793 mp->next->prev = mp->prev; 00794 00795 /* 00796 * save the pointer 00797 */ 00798 nextp = mp->next; 00799 00800 /* Clear it. its the last message in the list */ 00801 if(mp->prev == NULL && mp->next == NULL) 00802 nhashdelete((int) player, &mudstate.mail_htab); 00803 00804 /* 00805 * then wipe 00806 */ 00807 free((char *) mp->subject); 00808 delete_mail_message(mp->number); 00809 free((char *) mp->time); 00810 free((char *) mp->tolist); 00811 free(mp); 00812 } else { 00813 nextp = mp->next; 00814 } 00815 } 00816 notify(player, "MAIL: Mailbox purged."); 00817 }
void do_mail_quick | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 2811 of file mail.c.
References alloc_lbuf, Flags2, free_lbuf, mail_to_list(), make_numlist(), notify, parse_to(), PLAYER_MAILS, and StringCopy.
Referenced by do_mail().
02812 { 02813 char *buf, *bp; 02814 02815 if(!arg1 || !*arg1) { 02816 notify(player, "MAIL: I don't know who you want to mail."); 02817 return; 02818 } 02819 if(!arg2 || !*arg2) { 02820 notify(player, "MAIL: No message."); 02821 return; 02822 } 02823 if(Flags2(player) & PLAYER_MAILS) { 02824 notify(player, "MAIL: Mail message already in progress."); 02825 return; 02826 } 02827 buf = alloc_lbuf("do_mail_quick"); 02828 bp = buf; 02829 StringCopy(bp, arg1); 02830 02831 parse_to(&bp, '/', 1); 02832 02833 if(!bp) { 02834 notify(player, "MAIL: No subject."); 02835 free_lbuf(buf); 02836 return; 02837 } 02838 mail_to_list(player, make_numlist(player, buf), bp, arg2, 0, 0); 02839 free_lbuf(buf); 02840 }
void do_malias_add | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 3117 of file mail.c.
References ExpMail, get_malias(), GOD, isPlayer, malias::list, lookup_player(), malias, NOTHING, notify, notify_printf(), malias::numrecep, malias::owner, and parse_dbref().
Referenced by do_malias().
03118 { 03119 int i = 0; 03120 dbref thing; 03121 struct malias *m; 03122 03123 thing = NOTHING; 03124 03125 if(!(m = get_malias(player, alias))) { 03126 notify_printf(player, "MAIL: Alias %s not found.", alias); 03127 return; 03128 } 03129 if(*person == '#') { 03130 thing = parse_dbref(person + 1); 03131 if(!isPlayer(thing)) { 03132 notify(player, "MAIL: Only players may be added."); 03133 return; 03134 } 03135 } 03136 03137 if(thing == NOTHING) 03138 thing = lookup_player(player, person, 1); 03139 03140 if(thing == NOTHING) { 03141 notify(player, "MAIL: I do not see that person here."); 03142 return; 03143 } 03144 03145 if((m->owner == GOD) && !ExpMail(player)) { 03146 notify(player, "MAIL: Permission denied."); 03147 return; 03148 } 03149 for(i = 0; i < m->numrecep; i++) { 03150 if(m->list[i] == thing) { 03151 notify(player, "MAIL: That person is already on the list."); 03152 return; 03153 } 03154 } 03155 03156 if(i >= (MALIAS_LEN - 1)) { 03157 notify(player, "MAIL: The list is full."); 03158 return; 03159 } 03160 03161 m->list[m->numrecep] = thing; 03162 m->numrecep = m->numrecep + 1; 03163 notify_printf(player, "MAIL: %s added to %s", Name(thing), m->name); 03164 }
void do_malias_adminlist | ( | dbref | ) |
Definition at line 3271 of file mail.c.
References malias::desc, do_malias_list_all(), ExpMail, ma_top, malias, Name(), malias::name, notify, notify_printf(), and malias::owner.
Referenced by do_malias().
03272 { 03273 struct malias *m; 03274 int i; 03275 03276 if(!ExpMail(player)) { 03277 do_malias_list_all(player); 03278 return; 03279 } 03280 notify(player, 03281 "Num Name Description Owner"); 03282 03283 for(i = 0; i < ma_top; i++) { 03284 m = malias[i]; 03285 notify_printf(player, "%-4d %-10.10s %-40.40s %-11.11s", i, 03286 m->name, m->desc, Name(m->owner)); 03287 } 03288 03289 notify(player, "***** End of Mail Aliases *****"); 03290 }
void do_malias_chown | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 3094 of file mail.c.
References ExpMail, get_malias(), lookup_player(), malias, NOTHING, notify, notify_printf(), and malias::owner.
Referenced by do_malias().
03095 { 03096 struct malias *m; 03097 dbref no = NOTHING; 03098 03099 if(!(m = get_malias(player, alias))) { 03100 notify_printf(player, "MAIL: Alias %s not found.", alias); 03101 return; 03102 } else { 03103 if(!ExpMail(player)) { 03104 notify(player, "MAIL: You cannot do that!"); 03105 return; 03106 } else { 03107 if((no = lookup_player(player, owner, 1)) == NOTHING) { 03108 notify(player, "MAIL: I do not see that here."); 03109 return; 03110 } 03111 m->owner = no; 03112 notify(player, "MAIL: Owner changed for alias."); 03113 } 03114 } 03115 }
void do_malias_create | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 2386 of file mail.c.
References desc, free_lbuf, get_malias(), Good_obj, lookup_player(), MA_INC, ma_size, ma_top, malias, MALIAS_LEN, name, NOTHING, notify, notify_printf(), StringCopy, TYPE_PLAYER, Typeof, and unparse_object().
Referenced by do_mail(), and do_malias_switch().
02387 { 02388 char *head, *tail, spot; 02389 struct malias *m; 02390 struct malias **nm; 02391 char *na, *buff; 02392 int i = 0; 02393 dbref target; 02394 02395 if(Typeof(player) != TYPE_PLAYER) { 02396 notify(player, "MAIL: Only players may create mail aliases."); 02397 return; 02398 } 02399 if(!alias || !*alias || !tolist || !*tolist) { 02400 notify(player, "MAIL: What alias do you want to create?."); 02401 return; 02402 } 02403 if(*alias != '*') { 02404 notify(player, "MAIL: All Mail aliases must begin with '*'."); 02405 return; 02406 } 02407 m = get_malias(player, alias); 02408 if(m) { 02409 notify_printf(player, "MAIL: Mail Alias '%s' already exists.", alias); 02410 return; 02411 } 02412 if(!ma_size) { 02413 ma_size = MA_INC; 02414 malias = (struct malias **) malloc(sizeof(struct malias *) * ma_size); 02415 } else if(ma_top >= ma_size) { 02416 ma_size += MA_INC; 02417 nm = (struct malias **) malloc(sizeof(struct malias *) * (ma_size)); 02418 02419 for(i = 0; i < ma_top; i++) 02420 nm[i] = malias[i]; 02421 free(malias); 02422 malias = nm; 02423 } 02424 malias[ma_top] = (struct malias *) malloc(sizeof(struct malias)); 02425 02426 i = 0; 02427 02428 /* 02429 * Parse the player list 02430 */ 02431 head = (char *) tolist; 02432 while (head && *head && (i < (MALIAS_LEN - 1))) { 02433 while (*head == ' ') 02434 head++; 02435 tail = head; 02436 while (*tail && (*tail != ' ')) { 02437 if(*tail == '"') { 02438 head++; 02439 tail++; 02440 while (*tail && (*tail != '"')) 02441 tail++; 02442 } 02443 if(*tail) 02444 tail++; 02445 } 02446 tail--; 02447 if(*tail != '"') 02448 tail++; 02449 spot = *tail; 02450 *tail = '\0'; 02451 /* 02452 * Now locate a target 02453 */ 02454 if(!strcasecmp(head, "me")) 02455 target = player; 02456 else if(*head == '#') { 02457 target = atoi(head + 1); 02458 if(!Good_obj(target)) 02459 target = NOTHING; 02460 } else 02461 target = lookup_player(player, head, 1); 02462 if((target == NOTHING) || (Typeof(target) != TYPE_PLAYER)) { 02463 notify(player, "MAIL: No such player."); 02464 } else { 02465 buff = unparse_object(player, target, 0); 02466 notify_printf(player, "MAIL: %s added to alias %s", buff, alias); 02467 malias[ma_top]->list[i] = target; 02468 i++; 02469 free_lbuf(buff); 02470 } 02471 /* 02472 * Get the next recip 02473 */ 02474 *tail = spot; 02475 head = tail; 02476 if(*head == '"') 02477 head++; 02478 } 02479 malias[ma_top]->list[i] = NOTHING; 02480 02481 na = alias + 1; 02482 malias[ma_top]->name = (char *) malloc(strlen(na) + 1); 02483 malias[ma_top]->numrecep = i; 02484 malias[ma_top]->owner = player; 02485 StringCopy(malias[ma_top]->name, na); 02486 malias[ma_top]->desc = (char *) malloc(strlen(na) + 1); 02487 StringCopy(malias[ma_top]->desc, na); /* 02488 * For now do this. 02489 */ 02490 ma_top++; 02491 02492 notify_printf(player, "MAIL: Alias set '%s' defined.", alias); 02493 }
void do_malias_delete | ( | dbref | , | |
char * | ||||
) |
Definition at line 3238 of file mail.c.
References ExpMail, get_malias(), ma_top, malias, notify, and malias::owner.
Referenced by do_malias().
03239 { 03240 int i = 0; 03241 int done = 0; 03242 struct malias *m; 03243 03244 m = get_malias(player, alias); 03245 03246 if(!m) { 03247 notify(player, 03248 "MAIL: Not a valid alias. Remember to prefix the alias name with *."); 03249 return; 03250 } 03251 03252 for(i = 0; i < ma_top; i++) { 03253 if(done) 03254 malias[i] = malias[i + 1]; 03255 else { 03256 if((m->owner == player) || ExpMail(player)) 03257 if(m == malias[i]) { 03258 done = 1; 03259 notify(player, "MAIL: Alias Deleted."); 03260 malias[i] = malias[i + 1]; 03261 } 03262 } 03263 } 03264 03265 if(!done) 03266 notify(player, "MAIL: Alias not found."); 03267 else 03268 ma_top--; 03269 }
void do_malias_desc | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 3074 of file mail.c.
References malias::desc, ExpMail, get_malias(), GOD, malias, notify, notify_printf(), malias::owner, and StringCopy.
Referenced by do_malias().
03075 { 03076 struct malias *m; 03077 03078 if(!(m = get_malias(player, alias))) { 03079 notify_printf(player, "MAIL: Alias %s not found.", alias); 03080 return; 03081 } else if((m->owner != GOD) || ExpMail(player)) { 03082 free(m->desc); /* 03083 * free it up 03084 */ 03085 m->desc = (char *) malloc(sizeof(char *) * strlen(desc)); 03086 03087 StringCopy(m->desc, desc); 03088 notify(player, "MAIL: Description changed."); 03089 } else 03090 notify(player, "MAIL: Permission denied."); 03091 return; 03092 }
void do_malias_list | ( | dbref | , | |
char * | ||||
) |
Definition at line 2495 of file mail.c.
References alloc_lbuf, ExpMail, free_lbuf, get_malias(), God, malias::list, malias, Name(), malias::name, notify, notify_printf(), malias::numrecep, malias::owner, safe_chr, safe_str, and safe_tprintf_str().
Referenced by do_malias_switch().
02496 { 02497 struct malias *m; 02498 int i = 0; 02499 char *buff, *bp; 02500 02501 m = get_malias(player, alias); 02502 02503 if(!m) { 02504 notify_printf(player, "MAIL: Alias '%s' not found.", alias); 02505 return; 02506 } 02507 if(!ExpMail(player) && (player != m->owner) && !(God(m->owner))) { 02508 notify(player, "MAIL: Permission denied."); 02509 return; 02510 } 02511 bp = buff = alloc_lbuf("do_malias_list"); 02512 safe_tprintf_str(buff, &bp, "MAIL: Alias *%s: ", m->name); 02513 for(i = m->numrecep - 1; i > -1; i--) { 02514 safe_str(Name(m->list[i]), buff, &bp); 02515 safe_chr(' ', buff, &bp); 02516 } 02517 *bp = '\0'; 02518 02519 notify(player, buff); 02520 free_lbuf(buff); 02521 }
void do_malias_list_all | ( | dbref | ) |
Definition at line 2523 of file mail.c.
References malias::desc, God, GOD, ma_top, malias, Name(), malias::name, notify, notify_printf(), and malias::owner.
Referenced by do_mail(), do_malias_adminlist(), and do_malias_switch().
02524 { 02525 struct malias *m; 02526 int i = 0; 02527 int notified = 0; 02528 02529 for(i = 0; i < ma_top; i++) { 02530 m = malias[i]; 02531 if((m->owner == GOD) || (m->owner == player) || God(player)) { 02532 if(!notified) { 02533 notify(player, 02534 "Name Description Owner"); 02535 notified++; 02536 } 02537 notify_printf(player, "%-12.12s %-35.35s %-15.15s", m->name, 02538 m->desc, Name(m->owner)); 02539 } 02540 } 02541 02542 notify(player, "***** End of Mail Aliases *****"); 02543 }
void do_malias_remove | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 3166 of file mail.c.
References ExpMail, get_malias(), GOD, malias::list, lookup_player(), malias, NOTHING, notify, malias::numrecep, malias::owner, and parse_dbref().
Referenced by do_malias().
03167 { 03168 int i, ok = 0; 03169 dbref thing; 03170 struct malias *m; 03171 03172 thing = NOTHING; 03173 03174 if(!(m = get_malias(player, alias))) { 03175 notify(player, "MAIL: Alias not found."); 03176 return; 03177 } 03178 if((m->owner == GOD) && !ExpMail(player)) { 03179 notify(player, "MAIL: Permission denied."); 03180 return; 03181 } 03182 03183 if(*person == '#') 03184 thing = parse_dbref(person + 1); 03185 03186 if(thing == NOTHING) 03187 thing = lookup_player(player, person, 1); 03188 03189 if(thing == NOTHING) { 03190 notify(player, "MAIL: I do not see that person here."); 03191 return; 03192 } 03193 03194 for(i = 0; i < m->numrecep; i++) { 03195 if(ok) 03196 m->list[i] = m->list[i + 1]; 03197 else if((m->list[i] == thing) && !ok) { 03198 m->list[i] = m->list[i + 1]; 03199 ok = 1; 03200 } 03201 } 03202 03203 if(ok) 03204 m->numrecep--; 03205 03206 notify_printf(player, "MAIL: %s removed from alias %s.", Name(thing), 03207 alias); 03208 }
void do_malias_rename | ( | dbref | , | |
char * | , | |||
char * | ||||
) |
Definition at line 3210 of file mail.c.
References ExpMail, get_malias(), malias, malias::name, notify, malias::owner, and StringCopy.
Referenced by do_malias().
03211 { 03212 struct malias *m; 03213 03214 if(get_malias(player, newname) != NULL) { 03215 notify(player, "MAIL: That name already exists!"); 03216 return; 03217 } 03218 if((m = get_malias(player, alias)) == NULL) { 03219 notify(player, "MAIL: I cannot find that alias!"); 03220 return; 03221 } 03222 if(*newname != '*') { 03223 notify(player, "MAIL: Bad alias."); 03224 return; 03225 } 03226 if(!ExpMail(player) && !(m->owner == player)) { 03227 notify(player, "MAIL: Permission denied."); 03228 return; 03229 } 03230 free(m->name); 03231 m->name = (char *) malloc(sizeof(char) * strlen(newname)); 03232 03233 StringCopy(m->name, newname + 1); 03234 03235 notify(player, "MAIL: Mailing Alias renamed."); 03236 }
Definition at line 2315 of file mail.c.
References add_mail_message(), get_malias(), GOD, malias::list, malias, notify, notify_printf(), malias::numrecep, send_mail(), tprintf(), TYPE_PLAYER, and Typeof.
Referenced by mail_to_list().
02317 { 02318 int k; 02319 dbref vic; 02320 struct malias *m; 02321 02322 if(!tolist || !*tolist) { 02323 notify(player, "MAIL: I can't figure out who you want to mail to."); 02324 return; 02325 } 02326 m = get_malias(player, tolist); 02327 02328 if(!m) { 02329 notify_printf(player, "MAIL: Mail alias %s not found.", tolist); 02330 return; 02331 } 02332 /* 02333 * Parse the player list 02334 */ 02335 02336 for(k = 0; k < m->numrecep; k++) { 02337 vic = m->list[k]; 02338 02339 if(Typeof(vic) == TYPE_PLAYER) { 02340 send_mail(player, m->list[k], listto, subject, number, flags, 02341 silent); 02342 } else 02343 send_mail(GOD, GOD, listto, subject, /* 02344 * Complain 02345 * about it 02346 */ 02347 add_mail_message(player, 02348 tprintf 02349 ("Alias Error: Bad Player %d for %s", 02350 (dbref) vic, tolist)), 0, silent); 02351 } 02352 }
void do_malias_status | ( | dbref | ) |
Definition at line 3292 of file mail.c.
References ExpMail, ma_size, ma_top, notify, and notify_printf().
Referenced by do_malias().
03293 { 03294 if(!ExpMail(player)) 03295 notify(player, "MAIL: Permission denied."); 03296 else { 03297 notify_printf(player, "MAIL: Number of mail aliases defined: %d", 03298 ma_top); 03299 notify_printf(player, "MAIL: Allocated slots %d", ma_size); 03300 } 03301 }
Definition at line 2354 of file mail.c.
References ExpMail, GOD, ma_top, malias, malias::name, malias::owner, and x.
Referenced by do_malias_add(), do_malias_chown(), do_malias_create(), do_malias_delete(), do_malias_desc(), do_malias_list(), do_malias_remove(), do_malias_rename(), do_malias_send(), mail_to_list(), and make_numlist().
02355 { 02356 char *mal; 02357 struct malias *m; 02358 int i = 0; 02359 int x = 0; 02360 02361 if((*alias == '#') && ExpMail(player)) { 02362 x = atoi(alias + 1); 02363 if(x < 0 || x >= ma_top) 02364 return NULL; 02365 else 02366 return malias[x]; 02367 } else { 02368 if(*alias != '*') 02369 return NULL; 02370 02371 mal = alias + 1; 02372 02373 for(i = 0; i < ma_top; i++) { 02374 m = malias[i]; 02375 if((m->owner == player) || (m->owner == GOD)) { 02376 if(!strcmp(mal, m->name)) /* 02377 * Found it! 02378 */ 02379 return m; 02380 } 02381 } 02382 } 02383 return NULL; 02384 }
void load_malias | ( | FILE * | ) |
Definition at line 2545 of file mail.c.
References getref(), and malias_read().
Referenced by load_mail().
02546 { 02547 char buffer[200]; 02548 02549 (void) getref(fp); 02550 if(fscanf(fp, "*** Begin %s ***\n", buffer) == 1 && 02551 !strcmp(buffer, "MALIAS")) { 02552 malias_read(fp); 02553 } else { 02554 fprintf(stderr, "ERROR: Couldn't find Begin MALIAS.\n"); 02555 return; 02556 02557 } 02558 }
void malias_read | ( | FILE * | ) |
Definition at line 2567 of file mail.c.
References Alive, malias::desc, getref(), Good_obj, malias::list, ma_size, ma_top, malias, malias::name, malias::numrecep, malias::owner, and StringCopy.
Referenced by load_malias().
02568 { 02569 int i, j; 02570 char buffer[1000]; 02571 struct malias *m; 02572 02573 fscanf(fp, "%d\n", &ma_top); 02574 02575 ma_size = ma_top; 02576 02577 if(ma_top > 0) 02578 malias = (struct malias **) malloc(sizeof(struct malias *) * ma_size); 02579 02580 else 02581 malias = NULL; 02582 02583 for(i = 0; i < ma_top; i++) { 02584 malias[i] = (struct malias *) malloc(sizeof(struct malias)); 02585 02586 m = (struct malias *) malias[i]; 02587 02588 fscanf(fp, "%d %d\n", &(m->owner), &(m->numrecep)); 02589 02590 fscanf(fp, "%[^\n]\n", buffer); 02591 m->name = (char *) malloc(strlen(buffer) - 1); 02592 StringCopy(m->name, buffer + 2); 02593 fscanf(fp, "%[^\n]\n", buffer); 02594 m->desc = (char *) malloc(strlen(buffer) - 1); 02595 StringCopy(m->desc, buffer + 2); 02596 02597 if(m->numrecep > 0) { 02598 02599 for(j = 0; j < m->numrecep; j++) { 02600 m->list[j] = getref(fp); 02601 02602 } 02603 } else 02604 m->list[0] = 0; 02605 02606 } 02607 /* compress aliases [to prevent junk] */ 02608 for(i = 0; i < ma_top; i++) 02609 if(!Good_obj(malias[i]->owner) || !Alive(malias[i]->owner)) { 02610 if(i != ma_top - 1) 02611 memcpy(malias[i], malias[ma_top - 1], sizeof(struct malias));; 02612 ma_top--; 02613 } 02614 }
void malias_write | ( | FILE * | ) |
Definition at line 2616 of file mail.c.
References malias::desc, malias::list, ma_top, malias, malias::name, malias::numrecep, and malias::owner.
Referenced by save_malias().
02617 { 02618 int i, j; 02619 struct malias *m; 02620 02621 fprintf(fp, "%d\n", ma_top); 02622 02623 for(i = 0; i < ma_top; i++) { 02624 m = malias[i]; 02625 fprintf(fp, "%d %d\n", m->owner, m->numrecep); 02626 fprintf(fp, "N:%s\n", m->name); 02627 fprintf(fp, "D:%s\n", m->desc); 02628 for(j = 0; j < m->numrecep; j++) 02629 fprintf(fp, "%d\n", m->list[j]); 02630 } 02631 }
void save_malias | ( | FILE * | ) |
Definition at line 2560 of file mail.c.
References malias_write().
02561 { 02562 02563 fprintf(fp, "*** Begin MALIAS ***\n"); 02564 malias_write(fp); 02565 }
void set_player_folder | ( | dbref | , | |
int | ||||
) |
Definition at line 1744 of file mail.c.
References A_MAILCURF, AF_LOCK, AF_NOPROG, AF_ODARK, AF_WIZARD, alloc_lbuf, atr_add(), atr_num(), attr::flags, free_lbuf, and GOD.
Referenced by do_mail_change_folder(), and player_folder().
01745 { 01746 /* 01747 * Set a player's folder to fnum 01748 */ 01749 ATTR *a; 01750 char *tbuf1; 01751 01752 tbuf1 = alloc_lbuf("set_player_folder"); 01753 sprintf(tbuf1, "%d", fnum); 01754 a = (ATTR *) atr_num(A_MAILCURF); 01755 if(a) 01756 atr_add(player, A_MAILCURF, tbuf1, GOD, a->flags); 01757 else { /* 01758 * Shouldn't happen, but... 01759 */ 01760 atr_add(player, A_MAILCURF, tbuf1, GOD, 01761 AF_ODARK | AF_WIZARD | AF_NOPROG | AF_LOCK); 01762 } 01763 free_lbuf(tbuf1); 01764 }