Annotation of sbbs/src/sbbs3/chat/chat.cpp, revision 1.1

1.1     ! root        1: /* chat.cpp */
        !             2: 
        !             3: /* Local sysop chat module (GUI Borland C++ Builder Project for Win32) */
        !             4: 
        !             5: /* $Id: chat.cpp,v 1.3 2003/05/16 08:26:17 rswindell Exp $ */
        !             6: 
        !             7: /****************************************************************************
        !             8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
        !             9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
        !            10:  *                                                                                                                                                     *
        !            11:  * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html         *
        !            12:  *                                                                                                                                                     *
        !            13:  * This program is free software; you can redistribute it and/or                       *
        !            14:  * modify it under the terms of the GNU General Public License                         *
        !            15:  * as published by the Free Software Foundation; either version 2                      *
        !            16:  * of the License, or (at your option) any later version.                                      *
        !            17:  * See the GNU General Public License for more details: gpl.txt or                     *
        !            18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
        !            19:  *                                                                                                                                                     *
        !            20:  * Anonymous FTP access to the most recent released source is available at     *
        !            21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
        !            22:  *                                                                                                                                                     *
        !            23:  * Anonymous CVS access to the development source and modification history     *
        !            24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
        !            25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
        !            26:  *     (just hit return, no password is necessary)                                                     *
        !            27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
        !            28:  *                                                                                                                                                     *
        !            29:  * For Synchronet coding style and modification guidelines, see                                *
        !            30:  * http://www.synchro.net/source.html                                                                          *
        !            31:  *                                                                                                                                                     *
        !            32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
        !            33:  * format) via e-mail to [email protected]                                                                      *
        !            34:  *                                                                                                                                                     *
        !            35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
        !            36:  ****************************************************************************/
        !            37: 
        !            38: //---------------------------------------------------------------------------
        !            39: 
        !            40: #include <vcl.h>
        !            41: #include <stdio.h>      // sprintf
        !            42: #pragma hdrstop
        !            43: USERES("chat.res");
        !            44: USEFORM("MainFormUnit.cpp", MainForm);
        !            45: int     node_num=0;
        !            46: char    node_number[32]="";
        !            47: char    ctrl_dir[MAX_PATH+1]="";
        !            48: char    node_dir[MAX_PATH+1]="";
        !            49: char    user_name[128]="";
        !            50: //---------------------------------------------------------------------------
        !            51: WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR cmdline, int)
        !            52: {
        !            53:     char*   p;
        !            54:     char*   argv=NULL;
        !            55:     char    str[256];
        !            56:     int     argc=0;
        !            57:     int     len=0;
        !            58: 
        !            59:     wsprintf(str,"CHAT: %s\r\n",cmdline);
        !            60:     OutputDebugString(str);
        !            61: 
        !            62:     for(p=cmdline;*p;p++) {
        !            63:         switch(argc) {
        !            64:             case 0:
        !            65:                 argv=ctrl_dir;
        !            66:                 break;
        !            67:             case 1:
        !            68:                 argv=node_dir;
        !            69:                 break;
        !            70:             case 2:
        !            71:                 argv=node_number;
        !            72:                 break;
        !            73:             default:
        !            74:                 argv=user_name;
        !            75:                 break;
        !            76:         }
        !            77:         if(*p==' ' && argc<3) {
        !            78:             argv[len]=0;
        !            79:             argc++;
        !            80:             len=0;
        !            81:             continue;
        !            82:         }
        !            83:         argv[len++]=*p;
        !            84:     }
        !            85:     if(argv!=NULL)
        !            86:         argv[len]=0;
        !            87: 
        !            88:     if(!user_name[0]) {
        !            89:         char errmsg[512];
        !            90:         sprintf(errmsg,"Invalid command-line: '%s'",cmdline);
        !            91:        Application->MessageBox(errmsg
        !            92:             ,"Synchronet Chat",MB_OK|MB_ICONEXCLAMATION);
        !            93:         return 0;
        !            94:     }
        !            95: 
        !            96:     node_num=(atoi(node_number));
        !            97: 
        !            98:     try
        !            99:     {
        !           100:          Application->Initialize();
        !           101:          Application->Title = "Synchronet Sysop Chat";
        !           102:                Application->CreateForm(__classid(TMainForm), &MainForm);
        !           103:          Application->Run();
        !           104:     }
        !           105:     catch (Exception &exception)
        !           106:     {
        !           107:          Application->ShowException(&exception);
        !           108:     }
        !           109:     return 0;
        !           110: }
        !           111: //---------------------------------------------------------------------------

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.