/*
    Pirate Bulletin Board System
    Copyright (C) 1990, Edward Luke

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


    Email address:
    lush@Athena.EE.MsState.EDU
*/
#include "bbs.h"

#define HIGHLIGHT 1
#define LOWLIGHT  0

struct help_info {
    int x,y ;
    int highlight ;
    int level ;
    char *text ;
} ;

struct help_info MainHelp[]  = {
     4,  0, HIGHLIGHT,   0, "HELP SCREEN\n",
    -1, -1, HIGHLIGHT,   0, "(I)nfo          Get Version and Copyright Information\n",
    -1, -1,  LOWLIGHT,  10, "(C)reate        Create a new board\n",
    -1, -1,  LOWLIGHT,   0, "(B)oards        List boards on system\n",
    -1, -1,  LOWLIGHT,   0, "(S)elect        Select current board\n",
    -1, -1,  LOWLIGHT,   0, "(R)ead          Enter multifunction Read Menu\n",
    -1, -1,  LOWLIGHT,   0, "(N)ew           Read all new messages\n",
    -1, -1,  LOWLIGHT,   0, "(V)isit         Make all messages current\n",
    -1, -1,  LOWLIGHT,   0, "(Z)ap           Zap boards from (N)ew search\n",
    -1, -1,  LOWLIGHT,   0, "(P)ost          Post a message on current board\n",
    -1, -1,  LOWLIGHT,   0, "(U)sers         List ALL users of this BBS\n",
    -1, -1,  LOWLIGHT,   0, "(T)alk          Enter Talk  Menu\n",
    -1, -1,  LOWLIGHT,   0, "(M)ail          Enter Mail Menu\n",
    -1, -1,  LOWLIGHT,   0, "(F)iles         Enter File Transfer Menu\n",
    -1, -1,  LOWLIGHT,   0, "(X)yz           Misc. utilities (Change passwd, and term type\n",
    -1, -1,  LOWLIGHT, 255, "(A)dmin         Enter Admin Menu\n",
    -1, -1,  LOWLIGHT,   0, "(G)oodbye       Leave This BBS\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL,
  } ;

struct help_info MailHelp[] = {
     4,  0, HIGHLIGHT,   0, "Mail Menu Help Screen\n",
    -1, -1,  LOWLIGHT,   0, "(N)ew           See New Mail Messages\n",
    -1, -1,  LOWLIGHT,   0, "(S)end          Send a Mail Message to another user\n",
    -1, -1,  LOWLIGHT,   0, "(R)ead          Enter Multi purpose Read Menu\n",
    -1, -1,  LOWLIGHT,   0, "(E)xit          EXIT Mail Menu\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info FileHelp[] = {
     4,  0, HIGHLIGHT,   0, "File Transfer Menu Help Screen\n",
    -1, -1,  LOWLIGHT,   0, "(S)elect        Select a File Sub-board\n",
    -1, -1,  LOWLIGHT,   0, "(L)ist          List the files on current Sub-board\n",
    -1, -1,  LOWLIGHT,   0, "(P)rotocol      Select download/upload protocol\n",
    -1, -1,  LOWLIGHT,   0, "(D)ownload      Download a file from this bbs\n",
    -1, -1,  LOWLIGHT,   0, "(U)pload        Upload a file to this bbs\n",
    -1, -1,  LOWLIGHT,   0, "(T)ext          View a text file\n",
    -1, -1,  LOWLIGHT,   0, "(E)xit          EXIT File Menu\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info XyzHelp[] = {
     4,  0, HIGHLIGHT,   0, "XYZ Menu Help Screen\n",
    -1, -1, HIGHLIGHT,   0, "(G)NU GENERAL PUBLIC LICENSE\n",
    -1, -1,  LOWLIGHT,  10, "(C)loak         Hide from other users\n",
    -1, -1,  LOWLIGHT,   0, "(P)asswd        Set User Passwd\n",
    -1, -1,  LOWLIGHT,   0, "(N)ame          Set User Name\n",
    -1, -1,  LOWLIGHT,   0, "(T)erminal      Set Terminal Type\n",
    -1, -1,  LOWLIGHT,   0, "(E)xit          EXIT XYZ Menu\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info TalkHelp[] = {
     4,  0, HIGHLIGHT,   0, "Talk Menu Help Screen\n",
    -1, -1,  LOWLIGHT,   0, "(U)sers         List Users CURRENTLY online\n",
    -1, -1,  LOWLIGHT,   0, "(T)alk          Talk to another user\n",
    -1, -1,  LOWLIGHT,   0, "(C)hat          Enter Chat Mode\n",
    -1, -1,  LOWLIGHT,   0, "(I)RC           IRC chat link with QuartzBBS\n",
    -1, -1,  LOWLIGHT,   0, "(E)xit          EXIT Talk Menu\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info AdminHelp[] = {
     4,  0, HIGHLIGHT,   0, "Admin Menu Help Screen\n",
    -1, -1,  LOWLIGHT, 255, "(U)ser Clean    Clean all accounts inactive over 30 days\n",
    -1, -1,  LOWLIGHT, 255, "(L)evel         Change User Level\n",
    -1, -1,  LOWLIGHT, 255, "(S)hell         Get Unix Shell\n",
    -1, -1,  LOWLIGHT, 255, "(I)nfo          Get and change user info\n",
    -1, -1,  LOWLIGHT, 255, "(D)elete User   Delete a user\n",
    -1, -1,  LOWLIGHT, 255, "(B)oard Delete  Delete a board\n",
    -1, -1,  LOWLIGHT,   0, "(E)xit          EXIT Admin Menu\n",
    -1, -1,  LOWLIGHT,   0, "(H)elp          Get this Help Screen\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info MainRead[] = {
     0,  0, HIGHLIGHT,   0, "Main Read Menu Help Screen\n",
     2,  0, HIGHLIGHT,   0, "Movement Commands\n",
    -1, -1,  LOWLIGHT,   0, "p            Previous Message\n",
    -1, -1,  LOWLIGHT,   0, "n            Next Message\n",
    -1, -1,  LOWLIGHT,   0, "P            Previous Page\n",
    -1, -1,  LOWLIGHT,   0, "N            Next Page\n",
    -1, -1,  LOWLIGHT,   0, "## <cr>      Goto Message ##\n",
    -1, -1,  LOWLIGHT,   0, "$            Goto Last Message\n",
    -1, -1,  LOWLIGHT,   0, "\n",
    -1, -1, HIGHLIGHT,   0, "Miscellanious Commands\n",
    -1, -1,  LOWLIGHT,   0, "r            Read a Message\n",
    -1, -1,  LOWLIGHT,   0, "CTRL-P       Post a Message\n",
    -1, -1,  LOWLIGHT,   0, "d            Delete Current Message if owned\n",
    -1, -1,  LOWLIGHT, 255, "E            Edit Current Post\n",
    -1, -1,  LOWLIGHT,   0, "s            Select a New Board\n",
    -1, -1,  LOWLIGHT,   0, "S            Sequentially read unread messages starting at cursor\n",
    -1, -1,  LOWLIGHT,   0, "CTRL-L       Redraw Screen\n",
    -1, -1,  LOWLIGHT,   0, "h            This Help Screen\n",
    -1, -1,  LOWLIGHT,   0, "\n",
    -1, -1, HIGHLIGHT,   0, "e            EXIT Read Menu\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;

struct help_info MailRead[] = {
     0,  0, HIGHLIGHT,   0, "Mail Read Menu Help Screen\n",
     2,  0, HIGHLIGHT,   0, "Movement Commands\n",
    -1, -1,  LOWLIGHT,   0, "p            Previous Message\n",
    -1, -1,  LOWLIGHT,   0, "n            Next Message\n",
    -1, -1,  LOWLIGHT,   0, "P            Previous Page\n",
    -1, -1,  LOWLIGHT,   0, "N            Next Page\n",
    -1, -1,  LOWLIGHT,   0, "## <cr>      Goto Message ##\n",
    -1, -1,  LOWLIGHT,   0, "$            Goto Last Message\n",
    -1, -1,  LOWLIGHT,   0, "\n",
    -1, -1, HIGHLIGHT,   0, "Miscellanious Commands\n",
    -1, -1,  LOWLIGHT,   0, "r            Read a Message\n",
    -1, -1,  LOWLIGHT,   0, "R            Reply to Sender\n",
    -1, -1,  LOWLIGHT,   0, "d            Delete Current Message\n",
    -1, -1,  LOWLIGHT,   0, "CTRL-L       Redraw Screen\n",
    -1, -1,  LOWLIGHT,   0, "h            This Help Screen\n",
    -1, -1,  LOWLIGHT,   0, "\n",
    -1, -1, HIGHLIGHT,   0, "e            EXIT Read Menu\n",
    -1, -1,  LOWLIGHT,   0, NULL
  } ;


do_the_help(p)
struct help_info *p ;
{
    while(p->text) {
        if(p->highlight)
          standout() ;
        if(p->x != -1)
          move(p->x, p->y) ;
        if(currentuser.userlevel >= p->level)
          prints("%s",p->text) ;
        if(p->highlight)
          standend() ;
        p++ ;
    }
    return ;
}


Help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(MainHelp) ;
    clrtobot() ;
}

m_help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(MailHelp) ;
    clrtobot() ;
}

f_help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(FileHelp) ;
    clrtobot() ;
}

x_help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(XyzHelp) ;
    clrtobot() ;
}

t_help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(TalkHelp) ;
    clrtobot() ;
}

a_help()
{
    move(3,0) ;
    clrtoeol() ;
    do_the_help(AdminHelp) ;
    clrtobot() ;
}

mainreadhelp()
{
    clear() ;
    do_the_help(MainRead) ;
    pressreturn() ;
    clear() ;
    return FULLUPDATE ;
}

mailreadhelp()
{
    clear() ;
    do_the_help(MailRead) ;
    pressreturn() ;
    clear() ;
    return FULLUPDATE ;
}
