Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

ODPCB.c 7.23 KB
Newer Older
rswindell's avatar
rswindell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* OpenDoors Online Software Programming Toolkit
 * (C) Copyright 1991 - 1999 by Brian Pirie.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
Deucе's avatar
Deucе committed
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
rswindell's avatar
rswindell committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
 *
 *
 *        File: ODPCB.c
 *
 * Description: Implements the PC-Board personality.
 *
 *   Revisions: Date          Ver   Who  Change
 *              ---------------------------------------------------------------
 *              Oct 13, 1994  6.00  BP   New file header format.
 *              Dec 09, 1994  6.00  BP   Standardized coding style.
 *              Nov 11, 1995  6.00  BP   Removed register keyword.
 *              Nov 14, 1995  6.00  BP   Added include of odscrn.h.
 *              Nov 14, 1995  6.00  BP   32-bit portability.
 *              Nov 16, 1995  6.00  BP   Removed oddoor.h, added odcore.h.
 *              Dec 22, 1995  6.00  BP   Added od_connect_speed.
 *              Dec 30, 1995  6.00  BP   Added ODCALL for calling convention.
 *              Jan 03, 1996  6.00  BP   Display connect speed with %lu.
 *              Feb 19, 1996  6.00  BP   Changed version number to 6.00.
 *              Mar 03, 1996  6.10  BP   Begin version 6.10.
36
 *              Aug 10, 2003  6.23  SH   *nix support
rswindell's avatar
rswindell committed
37 38 39 40 41 42 43 44 45
 */

#define BUILDING_OPENDOORS

#include <string.h>
#include <stdio.h>
#include <time.h>

#include "OpenDoor.h"
46
#include "ODStr.h"
rswindell's avatar
rswindell committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
#include "ODCore.h"
#include "ODGen.h"
#include "ODScrn.h"
#include "ODKrnl.h"
#include "ODUtil.h"
#include "ODStat.h"


/* ----------------------------------------------------------------------------
 * pdef_pcboard()
 *
 * Personality function for the PC-Board like status line / function key
 * personality.
 *
 * Parameters: btOperation - Indicates personality operation to be performed.
 *
 *     Return: void
 */
ODAPIDEF void ODCALL pdef_pcboard(BYTE btOperation)
{
   static char szTemp[81];
   BYTE btInfoType = od_control.od_info_type;


   switch(btOperation)
   {
      case PEROP_DISPLAY1:
         ODScrnSetAttribute(0x70);
         ODScrnSetCursorPos(1, 24);
         ODScrnDisplayString("                                                      ALT-H=Help                                                                                                ");
         ODScrnSetCursorPos(3, 24);
         if(od_control.baud != 0)
         {
            ODScrnPrintf("(%lu) ", od_control.od_connect_speed);
         }
         else
         {
            ODScrnDisplayString("(Local) ");
         }
         sprintf(szTemp, "%s - %s", od_control.user_name,
            od_control.user_location);
         szTemp[42] = '\0';
         strupr(szTemp);
         ODScrnDisplayString(szTemp);
         ODScrnSetCursorPos(1,25);
         if(od_control.user_ansi || od_control.user_avatar
            || od_control.user_rip)
         {
            ODScrnDisplayChar('G');
         }
         else
         {
            ODScrnDisplayChar('A');
         }
         if(btInfoType == RA1EXITINFO || btInfoType == RA2EXITINFO
            || btInfoType == DOORSYS_WILDCAT)
         {
            ODScrnPrintf(" (%s)",od_control.user_firstcall);
         }
         ODScrnSetCursorPos(15, 25);
         ODScrnPrintf("Sec(0)=%u  ",od_control.user_security);
         if(od_control.od_extended_info || btInfoType == DOORSYS_GAP
            || btInfoType == CHAINTXT || btInfoType == DOORSYS_WILDCAT)
         {
            ODScrnPrintf("Times On=%u  ", od_control.user_numcalls);
         }
         if(od_control.od_extended_info || btInfoType == SFDOORSDAT
            || btInfoType == DOORSYS_GAP || btInfoType == DOORSYS_WILDCAT)
         {
            ODScrnPrintf("Up:Dn=%lu:%lu", od_control.user_uploads,
               od_control.user_downloads);
         }
         ODScrnSetCursorPos(70, 25);
         ODScrnPrintf("%4d", od_control.user_timelimit);

         od_control.key_status[0] = 0x0000;
         od_control.key_status[1] = 0x2300;
         break;

      case PEROP_DISPLAY2:
         ODScrnSetAttribute(0x70);
         ODScrnSetCursorPos(1, 24);
         ODScrnDisplayString("  Alt-> N=Next X=DOS F1/F2=Time                                                   2=LkOut 5=SHELL 8=HngUp 10=Chat                                               ");

         od_control.key_status[0] = 0x2300;
         od_control.key_status[1] = 0x0000;
         break;

      case PEROP_UPDATE1:
         ODScrnSetAttribute(0x70);
         ODScrnSetCursorPos(70, 25);
         ODScrnPrintf("%4d", od_control.user_timelimit);
         break;

      case PEROP_INITIALIZE:
         od_control.key_hangup = 0x4200;
         od_control.key_drop2bbs = 0x2d00;
         od_control.key_dosshell = 0x3f00;
         od_control.key_chat = 0x4400;
         od_control.key_sysopnext = 0x3100;
         od_control.key_lockout = 0x3c00;
         od_control.key_status[0] = 0x0000;
         od_control.key_status[1] = 0x2300;
         od_control.key_status[2] = 0x0000;
         od_control.key_status[3] = 0x0000;
         od_control.key_status[4] = 0x0000;
         od_control.key_status[5] = 0x0000;
         od_control.key_status[6] = 0x0000;
         od_control.key_status[7] = 0x0000;
         od_control.key_status[8] = 0x0000;
         od_control.key_keyboardoff = 0x2500;
         od_control.key_moretime = 0x0000;
         od_control.key_lesstime = 0x0000;
         ODStatAddKey(0x6900);
         ODStatAddKey(0x6800);
         od_control.od_page_statusline = 0;
         break;

      case PEROP_CUSTOMKEY:
         switch(od_control.od_last_hot)
         {
            /* Key to add five minutes. */
            case 0x6900:
               if(od_control.user_timelimit <= 1435 &&
                  od_control.user_timelimit >= 5)
               {
                  od_control.user_timelimit += 5;
                  bForceStatusUpdate = TRUE;
                  CALL_KERNEL_IF_NEEDED();
               }
               else if(od_control.user_timelimit < 5)
               {
                  od_control.user_timelimit++;
                  bForceStatusUpdate = TRUE;
                  CALL_KERNEL_IF_NEEDED();
               }
               break;

            /* Subtract five minutes from the user's remaining time. */
            case 0x6800:
               if(od_control.user_timelimit > 5)
               {
                  od_control.user_timelimit -= 5;
                  bForceStatusUpdate = TRUE;
                  CALL_KERNEL_IF_NEEDED();
               }
               else if(od_control.user_timelimit > 1)
               {
                  --od_control.user_timelimit;
                  bForceStatusUpdate = TRUE;
                  CALL_KERNEL_IF_NEEDED();
               }
               break;

            default:
               return;
         }
         od_control.od_last_hot = 0;
         break;
   }
}