Annotation of sbbs/src/sbbs3/ctrl/mailcfgdlgunit.cpp, revision 1.1.1.2

1.1       root        1: /* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */
                      2: 
1.1.1.2 ! root        3: /* $Id: MailCfgDlgUnit.cpp,v 1.26 2009/08/14 08:58:15 rswindell Exp $ */
1.1       root        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:  *                                                                                                                                                     *
1.1.1.2 ! root        9:  * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html         *
1.1       root       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: #include <vcl.h>
                     38: #pragma hdrstop
                     39: 
                     40: #include "MainFormUnit.h"
                     41: #include "MailCfgDlgUnit.h"
                     42: #include "TextFileEditUnit.h"
                     43: #include <stdio.h>                     // sprintf()
                     44: #include <mmsystem.h>          // sndPlaySound()
                     45: //---------------------------------------------------------------------
                     46: #pragma resource "*.dfm"
                     47: TMailCfgDlg *MailCfgDlg;
                     48: //---------------------------------------------------------------------
                     49: __fastcall TMailCfgDlg::TMailCfgDlg(TComponent* AOwner)
                     50:        : TForm(AOwner)
                     51: {
                     52: }
                     53: //---------------------------------------------------------------------
                     54: void __fastcall TMailCfgDlg::InboundSoundButtonClick(TObject *Sender)
                     55: {
                     56:        OpenDialog->FileName=InboundSoundEdit->Text;
                     57:        if(OpenDialog->Execute()==true) {
                     58:        InboundSoundEdit->Text=OpenDialog->FileName;
                     59:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                     60:     }
                     61: }
                     62: //---------------------------------------------------------------------------
                     63: 
                     64: void __fastcall TMailCfgDlg::OutboundSoundButtonClick(TObject *Sender)
                     65: {
                     66:        OpenDialog->FileName=OutboundSoundEdit->Text;
                     67:        if(OpenDialog->Execute()==true) {
                     68:        OutboundSoundEdit->Text=OpenDialog->FileName;
                     69:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                     70:        }
                     71: }
                     72: //---------------------------------------------------------------------------
                     73: 
                     74: void __fastcall TMailCfgDlg::FormShow(TObject *Sender)
                     75: {
                     76:     char str[128];
                     77: 
                     78:     if(MainForm->mail_startup.interface_addr==0)
                     79:         NetworkInterfaceEdit->Text="<ANY>";
                     80:     else {
                     81:         sprintf(str,"%d.%d.%d.%d"
                     82:             ,(MainForm->mail_startup.interface_addr>>24)&0xff
                     83:             ,(MainForm->mail_startup.interface_addr>>16)&0xff
                     84:             ,(MainForm->mail_startup.interface_addr>>8)&0xff
                     85:             ,MainForm->mail_startup.interface_addr&0xff
                     86:         );
                     87:         NetworkInterfaceEdit->Text=AnsiString(str);
                     88:     }
                     89:     MaxClientsEdit->Text=AnsiString(MainForm->mail_startup.max_clients);
                     90:     MaxInactivityEdit->Text=AnsiString(MainForm->mail_startup.max_inactivity);
                     91:        MaxRecipientsEdit->Text=AnsiString(MainForm->mail_startup.max_recipients);
                     92:        MaxMsgSizeEdit->Text=AnsiString(MainForm->mail_startup.max_msg_size);
                     93:     LinesPerYieldEdit->Text=AnsiString(MainForm->mail_startup.lines_per_yield);
                     94: 
                     95:     AutoStartCheckBox->Checked=MainForm->MailAutoStart;
                     96:     LogFileCheckBox->Checked=MainForm->MailLogFile;
                     97:     HostnameCheckBox->Checked
                     98:         =!(MainForm->mail_startup.options&MAIL_OPT_NO_HOST_LOOKUP);
1.1.1.2 ! root       99:     UseSubPortCheckBox->Checked=MainForm->mail_startup.options&MAIL_OPT_USE_SUBMISSION_PORT;
1.1       root      100: 
                    101:     DefCharsetEdit->Text=AnsiString(MainForm->mail_startup.default_charset);
                    102:     RelayServerEdit->Text=AnsiString(MainForm->mail_startup.relay_server);
                    103:     RelayAuthNameEdit->Text=AnsiString(MainForm->mail_startup.relay_user);
                    104:     RelayAuthPassEdit->Text=AnsiString(MainForm->mail_startup.relay_pass);
                    105:     SMTPPortEdit->Text=AnsiString(MainForm->mail_startup.smtp_port);
1.1.1.2 ! root      106:     SubPortEdit->Text=AnsiString(MainForm->mail_startup.submission_port);
1.1       root      107:     POP3PortEdit->Text=AnsiString(MainForm->mail_startup.pop3_port);
                    108:     RelayPortEdit->Text=AnsiString(MainForm->mail_startup.relay_port);
                    109:     if(isalnum(MainForm->mail_startup.dns_server[0]))
                    110:         DNSServerEdit->Text=AnsiString(MainForm->mail_startup.dns_server);
                    111:     else
                    112:         DNSServerEdit->Text="<auto>";
                    113:     InboundSoundEdit->Text=AnsiString(MainForm->mail_startup.inbound_sound);
                    114:     OutboundSoundEdit->Text=AnsiString(MainForm->mail_startup.outbound_sound);
                    115:     POP3SoundEdit->Text=AnsiString(MainForm->mail_startup.pop3_sound);
                    116:     DeliveryAttemptsEdit->Text
                    117:         =AnsiString(MainForm->mail_startup.max_delivery_attempts);
                    118:     RescanFreqEdit->Text=AnsiString(MainForm->mail_startup.rescan_frequency);
                    119:     DefaultUserEdit->Text=AnsiString(MainForm->mail_startup.default_user);
                    120:     BLSubjectEdit->Text=AnsiString(MainForm->mail_startup.dnsbl_tag);
                    121:     BLHeaderEdit->Text=AnsiString(MainForm->mail_startup.dnsbl_hdr);
                    122: 
                    123:     DebugTXCheckBox->Checked=MainForm->mail_startup.options
                    124:         &MAIL_OPT_DEBUG_TX;
                    125:     DebugRXCheckBox->Checked=MainForm->mail_startup.options
                    126:         &MAIL_OPT_DEBUG_RX_RSP;
                    127:     DebugHeadersCheckBox->Checked=MainForm->mail_startup.options
                    128:         &MAIL_OPT_DEBUG_RX_HEADER;
                    129:     NotifyCheckBox->Checked
                    130:        =!(MainForm->mail_startup.options&MAIL_OPT_NO_NOTIFY);
                    131:     POP3EnabledCheckBox->Checked=MainForm->mail_startup.options
                    132:         &MAIL_OPT_ALLOW_POP3;
                    133:     POP3LogCheckBox->Checked=MainForm->mail_startup.options
                    134:         &MAIL_OPT_DEBUG_POP3;
                    135:     RelayRadioButton->Checked=MainForm->mail_startup.options
                    136:        &MAIL_OPT_RELAY_TX;
                    137:     RelayAuthPlainRadioButton->Checked=MainForm->mail_startup.options
                    138:         &MAIL_OPT_RELAY_AUTH_PLAIN;
                    139:     RelayAuthLoginRadioButton->Checked=MainForm->mail_startup.options
                    140:         &MAIL_OPT_RELAY_AUTH_LOGIN;
                    141:     RelayAuthCramMD5RadioButton->Checked=MainForm->mail_startup.options
                    142:         &MAIL_OPT_RELAY_AUTH_CRAM_MD5;
                    143: 
                    144: #if 0 /* this is a stupid option */
                    145:     UserNumberCheckBox->Checked=MainForm->mail_startup.options
                    146:        &MAIL_OPT_ALLOW_RX_BY_NUMBER;
                    147: #endif
                    148:     AllowRelayCheckBox->Checked=MainForm->mail_startup.options
                    149:        &MAIL_OPT_ALLOW_RELAY;
                    150:     AuthViaIpCheckBox->Checked=MainForm->mail_startup.options
                    151:        &MAIL_OPT_SMTP_AUTH_VIA_IP;
                    152:     if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_REFUSE)
                    153:            BLRefuseRadioButton->Checked=true;
                    154:     else if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_BADUSER)
                    155:            BLBadUserRadioButton->Checked=true;
                    156:     else if(MainForm->mail_startup.options&MAIL_OPT_DNSBL_IGNORE)
                    157:            BLIgnoreRadioButton->Checked=true;
                    158:        else
                    159:            BLTagRadioButton->Checked=true;
1.1.1.2 ! root      160:     DNSBLSpamHashCheckBox->Checked=MainForm->mail_startup.options
        !           161:        &MAIL_OPT_DNSBL_SPAMHASH;
1.1       root      162: 
                    163:     TcpDnsCheckBox->Checked=MainForm->mail_startup.options
                    164:        &MAIL_OPT_USE_TCP_DNS;
                    165:     SendMailCheckBox->Checked=
                    166:         !(MainForm->mail_startup.options&MAIL_OPT_NO_SENDMAIL);
                    167: 
                    168:     int i=0;
                    169:     AdvancedCheckListBox->Checked[i++]
                    170:         =(MainForm->mail_startup.options&MAIL_OPT_SEND_INTRANSIT);
                    171:     AdvancedCheckListBox->Checked[i++]
                    172:         =(MainForm->mail_startup.options&MAIL_OPT_DEBUG_RX_BODY);
                    173:     AdvancedCheckListBox->Checked[i++]
                    174:         =(MainForm->mail_startup.options&MAIL_OPT_ALLOW_RX_BY_NUMBER);
                    175:     AdvancedCheckListBox->Checked[i++]
1.1.1.2 ! root      176:         =(MainForm->mail_startup.options&MAIL_OPT_ALLOW_SYSOP_ALIASES);
        !           177: 
        !           178:     AdvancedCheckListBox->Checked[i++]
1.1       root      179:         =(MainForm->mail_startup.options&MAIL_OPT_DNSBL_CHKRECVHDRS);
                    180:     AdvancedCheckListBox->Checked[i++]
                    181:         =(MainForm->mail_startup.options&MAIL_OPT_DNSBL_THROTTLE);
1.1.1.2 ! root      182:     AdvancedCheckListBox->Checked[i++]
        !           183:         =!(MainForm->mail_startup.options&MAIL_OPT_NO_AUTO_EXEMPT);
1.1       root      184: 
                    185:     DNSBLRadioButtonClick(Sender);
                    186:     DNSRadioButtonClick(Sender);
                    187:        POP3EnabledCheckBoxClick(Sender);
                    188:     SendMailCheckBoxClick(Sender);
                    189:     AllowRelayCheckBoxClick(Sender);
                    190:     RelayAuthRadioButtonClick(Sender);
1.1.1.2 ! root      191:     UseSubPortCheckBoxClick(Sender);
1.1       root      192:     PageControl->ActivePage=GeneralTabSheet;
                    193: }
                    194: //---------------------------------------------------------------------------
                    195: static void setBit(unsigned long* l, long bit, bool yes)
                    196: {
                    197:     if(yes)
                    198:         *l|=bit;
                    199:     else
                    200:         *l&=~bit;
                    201: }
                    202: //---------------------------------------------------------------------------
                    203: void __fastcall TMailCfgDlg::OKBtnClick(TObject *Sender)
                    204: {
                    205:     char    str[128],*p;
                    206:     DWORD   addr;
                    207: 
                    208:     SAFECOPY(str,NetworkInterfaceEdit->Text.c_str());
                    209:     p=str;
                    210:     while(*p && *p<=' ') p++;
                    211:     if(*p && isdigit(*p)) {
                    212:         addr=atoi(p)<<24;
                    213:         while(*p && *p!='.') p++;
                    214:         if(*p=='.') p++;
                    215:         addr|=atoi(p)<<16;
                    216:         while(*p && *p!='.') p++;
                    217:         if(*p=='.') p++;
                    218:         addr|=atoi(p)<<8;
                    219:         while(*p && *p!='.') p++;
                    220:         if(*p=='.') p++;
                    221:         addr|=atoi(p);
                    222:         MainForm->mail_startup.interface_addr=addr;
                    223:     } else
                    224:         MainForm->mail_startup.interface_addr=0;
                    225: 
1.1.1.2 ! root      226:        MainForm->mail_startup.smtp_port=SMTPPortEdit->Text.ToIntDef(IPPORT_SMTP);
        !           227:        MainForm->mail_startup.submission_port=SubPortEdit->Text.ToIntDef(IPPORT_SUBMISSION);
        !           228:     MainForm->mail_startup.pop3_port=POP3PortEdit->Text.ToIntDef(IPPORT_POP3);
        !           229:     MainForm->mail_startup.relay_port=RelayPortEdit->Text.ToIntDef(IPPORT_SMTP);
1.1       root      230:     MainForm->mail_startup.max_clients=MaxClientsEdit->Text.ToIntDef(10);
                    231:     MainForm->mail_startup.max_inactivity=MaxInactivityEdit->Text.ToIntDef(120);
                    232:     MainForm->mail_startup.max_recipients=MaxRecipientsEdit->Text.ToIntDef(100);
                    233:     MainForm->mail_startup.max_msg_size
                    234:        =MaxMsgSizeEdit->Text.ToIntDef(MainForm->mail_startup.max_msg_size);
                    235:     MainForm->mail_startup.max_delivery_attempts
                    236:         =DeliveryAttemptsEdit->Text.ToIntDef(10);
                    237:     MainForm->mail_startup.rescan_frequency=RescanFreqEdit->Text.ToIntDef(300);
                    238:     MainForm->mail_startup.lines_per_yield=LinesPerYieldEdit->Text.ToIntDef(10);
                    239: 
                    240:     SAFECOPY(MainForm->mail_startup.default_charset
                    241:         ,DefCharsetEdit->Text.c_str());
                    242:     SAFECOPY(MainForm->mail_startup.default_user
                    243:         ,DefaultUserEdit->Text.c_str());
                    244:     if(isalnum(*DNSServerEdit->Text.c_str()))
                    245:         SAFECOPY(MainForm->mail_startup.dns_server
                    246:             ,DNSServerEdit->Text.c_str());
                    247:     else
                    248:         MainForm->mail_startup.dns_server[0]=0;
                    249:     SAFECOPY(MainForm->mail_startup.relay_server
                    250:         ,RelayServerEdit->Text.c_str());
                    251:     SAFECOPY(MainForm->mail_startup.relay_user
                    252:         ,RelayAuthNameEdit->Text.c_str());
                    253:     SAFECOPY(MainForm->mail_startup.relay_pass
                    254:         ,RelayAuthPassEdit->Text.c_str());
                    255:     SAFECOPY(MainForm->mail_startup.inbound_sound
                    256:         ,InboundSoundEdit->Text.c_str());
                    257:     SAFECOPY(MainForm->mail_startup.outbound_sound
                    258:         ,OutboundSoundEdit->Text.c_str());
                    259:     SAFECOPY(MainForm->mail_startup.pop3_sound
                    260:         ,POP3SoundEdit->Text.c_str());
                    261:     SAFECOPY(MainForm->mail_startup.dnsbl_tag
                    262:        ,BLSubjectEdit->Text.c_str());
                    263:     SAFECOPY(MainForm->mail_startup.dnsbl_hdr
                    264:        ,BLHeaderEdit->Text.c_str());
                    265: 
                    266:        if(RelayRadioButton->Checked==true)
                    267:        MainForm->mail_startup.options|=MAIL_OPT_RELAY_TX;
                    268:     else
                    269:            MainForm->mail_startup.options&=~MAIL_OPT_RELAY_TX;
                    270:     MainForm->mail_startup.options&=~(MAIL_OPT_RELAY_AUTH_MASK);
                    271:     if(RelayAuthLoginRadioButton->Checked==true)
                    272:         MainForm->mail_startup.options|=MAIL_OPT_RELAY_AUTH_LOGIN;
                    273:     else if(RelayAuthPlainRadioButton->Checked==true)
                    274:         MainForm->mail_startup.options|=MAIL_OPT_RELAY_AUTH_PLAIN;
                    275:     else if(RelayAuthCramMD5RadioButton->Checked==true)
                    276:         MainForm->mail_startup.options|=MAIL_OPT_RELAY_AUTH_CRAM_MD5;
                    277:        if(DebugTXCheckBox->Checked==true)
                    278:        MainForm->mail_startup.options|=MAIL_OPT_DEBUG_TX;
                    279:     else
                    280:            MainForm->mail_startup.options&=~MAIL_OPT_DEBUG_TX;
                    281:        if(DebugRXCheckBox->Checked==true)
                    282:        MainForm->mail_startup.options|=MAIL_OPT_DEBUG_RX_RSP;
                    283:     else
                    284:            MainForm->mail_startup.options&=~MAIL_OPT_DEBUG_RX_RSP;
                    285:        if(NotifyCheckBox->Checked==false)
                    286:        MainForm->mail_startup.options|=MAIL_OPT_NO_NOTIFY;
                    287:     else
                    288:            MainForm->mail_startup.options&=~MAIL_OPT_NO_NOTIFY;
                    289:        if(DebugHeadersCheckBox->Checked==true)
                    290:        MainForm->mail_startup.options|=MAIL_OPT_DEBUG_RX_HEADER;
                    291:     else
                    292:            MainForm->mail_startup.options&=~MAIL_OPT_DEBUG_RX_HEADER;
                    293:        if(POP3EnabledCheckBox->Checked==true)
                    294:        MainForm->mail_startup.options|=MAIL_OPT_ALLOW_POP3;
                    295:     else
                    296:            MainForm->mail_startup.options&=~MAIL_OPT_ALLOW_POP3;
                    297:        if(POP3LogCheckBox->Checked==true)
                    298:        MainForm->mail_startup.options|=MAIL_OPT_DEBUG_POP3;
                    299:     else
                    300:            MainForm->mail_startup.options&=~MAIL_OPT_DEBUG_POP3;
                    301:        if(AllowRelayCheckBox->Checked==true)
                    302:        MainForm->mail_startup.options|=MAIL_OPT_ALLOW_RELAY;
                    303:     else
                    304:            MainForm->mail_startup.options&=~MAIL_OPT_ALLOW_RELAY;
                    305:        if(AuthViaIpCheckBox->Checked==true)
                    306:        MainForm->mail_startup.options|=MAIL_OPT_SMTP_AUTH_VIA_IP;
                    307:     else
                    308:            MainForm->mail_startup.options&=~MAIL_OPT_SMTP_AUTH_VIA_IP;
1.1.1.2 ! root      309:        if(UseSubPortCheckBox->Checked==true)
        !           310:        MainForm->mail_startup.options|=MAIL_OPT_USE_SUBMISSION_PORT;
        !           311:     else
        !           312:            MainForm->mail_startup.options&=~MAIL_OPT_USE_SUBMISSION_PORT;
1.1       root      313: 
                    314:     /* DNSBL */
                    315:        MainForm->mail_startup.options&=
                    316:        ~(MAIL_OPT_DNSBL_IGNORE|MAIL_OPT_DNSBL_REFUSE|MAIL_OPT_DNSBL_BADUSER);
                    317:        if(BLIgnoreRadioButton->Checked==true)
                    318:        MainForm->mail_startup.options|=MAIL_OPT_DNSBL_IGNORE;
                    319:     else if(BLRefuseRadioButton->Checked==true)
                    320:        MainForm->mail_startup.options|=MAIL_OPT_DNSBL_REFUSE;
                    321:     else if(BLBadUserRadioButton->Checked==true)
                    322:        MainForm->mail_startup.options|=MAIL_OPT_DNSBL_BADUSER;
1.1.1.2 ! root      323:     if(DNSBLSpamHashCheckBox->Checked==true)
        !           324:        MainForm->mail_startup.options|=MAIL_OPT_DNSBL_SPAMHASH;
1.1       root      325:     else
1.1.1.2 ! root      326:            MainForm->mail_startup.options&=~MAIL_OPT_DNSBL_SPAMHASH;
1.1       root      327: 
                    328:        if(HostnameCheckBox->Checked==false)
                    329:        MainForm->mail_startup.options|=MAIL_OPT_NO_HOST_LOOKUP;
                    330:     else
                    331:            MainForm->mail_startup.options&=~MAIL_OPT_NO_HOST_LOOKUP;
                    332:        if(TcpDnsCheckBox->Checked==true)
                    333:        MainForm->mail_startup.options|=MAIL_OPT_USE_TCP_DNS;
                    334:     else
                    335:            MainForm->mail_startup.options&=~MAIL_OPT_USE_TCP_DNS;
                    336:     if(SendMailCheckBox->Checked==false)
                    337:         MainForm->mail_startup.options|=MAIL_OPT_NO_SENDMAIL;
                    338:     else
                    339:         MainForm->mail_startup.options&=~MAIL_OPT_NO_SENDMAIL;
                    340: 
                    341:     int i=0;
                    342:     setBit(&MainForm->mail_startup.options
                    343:         ,MAIL_OPT_SEND_INTRANSIT
                    344:         ,AdvancedCheckListBox->Checked[i++]);
                    345:     setBit(&MainForm->mail_startup.options
                    346:         ,MAIL_OPT_DEBUG_RX_BODY
                    347:         ,AdvancedCheckListBox->Checked[i++]);
                    348:     setBit(&MainForm->mail_startup.options
                    349:         ,MAIL_OPT_ALLOW_RX_BY_NUMBER
                    350:         ,AdvancedCheckListBox->Checked[i++]);
                    351:     setBit(&MainForm->mail_startup.options
1.1.1.2 ! root      352:         ,MAIL_OPT_ALLOW_SYSOP_ALIASES
        !           353:         ,AdvancedCheckListBox->Checked[i++]);
        !           354:     setBit(&MainForm->mail_startup.options
1.1       root      355:         ,MAIL_OPT_DNSBL_CHKRECVHDRS
                    356:         ,AdvancedCheckListBox->Checked[i++]);
                    357:     setBit(&MainForm->mail_startup.options
                    358:         ,MAIL_OPT_DNSBL_THROTTLE
                    359:         ,AdvancedCheckListBox->Checked[i++]);
1.1.1.2 ! root      360:     setBit(&MainForm->mail_startup.options
        !           361:         ,MAIL_OPT_NO_AUTO_EXEMPT
        !           362:         ,!AdvancedCheckListBox->Checked[i++]);
1.1       root      363: 
                    364:     MainForm->MailAutoStart=AutoStartCheckBox->Checked;
                    365:     MainForm->MailLogFile=LogFileCheckBox->Checked;
                    366: 
                    367:     MainForm->SaveIniSettings(Sender);
                    368: }
                    369: //---------------------------------------------------------------------------
                    370: 
                    371: 
                    372: void __fastcall TMailCfgDlg::POP3SoundButtonClick(TObject *Sender)
                    373: {
                    374:        OpenDialog->FileName=POP3SoundEdit->Text;
                    375:        if(OpenDialog->Execute()==true) {
                    376:        POP3SoundEdit->Text=OpenDialog->FileName;
                    377:         sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
                    378:     }
                    379: }
                    380: //---------------------------------------------------------------------------
                    381: 
                    382: void __fastcall TMailCfgDlg::DNSRadioButtonClick(TObject *Sender)
                    383: {
                    384:     bool checked = RelayRadioButton->Checked && SendMailCheckBox->Checked;
                    385:     RelayTabSheet->TabVisible=checked;
                    386:     RelayPortEdit->Enabled=checked;
                    387:     RelayPortLabel->Enabled=checked;
                    388:     checked = (!RelayRadioButton->Checked) && SendMailCheckBox->Checked;
                    389:     DNSServerEdit->Enabled=checked;
                    390:     DNSServerLabel->Enabled=checked;
                    391:     TcpDnsCheckBox->Enabled=checked;
                    392: }
                    393: //---------------------------------------------------------------------------
                    394: 
                    395: void __fastcall TMailCfgDlg::POP3EnabledCheckBoxClick(TObject *Sender)
                    396: {
                    397:        POP3PortEdit->Enabled=POP3EnabledCheckBox->Checked;
                    398:     POP3PortLabel->Enabled=POP3EnabledCheckBox->Checked;
                    399:     POP3SoundEdit->Enabled=POP3EnabledCheckBox->Checked;
                    400:     POP3SoundLabel->Enabled=POP3EnabledCheckBox->Checked;
                    401:     POP3SoundButton->Enabled=POP3EnabledCheckBox->Checked;
                    402:     POP3LogCheckBox->Enabled=POP3EnabledCheckBox->Checked;
                    403: }
                    404: //---------------------------------------------------------------------------
                    405: 
                    406: 
                    407: void __fastcall TMailCfgDlg::SendMailCheckBoxClick(TObject *Sender)
                    408: {
                    409:     bool checked=SendMailCheckBox->Checked;
                    410: 
                    411:     DeliveryAttemptsEdit->Enabled=checked;
                    412:     DeliveryAttemptsLabel->Enabled=checked;
                    413:     RescanFreqEdit->Enabled=checked;
                    414:     RescanFreqLabel->Enabled=checked;
                    415:     DNSRadioButton->Enabled=checked;
                    416:     DNSServerEdit->Enabled=checked;
                    417:     TcpDnsCheckBox->Enabled=checked;
                    418:     RelayRadioButton->Enabled=checked;
                    419:     OutboundSoundEdit->Enabled=checked;
                    420:     OutboundSoundLabel->Enabled=checked;
                    421:     OutboundSoundButton->Enabled=checked;
                    422:     DefCharsetLabel->Enabled=checked;
                    423:     DefCharsetEdit->Enabled=checked;
                    424: 
                    425:     DNSRadioButtonClick(Sender);
                    426: }
                    427: //---------------------------------------------------------------------------
                    428: 
                    429: 
                    430: void __fastcall TMailCfgDlg::DNSBLRadioButtonClick(TObject *Sender)
                    431: {
                    432:        BLSubjectEdit->Enabled=BLTagRadioButton->Checked;
                    433:        BLHeaderEdit->Enabled=BLTagRadioButton->Checked;
                    434:     BLSubjectLabel->Enabled=BLTagRadioButton->Checked;
                    435:        BLHeaderLabel->Enabled=BLTagRadioButton->Checked;
1.1.1.2 ! root      436:     DNSBLSpamHashCheckBox->Enabled
        !           437:         =(BLTagRadioButton->Checked ||  BLIgnoreRadioButton->Checked);
1.1       root      438: }
                    439: //---------------------------------------------------------------------------
                    440: 
                    441: void __fastcall TMailCfgDlg::DNSBLServersButtonClick(TObject *Sender)
                    442: {
                    443:        char filename[MAX_PATH+1];
                    444: 
                    445:     sprintf(filename,"%sdns_blacklist.cfg",MainForm->cfg.ctrl_dir);
                    446:        Application->CreateForm(__classid(TTextFileEditForm), &TextFileEditForm);
                    447:        TextFileEditForm->Filename=AnsiString(filename);
                    448:     TextFileEditForm->Caption="Services Configuration";
                    449:        TextFileEditForm->ShowModal();
                    450:     delete TextFileEditForm;
                    451: }
                    452: //---------------------------------------------------------------------------
                    453: 
                    454: 
                    455: void __fastcall TMailCfgDlg::DNSBLExemptionsButtonClick(TObject *Sender)
                    456: {
                    457:        char filename[MAX_PATH+1];
                    458: 
                    459:     sprintf(filename,"%sdnsbl_exempt.cfg",MainForm->cfg.ctrl_dir);
                    460:        Application->CreateForm(__classid(TTextFileEditForm), &TextFileEditForm);
                    461:        TextFileEditForm->Filename=AnsiString(filename);
                    462:     TextFileEditForm->Caption="Services Configuration";
                    463:        TextFileEditForm->ShowModal();
                    464:     delete TextFileEditForm;
                    465: }
                    466: //---------------------------------------------------------------------------
                    467: 
                    468: void __fastcall TMailCfgDlg::AllowRelayCheckBoxClick(TObject *Sender)
                    469: {
                    470:        AuthViaIpCheckBox->Enabled=AllowRelayCheckBox->Checked;
                    471: }
                    472: //---------------------------------------------------------------------------
                    473: 
                    474: void __fastcall TMailCfgDlg::RelayAuthRadioButtonClick(TObject *Sender)
                    475: {
                    476:     bool enabled = !RelayAuthNoneRadioButton->Checked;
                    477: 
                    478:     RelayAuthNameEdit->Enabled=enabled;
                    479:     RelayAuthPassEdit->Enabled=enabled;
                    480:     RelayAuthNameLabel->Enabled=enabled;
                    481:     RelayAuthPassLabel->Enabled=enabled;
                    482: }
                    483: //---------------------------------------------------------------------------
                    484: 
1.1.1.2 ! root      485: void __fastcall TMailCfgDlg::UseSubPortCheckBoxClick(TObject *Sender)
        !           486: {
        !           487:     bool enabled = UseSubPortCheckBox->Checked;
        !           488: 
        !           489:     SubPortLabel->Enabled = enabled;
        !           490:     SubPortEdit->Enabled = enabled;
        !           491: }
        !           492: //---------------------------------------------------------------------------
        !           493: 

unix.superglobalmegacorp.com

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