skylib_fluffos_v3/
skylib_fluffos_v3/bin/
skylib_fluffos_v3/bin/db/
skylib_fluffos_v3/fluffos-2.9-ds2.04/
skylib_fluffos_v3/fluffos-2.9-ds2.04/ChangeLog.old/
skylib_fluffos_v3/fluffos-2.9-ds2.04/Win32/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/simuls/
skylib_fluffos_v3/fluffos-2.9-ds2.04/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/clone/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/command/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/data/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/etc/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/master/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/log/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/compiler/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/efuns/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/operators/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/u/
skylib_fluffos_v3/fluffos-2.9-ds2.04/tmp/
skylib_fluffos_v3/fluffos-2.9-ds2.04/windows/
skylib_fluffos_v3/mudlib/
skylib_fluffos_v3/mudlib/cmds/
skylib_fluffos_v3/mudlib/cmds/admin/
skylib_fluffos_v3/mudlib/cmds/guild-race/
skylib_fluffos_v3/mudlib/cmds/living/broken/
skylib_fluffos_v3/mudlib/cmds/player/group_cmds/
skylib_fluffos_v3/mudlib/cmds/playtester/
skylib_fluffos_v3/mudlib/d/admin/
skylib_fluffos_v3/mudlib/d/admin/room/
skylib_fluffos_v3/mudlib/d/admin/room/we_care/
skylib_fluffos_v3/mudlib/d/admin/save/
skylib_fluffos_v3/mudlib/d/admin/text/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/buildings/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/map/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/roads/
skylib_fluffos_v3/mudlib/d/learning/chars/
skylib_fluffos_v3/mudlib/d/learning/functions/
skylib_fluffos_v3/mudlib/d/learning/handlers/
skylib_fluffos_v3/mudlib/d/learning/help_topics/
skylib_fluffos_v3/mudlib/d/learning/help_topics/npcs/
skylib_fluffos_v3/mudlib/d/learning/help_topics/objects/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/RCS/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/crowd/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/situations/
skylib_fluffos_v3/mudlib/d/learning/save/
skylib_fluffos_v3/mudlib/d/learning/school/
skylib_fluffos_v3/mudlib/d/learning/school/add_sc/
skylib_fluffos_v3/mudlib/d/learning/school/characters/
skylib_fluffos_v3/mudlib/d/learning/school/general/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/basic_commands/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/edtutor/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/unix_tutor/
skylib_fluffos_v3/mudlib/d/learning/school/items/
skylib_fluffos_v3/mudlib/d/learning/school/npc_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/room_basic/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/situations/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/terrain_tutor/
skylib_fluffos_v3/mudlib/d/learning/text/
skylib_fluffos_v3/mudlib/d/liaison/
skylib_fluffos_v3/mudlib/d/mudlib/
skylib_fluffos_v3/mudlib/d/mudlib/changes/
skylib_fluffos_v3/mudlib/d/playtesters/
skylib_fluffos_v3/mudlib/d/playtesters/effects/
skylib_fluffos_v3/mudlib/d/playtesters/handlers/
skylib_fluffos_v3/mudlib/d/playtesters/items/
skylib_fluffos_v3/mudlib/d/sage/
skylib_fluffos_v3/mudlib/doc/
skylib_fluffos_v3/mudlib/doc/creator/
skylib_fluffos_v3/mudlib/doc/driver/
skylib_fluffos_v3/mudlib/doc/driver/efuns/arrays/
skylib_fluffos_v3/mudlib/doc/driver/efuns/buffers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/calls/
skylib_fluffos_v3/mudlib/doc/driver/efuns/compile/
skylib_fluffos_v3/mudlib/doc/driver/efuns/filesystem/
skylib_fluffos_v3/mudlib/doc/driver/efuns/floats/
skylib_fluffos_v3/mudlib/doc/driver/efuns/functions/
skylib_fluffos_v3/mudlib/doc/driver/efuns/general/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mappings/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mixed/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mudlib/
skylib_fluffos_v3/mudlib/doc/driver/efuns/numbers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/parsing/
skylib_fluffos_v3/mudlib/doc/login/
skylib_fluffos_v3/mudlib/doc/lpc/basic_manual/
skylib_fluffos_v3/mudlib/doc/lpc/intermediate/
skylib_fluffos_v3/mudlib/doc/new/add_command/
skylib_fluffos_v3/mudlib/doc/new/events/
skylib_fluffos_v3/mudlib/doc/new/handlers/
skylib_fluffos_v3/mudlib/doc/new/living/race/
skylib_fluffos_v3/mudlib/doc/new/living/spells/
skylib_fluffos_v3/mudlib/doc/new/object/
skylib_fluffos_v3/mudlib/doc/new/player/
skylib_fluffos_v3/mudlib/doc/new/room/guild/
skylib_fluffos_v3/mudlib/doc/new/room/outside/
skylib_fluffos_v3/mudlib/doc/new/room/storeroom/
skylib_fluffos_v3/mudlib/doc/object/
skylib_fluffos_v3/mudlib/doc/playtesters/
skylib_fluffos_v3/mudlib/doc/policy/
skylib_fluffos_v3/mudlib/doc/weapons/
skylib_fluffos_v3/mudlib/global/
skylib_fluffos_v3/mudlib/global/creator/
skylib_fluffos_v3/mudlib/handlers/
skylib_fluffos_v3/mudlib/include/casino/
skylib_fluffos_v3/mudlib/include/cmds/
skylib_fluffos_v3/mudlib/include/effects/
skylib_fluffos_v3/mudlib/include/npc/
skylib_fluffos_v3/mudlib/include/room/
skylib_fluffos_v3/mudlib/include/shops/
skylib_fluffos_v3/mudlib/net/daemon/
skylib_fluffos_v3/mudlib/net/daemon/chars/
skylib_fluffos_v3/mudlib/net/inherit/
skylib_fluffos_v3/mudlib/net/obj/
skylib_fluffos_v3/mudlib/net/obj/BACKUPS/
skylib_fluffos_v3/mudlib/obj/amulets/
skylib_fluffos_v3/mudlib/obj/armours/plate/
skylib_fluffos_v3/mudlib/obj/b_day/
skylib_fluffos_v3/mudlib/obj/clothes/transport/horse/
skylib_fluffos_v3/mudlib/obj/faith/symbols/
skylib_fluffos_v3/mudlib/obj/fungi/
skylib_fluffos_v3/mudlib/obj/gatherables/
skylib_fluffos_v3/mudlib/obj/instruments/
skylib_fluffos_v3/mudlib/obj/media/
skylib_fluffos_v3/mudlib/obj/misc/player_shop/
skylib_fluffos_v3/mudlib/obj/monster/godmother/
skylib_fluffos_v3/mudlib/obj/monster/transport/
skylib_fluffos_v3/mudlib/obj/rings/
skylib_fluffos_v3/mudlib/obj/scabbards/
skylib_fluffos_v3/mudlib/obj/spells/
skylib_fluffos_v3/mudlib/obj/stationery/
skylib_fluffos_v3/mudlib/obj/stationery/envelopes/
skylib_fluffos_v3/mudlib/obj/toys/
skylib_fluffos_v3/mudlib/obj/vessels/
skylib_fluffos_v3/mudlib/obj/weapons/axes/
skylib_fluffos_v3/mudlib/obj/weapons/chains/
skylib_fluffos_v3/mudlib/obj/weapons/maces/BACKUPS/
skylib_fluffos_v3/mudlib/save/autodoc/
skylib_fluffos_v3/mudlib/save/book_handler/
skylib_fluffos_v3/mudlib/save/books/history/calarien/
skylib_fluffos_v3/mudlib/save/mail/
skylib_fluffos_v3/mudlib/save/new_soul/data/
skylib_fluffos_v3/mudlib/save/parcels/
skylib_fluffos_v3/mudlib/save/playerinfo/
skylib_fluffos_v3/mudlib/save/players/d/
skylib_fluffos_v3/mudlib/save/players/s/
skylib_fluffos_v3/mudlib/save/random_names/
skylib_fluffos_v3/mudlib/save/random_names/data/
skylib_fluffos_v3/mudlib/save/terrains/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_desert/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_grassy_field/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_mountain/
skylib_fluffos_v3/mudlib/save/todo_lists/
skylib_fluffos_v3/mudlib/secure/
skylib_fluffos_v3/mudlib/secure/cmds/admin/
skylib_fluffos_v3/mudlib/secure/cmds/lord/
skylib_fluffos_v3/mudlib/secure/config/
skylib_fluffos_v3/mudlib/secure/handlers/autodoc/
skylib_fluffos_v3/mudlib/secure/handlers/intermud/
skylib_fluffos_v3/mudlib/secure/include/global/
skylib_fluffos_v3/mudlib/secure/save/
skylib_fluffos_v3/mudlib/secure/save/handlers/
skylib_fluffos_v3/mudlib/secure/std/
skylib_fluffos_v3/mudlib/secure/std/classes/
skylib_fluffos_v3/mudlib/secure/std/modules/
skylib_fluffos_v3/mudlib/std/creator/
skylib_fluffos_v3/mudlib/std/dom/
skylib_fluffos_v3/mudlib/std/effects/
skylib_fluffos_v3/mudlib/std/effects/external/
skylib_fluffos_v3/mudlib/std/effects/fighting/
skylib_fluffos_v3/mudlib/std/effects/magic/
skylib_fluffos_v3/mudlib/std/effects/magic/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/other/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/priest/
skylib_fluffos_v3/mudlib/std/effects/room/
skylib_fluffos_v3/mudlib/std/environ/
skylib_fluffos_v3/mudlib/std/guilds/
skylib_fluffos_v3/mudlib/std/guilds/old/
skylib_fluffos_v3/mudlib/std/languages/
skylib_fluffos_v3/mudlib/std/liquids/
skylib_fluffos_v3/mudlib/std/npc/
skylib_fluffos_v3/mudlib/std/npc/goals/
skylib_fluffos_v3/mudlib/std/npc/goals/basic/
skylib_fluffos_v3/mudlib/std/npc/goals/misc/
skylib_fluffos_v3/mudlib/std/npc/plans/
skylib_fluffos_v3/mudlib/std/npc/plans/basic/
skylib_fluffos_v3/mudlib/std/npc/types/
skylib_fluffos_v3/mudlib/std/npc/types/helper/
skylib_fluffos_v3/mudlib/std/npcs/
skylib_fluffos_v3/mudlib/std/outsides/
skylib_fluffos_v3/mudlib/std/races/shadows/
skylib_fluffos_v3/mudlib/std/room/basic/BACKUPS/
skylib_fluffos_v3/mudlib/std/room/basic/topography/
skylib_fluffos_v3/mudlib/std/room/controller/
skylib_fluffos_v3/mudlib/std/room/inherit/topography/
skylib_fluffos_v3/mudlib/std/room/topography/area/
skylib_fluffos_v3/mudlib/std/room/topography/iroom/
skylib_fluffos_v3/mudlib/std/room/topography/milestone/
skylib_fluffos_v3/mudlib/std/shadows/curses/
skylib_fluffos_v3/mudlib/std/shadows/disease/
skylib_fluffos_v3/mudlib/std/shadows/fighting/
skylib_fluffos_v3/mudlib/std/shadows/healing/
skylib_fluffos_v3/mudlib/std/shadows/magic/
skylib_fluffos_v3/mudlib/std/shadows/poison/
skylib_fluffos_v3/mudlib/std/shadows/room/
skylib_fluffos_v3/mudlib/std/shops/controllers/
skylib_fluffos_v3/mudlib/std/shops/objs/
skylib_fluffos_v3/mudlib/std/shops/player_shop/
skylib_fluffos_v3/mudlib/std/socket/
skylib_fluffos_v3/mudlib/std/soul/d/
skylib_fluffos_v3/mudlib/std/soul/e/
skylib_fluffos_v3/mudlib/std/soul/i/
skylib_fluffos_v3/mudlib/std/soul/j/
skylib_fluffos_v3/mudlib/std/soul/k/
skylib_fluffos_v3/mudlib/std/soul/l/
skylib_fluffos_v3/mudlib/std/soul/n/
skylib_fluffos_v3/mudlib/std/soul/o/
skylib_fluffos_v3/mudlib/std/soul/q/
skylib_fluffos_v3/mudlib/std/soul/r/
skylib_fluffos_v3/mudlib/std/soul/u/
skylib_fluffos_v3/mudlib/std/soul/v/
skylib_fluffos_v3/mudlib/std/soul/y/
skylib_fluffos_v3/mudlib/std/soul/z/
skylib_fluffos_v3/mudlib/std/stationery/
skylib_fluffos_v3/mudlib/w/
skylib_fluffos_v3/mudlib/w/default/
skylib_fluffos_v3/mudlib/w/default/armour/
skylib_fluffos_v3/mudlib/w/default/clothes/
skylib_fluffos_v3/mudlib/w/default/item/
skylib_fluffos_v3/mudlib/w/default/npc/
skylib_fluffos_v3/mudlib/w/default/room/
skylib_fluffos_v3/mudlib/w/default/weapon/
skylib_fluffos_v3/mudlib/www/
skylib_fluffos_v3/mudlib/www/java/
skylib_fluffos_v3/mudlib/www/secure/
skylib_fluffos_v3/mudlib/www/secure/lpc/advanced/
skylib_fluffos_v3/mudlib/www/secure/lpc/intermediate/
skylib_fluffos_v3/win32/
/**
 * This is the organizations handler.
 * Keeps track of organizations, their members and other properties.
 * @author Sandoz
 */

#define SAVE_FILE  HANDLER_SAVE_DIR "/orgs"
#define TIME       ctime(time())
#define CHECK_TIME 86400
#define DATA       ( ( class org_data ) orgs[name] )

class org_data {
  string info;        // general info about the organization
  string title;       // the official title of the organization
  string *req_orgs;   // any orgs one has to be a memeber of to join
  string *anti_orgs;  // any orgs one can't be a member of to join
  string *req_quests; // any quests one needs to do before joining
  string channel;
}

private mapping orgs, members;

private void check_members( string name );
private void check_all_members();

/** @ignore yes */
private void create() {
    if( file_size( SAVE_FILE+".o" ) > 0 )
        unguarded( (: restore_object, SAVE_FILE :) );
    if( !mapp(orgs) )
        orgs = ([ ]);
    if( !mapp(members) )
        members = ([ ]);
    if( sizeof( keys(orgs) ) )
        call_out( (: check_all_members :), 300 + random( 300 ) );
} /* create() */

/** @ignore yes */
private void save_data_file() {
    unguarded( (: save_object, SAVE_FILE :) );
} /* save_data_file() */

/** @ignore yes */
void dest_me() {
    destruct(TO);
} /* dest_me() */

/**
 * This method returns all the current orgs.
 * @return all current orgs
 * @see query_members()
 * @see query_member()
 */
string *query_orgs() { return keys(orgs); }

/**
 * This method adds a new organization into the orgs mapping.
 * @param name the name of the organization to add
 * @param title the title of the new organization
 * @param info the general description of the organization
 * @return 1 if successful, 0 if an org with the name already exists
 * @see remove_org()
 * @see query_org()
 */
varargs int add_org( string name, string title, string info, string channel ) {
    class org_data org;

    if( !name || name == "" || orgs[name] || !adminp( previous_object(-1) ) )
        return 0;

    org = new( class org_data );
    org->info = info || "Why bother?";
    org->title = title || "The Organization of No Title";
    org->channel = channel;
    orgs[name] = org;
    members[name] = ({ });

    save_data_file();

    return 1;

} /* add_org() */

/**
 * This method removes an organization from the handler.
 * @param name the name of the organization to remove.
 * @return 1 if successfully removed, 0 if not
 * @see add_org()
 * @see query_org()
 */
int remove_org( string name ) {
    if( undefinedp( orgs[name] ) || !adminp( previous_object(-1) ) )
        return 0;

    map_delete( orgs, name );
    map_delete( members, name );

    save_data_file();

    return 1;

} /* remove_org() */

/**
 * This method queries if the specified organization exists or not.
 * @param name the name of the organization to check
 * @return 1 if the organization exists, 0 if not
 * @see add_org()
 * @see remove_org()
 */
int query_org( string name ) { return !undefinedp( orgs[name] ); }

/**
 * This method sets a new title for the specified org.
 * @param name the name of the org to set a new title for
 * @param title the new title to set
 * @return 1 if title successfully set, 0 if not
 * @see query_title()
 */
int set_title( string name, string title ) {
    if( !orgs[name] || !title || title == "" )
        return 0;

    DATA->title = title;
    save_data_file();
    return 1;

} /* set_title() */

/**
 * This method returns the title of the organization.
 * @param name the name of the organization to get the title for
 * @return the title of the organization
 * @see set_title()
 */
string query_title( string name ) {
    if( !orgs[name] )
        return 0;
    return DATA->title;
} /* query_title() */

/**
 * This method sets a new channel for the specified org.
 * @param name the name of the org to set a new channel for
 * @param channel the new channel to set
 * @return 1 if channel successfully set, 0 if not
 * @see query_channel()
 */
int set_channel( string name, string channel ) {
    if( !orgs[name] || !channel || channel == "" )
        return 0;

    DATA->channel = channel;
    save_data_file();
    return 1;

} /* set_title() */

/**
 * This method returns the channel used by the organization.
 * @param name the name of the organization to get the channel for
 * @return the channel used by the organization
 * @see set_channel()
 */
string query_channel( string name ) {
    if( !orgs[name] )
        return 0;
    return DATA->channel;
} /* query_channel() */

/**
 * This method sets a new info for the specified org.
 * @param name the name of the org to set a new info for
 * @param info the new info to set
 * @return 1 if title successfully set, 0 if not
 * @see set_info()
 */
int set_info( string name, string info ) {
    if( !orgs[name] || !info || info == "" )
        return 0;

    DATA->info = info;
    save_data_file();
    return 1;

} /* set_info() */

/**
 * This method returns the general info of the organization.
 * @param name the name of the organization to get the info for
 * @return the general info of the organization
 * @see query_info()
 */
string query_info( string name ) {
    if( !orgs[name] )
        return 0;
    return DATA->info;
} /* query_info() */

/**
 * This method adds an org to the specified organization's
 * required orgs array.
 * @param name the name of the org to add the req for
 * @param req a string or an array of strings to add to
 * the required orgs list
 * @see remove_req_org()
 * @see query_req_orgs()
 */
void add_req_org( string name, mixed req ) {
    string *reqs;

    if( !orgs[name] )
        return;

    if( !pointerp( reqs = DATA->req_orgs ) )
        reqs = ({ });

    if( stringp(req) && query_org(req) && member_array( req, reqs ) == -1 )
        reqs += ({ req });
    else if( pointerp(req) )
        foreach( req in req )
          if( stringp(req) && query_org(req) &&
              member_array( req, reqs ) == -1 )
              reqs += ({ req });

    DATA->req_orgs = reqs;
    save_data_file();

} /* add_req_org() */

/**
 * This method removes an org from the specified organization's
 * required orgs array.
 * @param name the name of the org to remove the req from
 * @param req a string or an array of strings to remove
 * @see add_req_org()
 * @see query_req_orgs()
 */
void remove_req_org( string name, mixed req ) {
    string *reqs;

    if( !orgs[name] )
        return;

    if( !pointerp( reqs = DATA->req_orgs ) )
        return;

    if( stringp(req) )
        reqs -= ({ req });
    else if( pointerp(req) )
        foreach( req in req )
          if( stringp(req) )
              reqs -= ({ req });

    DATA->req_orgs = reqs;
    save_data_file();

} /* remove_req_org() */

/**
 * This method will return the orgs one has to be a member of
 * before they can join the specified org.
 * @param name the name of the org to get the required orgs for
 * @return the required orgs array
 * @see add_req_org()
 * @see remove_req_org()
 */
string *query_req_orgs( string name ) { return DATA->req_orgs || ({ }); }

/**
 * This method adds a quest to the specified organization's
 * required quests array.
 * @param name the name of the org to add the req quest for
 * @param req a string or an array of strings to add to
 * the required quests list
 * @see remove_req_quest()
 * @see query_req_quests()
 */
void add_req_quest( string name, mixed req ) {
    string *reqs;

    if( !orgs[name] )
        return;

    if( !pointerp( reqs = DATA->req_quests ) )
        reqs = ({ });

    if( stringp(req) && member_array( req, reqs ) == -1 )
        reqs += ({ req });
    else if( pointerp(req) )
        foreach( req in req )
          if( stringp(req) && member_array( req, reqs ) == -1 )
              reqs += ({ req });

    DATA->req_quests = reqs;
    save_data_file();

} /* add_req_quest() */

/**
 * This method removes a quest from the specified organization's
 * required quests array.
 * @param name the name of the org to remove the req quest from
 * @param req a string or an array of strings to remove
 * @see add_req_quest()
 * @see query_req_quests()
 */
void remove_req_quest( string name, mixed req ) {
    string *reqs;

    if( !orgs[name] )
        return;

    if( !pointerp( reqs = DATA->req_quests ) )
        return;

    if( stringp(req) )
        reqs -= ({ req });
    else if( pointerp(req) )
        foreach( req in req )
          if( stringp(req) )
              reqs -= ({ req });

    DATA->req_quests = reqs;
    save_data_file();

} /* remove_req_quest() */

/**
 * This method will return the quests has to do before they can
 * join the specified org.
 * @param name the name of the org to get the required quest for
 * @return the required quests array
 * @see add_req_quest()
 * @see remove_req_quest()
 */
string *query_req_quests( string name ) { return DATA->req_quests || ({ }) ; }

/**
 * This method adds an org that one can't be a member of to the
 * specified organization's required anti-orgs array.
 * @param name the name of the org to add the req for
 * @param anti a string or an array of strings to add to
 * the anti-org list
 * @see remove_anti_org()
 * @see query_anti_orgs()
 */
void add_anti_org( string name, mixed anti ) {
    string *antis;

    if( !orgs[name] )
        return;

    if( !pointerp( antis = DATA->anti_orgs ) )
        antis = ({ });

    if( stringp(anti) && query_org(anti) && member_array( anti, antis ) == -1 )
        antis += ({ anti });
    else if( pointerp(anti) )
        foreach( anti in anti )
          if( stringp(anti) && query_org(anti) &&
              member_array( anti, antis ) == -1 )
              antis += ({ anti });

    DATA->anti_orgs = antis;
    save_data_file();

} /* add_anti_org() */

/**
 * This method removes an anti-org from the specified organization's
 * anti-orgs array.
 * @param name the name of the org to remove the anti-org from
 * @param anti a string or an array of strings to remove
 * @see add_anti_org()
 * @see query_anti_orgs()
 */
void remove_anti_org( string name, mixed anti ) {
    string *antis;

    if( !orgs[name] )
        return;

    if( !pointerp( antis = DATA->anti_orgs ) )
        return;

    if( stringp(anti) )
        antis -= ({ anti });
    else if( pointerp(anti) )
        foreach( anti in anti )
          if( stringp(anti) )
              antis -= ({ anti });

    DATA->anti_orgs = antis;
    save_data_file();

} /* remove_anti_org() */

/**
 * This method will return the orgs one cannot be a member of
 * if they want to join the specified org.
 * @param name the name of the org to get the anti-orgs for
 * @return the anti-orgs array
 * @see add_anti_org()
 * @see remove_anti_org()
 */
string *query_anti_orgs( string name ) { return DATA->anti_orgs || ({ }) ; }

/**
 * This method returns all the members of the specified org.
 * @param name the name of the org to get the members of
 * @return the members array
 * @see query_member()
 */
string *query_members( string name ) { return members[name] || ({ }); }

/**
 * This method queries whether or not the player is a
 * member of the organization or not.
 * @param name the name of the org to check
 * @param player the name of the player to check
 * @return 1 if the player is a member, 0 if not
 * @see add_member()
 * @see remove_member()
 * @see query_can_join()
 */
int query_member( string name, string player ) {
    string *tmp;

    if( !pointerp( tmp = members[name] ) )
        return 0;

    return ( member_array( player, tmp ) != -1 );

} /* query_member() */

/**
 * This method checks whether or not the player can join an org.
 * This checks all the reqs and anti-orgs etc.
 * @param name the name of the org to check
 * @param player the name of the player to check
 * @return 1 if the player could join the org, 0 if not
 * @see add_member()
 * @see remove_member()
 * @see query_member()
 */
int query_can_join( string name, string player ) {
    if( !orgs[name] || !PLAYER_H->test_user(player) )
        return 0;

    if( sizeof( filter( query_req_orgs(name),
        (: !query_member( $1, $2 ) :), player ) ) )
        return 0;

    if( sizeof( filter( query_anti_orgs(name),
        (: query_member( $1, $2 ) :), player ) ) )
        return 0;

    if( sizeof( filter( query_req_quests(name),
        (: !LIBRARY_H->query_quest_done( $2, $1 ) :), player ) ) )
        return 0;

    return 1;

} /* query_can_join() */

/**
 * This method adds a member to an org.
 * @param name the name of the org to add a member to
 * @param player the name of the player to add
 * @return 1 if successfully added, 0 if not
 * @see remove_member()
 * @see query_member()
 * @see query_can_join()
 */
int add_member( string name, string player ) {
    
    if( !members[name] || query_member( name, player ) ||
        !query_can_join( name, player ) )
        return 0;

    members[name] += ({ player });
    save_data_file();
         
    return 1;

} /* add_member() */

/**
 * This method removes a member from an org.
 * @param name the name of the org to remove a member from
 * @param player the name of the player to remove
 * @return 1 if successfully removed, 0 if not
 * @see add_member()
 * @see query_member()
 * @see query_can_join()
 */
int remove_member( string name, string player ) {
    if( !members[name] )
        return 0;

    members[name] -= ({ player });
    save_data_file();
    return 1;

} /* add_member() */

/**
 * This method returns the orgs the specified player is a member of.
 * @param player the name of the player
 * @return the orgs the player is a member of
 * @see query_orgs()
 * @see query_member()
 */
string *query_my_orgs( string player ) {
    return filter( keys(orgs), (: query_member( $1, $2 ) :), player );
} /* query_my_orgs() */

/** @ignore yes */
private void check_members( string *left ) {
    if( sizeof(left) ) {
        string name;
         
        name = left[0];
        left = left[1..];

        foreach( string player in query_members( name ) ) {
            if( !player || !PLAYER_H->test_user(player) ) {
                members[name] -= ({ player });
                log_file("ORGS", "%O removed from %O - %s - %s\n",
                    player, name, "doesn't exist anymore", TIME );
            }
        }

        if( sizeof(left) ) {
            call_out( (: check_members :), 10, left );
            return;
        }

        // Save only when the cycle has ended,
        // otherwise we save once every ten seconds per org.
        save_data_file();
    }

} /* check_members() */

/** @ignore yes */
private void check_all_members() {
    string *all;

    call_out( (: check_all_members :), CHECK_TIME );

    if( sizeof( all = keys(orgs) ) )
        check_members( all );

} /* check_all_members() */

/**
 * This method deletes the given player by name from all orgs.
 * This should be called by the refresh handler when the player
 * refreshes or is deleted.
 * @param player the player to delete
 */
void refresh_player( string player ) {
    int flag;

    foreach( string name in keys(members) ) {
        if( member_array( player, members[name] ) != -1 ) {
            flag = 1;
            members[name] -= ({ player });
        }
    }

    if( flag )
        save_data_file();

} /* refresh_player() */

/** @ignore yes */
mixed stats() {
    mixed org_info;

    org_info = ({ });

    foreach( string name in keys(orgs) )
        org_info += ({ ({ name, DATA->title }) });

    return ({ ({ "total orgs" , sizeof( keys( orgs ) ) }) }) + org_info;

} /* stats() */