[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/login_handler.c

The login handler lets you have a funct called as a player logs in or out. The funct you setup will be called when the player logs in or out. The object will also give you a list of all the people who are logged in. This is a by product of its method of operation rather than anything important. It is quite possibly more useful to call users().

The funct which is to be called only needs to be called once as the objects state is saved. When a player enters, logsout or goes net dead the funct will be called on the specified object. The funct will have two parameters, the first will be the player name logging in/out and the last will be a define from /include/login.h specifying which sort of event has occured.

A new temporary method of adding a call back to the login_handler has been added. This will allow you to add a call that is not saved, so you can use an object reference instead of a file name.

See also:
/secure/login.c, efun::users() and /include/login.h

Written by Furball

Includes

This class includes the following files /include/player_handler.h, /include/login.h and /include/login_handler.h

Class Index

Method index

Public Functions

These are functions that everyone can access.

add_dynamic_login_call
int add_dynamic_login_call(string player,
                           mixed funct,
                           mixed obj)

This method adds a funct to be called whenever a player logs in. The funct and object are stored only for this reboot so they may be object references or funct pointers.

Parameters:
player - specfic player to look for "all" for everyone
func - the funct to call
obj - the object to call the funct on

Returns:
0 on failure and 1 on success

See also:
remove_dynamic_login_call() and add_static_login_call()


add_static_login_call
int add_static_login_call(string player,
                          mixed funct,
                          mixed obj)

This method adds a funct to be called whenever a player logs in. The funct and object both need to be strings so that they are saved correctly. This will be saved to the save file and restored over logins.

The function will be called with two parameters, the first is the name of the player and the second is the type of the event. The event types are defined in /include/login.h The event will be one of RECONNECT, LOGIN, LOGOUT, NETDEATH.

Parameters:
player - specfic player to look for "all" for everyone
func - the funct to call
obj - the object to call the funct on

Returns:
0 on failure and 1 on success

See also:
remove_static_login_call() and add_dynamic_login_call()


add_to_login_queue
void add_to_login_queue(object login_ob)

This method adds an object to the login queue. This is called from inside /secure/login.c

Parameters:
login_ob - the object to add to the queue

See also:
/secure/login.c


can_jump_queue
int can_jump_queue(object ob)
clean_lockdowns
void clean_lockdowns()
clear_lockdowns
void clear_lockdowns(string ip)
clear_messages
void clear_messages()
failed_login
void failed_login(string ip_addr)
get_message
string get_message(string mess_name)

This function is used to cache the login messages used by /secure/login it costs a bit in memory but saves us having to re-read the same text file everytime someone logs in. For security reasons this function will only work with files in /doc

Parameters:
the - filename of the file to be returned

Returns:
the text of the file.


int_is_discworld_full
int int_is_discworld_full(int logins)
is_compressed_full
int is_compressed_full(int logins)
is_discworld_full
int is_discworld_full(int logins)

Try and figure out if the mud is full or not. Counts the number of players and returns a true or false value.

Parameters:
logins - a flag

Returns:
1 if the mud is full, 0 if it is not

See also:
/include/login.h->WITHOUT_LOGINS_NOT_IN_QUEUE(), /include/login.h->WITHOUT_LOGIN_QUEUE() and /include/login.h->WITHOUT_ANY_LOGINS()


is_uncompressed_full
int is_uncompressed_full(int logins)
pop_from_login_queue
object pop_from_login_queue()

This method returns the top element of the login queue and removes them from it.

Returns:
the top element of the login queue, 0 if none


query_best
string query_best()

This returns the player name with the best alignment.

Returns:
player name with the best alignment


query_lockdowns
void query_lockdowns()
query_login_queue
object * query_login_queue()

This method returns the current list of people in the login queue.

Returns:
the objects in the login queue


query_players_on
string * query_players_on()

This method returns a list of the current players who are online.

Returns:
the string names of the online players


query_worst
string query_worst()

This returns the player name with the worst alignment.

Returns:
player name with the worst alignment


remove_dynamic_login_call
int remove_dynamic_login_call(string player,
                              mixed funct,
                              mixed obj)

This method removes a login call.

Parameters:
player - the player specifier
funct - the funct name
obj - the object to call the funct on

Returns:
0 on failure and 1 on success

See also:
add_dynamic_login_call() and add_static_login_call()


remove_from_login_queue
void remove_from_login_queue(object ob)

This method removes an object from the login queue, if they log out or something.

Parameters:
ob - the object to remove from the queue


remove_static_login_call
int remove_static_login_call(string player,
                             mixed funct,
                             mixed obj)

This method removes a login call.

Parameters:
player - the player specifier
funct - the funct name
obj - the object to call the funct on

Returns:
0 on failure and 1 on success

See also:
add_static_login_call() and add_dynamic_login_call()


site_lockeddown
int site_lockeddown(string ip_addr)
tidy_players_on
int tidy_players_on(string player)
update_players_on
void update_players_on(string player)
write_log
void write_log(string event,
               string name,
               int guest,
               string other)

This method is used to do delayed logging to the log files. It will store a bunch of entries until it is over a maximum size and then save this to the log.

Parameters:
event - the event generated
name - the name of the player the event is for
guest - if the person in question is a guest
other - other information about the event


Classes

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