예제 #1
0
/**********************************************************************
* editroom
* <E>dit room in aide menu
**********************************************************************/
void
editroom(void)
{
char    anon_opt;
char    opt;
char   *roomname;
int     flags;
int     gen;

  if (curr <= AIDE_RM_NBR && !ouruser->f_prog)
  {
    printf("Only programmers can edit Lobby, Mail, or Aide forums!\n");
    return;
  }

  flags = msg->room[curr].flags;
  gen = msg->room[curr].gen;

  /* Edit the room name */
  printf("Forum name is currently: %s>\n", msg->room[curr].name);

  roomname = get_name("New forum name (return leaves it unchanged) -> ", 3);

  /* If you're an aide or wizard, you can edit the permissions of the room */

  if (ouruser->f_admin)
  {
    /************************************************************
    * These ifs form a sentence onscreen.
    ************************************************************/

    printf("\n%s> was a", msg->room[curr].name);

    if (!(msg->room[curr].flags & QR_PRIVATE))
      printf(" public");

    if (msg->room[curr].flags & QR_PRIVATE)
      printf(" private");

    if (msg->room[curr].flags & QR_GUESSNAME)
      printf(" guessname");

    if (msg->room[curr].flags & QR_MINOR)
      printf(" non-minors only");

    if (msg->room[curr].flags & QR_ANONONLY)
      printf(" Anonymous-only");

    if (msg->room[curr].flags & QR_ANON2)
      printf(" Anonymous-optional");

    printf(" forum\n");

    printf("New forum type <1>pub <2>guessname <3>non-minors only <4>inv-only -> ");
    opt = get_single_quiet("1234");

    putchar('\n');

    /**********************************************************************
    * Option 1 (public) is default.
    * Non-public rooms have only 1 or 2 "privacy" bits: 
    * QR_PRIVATE by itself means invite-only, 
    * otherwise also set QR_GUESSNAME || QR_MINOR
    * Turn off all but inuse bits, we're going to reset everything
    * Turn bits back on as we go along
    **********************************************************************/
    flags = QR_INUSE;

    if (opt > '1')
      flags |= QR_PRIVATE;

    if (opt == '2')
      flags |= QR_GUESSNAME;

    if (opt == '3')
      flags |= QR_MINOR;

    if (opt != '1')
    {
      printf("(Answer yes to start a private forum)\n");
      printf("Cause users to forget forum? (y/n) -> ");

      gen = msg->room[curr].gen;
      if (yesno(-1) == YES)
      {
	if (++gen == 100)
	  gen = 10;
      }
    }
  }

  flags &= ~(QR_ANONONLY | QR_ANON2);
  printf("Identity: <1>Normal <2>Anon <3>Anon-optional -> ");
  anon_opt = get_single_quiet("123");

  if (anon_opt == '1')
    printf("Normal\n");
  else if (anon_opt == '2')
  {
    flags |= QR_ANONONLY;
    printf("Anonymous only\n");
  }
  else
  {
    flags |= QR_ANON2;
    printf("Anonymous optional\n");
  }


  colorize("@YSave changes? (Y/N) ->@G ");
  if (yesno(-1) == YES)
  {
    locks(SEM_MSG);
    if (*roomname)
      strcpy(msg->room[curr].name, roomname);
    msg->room[curr].flags = flags;
    msg->room[curr].gen = gen;
    unlocks(SEM_MSG);
  }

  printf("\nUse edit <D>escription to change description/forum moderator.\n");
}
예제 #2
0
파일: friends.c 프로젝트: cafuego/monolith
void
menu_friend(int param)
{
    register char cmd = '\0';
    char *str = NULL;

    nox = 1;
    while (1) {
	IFNEXPERT
	{
	    if (param == FRIEND)
		more(MENUDIR "/menu_friend", 1);
	    else
		more(MENUDIR "/menu_enemy", 1);
	}

	if (!(usersupp->flags & US_NOCMDHELP))
	    cprintf("%s\n", (param == FRIEND) ? FRIEND_CMDS : ENEMY_CMDS);

	cprintf("\1f\1g%s \1w-> \1c", (param == FRIEND) ? "Edit X-Friends" : "Edit X-Enemies");

	cmd = get_single_quiet("Aacrtdqls\n\r ?");

	switch (cmd) {

	    case '?':
		cprintf("Help!\n");
		if (param == FRIEND)
		    online_help('f');
/*                  more(MENUDIR "/menu_friend", 1); */
		else
		    online_help('e');
/*                  more(MENUDIR "/menu_enemy", 1); */
		break;

	    case '\n':
	    case '\r':
	    case ' ':
	    case 'q':
		cprintf("\1f\1gQuit.\n");
/*		update_friends_cache(); */
		start_user_cache(usersupp->usernum);
		return;
		break;

	    case 'A':
		if (param == FRIEND) {
		    cprintf("\1f\1gAdd Quick-X Friend.\n");
		    menu_friend_quick_add();
		    break;
		}
		break;

	    case 'a':
		cprintf("\1f\1gAdd user to %slist.\n", (param == FRIEND) ? "friends" : "enemy");
		menu_friend_add(param);
		break;

	    case 'c':
		cprintf("\1f\1gAre you sure you want to clear your %slist (y/N)? ", (param == FRIEND) ? "friends" : "enemy");
		if (yesno_default(NO) == NO)
		    break;
		cprintf("\1f\1g%s \1w-> \1c", (param == FRIEND) ? "Edit X-Friends" : "Edit X-Enemies");
		cprintf("\1f\1gClearing %slist.\n", (param == FRIEND) ? "friends" : "enemy");
		if (param == FRIEND) {
		    mono_sql_uu_clear_list_by_type(usersupp->usernum, L_FRIEND);
		} else {
		    mono_sql_uu_clear_list_by_type(usersupp->usernum, L_ENEMY);
		}
		break;

	    case 'd':
	    case 'r':
		cprintf("\1f\1gRemove user from %slist.\n", (param == FRIEND) ? "friends" : "enemy");
		menu_friend_remove(param);
		break;

	    case 'l':
	    case 's':
		cprintf("\1f\1gList %s.\n", (param == FRIEND) ? "friends" : "enemies");
		str = menu_friend_list(param);
		more_string(str);
		xfree(str);
		break;

	    case 't':
		if (param == ENEMY)
		    break;
		usersupp->flags ^= US_NOTIFY_FR;
		cprintf("\1f\1gToggle logon notifications %s.\n", (usersupp->flags & US_NOTIFY_FR) ? "on" : "\1roff\1g");
		break;

	    default:
		cprintf("\1f\1rEEK, HAMSTERS\n");
		break;
	}			/* switch */
    }				/* while */
    return;
}
예제 #3
0
/**********************************************************************
* aide menu
* Access to this menu is restricted to those with aide status.
* Wizards can do everything
* System Aides can do all but aideify
* Room Aides can only get here if it's their room and they can
* NOT do <A>ideify <C>reateroom <Z>ap room.
**********************************************************************/
void
aide_menu(void)
{
register int chr = '?';

  /* Can't get here unless you're at least a room aide for this room */

  while (chr != 'M' && chr != ' ' && chr != '\n')
  {
    switch (chr)
    {
      case 'C':
	printf("Create new forum\n");
	createroom();
	loadroom();
	break;

      case 'D':
	printf("Edit forum description\n\n");
	editdesc();
	break;

      case 'E':
	printf("Edit forum\n");
	editroom();
	break;

      case 'H':
	printf("Help!\n");
	if (ouruser->f_admin)
	  help("aidemenu", YES);
	else
	  help("fmmenu", YES);
	break;

      case 'I':
	printf("Invite user\n");
	invite();
	break;

      case 'K':
	printf("Kick out user\n");
	kickout();
	break;

      case 'L':
	if (ouruser->f_prog)
	{
	  printf("Logout all users\n");
	  logout_all();
	  break;
	}
	/* FALL THRU */

      case 'l':
        printf("Logout user\n");
        logout();
        break;

      case 'O':
	show_online(1);
	break;

      case 'W':
	whoknows();
	break;

      case 'X':
	if (ouruser->f_prog)
	  xbroadcast();
	else
	  chr = 0;
	break;

      case 'Z':
	printf("Zap (delete) forum\n");
	deleteroom();
	loadroom();
	break;

      case '?':
      case '/':
	if (ouruser->f_admin)
	  help("aidecmd", NO);
	else
	  help("fmcmd", NO);
	break;

      default:
	break;
    }

    if (chr)
      colorize("\n@Y[%s]@M Forum command ->@G ", msg->room[curr].name);
    if (ouruser->f_admin)
      chr = get_single_quiet("CDEHIKlLMOWXZ \n/?");
    else
      chr = get_single_quiet("DEHIKMW \n/?");

  }				/* end of while loop */
  printf("Forum level\n");
}
예제 #4
0
/**********************************************************************
* edit room description
* Ask user if they want to edit <R>oom aide only, <D>escription only,
* <B>oth, or <Q>uit.
* Contingent on option chosen, edit the item(s).  When done, write
* the description to the descfile.
* raname is taken either from reading the description or set anew.
* If a new aide is chosen, read his/her user file and assign ->usernum
* to be roomaide.
**********************************************************************/
void
editdesc(void)
{
char    choice = '0';
char    descfile[100];
char    newdescfile[100];
int     dfd;		/* desc file descriptor */
int     dummy;		/* readmsg() needs this: returns YES/NO */
int     err;		/* makemessage returns this */
char    raname[MAXALIAS+1];
int	upload;
char   *cp;
struct mheader *mh;
int size;
unsigned char *infop;
struct user *tmpuser;

  sprintf(descfile, "%sroom%d", DESCDIR, curr);
  sprintf(newdescfile, "%sroom%d.NEW", DESCDIR, curr);

  size = 0;
  if (!(infop = (unsigned char *)mymmap(descfile, &size, 0)) || !size)
  {
    colorize("@RDescription doesn't yet exist@G\n");
    choice = 'B';
  }
  else
  {
    readmessage(infop, &dummy, raname, FALSE, 0);
    munmap((void *)infop, size);
  }

  /* if it's a new description, don't bother prompting for choice */
  if (choice != 'B')
  {
    printf("\nEdit <F>orum moderator only, <D>escription only, <B>oth, <Q>uit -> ");
    choice = get_single_quiet("FDBQ \n");
    putchar('\n');
  }
  if (choice == 'Q' || choice == ' ' || choice == '\n')
    return;

  if (choice == 'B' || choice == 'F')
  {
    cp = get_name("\nNew forum moderator -> ", 2);
    if (!*cp)
      return;

    if (!strcmp(cp, "Sysop"))
      msg->room[curr].roomaide = 0;
    else
      if (!(tmpuser = getuser(cp)) || tmpuser->f_invisible)
      {
	if (tmpuser)
	  freeuser(tmpuser);
	printf("\nThere is no user %s on this BBS.\n", cp);
        return;
      }
      else
      {
        msg->room[curr].roomaide = tmpuser->usernum;
	freeuser(tmpuser);
      }

    if (choice == 'F')
      return;
  }

  printf("\nHit Y to upload a description or N to enter it normally (Y/N) -> ");
  if ((upload = yesno(-1)))
    printf("\n(Use control-D to end!)\n");

  printf("\nEnter a new forum description...\n\n");

  err = makemessage(NULL, MES_DESC, upload);

  if (err == ABORT)
    colorize("@RDescription not entered\n@G");
  else if (err != SAVE)
    colorize("@RSome mystical error - can't make description\n@G");
  else if ((dfd = open(newdescfile, O_WRONLY | O_CREAT | O_EXCL, 0640)) < 0)
    printf("error opening desc file to make final copy\n");
  else
  {
    mh = (struct mheader *)(void *)tmpstart;
    write(dfd, tmpstart, mh->hlen + mh->len + 1);
    close(dfd);
    rename(newdescfile, descfile);
  }
  munmap((void *)tmpstart, 53248);
  if (err == SAVE)
  {
    printf("\nMark forum info as having been updated? (Y/N) -> ");
    if (yesno(-1))
      msg->room[curr].descupdate = msg->room[curr].highest;
  }
}
예제 #5
0
/**********************************************************************
* createroom
**********************************************************************/
void
createroom(void)
{
register int i;
int     found;
char   *newroom;
char    opt;
int     rm_nbr;
int    qpos;
char filename[80];


  printf("Are you sure? (Y/N) ->");
  if (!yesno(-1))
    return;

  newroom = get_name("Name for new forum? ", 3);

  if (!*newroom)
    return;

  found = NO;

  /* Simultaneously search for a duplicate and the first unused room */
  for (qpos = rm_nbr = 0; rm_nbr < MAXROOMS && !found; ++rm_nbr)
  {
    /* quit searching if you find a duplicate */
    if ((msg->room[rm_nbr].flags & QR_INUSE)
	&& !strcmp(msg->room[rm_nbr].name, newroom))
      found = YES;

    /* get position of FIRST available room */
    if (!(msg->room[rm_nbr].flags & QR_INUSE) && !qpos)
      qpos = rm_nbr;
  }

  if (found)
  {
    printf("There is already a forum by that name\n");
    return;
  }

  /* qpos never gets set if all rooms are in use */
  /* the rest of the function depends on qpos being set -sf */
  if (!qpos)
  {
    printf("Sorry, no space is available for another forum.\n");
    return;
  }

  /* Set the access for the new room */
  help("roomaccess", NO);

  printf("\n<1>Public <2>Guess name <3>Non-minors only <4>Invitation only\n");
  printf("Enter forum type-> ");
  opt = get_single_quiet("1234");

  printf("\n\n\042%s\042, will be a", newroom);

  /* This is a bug!!  It never gets used!! */ 
  switch (opt)
  {
    case 1:
      printf(" public");
      break;
    case 2:
      printf(" guess-name");
      break;
    case 3:
      printf(" non-minors only");
      break;
    case 4:
      printf(" invitation-only");
      break;
  }

  printf(" forum\n");

  printf("Install it? (y/n) -> ");
  if (!yesno(-1))
  {
    printf("Create Forum aborted\n");
    return;
  }

  /* delete & zero room info & whoknows files if they exist */
  /* NOTE: Need exclusive access here! */
  sprintf(filename, "%sroom%d", DESCDIR, qpos);
  unlink(filename);
  open(filename, O_WRONLY | O_CREAT, 0640);
  sprintf(filename, "%srm%d", WHODIR, qpos);
  unlink(filename);
  open(filename, O_WRONLY | O_CREAT, 0640);

  locks(SEM_MSG);

  if (msg->room[qpos].flags & QR_INUSE)
  {
    unlocks(SEM_MSG);
    printf("\nForum slot taken, please try again.\n");
    return;
  }

  curr = qpos;

  strcpy(msg->room[curr].name, newroom);

  msg->room[curr].highest = 0L;
  msg->room[curr].posted = 0L;

  if (++msg->room[curr].gen == 100)
    msg->room[curr].gen = 10;

  /* want a clean slate to work with */
  msg->room[curr].flags = QR_INUSE;

  if (opt > '1')
    msg->room[curr].flags |= QR_PRIVATE;
  if (opt == '2')
    msg->room[curr].flags |= QR_GUESSNAME;
  if (opt == '3')
    msg->room[curr].flags |= QR_MINOR;

  for (i = 0; i < MSGSPERRM; i++)
  {
    msg->room[curr].pos[i] = 0;
    msg->room[curr].num[i]= 0;
    msg->room[curr].chron[i]= 0;
  }

  unlocks(SEM_MSG);

  printf("Use edit description to assign forum moderator.\n");

  printf("\n%s> (#%d) created as a", msg->room[curr].name, curr);

  if (!(msg->room[curr].flags & QR_PRIVATE))
    printf(" public");

  if (msg->room[curr].flags & QR_PRIVATE)
    printf(" [private]");

  if (msg->room[curr].flags & QR_GUESSNAME)
    printf(" [guessname]");

  if (msg->room[curr].flags & QR_MINOR)
    printf(" [non-minors only]");

  printf(" forum\n");

  /* Join user to the room that was just created */
  ouruser->forget[curr] = TWILIGHTZONE;
  ouruser->generation[curr] = msg->room[curr].gen;

  return;
}
예제 #6
0
void
clip_board()
{

    int cmd = 0;

    while (cmd != 'Q' && cmd != ' ' && cmd != '\r') {
	display_short_prompt();

	cprintf( _("\01f\01gClipboard: \01a"));
	IFNEXPERT
	{
	    more(MENUDIR "/menu_clipboard", 1);
	    display_short_prompt();
	    cprintf("\01f\01gClipboard: \01a");
	}

	cmd = get_single_quiet("DEMRS?Q \r");

	switch (cmd) {

	    case 'D':
		cprintf(_("\01f\01gDelete ClipBoard.\n"));
		cprintf(_("\01f\01yAre you sure you want to delete your clipboard? (y/N) "));
		if (yesno_default(NO) == NO) {
		    cprintf(_("\1f\1gClipboard not deleted.\n"));
		} else {
		    close(creat(CLIPFILE, 0600));
		    cprintf(_("\1f\1gClipboard deleted.\n"));
		}
		break;

	    case 'E':
		cprintf(_("\01f\01gEdit ClipBoard.\n"));
		editor_edit(CLIPFILE);
		break;

	    case 'M':
                (void) mail_clipboard(CLIPFILE);
		break;

	    case 'R':
		cprintf(_("\01f\01gRemove Colorcodes.\n"));
		if (de_colorize(CLIPFILE) != 0)
		    cprintf(_("\01f\01r\nWarning\01w:\01g Couldn't remove colours."));
		break;

	    case 'S':
		cprintf(_("\01f\01gShow ClipBoard contents.\01c\n\n"));
		cprintf(_("\01w----- CLIPBOARD -----\n\01g"));
		more(CLIPFILE, 1);
		cprintf(_("\01f\01w----- CLIPBOARD -----\n"));
		break;

	    case 'Q':
	    case ' ':
	    case '\r':
		cprintf(_("\01f\01gQuit.\n"));
		break;


	    case '?':
		cprintf("\01f\01gShow menu.\n");
		more(MENUDIR "/menu_clipboard", 1);
		break;

	    default:
		break;

	}
    }
}
예제 #7
0
void
notebook(int for_who)
{

    int cmd, a;
    char nbname[70];
    char tempstr[180];
    FILE *fp;

    /* if roomnotebook */
    if (for_who == 1)
	sprintf(nbname, "%sroomnb%d", NOTEBOOKDIR, curr_rm);
    else {
	sprintf(nbname, "%sOwn_%s", NOTEBOOKDIR, usersupp->username);
	name2file(nbname);
    }
    cprintf("\n");
    for (;;) {

	if (! ( usersupp->flags & US_EXPERT ) )
	    more(MENUDIR "/menu_note", 1);

	cprintf("\1a\1f\1pNoteBook-> ");

	cmd = get_single_quiet("?CDELSQ \r\b");

	cprintf("\1f\1y");

	switch (cmd) {
	    case 'C':
		cprintf(_("Copy'ing the NoteBook to the end of the ClipBoard.\n"));
		sprintf(tempstr, "cat %s >> %s", nbname, CLIPFILE);
		system(tempstr);
		break;

	    case 'D':
		cprintf(_("Delete NoteBook!\n"));
		cprintf(_("Are you sure? "));
		if (yesno_default(NO) == YES)
		    fclose(fopen(nbname, "w"));
		break;

	    case 'E':
		cprintf("Enter a new NoteBook.\n");
		fp = xfopen(nbname, "w", FALSE);
		if (!fp) {
		    cprintf("\1f\1rNotebook could not be opened.\n");
		    break;
		}
		get_buffer(fp, EDIT_NORMAL, &a);
		fclose(fp);
		break;

	    case 'L':
		cprintf("Locally edit the NoteBook.\n");
		editor_edit(nbname);
		break;

	    case 'S':
		cprintf("Show NoteBook contents.\n\n");
		cprintf("\1p-- start of notebook -----\n\1g");
		more(nbname, 1);
		cprintf("\1f\1p-- end of notebook -----\n");
		break;

	    case '?':
		cprintf("Help.\n");
		more(MENUDIR "/menu_note", 1);
		break;

	    default:
		cprintf("\n");
		return;
	}
    }
}
예제 #8
0
void
do_login(void)
{
register int i;
register int users;
register char *name;
register struct tm *ltm;
register struct user *tmpuser = 0;
register int wrong = 0;
register char *bbsname;
char pas[9];
char temp[128];
char myname[MAXALIAS + 1];

  printf("\nDOC (Dave's Own version of Citadel) Version 1.71\n\nWelcome to the ISCA BBS.\n\n%s", (bbsname = getenv("BBSNAME")) ? "" : "\nLogin as 'Guest' to just look around, or 'New' to create a new account.\n\n");

  for (;;)
  {
    guest = 0;

    if (!bbsname)
      name = get_name("Name: ", 1);
    else
      strcpy(name = myname, bbsname);

    if (strcmp(name, "New"))
    {
      if ((tmpuser = getuser(name)))
        freeuser(tmpuser);
      if (tmpuser && (!bbsname || tty) && strcmp(name, "Guest"))
        get_string("Password: "******"Incorrect login.\n");
	else
	  printf("There is no user %s on this BBS.\n", name);
        if (++wrong > 3 || bbsname)
        {
	  if (!bbsname)
            printf("\n\nToo many attempts.  Goodbye.\n");
          my_exit(3);
        }
        flush_input(wrong);
        continue;
      }
      else
      {
        xinit();
	if (ouruser->keytime)
	{     
	  printf("\n\n\nYou have not yet registered your validation key...\n\n");
	  dokey(ouruser);
	  if (ouruser->keytime && ouruser->f_trouble)
	  {
	    printf("\n\nYou will need to enter your validation key before you may gain access to the\nBBS.  If you have not yet received your key and think you should, you may send\nE-mail to [email protected].  Please include your BBS username in this\nE-mail so the sysop who receives it knows who you are.  Remember that it can\ntake several days from the time your account was originally created for the\nsysops to validate the information you have provided, if it has been less than\nfour days since you created your account please do not send E-mail yet, as it\nlikely they haven't finished with your account yet.  Impatience won't make them\nwork any faster, and quite likely will make them decide to make you a special\ncase and work slower!  Remember, this BBS is a privilege, not a right.\n\n\n");
	    my_exit(15);
	  }
	}

	printf("\nIowa Student Computer Association BBS.\n");

	if (ouruser->f_deleted)
        {
	  if (ouruser->f_namechanged)
	    printf("\a\nThis account has been marked for deletion because of a request to change the\nusername from '%s' to '%s'.\n\nYou may login as '%s' using the same password.\n\n", ouruser->name, ouruser->reminder, ouruser->reminder);
          else
            printf("\a\nThis account has been marked for deletion, either through your choice or\nbecause you violated ISCA BBS rules by doing something such as providing\nobviously bogus profile info.  You will be logged off.\n\n");
          my_exit(10);
        }
	else if (ouruser->f_inactive)
        {
          printf("You seem to have been denied access to the message system.\n");
          printf("Please contact ISCA (e-mail address [email protected]) for more.\n");
          my_exit(10);
        }


	i = ouruser->time;
        ltm = localtime(&ouruser->time);
        users = add_loggedin(ouruser);

        if (!guest && ouruser->time)
        {
	  printf("Last on: %d/%d/%d %d:%02d ", ltm->tm_mon + 1,
                 ltm->tm_mday, 1900 + ltm->tm_year, ltm->tm_hour, ltm->tm_min);
          ltm = localtime(&ouruser->timeoff);
	  if (ouruser->timeoff >= i)
            printf("until %d:%02d from %s\n", ltm->tm_hour, ltm->tm_min, ouruser->remote);
	  else
	    printf("from %s\n", ouruser->remote);
        }

        strcpy(ouruser->loginname, ARGV[1] && ARGV[2] ? ARGV[2] : "");
        strncpy(ouruser->remote, ARGV[1] ? ARGV[1] : "local", sizeof ouruser->remote - 1);

        if (ouruser->f_noclient)
	{
	  printf("\n\nYou have been disallowed use of the BBS client, you must login using telnet.\n\n");
	  my_exit(10);
	}

	sprintf(temp, "%s %s%s%s/%d", client ? "CLIENT" : "LOGIN", ARGV[1] && ARGV[2] ? ARGV[2] : "", ARGV[1] && ARGV[2] ? "@" : "", ouruser->remote, mybtmp->remport);
	logevent(temp);

	++ouruser->timescalled;

	if (!guest)
	  printf("This is call %d.  There are %d users.\n", ouruser->timescalled, users);
        if (ouruser->f_aide)
           validate_users(0);

	/*
	 * Turn off expresses and tell the user this was done if user is
	 * configured for this 
	 */
	if (!guest && mybtmp->xstat)
	  printf("\nNOTE:  You have eXpress messages turned OFF as a default!\n");
        if (mybtmp->elf)
          printf("\nYou are marked as available to help others.\n");

	checkmail(FALSE);

	termset();

        if (*ouruser->reminder)
        {
          printf("\n\aREMINDER:\n%s\n\n", ouruser->reminder);
          printf("Please hit 'Y' to acknowledge having seen this reminder -> ");
          get_single_quiet("yY");
        }

	if (ouruser->f_badinfo || ouruser->f_duplicate)
	{
	  help("badinfo", NO);
	  mysleep(300);
	}

	if (guest)
	{
	  help("guestwelcome", NO);
	  hit_return_now();
	}
	return;
      }
    }
    else
      if (!(i = new_user()))
      {
	printf("\n\nSorry, there was some problem setting up your BBS account.\n\nPlease try again later.\n\n");
        my_exit(10);
      }
      else if (i > 0)
        return;
  }
}
예제 #9
0
void
bbsstart(void)
{
unsigned char stdinbuf[STDINBUFSIZ];
long    uglastmsg;	/* last msg seen in prev. rm */
long    ugtemp = TWILIGHTZONE;
short   prev_rm = TWILIGHTZONE;
char    cit_cmd;
char    bueller = 0;

  room = &sroom;
  setvbuf(stdin, (char *)stdinbuf, _IOFBF, STDINBUFSIZ);
  setvbuf(stdout, (char *)stdoutbuf, _IOFBF, STDOUTBUFSIZ);

  init_system();
  /* Putty.exe is obstinate */
  /* IAC WILL SGA */
  putchar(IAC); putchar(WILL); putchar(TELOPT_SGA);
  /* magic to set telnet into character mode */
  /* IAC  DO LINEMODE, IAC WILL ECHO */
  write(1,"\377\375\042\377\373\001",6);
  /* let window sizes come through */
  /* IAC DO NAWS */
  write(1,"\377\375\037",3);

  reserve_slot();
  do_login();

  colorize("\n@G");

  curr = LOBBY_RM_NBR;
  inituser();

  openroom();
  storeug(&uglastmsg, &ugtemp);

  /* The first thing we do is make the user read the lobby */
  cit_cmd = 'N';

  readroom(cit_cmd);


  for(;;)
  {
    /*
     * check if user has been kicked out of this room while they were in it,
     * or if room was deleted
     */
    if (ouruser->generation[curr] < 0 || !msg->room[curr].flags)
    {
      curr = LOBBY_RM_NBR;
      openroom();
      storeug(&uglastmsg, &ugtemp);
    }

    if (cit_cmd)
      colorize("\n@Y%s>@G ", msg->room[curr].name);

    checkx(0);

    if (ouruser->f_prog)
      cit_cmd = get_single_quiet("ABCD\005eEFGHIJKLNOpPqQRsSTUvVwWxX\027\030yYZ /?#%@-\"");
    else if (ouruser->f_aide)
      cit_cmd = get_single_quiet("ABC\005eEFGHIJKLNOpPqQRsSTUvVwWxX\027\030yYZ /?#%@-\"");
    else if (ouruser->usernum == msg->room[curr].roomaide && !ouruser->f_twit)
      cit_cmd = get_single_quiet("ABC\005eEFGHIJKLNOpPqQRsSTUwWxX\027\030yYZ /?#%-\"");
    else
      cit_cmd = get_single_quiet("BCeEFGHIJKLNOpPqQRsSTUwWxX\027\030yYZ /?#%-\"");

    if (cit_cmd == SP)
      cit_cmd = 'N';

    if (guest && !strchr("BFGHIJKLNOpPRsSTUwWyY/?#-", cit_cmd))
    {
      colorize("\n\n@RThe Guest user cannot do that.@G\n");
      continue;
    }

    if (curr == LOBBY_RM_NBR && strchr("DGNqsTU\027X\030Z% ", cit_cmd))
    {
      if (bueller++ >= 12)
        flush_input(bueller / 25);
      if (bueller >= 100)
      {
        colorize("@R\n\n\nGo away until you have something useful to do!\n\n\n@G");
        my_exit(10);
      }
    }
    else
      bueller = 0;

    if (strchr("AC\005eEHJpPQSvVx\030yYZ#-\"", cit_cmd))
      mybtmp->nox = 1;

    switch (cit_cmd)
    {

      case 'A':
	printf("Sysop commands (%s)\n", msg->room[curr].name);
	aide_menu();
	break;

      case 'R':
      case 'B':
	cit_cmd = 'R';
	printf("Read Reverse\n");
	readroom(cit_cmd);
	break;

      case 'C':
        printf("Change config\n");
        change_setup(NULL);
	break;

      case 'D':
	printf("Debug\n");
	debug();
	break;

      case '\005':
	if (ouruser->usernum == msg->room[curr].roomaide)
	{
	  printf("Enter Forum Moderator message\n\nAre you sure you want to enter a message as Forum Moderator? (Y/N) -> ");
	  if (!yesno(-1))
	    break;
	  sysopflags |= SYSOP_FROM_FM;
	}
	else if (ouruser->f_admin)
        {
	  printf("Enter Sysop message\n\nNOTE: You are entering this message as Sysop!\n\n");
	  sysopflags |= SYSOP_FROM_SYSOP;
        }
	/* FALL THRU */

      case 'e':
      case 'E':
	{
	  char work[20];

	  if (ouruser->f_newbie && (curr == MAIL_RM_NBR || curr > 4))
	    help("newuseraccess", NO);
	  else
	  {
	    if (cit_cmd == 'E')
	      printf("Upload message\n\n");
	    else if (cit_cmd == 'e')
	      printf("Enter message\n\n");
	    *work = 0;
	    (void)entermessage(curr, work, cit_cmd == 'e' ? 0 : 2);
	    sysopflags &= ~(SYSOP_FROM_SYSOP | SYSOP_FROM_FM);
	  }
	}
	break;

      case 'F':
	printf("Read Forward\n");
	readroom(cit_cmd);
	break;

      case 'G':
	printf("Goto ");
	updatels(&prev_rm);
	/* find next room with unread msgs and open it */
	nextroom();
	openroom();
	storeug(&uglastmsg, &ugtemp);
	break;

      case 'H':
	printf("Help!\n");
	help("topics", YES);
	break;

      case 'q':
      case 'Q':
        get_syself_help(cit_cmd);
        break;

      case 'I':
	printf("Forum Info\n");
	readdesc();
	break;

      case 'J':
	{
	  int old_rm;

	  printf("Jump to ");
	  old_rm = curr;
	  if (findroom() == YES)
	  {
	    int save_rm;
  
            mybtmp->nox = 0;
	    save_rm = curr;
	    curr = old_rm;
	    updatels(&prev_rm);
	    curr = save_rm;
	    openroom();
	    storeug(&uglastmsg, &ugtemp);
	  }
	}
	break;

      case 'K':
	printf("Known forums and zapped list\n");
	knrooms();
	break;

      case 'L':
        dologout();
	break;

      case 'N':
	if (ouruser->lastseen[curr] < room->num[MSGSPERRM - 1])
	{
	  printf("Read New\n");
	  readroom(cit_cmd);
	}
	else
	{			/* No new notes so just do a Goto now */
	  printf("Goto ");
	  updatels(&prev_rm);
	  /* find next room with unread msgs and open it */
	  nextroom();
	  openroom();
	  storeug(&uglastmsg, &ugtemp);
	}
	break;

      case 'O':
	printf("Read Old messages reverse\n");
	readroom(cit_cmd);
	break;

      case 'p':
      case 'P':
	profile_user(cit_cmd == 'P');
	break;

      case 's':		/* don't update lastseen, you're skipping the room */
	printf("Skip %s\n", msg->room[curr].name);
	skipping[curr >> 3] |= 1 << (curr & 7);
	/* after skipping a room, find the next unread room (not a goto) */
	nextroom();
	openroom();
	ugtemp = ouruser->lastseen[curr];
	break;

      case 'S':
	{
	  int old_rm;

	  printf("Skip %s to ", msg->room[curr].name);
	  old_rm = curr;
	  if (findroom() == YES)
	  {
            mybtmp->nox = 0;
	    skipping[old_rm >> 3] |= 1 << (old_rm & 7);
	    openroom();
	    ugtemp = ouruser->lastseen[curr];
	  }
	}
	break;

      case 'T':
	printdate("Time\n\n%s");
	break;

      case 'U':
	printf("Ungoto\n");
	ungoto(prev_rm, &uglastmsg, &ugtemp);
	break;

      case 'v':
	cit_cmd = 0;
	break;

      case 'V':
	printf("Validate new users\n");
	validate_users(1);
	break;

      case '\027':
	if (client)
	  clientwho();
	else
	  cit_cmd = 0;
	break;

      case 'w':		/* Short form of who's online */
	show_online(3);
	break;

      case 'W':		/* Who's online */
	show_online(0);
	break;

      case 'x':
	express();
	break;

      case 'X':
	change_express(1);
	break;

      case CTRL_X:
	old_express();
	break;

      case 'y':
      case 'Y':
        if (!wanttoyell(cit_cmd))
          break;
	(void)entermessage(-1, "", cit_cmd == 'y' ? 0 : 2);
	break;

      case 'Z':
	printf("Zap forum\n");
	if (forgetroom())
        {
	  nextroom();
	  openroom();
	  ugtemp = ouruser->lastseen[curr];
        }
	break;

      case '?':
      case '/':
	if (guest)
	  help("guestforumlevel", NO);
	else
	  help("doccmd", NO);
	break;

      case '#':
	readroom(cit_cmd);
	break;

      case '%':
	if (ouruser->f_elf && !ouruser->f_restricted && !ouruser->f_twit)
          if (mybtmp->xstat && !mybtmp->elf)
            printf("\n\nYou can't enable yourself as a guide while your X's are disabled.\n");
	  else if ((mybtmp->elf = !mybtmp->elf))
	    printf("\n\nYou are now marked as being available to help others.\n");
	  else
	    printf("\n\nYou are no longer marked as being available to help others.\n");
	else
	  cit_cmd = 0;
	break;

      case '-':
	readroom(cit_cmd);
	break;

      case '@':
	printf("Sysops, programmers, and forum moderators\n");
	more(AIDELIST, 0);
	break;

      case '"':
	{
	  char work[20];

	  printf("Quote X messages to Sysop\n");
          *work = 0;
          (void)entermessage(-1, work, -1);
	}
	break;

      default:
	break;
    }				/* switch */

  }