Domaininfo
------------------------------------------------------------------------------
The /obj/domaininfo maintains a database of all domains and their members.
This database is build on first access from the /secure/save/-files (this
may take some minutes), so every change of the state of one member should
be notified with the domaininfo to keep the database up to date.
Note that the domaininfo-lfuns just keep care of its database, not of
the 'official' data, which is property of /secure/master.
There is always only one /obj/domaininfo - it is not possible to clone
it.
The domaininfo juggles a lot with arrays, to please use /obj/domaininfo.h
with the proper defines when dealing with this.
The domaininfo offers several lfuns for your use:
-- The domaininfo object and the database --
int QueryState()
Returns the current state of the Domaininfo. This is one of three values:
- DI_UNINITED : the database is invalid, and most probably empty.
- DI_INITED : the database is loaded.
- DI_INITING : the database is under construction from the save-files.
int QueryLoadTime()
The time() when the database has been completed.
int QueryChangeTime()
The time() of the last change done to the database.
int QueryDCount()
The number of registered domains.
int QueryWCount()
The number of registered wizards.
string QueryVersion()
Returns the version (e.g. "920727") of the object.
ReloadData()
Reloads the database.
-- Handling of wizards --
mixed *QueryWizardData (string name)
Reads the /secure/save-file of wizard <name> and returns an alist
with its domain-memberships.
Keys of the list are the pure domainnames, the data are single integers
describing the membership as following:
- D_MEMBER : wizard is an ordinary member
- D_VICE : wizard is domain vice-lord
- D_LORD : wizard is domain lord
<name> may be a single name ("mateese") or the complete pathname
("/secure/save/mateese.o").
If there is no file for <name>, 0 is returned.
SetWizard (string wname, string dname, int stat)
Sets the status of wizard <wname> in domain <dname> to <stat>.
<stat> may be D_MEMBER, D_VICE and D_LORD.
Additionally the value D_NOMEMBER is allowed for removal of
<wname> from <dname>.
int QueryWizard (string wname, string dname)
Returns the status (same four values as in SetWizard()) of
wizard <wname> in domain <dname>).
-- Handling of domains --
SetDomain (string dname, mixed *ddata)
Sets the data of domain <dname> to <ddata>.
mixed QueryDomain (string dname)
Returns the data of domain <dname> or -1.
mixed QueryAllDomains ()
Returns an array with all registered domainnames.
RemoveDomain (string dname)
Removes the domain <dname> from the database.
The domaindata <ddata> is quite complex and contains the following:
ddata [DD_HASDIR] : a flag, if the domain has an directory
ddata [DD_WIZ ] : an alist of the domainmembers.
ddata [DD_WIZ][DW_NAME] : the name of the member (key)
ddata [DD_WIZ][DW_DSTAT] : the status of the member (data)
Again, the values vor DW_DSTAT are D_MEMBER, D_VICE and D_LORD.
For easier use, empty data may be abbreviated as:
DD_EMPTY : an empty ddata
DW_EMPTY : an empty ddata[DD_WIZ]
------------------------------------------------------------------------------
Mateese, Biontic Magics & Darkness - 27-Jul-92