[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/mail_handler.c

Each player can have a number of folders. Each folder stores a number of mail IDs. Each mail ID corresponds to a mail message.

Includes

This class includes the following files /obj/handlers/mail.h, /include/player_handler.h, /include/socket_errors.h, /include/comms.h, /include/playtesters.h, /include/network.h, /include/localtime.h, /include/mime.h and /include/board.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

add_controller
int add_controller(string list_name,
                   string player)

This function adds a controller to the specified mailing list.

Parameters:
list_name - The list to add to
player - The controller to add

See also:
query_controllers()


add_folder
int add_folder(string player,
               string folder)

This adds a folder to someone.

Parameters:
player - The player to add the folder to
folder - The name of the folder to add

Returns:
A code indicating how it went


add_mail_to_folder
varargs mixed add_mail_to_folder(string player,
                                 string folder,
                                 mixed mail_id,
                                 int foo)

This adds an existing mail to a given folder.

Parameters:
player - The player owning the folder
folder - The folder to add to
mail_id - The mail ID to add. Can also be an array of mails to add

Returns:
A code telling how it went. Or an array of codes


add_member
int add_member(string list_name,
               string player)

This function adds a member to a specific mailing list.

Parameters:
list_name - The mailing list to add a member to
player - The player to add

Returns:
1 if successful, 0 if not

See also:
remove_member() and add_member()


check_mail
string check_mail(string player)

This function is called when the player logs on to determine if they have any new mail or not.

Parameters:
player - The name of the player to check

Returns:
A string describing their mail status


create_list
int create_list(string list,
                string creator)

This function attempts to create a mailing list.

Parameters:
list - The name of the list to create
creator - The creator of the list

Returns:
1 if successful, 0 if not

See also:
query_creator(), query_members() and query_controllers()


create_mail_message
string create_mail_message(string from,
                           string * to,
                           string * cc,
                           string subject,
                           string body)

This creates a mail message. It saves the mail to disk, distributes it in the folders of the recipients, and sends any postal frogs needed.

Parameters:
from - Who sent the mail
to - The recipients
cc - The CC recipients
subject - The subject of the mail
body - The body of the mail

Returns:
A string describing how it went


delete_account
void delete_account(string player)
delete_list
int delete_list(string list)

This function will delete a mailing list.

Parameters:
list - The mailing list to delete

Returns:
0 if failed and 1 on success

See also:
create_list()


finger_mail
string finger_mail(string player)

This function returns the string used when fingering a player to determine their mail status.

Parameters:
player - The player name to finger

Returns:
The string associated with the inbox of the player


folder_filename
varargs string folder_filename(string player,
                               string folder,
                               int create_it)

This returns the file name of the given folder save file.

Parameters:
player - The player to check
folder - The folder to find
create_it - If true the path is created if it doesn't already exist

Returns:
The file name to the save file, or 0 if it's invalid


format_date
string format_date(int date)

This formats the date as displayed in mail.

Parameters:
date - The date to format

Returns:
The date string


format_mail
string format_mail(class mail_info data)
load_formatted_mail
string load_formatted_mail(int mail_id)

Loads a mail of a given ID and formats the data into a string.

Parameters:
mail_id - The ID of the mail to load

Returns:
The formatted mail body


load_mail_data
class mail_info load_mail_data(int mail_id)

Loads the mail info of a given mail.

Parameters:
mail_id - The ID of the mail to load

Returns:
The mail info


mail
object mail(string recipient,
            string subject)
mail_count
int * mail_count(string player)

This function returns a 2 item array for the amount of mail in a person's inbox. The first index is the total number of messages and the second is the number that are unread.

Parameters:
player - The player's name

Returns:
({ no. of mails, no. unread })


mail_exists
int mail_exists(int mail_id)
mail_filename
varargs string mail_filename(int mail_id,
                             int create_it)

This returns the file name of a given mail.

Parameters:
id - The mail ID to get the save file of
create_it - If true the path is created if it doesn't already exist

Returns:
The file name to the save file, or 0 if it's invalid


query_board_name
string query_board_name(string name)

This function returns the actual name of the board that is referenced by the given alias.

Parameters:
name - The alias to resolve

Returns:
The name of the board or 0 on failure


query_controller
int query_controller(string list_name,
                     string player)

This function checks to see if the given player is a controller of a list.

Parameters:
list_name - The name of the list
player - The name to check to see if they are a controller

See also:
query_controllers() and query_member()


query_controllers
string * query_controllers(string list)

This function returns all the current controllers of the mailing list. Controllers can add and remove members from a list.

Parameters:
list - The mailing list to query the controllers for

Returns:
The array of controllers


query_creator
string query_creator(string list_name)

This function returns the creator of the list.

Parameters:
list_name - The list to get the creator of

Returns:
The creator of the list

See also:
create_list()


query_folder_contents
class mail_info_personal * query_folder_contents(string player,
                                                 string folder)

This returns the mails in a specific folder.

Parameters:
player - The player to check for
folder - The folder to check in

Returns:
The array of mails, or 0 if it fails


query_folders
string * query_folders(string player)

This returns the list of folders a player has.

Parameters:
player - The name of the player to check

Returns:
The list of folders, 0 if an error occurs


query_local_name
string query_local_name(string str)

This returns the right format of a local mail recipient.

Parameters:
str - The address to check

Returns:
Local name for local messages, 0 for remote messages


query_mail_counter
int query_mail_counter()

This returns the mail counter, that is the number of the next free mail file.

Returns:
The counter


query_mail_ids_in_folder
int * query_mail_ids_in_folder(string player,
                               string folder)

This returns the mail IDs of the mails in a specific folder.

Parameters:
player - The player to check for
folder - The folder to check in

Returns:
The array of mail IDs, or 0 if it fails


query_mailer
object query_mailer(string player)

This function finds the mailer associated with a particular player.

Parameters:
player - The player whose mailer to find

Returns:
The mailer object associated with the player

See also:
set_mailer() and delete_mailer()


query_mailing_list
int query_mailing_list(string list)

This function checks to see if the specified mailing list exists or not.

Parameters:
list - The list name to check

Returns:
1 if the list exists, 0 if not

See also:
query_mailing_lists(), query_members() and query_member()


query_mailing_lists
string * query_mailing_lists()

This function returns the current mailing lists available.

Returns:
the array of available mailing lists


query_member
int query_member(string list_name,
                 string player)

This function checks to see if the given player is in the given mailing list.

Parameters:
list_name - The mailing list name
player - The name of the player in the list

Returns:
1 if the player is a member, 0 if not

See also:
query_mailing_lists(), query_mailing_list() and query_members()


query_members
string * query_members(string list)

This returns the current members of the specified mailing list.

Parameters:
list - The mailing list to get the members of

Returns:
The members of the mailing list

See also:
query_mailing_lists(), query_mailing_list() and query_member()


query_msgboards
string * query_msgboards()

This returns all the registered messageboards.

Returns:
The names of all messageboards


query_registered_board
int query_registered_board(string name)

This function checks whether the given name is a valid alias for a messageboard.

Parameters:
name - The name to check

Returns:
1 if it is a board, 0 otherwise


register_msgboard
int register_msgboard(string alias,
                      string board)

This function is used to register an alias for a messageboard. If there already is another board aliased like this, you have to unregister that alias first.

Parameters:
alias - The string to use as an alias

Returns:
1 on success, 0 on failure


remove_controller
int remove_controller(string list_name,
                      string player)

This function removes a controller from the specified mailing list.

Parameters:
list_name - The mailing list to remove the member from
player - The member to remove

See also:
add_controller() and query_controller()


remove_folder
int remove_folder(string player,
                  string folder)

This removes a folder from someone. All mails in the folder will be deleted.

Parameters:
player - The player to remove a folder from
folder - The folder to remove

Returns:
A code indicating how it went


remove_mail_from_folder
mixed remove_mail_from_folder(string player,
                              string folder,
                              mixed mail_id)

This removes a given mail from a given folder.

Parameters:
player - The player owning the folder
folder - The folder to remove from
mail_id - The mail ID to remove. Can also be an array of mail IDs

Returns:
A code telling how it went. Or an array of codes


remove_member
int remove_member(string list_name,
                  string player)

This function removes a member from the specified mailing list.

Parameters:
list_name - The mailing list to remove the member from
player - The name of the member to remove

Returns:
1 on success, 0 on failure

See also:
add_member(), query_member() and delete_member()


save_mail_data
void save_mail_data(int mail_id,
                    class mail_info mail_data)

Saves the data of a given mail.

Parameters:
mail_id - The ID of the mail to save
mail_data - The info to save


set_mail_counter
void set_mail_counter(int counter)

This sets the mail counter. This should never be used, but can be used in case of errors. Use with caution.

Parameters:
counter - The counter to use


set_mailer
int set_mailer(string player,
               object mailer)

This function sets the mailer object for a specific player.

Parameters:
player - The player the mailer is for
mailer - The mailer for the player

Returns:
1 if successful, 0 else


set_status
mixed set_status(string player,
                 string folder,
                 mixed mail_id,
                 int status)
unregister_msgboard
void unregister_msgboard(string alias)

This function removes an alias for a messageboard.

Parameters:
alias - The alias to be removed


valid_folder_name
int valid_folder_name(string str)

This determines if a certain string is valid as a name of a folder.

Parameters:
str - The tentative folder name

Returns:
1 if it's valid, 0 else


we_are_done
void we_are_done(object mailer)

Classes

These are nice data types for dealing with... Data!