/* * Unmuzzle the bastard now he has apologised and grovelled enough via email */ void unmuzzle(UR_OBJECT user) { UR_OBJECT u; int on; if (word_count < 2) { write_user(user, "Usage: unmuzzle <user>\n"); return; } u = retrieve_user(user, word[1]); if (!u) { return; } on = retrieve_user_type == 1; /* error checks */ if (u == user) { write_user(user, "Trying to unmuzzle yourself is the tenth sign of madness.\n"); done_retrieve(u); return; } /* FIXME: Use sentinel other JAILED */ if (u->muzzled == JAILED) { vwrite_user(user, "%s~RS is not muzzled.\n", u->recap); done_retrieve(u); return; } if (u->muzzled > user->level) { vwrite_user(user, "%s~RS's muzzle is set to level %s, you do not have the power to remove it.\n", u->recap, user_level[u->muzzled].name); done_retrieve(u); return; } /* do the unmuzzle */ u->muzzled = JAILED; /* FIXME: Use sentinel other JAILED */ vwrite_user(user, "~FG~OLYou remove %s~RS's muzzle.\n", u->recap); write_syslog(SYSLOG, 1, "%s unmuzzled %s.\n", user->name, u->name); add_history(u->name, 0, "~FGUnmuzzled~RS by %s, level %d (%s).\n", user->name, user->level, user_level[user->level].name); sprintf(text, "~FG~OLYou have been unmuzzled!\n"); if (!on) { send_mail(user, u->name, text, 0); } else { write_user(u, text); } /* finish up */ if (!on) { strcpy(u->site, u->last_site); u->socket = -2; } save_user_details(u, on); done_retrieve(u); }
/* Calculate the spodlist */ void calc_spodlist(void) { UR_OBJECT u; UD_OBJECT entry; /* Delete the whole list */ delete_spodlist(); /* Save all players so times are accurate */ for (u = user_first; u; u = u->next) { #ifdef NETLINKS if (u->type == REMOTE_TYPE) { continue; } #endif if (u->type == CLONE_TYPE || u->login) { continue; } save_user_details(u, 1); } /* Create spod list */ for (entry = first_user_entry; entry; entry = entry->next) { u = retrieve_user(NULL, entry->name); if (!u) { continue; } add_name_to_spodlist(u->name, u->total_login); done_retrieve(u); } }
/* * See if user has a room key */ int has_room_key(const char *visitor, RM_OBJECT rm) { UR_OBJECT u; FU_OBJECT fu; int haskey; /* get owner */ u = retrieve_user(NULL, rm->owner); if (!u) { return 0; } /* check flags */ for (fu = u->fu_first; fu; fu = fu->next) { if (!strcasecmp(fu->name, visitor)) { break; } } haskey = fu && (fu->flags & fufROOMKEY); done_retrieve(u); return haskey; }
/* * Unarrest a user who is currently under arrest and in jail */ void unarrest(UR_OBJECT user) { UR_OBJECT u; RM_OBJECT rm; int on; if (word_count < 2) { write_user(user, "Usage: unarrest <user>\n"); return; } u = retrieve_user(user, word[1]); if (!u) { return; } on = retrieve_user_type == 1; /* error checks */ if (u == user) { write_user(user, "You cannot unarrest yourself.\n"); return; } if (u->level != JAILED) { vwrite_user(user, "%s~RS is not under arrest!\n", u->recap); done_retrieve(u); return; } if (user->level < u->arrestby) { vwrite_user(user, "%s~RS can only be unarrested by a %s or higher.\n", u->recap, user_level[u->arrestby].name); done_retrieve(u); return; } /* do it */ u->level = u->unarrest; u->real_level = u->level; u->arrestby = JAILED; /* FIXME: Use sentinel other JAILED */ user_list_level(u->name, u->level); strcpy(u->date, (long_date(1))); sprintf(text, "~FG~OLYou have been unarrested... Now try to behave!\n"); if (!on) { send_mail(user, u->name, text, 0); vwrite_user(user, "%s has been unarrested.\n", u->name); } else { write_user(u, text); vwrite_user(user, "%s has been unarrested.\n", u->name); write_room(NULL, "The Hand of Justice reaches through the air...\n"); rm = get_room_full(amsys->default_warp); if (!rm) { vwrite_user(user, "Cannot find a room for ex-cons, so %s~RS is still in the %s!\n", u->recap, u->room->name); } else { move_user(u, rm, 2); } } write_syslog(SYSLOG, 1, "%s UNARRESTED %s\n", user->name, u->name); add_history(u->name, 1, "Was ~FGunarrested~RS by %s.\n", user->name); if (!on) { u->socket = -2; strcpy(u->site, u->last_site); } save_user_details(u, on); done_retrieve(u); }
/* * this function allows admin to control personal rooms */ void personal_room_admin(UR_OBJECT user) { char rmname[ROOM_NAME_LEN + 1], filename[80]; RM_OBJECT rm; UR_OBJECT u; int trsize, rmcount, locked, unlocked; if (word_count < 2) { write_user(user, "Usage: rmadmin -l / -m / -u <name> / -d <name>\n"); return; } if (!amsys->personal_rooms) { write_user(user, "Personal room functions are currently disabled.\n"); return; } strtolower(word[1]); /* just display the amount of memory used by personal rooms */ if (!strcmp(word[1], "-m")) { write_user(user, "+----------------------------------------------------------------------------+\n"); write_user(user, "| ~FC~OLPersonal Room Memory Usage~RS |\n"); write_user(user, "+----------------------------------------------------------------------------+\n"); rmcount = locked = unlocked = 0; for (rm = room_first; rm; rm = rm->next) { if (!is_personal_room(rm)) { continue; } ++rmcount; if (is_private_room(rm)) { ++locked; } else { ++unlocked; } } trsize = rmcount * (sizeof *rm); vwrite_user(user, "| %-15.15s: ~OL%2d~RS locked, ~OL%2d~RS unlocked |\n", "status", locked, unlocked); vwrite_user(user, "| %-15.15s: ~OL%5d~RS * ~OL%8d~RS bytes = ~OL%8d~RS total bytes (%02.3f Mb) |\n", "rooms", rmcount, (int) (sizeof *rm), trsize, trsize / 1048576.0); write_user(user, "+----------------------------------------------------------------------------+\n"); return; } /* list all the personal rooms in memory together with status */ if (!strcmp(word[1], "-l")) { write_user(user, "+----------------------------------------------------------------------------+\n"); write_user(user, "| ~OL~FCPersonal Room Listings~RS |\n"); write_user(user, "+----------------------------------------------------------------------------+\n"); rmcount = 0; for (rm = room_first; rm; rm = rm->next) { if (!is_personal_room(rm)) { continue; } ++rmcount; vwrite_user(user, "| Owner : ~OL%-*.*s~RS Status : ~OL%s~RS Msg Count : ~OL%2d~RS People : ~OL%2d~RS |\n", USER_NAME_LEN, USER_NAME_LEN, rm->owner, is_private_room(rm) ? "~FRlocked " : "~FGunlocked", rm->mesg_cnt, room_visitor_count(rm)); } if (!rmcount) { write_user(user, "| ~FRNo personal rooms are currently in memory~RS |\n"); } write_user(user, "+----------------------------------------------------------------------------+\n"); if (rmcount) { vwrite_user(user, "| Total personal rooms : ~OL~FM%2d~RS |\n", rmcount); write_user(user, "+----------------------------------------------------------------------------+\n"); } return; } /* unload a room from memory or delete it totally - all rooms files */ if (!strcmp(word[1], "-u") || !strcmp(word[1], "-d")) { if (word_count < 3) { write_user(user, "Usage: rmadmin -l / -m / -u <name> / -d <name>\n"); return; } sprintf(rmname, "(%s)", word[2]); strtolower(rmname); /* first do checks on the room */ rm = get_room_full(rmname); if (!rm) { write_user(user, "That user does not have a personal room built.\n"); return; } if (room_visitor_count(rm)) { write_user(user, "You cannot remove a room if people are in it.\n"); return; } /* okay to remove the room */ /* remove invites */ for (u = user_first; u; u = u->next) { if (u->invite_room == rm) { u->invite_room = NULL; } } /* destroy */ destruct_room(rm); strtolower(word[2]); *word[2] = toupper(*word[2]); /* delete all files */ if (!strcmp(word[1], "-d")) { sprintf(filename, "%s/%s/%s.R", USERFILES, USERROOMS, word[2]); remove(filename); sprintf(filename, "%s/%s/%s.B", USERFILES, USERROOMS, word[2]); remove(filename); write_syslog(SYSLOG, 1, "%s deleted the personal room of %s.\n", user->name, word[2]); vwrite_user(user, "You have now ~OL~FRdeleted~RS the room belonging to %s.\n", word[2]); /* remove all the key flags */ u = retrieve_user(user, word[2]); if (u) { all_unsetbit_flagged_user_entry(u, fufROOMKEY); write_user(user, "All keys to that room have now been destroyed.\n"); done_retrieve(u); } } else { /* just unload from memory */ write_syslog(SYSLOG, 1, "%s unloaded the personal room of %s from memory.\n", user->name, word[2]); vwrite_user(user, "You have now ~OL~FGunloaded~RS the room belonging to %s from memory.\n", word[2]); } return; } /* wrong input given */ write_user(user, "Usage: rmadmin -l | -m | -u <name> | -d <name>\n"); }
/* * Put annoying user in jail */ void arrest(UR_OBJECT user) { UR_OBJECT u; RM_OBJECT rm; int on; if (word_count < 2) { write_user(user, "Usage: arrest <user>\n"); return; } u = retrieve_user(user, word[1]); if (!u) { return; } on = retrieve_user_type == 1; /* error checks */ if (u == user) { write_user(user, "You cannot arrest yourself.\n"); return; } if (u->level >= user->level) { write_user(user, "You cannot arrest anyone of the same or higher level than yourself.\n"); done_retrieve(u); return; } if (u->level == JAILED) { vwrite_user(user, "%s~RS has already been arrested.\n", u->recap); done_retrieve(u); return; } /* do it */ u->vis = 1; u->unarrest = u->level; u->arrestby = user->level; u->level = JAILED; u->real_level = u->level; user_list_level(u->name, u->level); strcpy(u->date, (long_date(1))); sprintf(text, "~FR~OLYou have been placed under arrest.\n"); if (!on) { send_mail(user, u->name, text, 0); vwrite_user(user, "%s has been placed under arrest.\n", u->name); } else { write_user(u, text); vwrite_user(user, "%s has been placed under arrest.\n", u->name); write_room(NULL, "The Hand of Justice reaches through the air...\n"); rm = get_room_full(amsys->default_jail); if (!rm) { vwrite_user(user, "Cannot find the jail, so %s~RS is arrested but still in the %s.\n", u->recap, u->room->name); } else { move_user(u, rm, 2); } vwrite_room_except_both(NULL, user, u, "%s~RS has been placed under arrest...\n", u->recap); } write_syslog(SYSLOG, 1, "%s ARRESTED %s (at level %s)\n", user->name, u->name, user_level[u->arrestby].name); add_history(u->name, 1, "Was ~FRarrested~RS by %s (at level ~OL%s~RS).\n", user->name, user_level[u->arrestby].name); if (!on) { u->socket = -2; strcpy(u->site, u->last_site); } save_user_details(u, on); done_retrieve(u); }