/** Write a suggestion to the board, or read if if you can **/ void suggestions(UR_OBJECT user, int done_editing) { FILE *fp; char *c; int cnt=0; set_crash(); if (com_num==RSUG) { write_user(user,"~BB~FG*** The Suggestions board has the following ideas ***\n\n"); switch (more(user, user->socket, SUGBOARD)) { case 0: write_user(user,"There are no suggestions.\n\n"); break; case 1: user->misc_op=2; } return; } #ifdef NETLINKS if (user->type==REMOTE_TYPE) { write_user(user,"Remote users cannot use this command, sorry!\n"); return; } #endif if (!done_editing) { write_user(user,"~BB~FG*** Writing a suggestion ***\n\n"); user->misc_op=8; editor(user,NULL); return; } if (!(fp=fopen(SUGBOARD, "a"))) { vwrite_user(user,"%s: couldn't add suggestion.\n",syserror); write_syslog(ERRLOG,1,"Couldn't open file %s to write in suggestions().\n", SUGBOARD); return; } sprintf(text,"~OLFrom: %s %s\n",user->bw_recap,long_date(0)); fputs(text,fp); c=user->malloc_start; while (c!=user->malloc_end) { putc(*c++,fp); if (*c=='\n') cnt=0; else ++cnt; if (cnt==80) { putc('\n',fp); cnt=0; } } fprintf(fp,"\n"); fclose(fp); write_user(user,"Suggestion written. Thank you for your contribution.\n"); amsys->suggestion_count++; }
/* * Show all clones on the system */ void allclones(UR_OBJECT user) { UR_OBJECT u; int cnt; cnt = 0; for (u = user_first; u; u = u->next) { if (u->type != CLONE_TYPE) { continue; } if (!cnt++) { vwrite_user(user, "\n~BB*** Current clones %s ***\n\n", long_date(1)); } vwrite_user(user, "%-15s : %s\n", u->name, u->room->name); } if (!cnt) { write_user(user, "There are no clones on the system.\n"); } else { vwrite_user(user, "\nTotal of ~OL%d~RS clone%s.\n\n", cnt, PLTEXT_S(cnt)); } }
/*** Write on the message board ***/ void write_board(UR_OBJECT user, char *inpstr, int done_editing) { FILE *fp; int cnt,inp; char *ptr,*name,fname[FNAME_LEN],rmname[ROOM_NAME_LEN+1]; set_crash(); if (user->muzzled) { vwrite_user(user, muzzled_cannot, "zapisovat"); return; } if (!done_editing) { if (word_count<2) { #ifdef NETLINKS if (user->type==REMOTE_TYPE) { /* Editor won't work over netlink cos all the prompts will go wrong, I'll address this in a later version. */ write_user(user,"Sorry, due to software limitations remote users cannot use the line editor.\nUse the '.write <mesg>' method instead.\n"); return; } #endif write_user(user, write_edit_header); user->misc_op=3; editor(user,NULL); return; } ptr=inpstr; inp=1; } else { ptr=user->malloc_start; inp=0; } if (user->room->access==PERSONAL_LOCKED || user->room->access==PERSONAL_UNLOCKED) { midcpy(user->room->name,rmname,1,strlen(user->room->name)-2); rmname[0]=toupper(rmname[0]); sprintf(fname,"%s/%s.B", USERROOMS,rmname); } else sprintf(fname,"%s/%s.B", ROOMFILES, user->room->name); if (!(fp=fopen(fname,"a"))) { vwrite_user(user,"%s: cannot write to file.\n",syserror); write_syslog(ERRLOG,1,"Couldn't open file %s to append in write_board().\n",fname); return; } if (user->vis) name=user->bw_recap; else name=invisname; /* The posting time (PT) is the time its written in machine readable form, this makes it easy for this program to check the age of each message and delete as appropriate in check_messages() */ #ifdef NETLINKS if (user->type==REMOTE_TYPE) sprintf(text,"PT: %d\r~OLFrom: %s@%s %s\n",(int)(time(0)),name,user->netlink->service,long_date(0)); else #endif sprintf(text,"PT: %d\r~OLFrom: %s %s\n",(int)(time(0)),name,long_date(0)); fputs(text,fp); cnt=0; while (*ptr!='\0') { putc(*ptr,fp); if (*ptr=='\n') cnt=0; else ++cnt; if (cnt==80) { putc('\n',fp); cnt=0; } ++ptr; } if (inp) fputs("\n\n",fp); else putc('\n',fp); fclose(fp); write_user(user, user_write_end); vwrite_room_except(user->room, user, room_write_end, name); user->room->mesg_cnt++; }
/* * reset the user variables */ void reset_user(UR_OBJECT user) { int i; strcpy(user->version, USERVER); *user->verify_code = '\0'; *user->email = '\0'; *user->homepage = '\0'; *user->icq = '\0'; *user->recap = '\0'; *user->bw_recap = '\0'; strcpy(user->desc, "is a newbie"); strcpy(user->in_phrase, "enters"); strcpy(user->out_phrase, "goes"); *user->afk_mesg = '\0'; *user->pass = '******'; *user->last_site = '\0'; *user->page_file = '\0'; *user->mail_to = '\0'; *user->inpstr_old = '\0'; *user->buff = '\0'; *user->call = '\0'; *user->samesite_check_store = '\0'; #ifdef GAMES *user->hang_word = '\0'; *user->hang_word_show = '\0'; *user->hang_guess = '\0'; #endif *user->invite_by = '\0'; strcpy(user->logout_room, room_first->name); strcpy(user->date, (long_date(1))); for (i = 0; i < MAX_COPIES; ++i) { *user->copyto[i] = '\0'; } for (i = 0; i < 10; ++i) { *user->macros[i] = '\0'; } #ifdef NETLINKS user->netlink = NULL; user->pot_netlink = NULL; #endif user->room = NULL; user->invite_room = NULL; user->malloc_start = NULL; user->malloc_end = NULL; user->owner = NULL; user->wrap_room = NULL; user->read_mail = time(0); user->last_input = time(0); user->last_login = time(0); user->retired = 0; user->level = NEW; user->real_level = user->level; user->unarrest = NEW; user->arrestby = JAILED; /* FIXME: Use sentinel other JAILED */ user->buffpos = 0; user->filepos = 0; user->command_mode = 0; user->vis = 1; user->ignall = 0; user->ignall_store = 0; user->ignshouts = 0; user->igntells = 0; user->muzzled = JAILED; /* FIXME: Use sentinel other JAILED */ user->last_login_len = 0; user->total_login = 0; user->prompt = amsys->prompt_def; user->colour = amsys->colour_def; user->charmode_echo = amsys->charecho_def; user->show_pass = amsys->passwordecho_def; user->misc_op = 0; user->edit_op = 0; user->edit_line = 0; user->charcnt = 0; user->warned = 0; user->accreq = 0; user->afk = 0; user->clone_hear = CLONE_HEAR_ALL; user->wipe_to = 0; user->wipe_from = 0; user->wrap = 0; user->pager = 23; user->logons = 0; user->expire = 1; user->lroom = 0; user->monitor = 0; user->gender = NEUTER; user->age = 0; user->hideemail = 1; user->misses = 0; user->hits = 0; user->kills = 0; user->deaths = 0; user->bullets = 6; user->hps = 10; user->alert = 0; user->mail_verified = 0; user->autofwd = 0; user->ignpics = 0; user->ignlogons = 0; user->igngreets = 0; user->ignwiz = 0; user->ignbeeps = 0; user->samesite_all_store = 0; user->cmd_type = 0; user->hang_stage = -1; user->show_rdesc = 1; user->lmail_all = 0; user->lmail_lev = NUM_LEVELS; for (i = 0; i < MAX_REMINDERS; ++i) { user->reminder[i].date = -1; *user->reminder[i].msg = '\0'; } user->reminder_pos = -1; for (i = 0; i < MAX_XCOMS; ++i) { user->xcoms[i] = -1; } for (i = 0; i < MAX_GCOMS; ++i) { user->gcoms[i] = -1; } for (i = 0; i < MAX_PAGES; ++i) { user->pages[i] = 0; } user->pagecnt = 0; user->login_prompt = 1; user->user_page_pos = 0; user->user_page_lev = NUM_LEVELS; user->pm_count = 0; user->pm_currcount = 0; user->universal_pager = 0; user->pm_current = NULL; user->pm_first = NULL; user->pm_last = NULL; user->fu_first = NULL; user->fu_last = NULL; user->rb_first = NULL; user->rb_last = NULL; user->money = DEFAULT_MONEY; user->bank = DEFAULT_BANK; user->inctime = 0; user->reverse_buffer = 0; user->visual = 0; user->visualn = 25; }
/* * 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); }
/* * 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); }