#include <mail.h>
Collaboration diagram for MailList:
Public Member Functions | |
MailList (dbref player) | |
mail * | FirstItem (void) |
mail * | NextItem (void) |
bool | IsEnd (void) |
void | RemoveItem (void) |
void | RemoveAll (void) |
void | AppendItem (struct mail *newp) |
Private Attributes | |
mail * | m_miHead |
mail * | m_mi |
dbref | m_player |
bool | m_bRemoved |
Definition at line 92 of file mail.h.
MailList::MailList | ( | dbref | player | ) |
Definition at line 4500 of file mail.cpp.
References m_bRemoved, m_mi, m_miHead, and m_player.
04501 { 04502 m_mi = NULL; 04503 m_miHead = NULL; 04504 m_player = player; 04505 m_bRemoved = false; 04506 }
void MailList::AppendItem | ( | struct mail * | newp | ) |
Definition at line 4552 of file mail.cpp.
References hashaddLEN(), hashfindLEN(), m_player, statedata::mail_htab, mudstate, mail::next, and mail::prev.
Referenced by load_mail_V5(), and send_mail().
04553 { 04554 struct mail *miHead = (struct mail *) 04555 hashfindLEN(&m_player, sizeof(m_player), &mudstate.mail_htab); 04556 04557 if (miHead) 04558 { 04559 // Add new item to the end of the list. 04560 // 04561 struct mail *miEnd = miHead->prev; 04562 04563 miNew->next = miHead; 04564 miNew->prev = miEnd; 04565 04566 miHead->prev = miNew; 04567 miEnd->next = miNew; 04568 } 04569 else 04570 { 04571 hashaddLEN(&m_player, sizeof(m_player), miNew, &mudstate.mail_htab); 04572 miNew->next = miNew; 04573 miNew->prev = miNew; 04574 } 04575 }
struct mail * MailList::FirstItem | ( | void | ) |
Definition at line 4470 of file mail.cpp.
References hashfindLEN(), m_bRemoved, m_mi, m_miHead, m_player, statedata::mail_htab, and mudstate.
Referenced by check_mail_expiration(), count_mail(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_purge(), do_mail_read(), do_mail_retract1(), do_mail_review(), do_mail_stats(), dump_mail(), mail_fetch(), and urgent_mail().
04471 { 04472 m_miHead = (struct mail *)hashfindLEN(&m_player, sizeof(m_player), &mudstate.mail_htab); 04473 m_mi = m_miHead; 04474 m_bRemoved = false; 04475 return m_mi; 04476 }
bool MailList::IsEnd | ( | void | ) |
Definition at line 4495 of file mail.cpp.
References m_mi.
Referenced by check_mail_expiration(), count_mail(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_purge(), do_mail_read(), do_mail_retract1(), do_mail_review(), do_mail_stats(), dump_mail(), mail_fetch(), and urgent_mail().
04496 { 04497 return (NULL == m_mi); 04498 }
struct mail * MailList::NextItem | ( | void | ) |
Definition at line 4478 of file mail.cpp.
References m_bRemoved, m_mi, m_miHead, and mail::next.
Referenced by check_mail_expiration(), count_mail(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_purge(), do_mail_read(), do_mail_retract1(), do_mail_review(), do_mail_stats(), dump_mail(), mail_fetch(), and urgent_mail().
04479 { 04480 if (!m_bRemoved) 04481 { 04482 if (NULL != m_mi) 04483 { 04484 m_mi = m_mi->next; 04485 if (m_mi == m_miHead) 04486 { 04487 m_mi = NULL; 04488 } 04489 } 04490 } 04491 m_bRemoved = false; 04492 return m_mi; 04493 }
void MailList::RemoveAll | ( | void | ) |
Definition at line 4577 of file mail.cpp.
References hashdeleteLEN(), hashfindLEN(), m_mi, m_player, statedata::mail_htab, MEMFREE, MessageReferenceDec(), mudstate, mail::next, mail::number, mail::subject, mail::time, and mail::tolist.
Referenced by do_mail_nuke().
04578 { 04579 struct mail *miHead = (struct mail *) 04580 hashfindLEN(&m_player, sizeof(m_player), &mudstate.mail_htab); 04581 04582 if (NULL != miHead) 04583 { 04584 hashdeleteLEN(&m_player, sizeof(m_player), &mudstate.mail_htab); 04585 } 04586 04587 struct mail *mi; 04588 struct mail *miNext; 04589 for (mi = miHead; NULL != mi; mi = miNext) 04590 { 04591 if (mi == miHead) 04592 { 04593 miNext = NULL; 04594 } 04595 else 04596 { 04597 miNext = mi->next; 04598 } 04599 MessageReferenceDec(mi->number); 04600 MEMFREE(mi->subject); 04601 mi->subject = NULL; 04602 MEMFREE(mi->tolist); 04603 mi->tolist = NULL; 04604 MEMFREE(mi->time); 04605 mi->time = NULL; 04606 MEMFREE(mi); 04607 } 04608 m_mi = NULL; 04609 }
void MailList::RemoveItem | ( | void | ) |
Definition at line 4508 of file mail.cpp.
References hashdeleteLEN(), hashreplLEN(), m_bRemoved, m_mi, m_miHead, m_player, statedata::mail_htab, MEMFREE, MessageReferenceDec(), mudstate, mail::next, NOTHING, mail::number, mail::prev, mail::subject, mail::time, and mail::tolist.
Referenced by check_mail_expiration(), do_mail_debug(), do_mail_purge(), and do_mail_retract1().
04509 { 04510 if ( NULL == m_mi 04511 || NOTHING == m_player) 04512 { 04513 return; 04514 } 04515 04516 struct mail *miNext = m_mi->next; 04517 04518 if (m_mi == m_miHead) 04519 { 04520 if (miNext == m_miHead) 04521 { 04522 hashdeleteLEN(&m_player, sizeof(m_player), &mudstate.mail_htab); 04523 miNext = NULL; 04524 } 04525 else 04526 { 04527 hashreplLEN(&m_player, sizeof(m_player), miNext, &mudstate.mail_htab); 04528 } 04529 m_miHead = miNext; 04530 } 04531 04532 // Relink the list 04533 // 04534 m_mi->prev->next = m_mi->next; 04535 m_mi->next->prev = m_mi->prev; 04536 04537 m_mi->next = NULL; 04538 m_mi->prev = NULL; 04539 MessageReferenceDec(m_mi->number); 04540 MEMFREE(m_mi->subject); 04541 m_mi->subject = NULL; 04542 MEMFREE(m_mi->time); 04543 m_mi->time = NULL; 04544 MEMFREE(m_mi->tolist); 04545 m_mi->tolist = NULL; 04546 MEMFREE(m_mi); 04547 04548 m_mi = miNext; 04549 m_bRemoved = true; 04550 }
bool MailList::m_bRemoved [private] |
Definition at line 98 of file mail.h.
Referenced by FirstItem(), MailList(), NextItem(), and RemoveItem().
struct mail* MailList::m_mi [private] |
Definition at line 96 of file mail.h.
Referenced by FirstItem(), IsEnd(), MailList(), NextItem(), RemoveAll(), and RemoveItem().
struct mail* MailList::m_miHead [private] |
Definition at line 95 of file mail.h.
Referenced by FirstItem(), MailList(), NextItem(), and RemoveItem().
dbref MailList::m_player [private] |
Definition at line 97 of file mail.h.
Referenced by AppendItem(), FirstItem(), MailList(), RemoveAll(), and RemoveItem().