Annotation of sbbs/sbbs3/ctrl/webcfgdlgunit.cpp, revision 1.1.1.1

1.1       root        1: /* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */
                      2: 
                      3: /* $Id: WebCfgDlgUnit.cpp,v 1.1 2004/11/08 09:32:47 rswindell Exp $ */
                      4: 
                      5: /****************************************************************************
                      6:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      7:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                      8:  *                                                                                                                                                     *
                      9:  * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html         *
                     10:  *                                                                                                                                                     *
                     11:  * This program is free software; you can redistribute it and/or                       *
                     12:  * modify it under the terms of the GNU General Public License                         *
                     13:  * as published by the Free Software Foundation; either version 2                      *
                     14:  * of the License, or (at your option) any later version.                                      *
                     15:  * See the GNU General Public License for more details: gpl.txt or                     *
                     16:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     17:  *                                                                                                                                                     *
                     18:  * Anonymous FTP access to the most recent released source is available at     *
                     19:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     20:  *                                                                                                                                                     *
                     21:  * Anonymous CVS access to the development source and modification history     *
                     22:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     23:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     24:  *     (just hit return, no password is necessary)                                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     26:  *                                                                                                                                                     *
                     27:  * For Synchronet coding style and modification guidelines, see                                *
                     28:  * http://www.synchro.net/source.html                                                                          *
                     29:  *                                                                                                                                                     *
                     30:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     31:  * format) via e-mail to [email protected]                                                                      *
                     32:  *                                                                                                                                                     *
                     33:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     34:  ****************************************************************************/
                     35: 
                     36: //---------------------------------------------------------------------------
                     37: 
                     38: #include <vcl.h>
                     39: #pragma hdrstop
                     40: 
                     41: #include "MainFormUnit.h"
                     42: #include "WebCfgDlgUnit.h"
                     43: #include <stdio.h>                     // sprintf()
                     44: #include <mmsystem.h>          // sndPlaySound()
                     45: //---------------------------------------------------------------------------
                     46: #pragma package(smart_init)
                     47: #pragma resource "*.dfm"
                     48: TWebCfgDlg *WebCfgDlg;
                     49: //---------------------------------------------------------------------------
                     50: __fastcall TWebCfgDlg::TWebCfgDlg(TComponent* Owner)
                     51:     : TForm(Owner)
                     52: {
                     53: }
                     54: //---------------------------------------------------------------------------
                     55: void __fastcall TWebCfgDlg::FormShow(TObject *Sender)
                     56: {
                     57:     char str[128];
                     58: 
                     59:     if(MainForm->web_startup.interface_addr==0)
                     60:         NetworkInterfaceEdit->Text="<ANY>";
                     61:     else {
                     62:         sprintf(str,"%d.%d.%d.%d"
                     63:             ,(MainForm->web_startup.interface_addr>>24)&0xff
                     64:             ,(MainForm->web_startup.interface_addr>>16)&0xff
                     65:             ,(MainForm->web_startup.interface_addr>>8)&0xff
                     66:             ,MainForm->web_startup.interface_addr&0xff
                     67:         );
                     68:         NetworkInterfaceEdit->Text=AnsiString(str);
                     69:     }
                     70:     if(MainForm->web_startup.max_clients==0)
                     71:         MaxClientsEdit->Text="infinite";
                     72:     else
                     73:         MaxClientsEdit->Text=AnsiString((int)MainForm->web_startup.max_clients);
                     74:     MaxInactivityEdit->Text=AnsiString((int)MainForm->web_startup.max_inactivity);
                     75:        PortEdit->Text=AnsiString((int)MainForm->web_startup.port);
                     76:     AutoStartCheckBox->Checked=MainForm->WebAutoStart;
                     77: 
                     78:     HtmlRootEdit->Text=AnsiString(MainForm->web_startup.root_dir);
                     79:     ErrorSubDirEdit->Text=AnsiString(MainForm->web_startup.error_dir);
                     80:     EmbeddedJsExtEdit->Text=AnsiString(MainForm->web_startup.js_ext);
                     81:     ServerSideJsExtEdit->Text=AnsiString(MainForm->web_startup.ssjs_ext);
                     82: 
                     83:     AnswerSoundEdit->Text=AnsiString(MainForm->web_startup.answer_sound);
                     84:     HangupSoundEdit->Text=AnsiString(MainForm->web_startup.hangup_sound);
                     85:     HackAttemptSoundEdit->Text=AnsiString(MainForm->web_startup.hack_sound);
                     86: 
                     87:        DebugTxCheckBox->Checked=MainForm->web_startup.options&WEB_OPT_DEBUG_TX;
                     88:        DebugRxCheckBox->Checked=MainForm->web_startup.options&WEB_OPT_DEBUG_RX;
                     89:     AccessLogCheckBox->Checked=MainForm->web_startup.options&WEB_OPT_HTTP_LOGGING;
                     90:     AccessLogCheckBoxClick(Sender);
                     91: 
                     92:     VirtualHostsCheckBox->Checked=MainForm->web_startup.options&WEB_OPT_VIRTUAL_HOSTS;
                     93: 
                     94:     HostnameCheckBox->Checked
                     95:         =!(MainForm->web_startup.options&BBS_OPT_NO_HOST_LOOKUP);
                     96: 
                     97:     PageControl->ActivePage=GeneralTabSheet;
                     98: }
                     99: //---------------------------------------------------------------------------
                    100: void __fastcall TWebCfgDlg::OKBtnClick(TObject *Sender)
                    101: {
                    102:     char    str[128],*p;
                    103:     DWORD   addr;
                    104: 
                    105:     SAFECOPY(str,NetworkInterfaceEdit->Text.c_str());
                    106:     p=str;
                    107:     while(*p && *p<=' ') p++;
                    108:     if(*p && isdigit(*p)) {
                    109:         addr=atoi(p)<<24;
                    110:         while(*p && *p!='.') p++;
                    111:         if(*p=='.') p++;
                    112:         addr|=atoi(p)<<16;
                    113:         while(*p && *p!='.') p++;
                    114:         if(*p=='.') p++;
                    115:         addr|=atoi(p)<<8;
                    116:         while(*p && *p!='.') p++;
                    117:         if(*p=='.') p++;
                    118:         addr|=atoi(p);
                    119:         MainForm->web_startup.interface_addr=addr;
                    120:     } else
                    121:         MainForm->web_startup.interface_addr=0;
                    122:     MainForm->web_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10);
                    123:     MainForm->web_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(300);
                    124:     MainForm->web_startup.port=PortEdit->Text.ToIntDef(23);
                    125:     MainForm->WebAutoStart=AutoStartCheckBox->Checked;
                    126: 
                    127:     SAFECOPY(MainForm->web_startup.root_dir
                    128:         ,HtmlRootEdit->Text.c_str());
                    129:     SAFECOPY(MainForm->web_startup.error_dir
                    130:         ,ErrorSubDirEdit->Text.c_str());
                    131:     SAFECOPY(MainForm->web_startup.js_ext
                    132:         ,EmbeddedJsExtEdit->Text.c_str());
                    133:     SAFECOPY(MainForm->web_startup.ssjs_ext
                    134:         ,ServerSideJsExtEdit->Text.c_str());
                    135: 
                    136:     SAFECOPY(MainForm->web_startup.answer_sound
                    137:         ,AnswerSoundEdit->Text.c_str());
                    138:     SAFECOPY(MainForm->web_startup.hangup_sound
                    139:         ,HangupSoundEdit->Text.c_str());
                    140:     SAFECOPY(MainForm->web_startup.hack_sound
                    141:         ,HackAttemptSoundEdit->Text.c_str());
                    142: 
                    143:        if(DebugTxCheckBox->Checked==true)
                    144:        MainForm->web_startup.options|=WEB_OPT_DEBUG_TX;
                    145:     else
                    146:            MainForm->web_startup.options&=~WEB_OPT_DEBUG_TX;
                    147:        if(DebugRxCheckBox->Checked==true)
                    148:        MainForm->web_startup.options|=WEB_OPT_DEBUG_RX;
                    149:     else
                    150:            MainForm->web_startup.options&=~WEB_OPT_DEBUG_RX;
                    151:        if(AccessLogCheckBox->Checked==true)
                    152:        MainForm->web_startup.options|=WEB_OPT_HTTP_LOGGING;
                    153:     else
                    154:            MainForm->web_startup.options&=~WEB_OPT_HTTP_LOGGING;
                    155:        if(HostnameCheckBox->Checked==false)
                    156:        MainForm->web_startup.options|=BBS_OPT_NO_HOST_LOOKUP;
                    157:     else
                    158:            MainForm->web_startup.options&=~BBS_OPT_NO_HOST_LOOKUP;
                    159:        if(VirtualHostsCheckBox->Checked==true)
                    160:        MainForm->web_startup.options|=WEB_OPT_VIRTUAL_HOSTS;
                    161:     else
                    162:            MainForm->web_startup.options&=~WEB_OPT_VIRTUAL_HOSTS;
                    163: 
                    164:     MainForm->SaveSettings(Sender);
                    165: }
                    166: //---------------------------------------------------------------------------
                    167: void __fastcall TWebCfgDlg::AnswerSoundButtonClick(TObject *Sender)
                    168: {
                    169:        OpenDialog->FileName=AnswerSoundEdit->Text;
                    170:        if(OpenDialog->Execute()==true) {
                    171:        AnswerSoundEdit->Text=OpenDialog->FileName;
                    172:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                    173:     }
                    174: }
                    175: //---------------------------------------------------------------------------
                    176: void __fastcall TWebCfgDlg::HangupSoundButtonClick(TObject *Sender)
                    177: {
                    178:        OpenDialog->FileName=HangupSoundEdit->Text;
                    179:        if(OpenDialog->Execute()==true) {
                    180:        HangupSoundEdit->Text=OpenDialog->FileName;
                    181:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                    182:        }
                    183: }
                    184: //---------------------------------------------------------------------------
                    185: void __fastcall TWebCfgDlg::HackAttemptSoundButtonClick(TObject *Sender)
                    186: {
                    187:        OpenDialog->FileName=HackAttemptSoundEdit->Text;
                    188:        if(OpenDialog->Execute()==true) {
                    189:        HackAttemptSoundEdit->Text=OpenDialog->FileName;
                    190:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                    191:        }
                    192: }
                    193: //---------------------------------------------------------------------------
                    194: 
                    195: void __fastcall TWebCfgDlg::AccessLogCheckBoxClick(TObject *Sender)
                    196: {
                    197:     LogBaseLabel->Enabled=AccessLogCheckBox->Checked;
                    198:     LogBaseNameEdit->Enabled=AccessLogCheckBox->Checked;
                    199: }
                    200: //---------------------------------------------------------------------------
                    201: 

unix.superglobalmegacorp.com

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