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

screens.c 7.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/******************************************************************************
SCREENS.C    Large displays and screen showing functions.

    Copyright 1993 - 2000 Paul J. Sidorsky

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    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
Deucе's avatar
Deucе committed
17
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

This module contains functions to display external screens.  It also contains
many of TOP's large displays, such as the opening and closing credits.
******************************************************************************/

#include "top.h"

/* This macro should be defined during testing, when an internal revision
   number is needed in addition to the program version. */
#define USE_REVISION

/* show_file() - Displays an external screen file.
   Parameters:  name - Base file name to display, with optional pass.
                tasks - Functions to perform (SCRN_ task bits).
   Returns:  Nothing.
   Notes:  The name parameter can contain an extension, but for normal
           external files (eg. those stored in the TOP ANSI Path) it should
           not contain one, which tells the door kit to determine the
           proper extension based on terminal type.
*/
void show_file(char *name, unsigned char tasks)
{

/* Reset attribute before displaying. */
if (tasks & SCRN_RESETCOL)
    {
    od_set_colour(D_GREY, D_BLACK);
    }
/* Clear screen before displaying. */
if (tasks & SCRN_CLS)
    {
    od_clr_scr();
    }

/* Display the file. */
top_output(OUT_SCREEN, getlang("ShowFilePrefix"));
sprintf(outbuf, "%s%s", cfg.topansipath, name);
od_send_file(outbuf);
top_output(OUT_SCREEN, getlang("ShowFileSuffix"));

/* Wait for keypress after displaying. */
if (tasks & SCRN_WAITKEY)
    {
    top_output(OUT_SCREEN, getlang("PressAnyKey"));
    od_get_key(TRUE);
    top_output(OUT_SCREEN, getlang("PressAnyKeySuffix"));
    }

return;
}

/* minihelp() - Shows command listing.
   Parameters:  None.
   Returns:  Nothing.
*/
void minihelp(void)
{

/* The command listing used to be hard coded, which is why this display has
   its own function.  Now, however, an external file is used. */

top_output(OUT_SCREEN, getlang("CommandListPrefix"));
show_file("minihelp", SCRN_NONE);

}

/* welcomescreen() - Show TOP opening credits.
   Parameters:  None.
   Returns:  Nothing.
*/
void welcomescreen(void)
{

if (cfg.showopeningcred)
    {
    /* Long form. */

    top_output(OUT_SCREEN, "^o@cWelcome to The Online Pub for ");
#if defined(PLATFORM_DESC)
    top_output(OUT_SCREEN, PLATFORM_DESC);
#elif defined(__OS2__)
    top_output(OUT_SCREEN, "OS/2");
#elif defined(__WIN32__)
    top_output(OUT_SCREEN, "Windows 95");
#elif defined(__unix__)
    top_output(OUT_SCREEN, "*nix");
#else
    top_output(OUT_SCREEN, "DOS");
#endif
    top_output(OUT_SCREEN, "^l v@1^o, by ^lPaul Sidorsky^o.@c", ver);
#ifdef USE_REVISION
    top_output(OUT_SCREEN, "^oInternal revision #^l@1^o.@c", rev);
#endif
    top_output(OUT_SCREEN, "Copyright 1993 - 1998 ");
    top_output(OUT_SCREEN, "^lISMWare(TM)^o, All Rights Reserved.@c");
    top_output(OUT_SCREEN, "^oWritten using ^l");
#ifdef __OS2__
    top_output(OUT_SCREEN, "Doors/2 v5.00b3");
#else
    top_output(OUT_SCREEN, "OpenDoors v6.00");
#endif
    top_output(OUT_SCREEN, "^o by ^l");
#ifdef __OS2__
    top_output(OUT_SCREEN, "Joel Downer & Brian Pirie");
#else
    top_output(OUT_SCREEN, "Brian Pirie");
#endif
    top_output(OUT_SCREEN, "^o.@c");
    top_output(OUT_SCREEN, getlang("BroughtToYouBy"), cfg.sysopname,
               cfg.bbsname);
    itoa(od_control.od_node, outnum[0], 10);
    top_output(OUT_SCREEN, getlang("LoggedOnNode"), outnum[0]);
    }
else
    {
    /* Short form. */

    top_output(OUT_SCREEN, "@c^oThe Online Pub for ");
#if defined(PLATFORM_DESC)
    top_output(OUT_SCREEN, PLATFORM_DESC);
#elif defined(__OS2__)
    top_output(OUT_SCREEN, "OS/2");
#elif defined(__WIN32__)
    top_output(OUT_SCREEN, "Windows 95");
#elif defined(__unix__)
    top_output(OUT_SCREEN, "*nix");
#else
    top_output(OUT_SCREEN, "DOS");
#endif
    top_output(OUT_SCREEN, " v@1@cCopyright 1993 - 1998 Paul Sidorsky, "
               "All Rights Reserved.@c", ver);
#ifdef USE_REVISION
    top_output(OUT_SCREEN, "^oInternal revision #^l@1^o.@c", rev);
#endif
    }

return;
}

/* newuserscreen() - Shows information screen to new TOP users.
   Parameters:  None.
   Return:  Nothing.
*/
void newuserscreen(void)
{

/* The new user screen used to be hard coded, which is why this display has
   its own function.  Now, however, an external file is used. */

show_file("newuser", SCRN_NONE);

return;
}

/* quit_top_screen() - Show TOP closing credits.
   Parameters:  None
   Returns:  Nothing.
*/
void quit_top_screen(void)
{

/* Nothing is shown if the sysop has closing credits turned off, to provide
   a more seamless appearance. */
if (!cfg.showclosingcred)
    {
    return;
    }

top_output(OUT_SCREEN, "@c@c^kThe Online Pub for ");
#if defined(PLATFORM_DESC)
    top_output(OUT_SCREEN, PLATFORM_DESC);
#elif defined(__OS2__)
    top_output(OUT_SCREEN, "OS/2");
#elif defined(__WIN32__)
    top_output(OUT_SCREEN, "Windows 95");
#elif defined(__unix__)
    top_output(OUT_SCREEN, "*nix");
#else
    top_output(OUT_SCREEN, "DOS");
#endif
sprintf(outbuf, " v%s@c", ver);
top_output(OUT_SCREEN, outbuf);
top_output(OUT_SCREEN, "Copyright 1993 - 1998 ISMWare(TM)@c@c");
top_output(OUT_SCREEN, getlang("Goodbye"));
top_output(OUT_SCREEN, getlang("ReturnToBBS"), cfg.bbsname);

return;
}

/* channelsummary() - Show who's in a channel and a quick help note.
   Parameters:  None.
   Returns:  Nothing.
   Notes:  This is the display used whenever a user first enters a new
           channel or when a user presses ENTER without typing any text.
*/
void channelsummary(void)
{
long xchan; /* No longer used. */
char chtyp, yestop = 0; /* Channel type reference, flag if there is a topic. */

top_output(OUT_SCREEN, getlang("ChanSummaryPrefix"));

/* Determine the channel type.  The type numbers are internal to this
   function only. */
/* Normal channel. */
if (curchannel < 4000000000UL)
    {
    chtyp = 0;
    }
/* Personal channel. */
if (curchannel >= 4000000000UL && curchannel < 4001000000UL)
    {
    chtyp = 1;
    }
/* Conference. */
if (curchannel > 4000999999UL)
    {
    chtyp = 2;
    }

/* Set a flag if there is a topic defined for this channel. */
if (cmibuf.topic[0] != 0)
    {
    yestop = 1;
    }

/* Tell the user where he/she is. */
switch (chtyp)
    {
    case 0: strcpy(outbuf, "YoureInChannel"); break;
    case 1: strcpy(outbuf, "YoureInUserChannel"); break;
    case 2: strcpy(outbuf, "YoureInConference"); break;
    }
top_output(OUT_SCREEN, getlang(outbuf), channelname(curchannel));

/* Show topic, if one exists. */
if (yestop)
    {
    switch (chtyp)
        {
        case 0: strcpy(outbuf, "ChannelTopic"); break;
        case 1: strcpy(outbuf, "UserChannelTopic"); break;
        case 2: strcpy(outbuf, "ConferenceTopic"); break;
        }
    top_output(OUT_SCREEN, getlang(outbuf), cmibuf.topic);
    }

/* Show who's in the channel. */
whos_in_pub();

/* Show a quick message on how to get help. */
top_output(OUT_SCREEN, getlang("ShortHelp"));

top_output(OUT_SCREEN, getlang("OpeningSuffix"));

}