home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap11 / howto06 / delphi10 / cciccfrm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-12  |  131.8 KB  |  3,787 lines

  1. unit Cciccfrm;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Menus, FileCtrl, CCWSock, CCICCInf,
  8.   CCICCPrf, IniFiles, Gauges , CCUUCode, CCFTP;
  9.  
  10. type
  11.   { This record is used to hold information about a newsgroup            }
  12.   { NOTE : hi and low pointers indicate either dl or trashing without dl }
  13.   { "read" is for an article dl'd but not trashed.                       }
  14.   PNewsGroupRecord = ^TNewsGroupRecord;
  15.   TNewsGroupRecord = record
  16.     GName                : String;  { Profile of the newsgroup              }
  17.     GRealName            : String;  { Real Newsrc name of the newsgroup     }
  18.     GLowest              : Longint; { Number of lowest dl/trashed article   }
  19.     GHighest             : Longint; { Number of highest dl/trashed article  }
  20.     GTotalNew            : Longint; { Total New articles available          }
  21.     GTotalAvailable      : Longint; { After update, shows how many arts on s}
  22.     GLowestAvailable     : Longint; { au, shows lowest a# on server         }
  23.     GHighestAvailable    : Longint; { au, shows highest a# on server        }
  24.     GPostable            : Boolean; { Can post to newsgroup                 }
  25.     GSubscribed          : Boolean; { Subscribed to newsgroup               }
  26.     GTotalArticles       : Longint; { Total articles maintained on system   }
  27.     GTotalUnReadArticles : Longint; { Total unread articles on system       }
  28.     GIDNumber            : Integer;
  29.     GFileName            : String;  { Name of file holding articles records }
  30.     GLTag                : Longint; { Tag field to hold pointer to arts TL  }
  31.   end;
  32.   NGRFile = file of TNewsGroupRecord; { File type for NGRec }
  33.   { This record is used to hold information about Newsgroup articles }
  34.   PNewsGroupArticleRecord = ^TNewsGroupArticleRecord;
  35.   TNewsGroupArticleRecord = record
  36.     NGAGroupname   : String;  { Newsgroup name (redundancy safeguard)     }
  37.     NGASubject     : String;  { Subject of article                        }
  38.     NGANumber      : Longint; { Article number                            }
  39.     NGADownloaded  : boolean; { Article attempted/succeeded downloading   }
  40.     NGASender      : String;  { Article's putative sender (CIUPKC158=us)  }
  41.     NGARead        : Boolean; { Article read flag                         }
  42.     NGAPosted      : Boolean; { Article posted flag                       }
  43.     NGAArtFileName : String;  { Name of system-gen file with article text }
  44.   end;
  45.   NGARFile = file of TNewsGroupArticleRecord;
  46.   { This record is used to hold information about EMail Mailboxes }
  47.   PEMailMailBoxRecord = ^TEMailMailBoxRecord;
  48.   TEMailMailBoxRecord = record
  49.     MBName        : String;  { Name of the mailbox                     }
  50.     MBIDNumber    : Integer;
  51.     MBMaxMsgNumber : Longint;
  52.     MBTotal       : Longint; { Total Mail Messages in Mailbox          }
  53.     MBUnReadTotal : Longint; { Total unread Mail Messages in Mailbox   }
  54.     MBUnSentTotal : Longint; { Total unsent Mail Messages in Mailbox   }
  55.     MBMsgFileName : String;  { Name of file holding Messages records   }
  56.     MBLTag        : Longint; { Tag to pointer to Tlist holding msgrecs }
  57.   end;
  58.   EMMBRFile = file of TEMailMailBoxRecord; { File type for EMMBRec }
  59.   { This record is used to hold information about EMail messages in a Mailbox }
  60.   PEMailMessageRecord = ^TEMailMessageRecord;
  61.   TEMailMessageRecord = record
  62.     MRMailBoxName      : String;  { Name of mailbox (redundancy safeguard)       }
  63.     MRMessageSubject   : String;  { Subject of the Message                       }
  64.     MRMessageRecipient : String;  { EMail address of primary recipient           }
  65.     MRMessageSender    : String;  { EMail address of sender                      }
  66.     MRCarbonCopy       : String;  { EMail CC recips; "|" delimited               }
  67.     MRBlindCarbonCopy  : String;  { EMail BCC recips; "|" delimited              }
  68.     MRDateTime         : String;  { EMail date/time field                        }
  69.     MRRead             : Boolean; { EMail Read flag                              }
  70.     MRSent             : Boolean; { EMail Send flag                              }
  71.     MRFileName         : String;  { EMail system generated filename for msg text }
  72.   end;
  73.   EMMRFile = file of TEMailMessageRecord; { File type for EMMRec }
  74.   TCCINetCCForm = class(TForm)
  75.     MainMenu1: TMainMenu;
  76.     Network1: TMenuItem;
  77.     N1: TMenuItem;
  78.     Exit1: TMenuItem;
  79.     Services1: TMenuItem;
  80.     IPAddress1: TMenuItem;
  81.     EMail1: TMenuItem;
  82.     FTP1: TMenuItem;
  83.     UsenetNws1: TMenuItem;
  84.     Panel1: TPanel;
  85.     Panel2: TPanel;
  86.     Panel3: TPanel;
  87.     Panel4: TPanel;
  88.     Panel5: TPanel;
  89.     Panel6: TPanel;
  90.     ListBox1: TListBox;
  91.     Panel7: TPanel;
  92.     SpeedButton1: TSpeedButton;
  93.     SpeedButton2: TSpeedButton;
  94.     ListBox2: TListBox;
  95.     ComboBox1: TComboBox;
  96.     Button1: TButton;
  97.     Memo1: TMemo;
  98.     Files1: TMenuItem;
  99.     Edit1: TMenuItem;
  100.     Encoding1: TMenuItem;
  101.     EMail2: TMenuItem;
  102.     FTP2: TMenuItem;
  103.     News1: TMenuItem;
  104.     Load1: TMenuItem;
  105.     Save1: TMenuItem;
  106.     Cut1: TMenuItem;
  107.     Copy1: TMenuItem;
  108.     CopytoFile1: TMenuItem;
  109.     Paste1: TMenuItem;
  110.     PastefromFile1: TMenuItem;
  111.     UUDecode1: TMenuItem;
  112.     MIMEDecode1: TMenuItem;
  113.     UUEncode1: TMenuItem;
  114.     MIMEEncode1: TMenuItem;
  115.     CheckMail1: TMenuItem;
  116.     ReplyToCurrentMessage1: TMenuItem;
  117.     SendCurrentMessage1: TMenuItem;
  118.     SendQueue1: TMenuItem;
  119.     Mailboxes1: TMenuItem;
  120.     Correspondents1: TMenuItem;
  121.     EmptyTrash1: TMenuItem;
  122.     SpeedButton4: TSpeedButton;
  123.     SpeedButton5: TSpeedButton;
  124.     SpeedButton3: TSpeedButton;
  125.     Panel8: TPanel;
  126.     Label1: TLabel;
  127.     Label2: TLabel;
  128.     ComboBox2: TComboBox;
  129.     Label3: TLabel;
  130.     ComboBox3: TComboBox;
  131.     ConnectToSite1: TMenuItem;
  132.     Disconnect1: TMenuItem;
  133.     UploadMarked1: TMenuItem;
  134.     DownloadMarked1: TMenuItem;
  135.     Directory1: TMenuItem;
  136.     ASCII1: TMenuItem;
  137.     Binary1: TMenuItem;
  138.     ASCII2: TMenuItem;
  139.     Binary2: TMenuItem;
  140.     ViewRemoteasText1: TMenuItem;
  141.     FTPSites1: TMenuItem;
  142.     CheckNewNews1: TMenuItem;
  143.     GetMarked1: TMenuItem;
  144.     CreateNewMessage1: TMenuItem;
  145.     Article1: TMenuItem;
  146.     SubscribedNewsgroups1: TMenuItem;
  147.     Trash1: TMenuItem;
  148.     Preferences1: TMenuItem;
  149.     EMail3: TMenuItem;
  150.     FTP3: TMenuItem;
  151.     News2: TMenuItem;
  152.     Label4: TLabel;
  153.     Label5: TLabel;
  154.     ViewasText1: TMenuItem;
  155.     Change1: TMenuItem;
  156.     Create1: TMenuItem;
  157.     Delete3: TMenuItem;
  158.     ChangeLocal1: TMenuItem;
  159.     OpenDialog1: TOpenDialog;
  160.     SaveDialog1: TSaveDialog;
  161.     Paths1: TMenuItem;
  162.     ProgressInfo1: TMenuItem;
  163.     N2: TMenuItem;
  164.     ViewInEditWindow1: TMenuItem;
  165.     ViewInStatusLine1: TMenuItem;
  166.     SaveToFile1: TMenuItem;
  167.     ViewWinsockInfo1: TMenuItem;
  168.     Description1: TMenuItem;
  169.     SystemStatus1: TMenuItem;
  170.     VendorSpecific1: TMenuItem;
  171.     Gauge1: TGauge;
  172.     NewsServers1: TMenuItem;
  173.     AllReadArticles1: TMenuItem;
  174.     AllMarkedArticles1: TMenuItem;
  175.     AllAvailableArticles1: TMenuItem;
  176.     NewArticle1: TMenuItem;
  177.     FollowupArticle1: TMenuItem;
  178.     Post1: TMenuItem;
  179.     CurrentArticle1: TMenuItem;
  180.     EntireQueue1: TMenuItem;
  181.     ConnectandUpdate1: TMenuItem;
  182.     Disconnect2: TMenuItem;
  183.     Headers1: TMenuItem;
  184.     RetrieveMarked1: TMenuItem;
  185.     RetrieveAll1: TMenuItem;
  186.     DownloadActiveNewsgroups1: TMenuItem;
  187.     PutinQueue1: TMenuItem;
  188.     TrashMarkedMessages1: TMenuItem;
  189.     MailServers1: TMenuItem;
  190.     ExitEMailRequired1: TMenuItem;
  191.     ToCurrentMessage1: TMenuItem;
  192.     ToNewMessage1: TMenuItem;
  193.     ToFile2: TMenuItem;
  194.     AbortNewsgroupDownload1: TMenuItem;
  195.     Catchup1: TMenuItem;
  196.     Marked1: TMenuItem;
  197.     All1: TMenuItem;
  198.     File1: TMenuItem;
  199.     SelectedArticle1: TMenuItem;
  200.     SelectMultipleArticles1: TMenuItem;
  201.     DecodeSelections1: TMenuItem;
  202.     procedure Exit1Click(Sender: TObject);
  203.     procedure FormCreate(Sender: TObject);
  204.     procedure FormDestroy(Sender: TObject);
  205.     procedure Description1Click(Sender: TObject);
  206.     procedure SystemStatus1Click(Sender: TObject);
  207.     procedure VendorSpecific1Click(Sender: TObject);
  208.     procedure ViewInEditWindow1Click(Sender: TObject);
  209.     procedure ViewInStatusLine1Click(Sender: TObject);
  210.     procedure SaveToFile1Click(Sender: TObject);
  211.     procedure IPAddress1Click(Sender: TObject);
  212.     procedure FTP1Click(Sender: TObject);
  213.     procedure FormResize(Sender: TObject);
  214.     procedure FTPSites1Click(Sender: TObject);
  215.     procedure FTP3Click(Sender: TObject);
  216.     procedure ConnectToSite1Click(Sender: TObject);
  217.     procedure Button1Click(Sender: TObject);
  218.     procedure ViewasText1Click(Sender: TObject);
  219.     procedure Disconnect1Click(Sender: TObject);
  220.     procedure ToDisplay1Click(Sender: TObject);
  221.     procedure ToFile1Click(Sender: TObject);
  222.     procedure Binary2Click(Sender: TObject);
  223.     procedure Change1Click(Sender: TObject);
  224.     procedure ChangeLocal1Click(Sender: TObject);
  225.     procedure ListBox1DblClick(Sender: TObject);
  226.     procedure ListBox2DblClick(Sender: TObject);
  227.     procedure ASCII1Click(Sender: TObject);
  228.     procedure DeleteRemoteFiles1Click(Sender: TObject);
  229.     procedure Binary1Click(Sender: TObject);
  230.     procedure Delete3Click(Sender: TObject);
  231.     procedure Create1Click(Sender: TObject);
  232.     procedure ListBox1Click(Sender: TObject);
  233.     procedure UsenetNws1Click(Sender: TObject);
  234.     procedure Disconnect2Click(Sender: TObject);
  235.     procedure News2Click(Sender: TObject);
  236.     procedure ConnectandUpdate1Click(Sender: TObject);
  237.     procedure CheckNewNews1Click(Sender: TObject);
  238.     procedure NewsServers1Click(Sender: TObject);
  239.     procedure SubscribedNewsgroups1Click(Sender: TObject);
  240.     procedure RetrieveMarked1Click(Sender: TObject);
  241.     procedure RetrieveAll1Click(Sender: TObject);
  242.     procedure GetMarked1Click(Sender: TObject);
  243.     procedure NewArticle1Click(Sender: TObject);
  244.     procedure FollowupArticle1Click(Sender: TObject);
  245.     procedure PutinQueue1Click(Sender: TObject);
  246.     procedure CurrentArticle1Click(Sender: TObject);
  247.     procedure EntireQueue1Click(Sender: TObject);
  248.     procedure AllReadArticles1Click(Sender: TObject);
  249.     procedure AllMarkedArticles1Click(Sender: TObject);
  250.     procedure AllAvailableArticles1Click(Sender: TObject);
  251.     procedure DownloadActiveNewsgroups1Click(Sender: TObject);
  252.     procedure UUEncode1Click(Sender: TObject);
  253.     procedure Load1Click(Sender: TObject);
  254.     procedure Save1Click(Sender: TObject);
  255.     procedure EMail1Click(Sender: TObject);
  256.     procedure CheckMail1Click(Sender: TObject);
  257.     procedure CreateNewMessage1Click(Sender: TObject);
  258.     procedure ReplyToCurrentMessage1Click(Sender: TObject);
  259.     procedure SendCurrentMessage1Click(Sender: TObject);
  260.     procedure SendQueue1Click(Sender: TObject);
  261.     procedure MailServers1Click(Sender: TObject);
  262.     procedure Mailboxes1Click(Sender: TObject);
  263.     procedure Correspondents1Click(Sender: TObject);
  264.     procedure EMail3Click(Sender: TObject);
  265.     procedure Paths1Click(Sender: TObject);
  266.     procedure ExitEMailRequired1Click(Sender: TObject);
  267.     procedure TrashMarkedMessages1Click(Sender: TObject);
  268.     procedure EmptyTrash1Click(Sender: TObject);
  269.     procedure ComboBox2Change(Sender: TObject);
  270.     procedure ComboBox3Change(Sender: TObject);
  271.     procedure MIMEDecode1Click(Sender: TObject);
  272.     procedure Cut1Click(Sender: TObject);
  273.     procedure Copy1Click(Sender: TObject);
  274.     procedure CopytoFile1Click(Sender: TObject);
  275.     procedure Paste1Click(Sender: TObject);
  276.     procedure PastefromFile1Click(Sender: TObject);
  277.     procedure ToCurrentMessage1Click(Sender: TObject);
  278.     procedure ToNewMessage1Click(Sender: TObject);
  279.     procedure ToFile2Click(Sender: TObject);
  280.     procedure SpeedButton5Click(Sender: TObject);
  281.     procedure SpeedButton3Click(Sender: TObject);
  282.     procedure SpeedButton1Click(Sender: TObject);
  283.     procedure SpeedButton2Click(Sender: TObject);
  284.     procedure ListBox2Click(Sender: TObject);
  285.     procedure AbortNewsgroupDownload1Click(Sender: TObject);
  286.     procedure Marked1Click(Sender: TObject);
  287.     procedure All1Click(Sender: TObject);
  288.     procedure File1Click(Sender: TObject);
  289.     procedure SelectedArticle1Click(Sender: TObject);
  290.     procedure SelectMultipleArticles1Click(Sender: TObject);
  291.     procedure DecodeSelections1Click(Sender: TObject);
  292.     procedure SpeedButton4Click(Sender: TObject);
  293.   private
  294.     { Private declarations }
  295.   public
  296.     { Public declarations }
  297.     procedure EnableFTPMenus;
  298.     procedure DisableFTPMenus;
  299.     procedure EnableNNTPMenus;
  300.     procedure DisableNNTPMenus;
  301.     procedure EnablePOP3SMTPMenus;
  302.     procedure DisablePOP3SMTPMenus;
  303.     procedure UpdateGauge( BytesFinished , TotalToHandle : longint );
  304.     procedure UpdateMailGauge( BytesFinished , TotalToHandle : longint );
  305.     procedure UpdateMIMEGauge( BytesFinished , TotalToHandle : longint );
  306.     procedure UpdateUUGauge( BytesFinished , TotalToHandle : longint );
  307.     function DoFTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  308.     function DoNNTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  309.     function DoPOP3Connection( PCRPointer : PConnectionsRecord ) : boolean;
  310.     function DoSMTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  311.     procedure DoFTPDisconnect;
  312.     procedure DoNNTPDisconnect;
  313.     procedure DoPOP3SMTPDisconnect;
  314.     procedure ReadIniData;
  315.     procedure WriteIniData;
  316.     procedure LoadFTPSiteFile;
  317.     procedure LoadNNTPSiteFile;
  318.     procedure LoadEmailServerFile;
  319.     procedure SaveEMailServerFile;
  320.     procedure LoadEmailMailboxFile( WhichServer : Integer );
  321.     procedure SaveEMailMailboxFile( WhichServer : Integer );
  322.     procedure LoadEmailCorrespondentsFile;
  323.     procedure SaveEMailCorrespondentsFile;
  324.     procedure SetupEMailServerStatus;
  325.     procedure SetupNNTPServersInfoDisplay;
  326.     procedure SaveFTPSiteFile;
  327.     procedure SetupFTPSiteLists;
  328.     procedure SaveNNTPSiteFile;
  329.     procedure SetupNNTPSiteLists;
  330.     procedure SetupNNTPNewsGroupsInfoDisplay;
  331.     procedure SetupNNTPNewsGroupLists;
  332.     procedure SaveNNTPNewsGroupLists;
  333.     procedure SetupNewsGroupListboxes;
  334.     procedure SetupEMailListboxes;
  335.     procedure SetupMailboxLists;
  336.     procedure SetupEMailServersInfoDisplay;
  337.     procedure SetupEMailMailboxInfoDisplay;
  338.     procedure PopulateLB2WithArticleHeaders;
  339.     procedure PopulateLB2WithMessageHeaders;
  340.     procedure SetupEMailCorrespondentsInfoDisplay;
  341.     procedure AddNullTermTextToMemo( TheTextToAdd   : String;
  342.                                      TheMemoToAddTo : TMemo   );
  343.     function AddNullTermTextToLabel( TheTextToAdd   : String ) : String;
  344.     procedure SetHGCursors;
  345.     procedure SetNormalCursors;
  346.     procedure AddProgressText( WhatText : String );
  347.     procedure ShowProgressText( WhatText : String );
  348.     procedure ShowProgressErrorText( WhatText : String );
  349.     procedure SocketsErrorOccurred( Sender     : TObject;
  350.                                      ErrorCode  : Integer;
  351.                                      TheMessage : String   );
  352.   end;
  353. var
  354.   CCINetCCForm         : TCCINetCCForm;
  355.   ProgressList         : TStringList;    { Used to hold progress text info }
  356.   ProgressFileName     : String;         { Used to hold progress file name }
  357.   ProgressOutputVector : Integer;        { Used to direct progress output  }
  358.   TheFTPSiteList       : TList;          { Used to store the FTP site recs }
  359.   TheWorkingFTPSL      : TList;          { Used to store working copy of l }
  360.   TheNewsServerList    : TList;          { Used to hold list of NNTP servs }
  361.   TheWorkingNSSL       : TList;          { Used for working copy of above  }
  362.   TheEMailServerList   : TList;          { Used for list of POP3/SMTP serv }
  363.   TheWorkingEMSL       : TList;          { Used for working copy of above  }
  364.   TheNewsRCList        : TList;          { Used for list of available ngs  }
  365.   TheWorkingNRCSL      : TList;          { Used for working copy of above  }
  366.   TheNGArticlesList    : TList;          { Used for current articles list  }
  367.                                          { (will hot swap from pointer of  }
  368.                                          {  Tlist of Tlists in base rec.)  }
  369.   TheEMailMailboxList  : TList;          { Used for list of available mbs  }
  370.   TheWorkingMBSL       : TList;          { Used for working copy of above  }
  371.   TheCorrespondentsList: TList;          { Used for list of correspondents }
  372.   TheWorkingCPSL       : TList;          { Used for working copy of above  }
  373.   TheMBMessagesList    : TList;          { Used for current msgs; hotswaps }
  374.   TheEMailServerFile   : CRFile;         { File of Email servers records   }
  375.   TheEMailCorrespondentsFile : CRFile;
  376.   TheNewsServerFile    : CRFile;         { File of NNTP servers records    }
  377.   TheNewsRCFile        : NGRFile;        { File of Newsgroups records      }
  378.   TheNewsArticleFile   : NGARFile;       { Current ng articles records file}
  379.   TheEMailMailboxFile  : EMMBRFile;      { File of Mailboxes records       }
  380.   TheEMailMessagesFile : EMMRFile;       { Current mb messages records file}
  381.   TheFTPSiteFile       : CRFile;         { Used to load the FTP site file  }
  382.   TheICCIniFile        : TIniFile;       { Used to retrieve the INI File   }
  383.   MailPath             : String;         { Used for path to Mail Files     }
  384.   NewsPath             : String;         { Used for path to News Files     }
  385.   FTPPath              : String;         { Used for path to FTP Files      }
  386.   CurrentPassWordString : String;        { Used to hold login id for anons }
  387.   CurrentEMPassWordString : String;      { Used to hold login id for anons }
  388.   PassWordControlVector : Integer;       { Used to hold display of pw vect }
  389.   CurrentRealPWString   : String;        { Used to hold a real password    }
  390.   EMPassWordControlVector : Integer;       { Used to hold display of pw vect }
  391.   CurrentEMRealPWString   : String;        { Used to hold a real password    }
  392.   TheFTPComponent       : TFTPComponent; { FTP Object                      }
  393.   TheLine ,
  394.   HolderLine ,
  395.   GlobalTextBuffer      : String;
  396.   TheAnonRedialVector ,
  397.   DefaultDownloadVector : Integer;
  398.   NewsReadArticlePurgingVector : Integer;
  399.   NewsPostQueueingVector : Integer;
  400.   NewsReadArticleDisplayVector : Integer;
  401.   NewsUUMIMEVector : Integer;
  402.   NewsInitialUpdateVector : Integer;
  403.   LeftoverText          : String;
  404.   LeftoversOnTable      : Boolean;
  405.   FileNameToXFer        : String;
  406.   WhichServer           : Integer;       { Holds current NNTP server }
  407.   WhichGroup            : Integer;       { Holds current NNTP newsgroup }
  408.   TheUUObject           : TUUCodingObject;
  409.   EMRemoteDeletionVector : Integer;
  410.   EMChokeVector : Integer;
  411.   EMDefaultDownloadVector : Integer;
  412.   EMQueueVector : Integer;
  413.   NewsgroupListLoaded ,
  414.   EmailLoaded ,
  415.   NewMessageInProgress : Boolean;
  416.   TheUUDecodeList      : TStringList;
  417.   
  418. implementation
  419.  
  420. uses CCICCPOP, CCICNNTP;
  421.  
  422. var
  423.   TheNNTPComponent      : TNNTPComponent;{ NNTP News Object                }
  424.  
  425. {$R *.DFM}
  426.  
  427.  
  428. { This procedure actually attempts to connect to the internet at an POP3SMTP site }
  429. function TCCINetCCForm.DoPOP3Connection( PCRPointer : PConnectionsRecord ) : boolean;
  430. begin
  431.   { Create the component }
  432.   Result := false;
  433.   { Do busy cursors }
  434.   SetHGCursors;
  435.   if not ThePOP3SMTPComponent.EstablishPOP3Connection( PCRPointer ) then
  436.   begin
  437.     { Do saved cursors }
  438.     ThePOP3SMTPComponent.POP3CommandInProgress := false;
  439.     ThePOP3SMTPComponent.Connection_Established := false;
  440.     SetNormalCursors;
  441.     exit;
  442.   end;
  443.   if not ThePOP3SMTPComponent.LoginUser( PCRPointer ) then
  444.   begin
  445.     { Do saved cursors }
  446.     ThePOP3SMTPComponent.POP3CommandInProgress := false;
  447.     ThePOP3SMTPComponent.Connection_Established := false;
  448.     SetNormalCursors;
  449.     exit;
  450.   end;
  451.   if not ThePOP3SMTPComponent.SendPassword( PCRPointer ) then
  452.   begin
  453.     { Do saved cursors }
  454.     ThePOP3SMTPComponent.POP3CommandInProgress := false;
  455.     ThePOP3SMTPComponent.Connection_Established := false;
  456.     SetNormalCursors;
  457.     exit;
  458.   end;
  459.   SetNormalCursors;
  460.   Result := true;
  461.   EnablePOP3SMTPMenus;
  462.   ThePOP3SMTPComponent.POP3CommandInProgress := false;
  463.   Panel1.Caption := '  Status : Connected to ' + PCRPointer^.CIPAddress;
  464. end;
  465.  
  466. { This procedure actually attempts to connect to the internet at an POP3SMTP site }
  467. function TCCINetCCForm.DoSMTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  468. begin
  469.   { Create the component }
  470.   Result := false;
  471.   { Do busy cursors }
  472.   SetHGCursors;
  473.   if not ThePOP3SMTPComponent.EstablishSMTPConnection( PCRPointer ) then
  474.   begin
  475.     { Do saved cursors }
  476.     ThePOP3SMTPComponent.SMTPCommandInProgress := false;
  477.     ThePOP3SMTPComponent.Connection_Established := false;
  478.     SetNormalCursors;
  479.     exit;
  480.   end;
  481.   if not ThePOP3SMTPComponent.SendHelo( PCRPointer ) then
  482.   begin
  483.     { Do saved cursors }
  484.     ThePOP3SMTPComponent.SMTPCommandInProgress := false;
  485.     ThePOP3SMTPComponent.Connection_Established := false;
  486.     SetNormalCursors;
  487.     exit;
  488.   end;
  489.   SetNormalCursors;
  490.   Result := true;
  491.   ThePOP3SMTPComponent.SMTPCommandInProgress := false;
  492.   Panel1.Caption := '  Status : Connected to ' + PCRPointer^.CIPAddress;
  493. end;
  494.  
  495. { This procedure actually attempts to disconnect to the internet at an ftp site}
  496. procedure TCCINetCCForm.DoPOP3SMTPDisconnect;
  497. begin
  498.   { Kill the socket }
  499.   ThePOP3SMTPComponent.Socket1.CCSockClose;
  500.   ThePOP3SMTPComponent.Connection_Established := false;
  501. end;
  502.  
  503. { Procedure to load the POP3SMTP Site list }
  504. procedure TCCINetCCForm.LoadEmailServerFile;
  505. var ThePSSRecord : PConnectionsRecord; { Generic TCR Pointer    }
  506.     PSSLName     : String;             { POP3SMTP Site List filename }
  507.     Counter_1    : Integer;            { Loop counter           }
  508. begin
  509.   { Create the sites list list }
  510.   TheEMailServerList := TList.Create;
  511.   { Set up the FTP sites list file name }
  512.   PSSLName := MailPath + '\PSSERVER.TCR';
  513.   { If the FTP Site List exists load it in }
  514.   if FileExists( PSSLName ) then
  515.   begin
  516.     { set up the file and open it }
  517.     AssignFile( TheEMailServerFile , PSSLName );
  518.     Reset( TheEMailServerFile );
  519.     { read in the records }
  520.     for Counter_1 := 0 to FileSize( TheEMailServerFile ) - 1 do
  521.     begin
  522.       { Create the TCRecord }
  523.       New( ThePSSRecord );
  524.       { Read in the data record }
  525.       Seek( TheEMailServerFile , Counter_1 );
  526.       Read( TheEMailServerFile , ThePSSRecord^ );
  527.       { Add the record to the list }
  528.       TheEMailServerList.Add( ThePSSRecord );
  529.     end;
  530.     { close the file }
  531.     CloseFile( TheEMailServerFile );
  532.   end
  533.   else
  534.   { Otherwise create a default one with the a generic mail site (?) }
  535.   begin
  536.     { create new record }
  537.     New( ThePSSRecord );
  538.     { fill in its info }
  539.     with ThePSSRecord^ do
  540.     begin
  541.       CProfile   := 'My Mail Server';
  542.       CIPAddress := 'mail.myprovider.com';
  543.       CUserName  := 'myname';
  544.       CPassword  := 'mypassword';
  545.       CStartDir  := 'myname@myprovider.com';
  546.     end;
  547.     { add it to the list }
  548.     { do it three more times }
  549.     TheEMailServerList.Add( ThePSSRecord );
  550.     { create the file and write out the data, then close it }
  551.     AssignFile( TheEMailServerFile , PSSLName );
  552.     Rewrite( TheEMailServerFile );
  553.     ThePSSRecord :=
  554.        PConnectionsRecord( TheEMailServerList.Items[ 0 ] );
  555.       Seek( TheEMailServerFile , 0 );
  556.       Write( TheEMailServerFile , ThePSSRecord^ );
  557.     CloseFile( TheEMailServerFile );
  558.   end;
  559.   TheWorkingEMSL := TList.Create;
  560.   For Counter_1 := 0 to TheEMailServerList.Count - 1 do
  561.   begin
  562.     New( ThePSSRecord );
  563.     ThePSSRecord^ := PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] )^;
  564.     TheWorkingEMSL.Add( ThePSSRecord );
  565.   end;
  566. end;
  567.  
  568. procedure TCCINetCCForm.SaveEMailServerFile;
  569. var ThePSSRecord : PConnectionsRecord; { The TC Record pointer   }
  570.     PSSLName     : String;             { POP3SMTP Site List filename }
  571.     Counter_1    : Integer;            { Loop counter           }
  572. begin
  573.   { Set up the file name }
  574.   PSSLName := MailPath + '\PSSERVER.TCR';
  575.   { Assign the file }
  576.   AssignFile( TheEMailServerFile , PSSLName );
  577.   { Rewrite it }
  578.   Rewrite( TheEMailServerFile );
  579.   { run the list through the procedure }
  580.   for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  581.   begin
  582.     { get the record from the list }
  583.     ThePSSRecord :=
  584.      PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] );
  585.     { Do the seek/write }
  586.     Seek( TheEMailServerFile , Counter_1 );
  587.     Write( TheEMailServerFile , ThePSSRecord^ );
  588.     { free the record }
  589.     Dispose( ThePSSRecord );
  590.   end;
  591.   { Close the file }
  592.   CloseFile( TheEMailServerFile );
  593.   { Free the list pointers }
  594.   TheEMailServerList.Free;
  595.   for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  596.   begin
  597.     ThePSSRecord := PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] );
  598.     Dispose( ThePSSRecord );
  599.   end;
  600.   TheWorkingEMSL.Free;
  601. end;
  602.  
  603. { Procedure to load the POP3SMTP Site list }
  604. procedure TCCINetCCForm.LoadEmailMailboxFile( WhichServer : Integer );
  605. var TheMBRecord : PEMailMailboxRecord; { Generic TCR Pointer    }
  606.     PSMBName    : String;              { Mailbox filename       }
  607.     Counter_1   ,
  608.     Counter_2   : Integer;             { Loop counter           }
  609.     TheMessagesList : TList;
  610.     TheEMMRecord : PEMailMessageRecord;
  611. begin
  612.   { Create the sites list list }
  613.   TheEMailMailboxList := TList.Create;
  614.   { Set up the FTP sites list file name }
  615.   PSMBName := MailPath + '\MAILBX' + IntToStr( WhichServer ) + '.MBX';
  616.   { If the FTP Site List exists load it in }
  617.   if FileExists( PSMBName ) then
  618.   begin
  619.     { set up the file and open it }
  620.     AssignFile( TheEMailMailboxFile , PSMBName );
  621.     Reset( TheEMailMailboxFile );
  622.     { read in the records }
  623.     for Counter_1 := 0 to FileSize( TheEMailMailboxFile ) - 1 do
  624.     begin
  625.       { Create the TCRecord }
  626.       New( TheMBRecord );
  627.       { Read in the data record }
  628.       Seek( TheEMailMailboxFile , Counter_1 );
  629.       Read( TheEMailMailboxFile , TheMBRecord^ );
  630.       { Add the record to the list }
  631.       TheEMailMailboxList.Add( TheMBRecord );
  632.     end;
  633.     { close the file }
  634.     CloseFile( TheEMailMailboxFile );
  635.   end
  636.   else
  637.   { Otherwise create a default one with the In and Out mailboxes (?) }
  638.   begin
  639.     { create new record }
  640.     New( TheMBRecord );
  641.     { fill in its info }
  642.     with TheMBRecord^ do
  643.     begin
  644.       MBName         := 'In Box';
  645.       MBIDNumber     := 1;
  646.       MBMaxMsgNumber := 0;
  647.       MBTotal        := 0;
  648.       MBUnReadTotal  := 0;
  649.       MBUnSentTotal  := 0;
  650.       MBMsgFileName  := 'MB1.MBX';
  651.       MBLTag         := 0;
  652.     end;
  653.     { add it to the list }
  654.     TheEMailMailboxList.Add( TheMBRecord );
  655.     { create new record }
  656.     New( TheMBRecord );
  657.     { fill in its info }
  658.     with TheMBRecord^ do
  659.     begin
  660.       MBName         := 'Out Box';
  661.       MBIDNumber     := 2;
  662.       MBMaxMsgNumber := 0;
  663.       MBTotal        := 0;
  664.       MBUnReadTotal  := 0;
  665.       MBUnSentTotal  := 0;
  666.       MBMsgFileName  := 'MB2.MBX';
  667.       MBLTag         := 0;
  668.     end;
  669.     { add it to the list }
  670.     TheEMailMailboxList.Add( TheMBRecord );
  671.     { create the file and write out the data, then close it }
  672.     AssignFile( TheEMailMailboxFile , PSMBName );
  673.     Rewrite( TheEMailMailboxFile );
  674.     TheMBRecord :=
  675.        PEMailMailboxRecord( TheEMailMailboxList.Items[ 0 ] );
  676.       Seek( TheEMailMailboxFile , 0 );
  677.       Write( TheEMailMailboxFile , TheMBRecord^ );
  678.     TheMBRecord :=
  679.        PEMailMailboxRecord( TheEMailMailboxList.Items[ 1 ] );
  680.       Seek( TheEMailMailboxFile , 1 );
  681.       Write( TheEMailMailboxFile , TheMBRecord^ );
  682.     CloseFile( TheEMailMailboxFile );
  683.   end;
  684.   { Load in Message Records and create storage lists }
  685.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  686.   begin
  687.     PSMBName := PEMailMailboxRecord(
  688.      TheEMailMailboxList.Items[ Counter_1 ] )^.MBMsgFileName;
  689.     if FileExists( MailPath + '\' + PSMBName ) then
  690.     begin
  691.       TheMessagesList := TList.Create;
  692.       AssignFile( TheEMailMessagesFile , MailPath + '\' + PSMBName );
  693.       Reset( TheEMailMessagesFile );
  694.       for Counter_2 := 0 to FileSize( TheEMailMessagesFile ) - 1 do
  695.       begin
  696.         New( TheEMMRecord );
  697.         Seek( TheEMailMessagesFile , Counter_2 );
  698.         Read( TheEMailMessagesFile , TheEMMRecord^ );
  699.         TheMessagesList.Add( TheEMMRecord );
  700.       end;
  701.       CloseFile( TheEMailMessagesFile );
  702.       PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^.MBLTag :=
  703.        Longint( TheMessagesList );
  704.     end
  705.     else
  706.     begin
  707.       TheMessagesList := TList.Create;
  708.       PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^.MBLTag :=
  709.        Longint( TheMessagesList );
  710.     end;
  711.   end;
  712.   TheWorkingMBSL := TList.Create;
  713.   For Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  714.   begin
  715.     New( TheMBRecord );
  716.     TheMBRecord^ := PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^;
  717.     TheWorkingMBSL.Add( TheMBRecord );
  718.   end;
  719. end;
  720.  
  721. procedure TCCINetCCForm.SaveEMailMailboxFile( WhichServer : Integer );
  722. var TheMBRecord : PEMailMailboxRecord; { Generic TCR Pointer    }
  723.     PSMBName    : String;              { Mailbox filename       }
  724.     Counter_2 ,
  725.     Counter_1   : Integer;             { Loop counter           }
  726.     TheList     : TList;
  727.     TheEMMRecord : PEMailMessageRecord;
  728. begin
  729.   { Load in Message Records and create storage lists }
  730.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  731.   begin
  732.     PSMBName := PEMailMailboxRecord(
  733.      TheEMailMailboxList.Items[ Counter_1 ] )^.MBMsgFileName;
  734.     TheList := TList( PEMailMailboxRecord(
  735.      TheEMailMailboxList.Items[ Counter_1 ] )^.MBLTag );
  736.     AssignFile( TheEMailMessagesFile , Mailpath + '\' + PSMBName );
  737.     Rewrite( TheEMailMessagesFile );
  738.     for Counter_2 := 0 to TheList.Count - 1 do
  739.     begin
  740.       TheEMMRecord := PEMailMessageRecord( TheList.Items[ Counter_2 ] );
  741.       Seek( TheEMailMessagesFile , Counter_2 );
  742.       Write( TheEMailMessagesFile , TheEMMRecord^ );
  743.       Dispose( TheEMMRecord );
  744.     end;
  745.     CloseFile( TheEMailMessagesFile );
  746.     TheList.Free;
  747.   end;
  748.   { Set up the file name }
  749.   PSMBName := MailPath + '\MAILBX' + IntToStr( WhichServer ) + '.MBX';
  750.   { Assign the file }
  751.   AssignFile( TheEMailMailboxFile , PSMBName );
  752.   { Rewrite it }
  753.   Rewrite( TheEMailMailboxFile );
  754.   { run the list through the procedure }
  755.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  756.   begin
  757.     { get the record from the list }
  758.     TheMBRecord :=
  759.      PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] );
  760.     { Do the seek/write }
  761.     Seek( TheEMailMailboxFile , Counter_1 );
  762.     Write( TheEMailMailboxFile , TheMBRecord^ );
  763.     { free the record }
  764.     Dispose( TheMBRecord );
  765.   end;
  766.   { Close the file }
  767.   CloseFile( TheEMailMailboxFile );
  768.   { Free the list pointers }
  769.   TheEMailMailboxList.Free;
  770.   for Counter_1 := 0 to TheWorkingMBSL.Count - 1 do
  771.   begin
  772.     TheMBRecord := PEMailMailboxRecord( TheWorkingMBSL.Items[ Counter_1 ] );
  773.     Dispose( TheMBRecord );
  774.   end;
  775.   TheWorkingMBSL.Free;
  776. end;
  777.  
  778. { Procedure to load the POP3SMTP Site list }
  779. procedure TCCINetCCForm.LoadEmailCorrespondentsFile;
  780. var ThePSSRecord : PConnectionsRecord; { Generic TCR Pointer    }
  781.     PSSLName     : String;             { POP3SMTP Site List filename }
  782.     Counter_1    : Integer;            { Loop counter           }
  783. begin
  784.   { Create the sites list list }
  785.   TheCorrespondentsList := TList.Create;
  786.   { Set up the FTP sites list file name }
  787.   PSSLName := MailPath + '\PSCORRSP.TCR';
  788.   { If the FTP Site List exists load it in }
  789.   if FileExists( PSSLName ) then
  790.   begin
  791.     { set up the file and open it }
  792.     AssignFile( TheEMailCorrespondentsFile , PSSLName );
  793.     Reset( TheEMailCorrespondentsFile );
  794.     { read in the records }
  795.     for Counter_1 := 0 to FileSize( TheEMailCorrespondentsFile ) - 1 do
  796.     begin
  797.       { Create the TCRecord }
  798.       New( ThePSSRecord );
  799.       { Read in the data record }
  800.       Seek( TheEMailCorrespondentsFile , Counter_1 );
  801.       Read( TheEMailCorrespondentsFile , ThePSSRecord^ );
  802.       { Add the record to the list }
  803.       TheCorrespondentsList.Add( ThePSSRecord );
  804.     end;
  805.     { close the file }
  806.     CloseFile( TheEMailCorrespondentsFile );
  807.   end
  808.   else
  809.   { Otherwise create a default one with the author }
  810.   begin
  811.     { create new record }
  812.     New( ThePSSRecord );
  813.     { fill in its info }
  814.     with ThePSSRecord^ do
  815.     begin
  816.       CProfile   := 'Nathan Wallace at TDE';
  817.       CIPAddress := 'kilgalen@tde.com';
  818.       CUserName  := '';
  819.       CPassword  := '';
  820.       CStartDir  := '';
  821.     end;
  822.     { add it to the list }
  823.     { do it three more times }
  824.     TheCorrespondentsList.Add( ThePSSRecord );
  825.     { create the file and write out the data, then close it }
  826.     AssignFile( TheEMailCorrespondentsFile , PSSLName );
  827.     Rewrite( TheEMailCorrespondentsFile );
  828.     ThePSSRecord :=
  829.        PConnectionsRecord( TheCorrespondentsList.Items[ 0 ] );
  830.       Seek( TheEMailCorrespondentsFile , 0 );
  831.       Write( TheEMailCorrespondentsFile , ThePSSRecord^ );
  832.     CloseFile( TheEMailCorrespondentsFile );
  833.   end;
  834.   TheWorkingCPSL := TList.Create;
  835.   For Counter_1 := 0 to TheCorrespondentsList.Count - 1 do
  836.   begin
  837.     New( ThePSSRecord );
  838.     ThePSSRecord^ := PConnectionsRecord( TheCorrespondentsList.Items[ Counter_1 ] )^;
  839.     TheWorkingCPSL.Add( ThePSSRecord );
  840.   end;
  841.   CCInetCCForm.ComboBox2.Clear;
  842.   CCInetCCForm.ComboBox3.Clear;
  843.   { Add the new info }
  844.   for Counter_1 := 0 to TheWorkingCPSL.Count - 1 do
  845.   begin
  846.     CCINetCCForm.ComboBox2.Items.Add( PConnectionsRecord(
  847.      TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  848.     CCINetCCForm.ComboBox3.Items.Add( PConnectionsRecord(
  849.      TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  850.   end;
  851.   CCINetCCForm.ComboBox2.ItemIndex := 0;
  852.   CCINetCCForm.ComboBox3.ItemIndex := 0;
  853. end;
  854.  
  855. procedure TCCINetCCForm.SaveEMailCorrespondentsFile;
  856. var ThePSSRecord : PConnectionsRecord; { The TC Record pointer   }
  857.     PSSLName     : String;             { POP3SMTP Site List filename }
  858.     Counter_1    : Integer;            { Loop counter           }
  859. begin
  860.   { Set up the file name }
  861.   PSSLName := MailPath + '\PSCORRSP.TCR';
  862.   { Assign the file }
  863.   AssignFile( TheEMailCorrespondentsFile , PSSLName );
  864.   { Rewrite it }
  865.   Rewrite( TheEMailCorrespondentsFile );
  866.   { run the list through the procedure }
  867.   for Counter_1 := 0 to TheCorrespondentsList.Count - 1 do
  868.   begin
  869.     { get the record from the list }
  870.     ThePSSRecord :=
  871.      PConnectionsRecord( TheCorrespondentsList.Items[ Counter_1 ] );
  872.     { Do the seek/write }
  873.     Seek( TheEMailCorrespondentsFile , Counter_1 );
  874.     Write( TheEMailCorrespondentsFile , ThePSSRecord^ );
  875.     { free the record }
  876.     Dispose( ThePSSRecord );
  877.   end;
  878.   { Close the file }
  879.   CloseFile( TheEMailCorrespondentsFile );
  880.   { Free the list pointers }
  881.   TheCorrespondentsList.Free;
  882.   for Counter_1 := 0 to TheWorkingCPSL.Count - 1 do
  883.   begin
  884.     ThePSSRecord := PConnectionsRecord( TheWorkingCPSL.Items[ Counter_1 ] );
  885.     Dispose( ThePSSRecord );
  886.   end;
  887.   TheWorkingCPSL.Free;
  888. end;
  889.  
  890. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  891. procedure TCCINetCCForm.SetupEMailServerStatus;
  892. begin
  893.   { Set up display for main form }
  894.   CCINetCCForm.Tag := 6; { Email Tag }
  895.   CCINetCCForm.Caption := 'CC Internet Command Center -- EMail Mode';
  896.   CCINetCCForm.ViewWinsockInfo1.Enabled := false;
  897.   CCINetCCForm.EMail2.Enabled := true;
  898.   CCINetCCForm.EMail1.Enabled := false;
  899.   CCINetCCForm.UsenetNws1.Enabled := false;
  900.   CCINetCCForm.FTP1.Enabled := false;
  901.   CCINetCCForm.Label1.Caption := 'Mail Server:';
  902.   CCINetCCForm.Button1.Caption := 'New Mail';
  903.   CCINetCCForm.Label4.Caption := 'Mailboxes';
  904.   CCINetCCForm.Label5.Caption := 'Messages';
  905. end;
  906.  
  907. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  908. procedure TCCINetCCForm.SetupMailboxLists;
  909. var TheEMMRecord : PEMailMessageRecord; {  }
  910.     Counter_1 ,
  911.     Counter_2    : Integer;             {  }
  912.     EMMFileName  : String;              {  }
  913.     WorkingList  : TList;
  914. begin
  915.   { Abort if no server to select }
  916.   if ComboBox1.ItemIndex = -1 then exit;
  917.   { Get number of server in list }
  918.   WhichServer := ComboBox1.ItemIndex;
  919.   { Load in mailbox data }
  920.   LoadEmailMailboxFile( WhichServer );
  921.   { Load in Mailbox Records and create storage lists }
  922.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  923.   begin
  924.     EMMFileName := PEMailMailboxRecord(
  925.      TheEMailMailboxList.Items[ Counter_1 ] )^.MBMsgFileName;
  926.     if FileExists( MailPath + '\' + EMMFileName ) then
  927.     begin
  928.       WorkingList := TList.Create;
  929.       AssignFile( TheEMailMessagesFile , EMMFileName );
  930.       Reset( TheEMailMessagesFile );
  931.       for Counter_2 := 0 to FileSize( TheEMailMessagesFile ) - 1 do
  932.       begin
  933.         New( TheEMMRecord );
  934.         Seek( TheEMailMessagesFile , Counter_2 );
  935.         Read( TheEMailMessagesFile , TheEMMRecord^ );
  936.         WorkingList.Add( TheEMMRecord );
  937.       end;
  938.       CloseFile( TheEMailMessagesFile );
  939.       PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^.MBLTag :=
  940.        Longint( WorkingList );
  941.     end
  942.     else
  943.     begin
  944.       WorkingList := TList.Create;
  945.       PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^.MBLTag :=
  946.        Longint( WorkingList );
  947.     end;
  948.   end;
  949. end;
  950.  
  951. { This procedure populates LB2 with article subjects for any }
  952. { available articles for a given newsgroup.                  }
  953. procedure TCCINetCCForm.PopulateLB2WithMessageHeaders;
  954. var Counter_1    : Integer;
  955.     TheEMMRecord : PEMailMessageRecord;
  956.     TempString   : String;
  957. begin
  958.   { Clear target list box }
  959.   ListBox2.Clear;
  960.   for Counter_1 := 0 to TheMBMessagesList.Count - 1 do
  961.   begin
  962.     TheEMMRecord :=
  963.      PEMailMessageRecord( TheMBMessagesList.Items[ Counter_1 ] );
  964.     TempString := '    [' + IntToStr( Counter_1 + 1 ) + '] ' +
  965.      TheEMMRecord^.MRMessageSubject;
  966.     if TheEMMRecord^.MRRead then TempString[ 2 ] := 'R';
  967.     if TheEMMRecord^.MRSent then TempString[ 2 ] := 'S';
  968.     if TheEMMRecord^.MRMessageSender = 'DELETE ME' then TempString[ 3 ] := 'T';
  969.     ListBox2.Items.Add( TempString );
  970.   end;
  971. end;
  972.  
  973. { This procedure swaps in the list of subscribed newsgroups to LB1 }
  974. { and calls another procedure to populate LB2 with any available   }
  975. { articles for the newsgroup.                                      }
  976. procedure TCCINetCCForm.SetupEMailListboxes;
  977. var Counter_1   : Integer;
  978.     TempString  : String;
  979.     TheMBRecord : PEMailMailboxRecord;
  980. begin
  981.   ListBox1.Clear;
  982.   ListBox1.Tag := 6;
  983.   ListBox2.Tag := 6;
  984.   Label4.Caption := 'Mailboxes';
  985.   Label5.Caption := 'Messages';
  986.   if TheEMailMailboxList.Count = 0 then
  987.   begin
  988.     ListBox2.Clear;
  989.     exit;
  990.   end;
  991.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  992.   begin
  993.     TheMBRecord := PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] );
  994.     TempString := TheMBRecord^.MBName;
  995.     if TheMBRecord^.MBUnSentTotal > 0 then TempString := TempString + ' {' +
  996.      IntToStr( TheMBRecord^.MBUnSentTotal ) + ' Queued}' else
  997.      if TheMBRecord^.MBUnReadTotal > 0 then TempString := TempString +
  998.        ' {' + IntToStr( TheMBRecord^.MBUnReadTotal ) + ' New}';
  999.     TempString := TempString + '{' + IntToStr( TheMBRecord^.MBTotal ) + ' Stored}';
  1000.     ListBox1.Items.Add( TempString );
  1001.   end;
  1002.   TheMBRecord := PEMailMailboxRecord( TheEMailMailboxList.Items[ 0 ] );
  1003.   TheMBMessagesList := TList( TheMBRecord^.MBLTag );
  1004.   PopulateLB2WithMessageHeaders;
  1005.   Label1.Caption := 'MailBox:';
  1006.   Button1.Caption := 'New Mail';
  1007. end;
  1008.  
  1009. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1010. procedure TCCINetCCForm.SetupEMailServersInfoDisplay;
  1011. var Counter_1  : Integer;            { Loop counter        }
  1012. begin
  1013.   { Set tag for POP3SMTP stuff }
  1014.   CCICInfoDlg.Tag := 6; { EMail Tag -- servers }
  1015.   { set up caption of main label }
  1016.   CCICInfoDlg.Label2.Caption := 'EMail Server Sites';
  1017.   { hide outline panel }
  1018.   CCICInfoDlg.Panel6.Top := 200;
  1019.   CCICInfoDlg.panel6.Height := 144;
  1020.   CCICInfoDlg.Panel6.Visible := false;
  1021.   CCICInfoDlg.Panel5.Visible := true;
  1022.   CCICInfoDlg.Panel8.Visible := true;
  1023.   CCICInfoDlg.Panel9.Visible := true;
  1024.   { clear the list box }
  1025.   CCICInfoDlg.ListBox1.Visible := false;
  1026.   CCICInfoDlg.ListBox2.Clear;
  1027.   CCINetCCForm.ComboBox1.Clear;
  1028.   { add profile strings to the list box }
  1029.   for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  1030.   begin
  1031.     CCICInfoDlg.ListBox2.Items.Add( PConnectionsRecord(
  1032.      TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  1033.     CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  1034.      TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  1035.   end;
  1036.   { Set up caption of special button }
  1037.   CCICInfoDlg.Button1.Visible := false;
  1038.   { Start with top record }
  1039.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  1040.   CCINetCCForm.ComboBox1.ItemIndex := 0;
  1041.   { put in data from top record and reset captions }
  1042.   with PConnectionsRecord( TheEMailServerList.Items[ 0 ] )^ do
  1043.   begin
  1044.     with CCICInfoDlg do
  1045.     begin
  1046.       Edit1.Text := CProfile;
  1047.       Panel2.Caption := '            Name:';
  1048.       Edit2.Text := CIPAddress;
  1049.       Panel3.Caption := '     IP Address:';
  1050.       Edit3.Text := CUserName;
  1051.       Panel5.Caption := '    User Name:';
  1052.       CurrentEMRealPWString := CPassword;
  1053.       case EMPasswordControlVector of
  1054.         1 : Edit4.Text := CPassword;
  1055.         2 : Edit4.Text := '**********';
  1056.       end;
  1057.       Panel8.Caption := '      Password:';
  1058.       Edit5.Text := CStartDir;
  1059.       Panel9.Caption := '    EMail Address:';
  1060.     end;
  1061.   end;
  1062. end;
  1063.  
  1064. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1065. procedure TCCINetCCForm.SetupEMailMailboxInfoDisplay;
  1066. var Counter_1      : Integer;
  1067.     TheWorkingList : TList;
  1068. begin
  1069.   { Set tag for POP3SMTP stuff }
  1070.   CCICInfoDlg.Tag := 7; { EMail Tag -- mailboxes }
  1071.   { set up caption of main label }
  1072.   CCICInfoDlg.Label2.Caption := 'Mailboxes';
  1073.   { hide outline panel }
  1074.   CCICInfoDlg.Panel6.Visible := true;
  1075.   CCICInfoDlg.Panel6.Top := 40;
  1076.   CCICInfoDlg.Panel6.Height := 304;
  1077.   CCICInfoDlg.Label1.Caption := 'Saved Messages';
  1078.   CCICInfoDlg.Panel3.Visible := false;
  1079.   CCICInfoDlg.Panel5.Visible := false;
  1080.   CCICInfoDlg.Panel8.Visible := false;
  1081.   CCICInfoDlg.Panel9.Visible := false;
  1082.   { clear the list box }
  1083.   CCICInfoDlg.ListBox1.Visible := true;
  1084.   CCICInfoDlg.ListBox1.MultiSelect := true;
  1085.   CCICInfoDlg.ListBox1.ExtendedSelect := true;
  1086.   CCICInfoDlg.ListBox2.Clear;
  1087.   CCICInfoDlg.ListBox1.Clear;
  1088.   { add profile strings to the list box }
  1089.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  1090.   begin
  1091.     CCICInfoDlg.ListBox2.Items.Add( PEMailMailboxRecord(
  1092.      TheEMailMailboxList.Items[ Counter_1 ] )^.MBName );
  1093.   end;
  1094.   { Set up caption of special button }
  1095.   CCICInfoDlg.Button1.Visible := true;
  1096.   CCICInfoDlg.Button1.Caption := 'XFer on Click';
  1097.   { Start with top record }
  1098.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  1099.   { put in data from top record and reset captions }
  1100.   with PEMailMailboxRecord( TheEMailMailboxList.Items[ 0 ] )^ do
  1101.   begin
  1102.     with CCICInfoDlg do
  1103.     begin
  1104.       Edit1.Text := MBName;
  1105.       Panel2.Caption := 'MB Name:';
  1106.       TheWorkingList := TList( MBLTag );
  1107.       if TheWorkingList.Count > 0 then
  1108.       begin
  1109.         ListBox1.Clear;
  1110.         for Counter_1 := 0 to TheWorkingList.Count - 1 do
  1111.         begin
  1112.           ListBox1.Items.Add( PEMailMessageRecord(
  1113.            TheWorkingList.Items[ Counter_1 ] )^.MRMessageSubject );
  1114.         end;
  1115.         Listbox1.ItemIndex := 0;
  1116.       end;
  1117.     end;
  1118.   end;
  1119. end;
  1120.  
  1121. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1122. procedure TCCINetCCForm.SetupEMailCorrespondentsInfoDisplay;
  1123. var Counter_1  : Integer;            { Loop counter        }
  1124. begin
  1125.   { Set tag for POP3SMTP stuff }
  1126.   CCICInfoDlg.Tag := 8; { EMail Tag -- correspondents }
  1127.   { set up caption of main label }
  1128.   CCICInfoDlg.Label2.Caption := 'Correspondents';
  1129.   { hide outline panel }
  1130.   CCICInfoDlg.Panel3.Visible := true;
  1131.   CCICInfoDlg.Panel6.Visible := false;
  1132.   CCICInfoDlg.Panel5.Visible := false;
  1133.   CCICInfoDlg.Panel8.Visible := false;
  1134.   CCICInfoDlg.Panel9.Visible := false;
  1135.   CCICInfoDlg.ListBox1.Visible := false;
  1136.   { clear the list box }
  1137.   CCICInfoDlg.ListBox2.Clear;
  1138.   { add profile strings to the list box }
  1139.   for Counter_1 := 0 to TheCorrespondentsList.Count - 1 do
  1140.   begin
  1141.     CCICInfoDlg.ListBox2.Items.Add( PConnectionsRecord(
  1142.      TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  1143.   end;
  1144.   { Set up caption of special button }
  1145.   CCICInfoDlg.Button1.Visible := false;
  1146.   { Start with top record }
  1147.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  1148.   { put in data from top record and reset captions }
  1149.   with PConnectionsRecord( TheCorrespondentsList.Items[ 0 ] )^ do
  1150.   begin
  1151.     with CCICInfoDlg do
  1152.     begin
  1153.       Edit1.Text := CProfile;
  1154.       Panel2.Caption := '            Name:';
  1155.       Edit2.Text := CIPAddress;
  1156.       Panel3.Caption := 'EMail Address:';
  1157.     end;
  1158.   end;
  1159. end;
  1160.  
  1161. procedure TCCINetCCForm.EnablePOP3SMTPMenus;
  1162. begin
  1163.   Button1.Caption := 'New Mail';
  1164.   CheckMail1.Enabled := true;
  1165.   CreateNewMessage1.Enabled := true;
  1166.   ReplyToCurrentMessage1.Enabled := true;
  1167.   SendCurrentMessage1.Enabled := true;
  1168.   SendQueue1.Enabled := true;
  1169.   MailServers1.Enabled := true;
  1170.   MailBoxes1.Enabled := true;
  1171.   Correspondents1.Enabled := true;
  1172.   TrashMarkedMessages1.Enabled := true;
  1173.   EmptyTrash1.Enabled := true;
  1174. end;
  1175.  
  1176. procedure TCCINetCCForm.DisablePOP3SMTPMenus;
  1177. begin
  1178.   CheckMail1.Enabled := False;
  1179.   CreateNewMessage1.Enabled := False;
  1180.   ReplyToCurrentMessage1.Enabled := False;
  1181.   SendCurrentMessage1.Enabled := False;
  1182.   SendQueue1.Enabled := False;
  1183.   MailServers1.Enabled := False;
  1184.   MailBoxes1.Enabled := False;
  1185.   Correspondents1.Enabled := False;
  1186.   TrashMarkedMessages1.Enabled := False;
  1187.   EmptyTrash1.Enabled := False;
  1188.   EMail1.Enabled := true;
  1189.   FTP1.Enabled := true;
  1190.   UseNetNws1.Enabled := true;
  1191.   IPAddress1.Enabled := true;
  1192.   EMail2.Enabled := false;
  1193. end;
  1194.  
  1195.  
  1196. procedure TCCINetCCForm.UpdateGauge( BytesFinished , TotalToHandle : longint );
  1197. var
  1198.   Percentage : longint;
  1199. begin
  1200.   if BytesFinished > TotalToHandle then BytesFinished := TotalToHandle;
  1201.   if TotalToHandle = 0 then exit;
  1202.   Percentage := Trunc( 100.0 / ( TotalToHandle / BytesFinished ));
  1203.   Gauge1.Progress := Percentage;
  1204.   Panel1.Caption := '  Status: ' + IntToStr( BytesFinished ) +
  1205.    ' bytes ' + FileNameToXFer + ' (' + IntToStr( Percentage ) + '% Done)';
  1206. end;
  1207.  
  1208. procedure TCCINetCCForm.UpdateMailGauge( BytesFinished , TotalToHandle : longint );
  1209. var
  1210.   Percentage : longint;
  1211. begin
  1212.   if BytesFinished > TotalToHandle then BytesFinished := TotalToHandle;
  1213.   if TotalToHandle = 0 then exit;
  1214.   Percentage := Trunc( 100.0 / ( TotalToHandle / BytesFinished ));
  1215.   Gauge1.Progress := Percentage;
  1216.   Panel1.Caption := '  Status: ' + IntToStr( BytesFinished ) +
  1217.    ' bytes mail (' + IntToStr( Percentage ) + '% Done)';
  1218. end;
  1219.  
  1220. procedure TCCINetCCForm.UpdateMIMEGauge( BytesFinished , TotalToHandle : longint );
  1221. var
  1222.   Percentage : longint;
  1223. begin
  1224.   if BytesFinished > TotalToHandle then BytesFinished := TotalToHandle;
  1225.   if TotalToHandle = 0 then exit;
  1226.   Percentage := Trunc( 100.0 / ( TotalToHandle / BytesFinished ));
  1227.   Gauge1.Progress := Percentage;
  1228.   Panel1.Caption := '  Status: ' + IntToStr( BytesFinished ) +
  1229.    ' bytes MIME (' + IntToStr( Percentage ) + '% Done)';
  1230. end;
  1231.  
  1232. procedure TCCINetCCForm.UpdateUUGauge( BytesFinished , TotalToHandle : longint );
  1233. var
  1234.   Percentage : longint;
  1235. begin
  1236.   if BytesFinished > TotalToHandle then BytesFinished := TotalToHandle;
  1237.   if TotalToHandle = 0 then exit;
  1238.   Percentage := Trunc( 100.0 / ( TotalToHandle / BytesFinished ));
  1239.   Gauge1.Progress := Percentage;
  1240.   Panel1.Caption := '  Status: ' + IntToStr( BytesFinished ) +
  1241.    ' bytes UUCode (' + IntToStr( Percentage ) + '% Done)';
  1242.   Panel1.Show;
  1243. end;
  1244.  
  1245. { This procedure actually attempts to connect to the internet at an ftp site }
  1246. function TCCINetCCForm.DoFTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  1247. var TheReturnString : String; { Display results of connection in status lines }
  1248. begin
  1249.   { Create the component }
  1250.   Result := false;
  1251.   { Do busy cursors }
  1252.   SetHGCursors;
  1253.   if not TheFTPComponent.EstablishConnection( PCRPointer ) then
  1254.   begin
  1255.     { Do saved cursors }
  1256.     TheFTPComponent.FTPCommandInProgress := false;
  1257.     TheFTPComponent.Connection_Established := false;
  1258.     SetNormalCursors;
  1259.     exit;
  1260.   end
  1261.   else
  1262.   begin { Connected; continue login process }
  1263.     if not TheFTPComponent.LoginUser( PCRPointer ) then
  1264.     begin
  1265.       { Do saved cursors }
  1266.       TheFTPComponent.FTPCommandInProgress := false;
  1267.       TheFTPComponent.Connection_Established := false;
  1268.       SetNormalCursors;
  1269.       exit;
  1270.     end;
  1271.     if not TheFTPComponent.SendPassword( PCRPointer ) then
  1272.     begin
  1273.       { Do saved cursors }
  1274.       TheFTPComponent.FTPCommandInProgress := false;
  1275.       TheFTPComponent.Connection_Established := false;
  1276.       SetNormalCursors;
  1277.       exit;
  1278.     end;
  1279.     if not TheFTPComponent.SetRemoteStartupDirectory( PCRPointer ) then
  1280.     begin
  1281.       { Do saved cursors }
  1282.       SetNormalCursors;
  1283.       TheFTPComponent.Connection_Established := false;
  1284.       TheFTPComponent.FTPCommandInProgress := false;
  1285.       exit;
  1286.     end;
  1287.     if not TheFTPComponent.GetRemoteWorkingDirectory( TheReturnString ) then
  1288.     begin
  1289.       { Do saved cursors }
  1290.       TheFTPComponent.Connection_Established := false;
  1291.       TheFTPComponent.FTPCommandInProgress := false;
  1292.       SetNormalCursors;
  1293.       exit;
  1294.     end;
  1295.     { Put up remote directory via PWD and strip quotes }
  1296.     Label4.Caption := TheFTPComponent.GetQuotedString( TheReturnString );
  1297.     { Get the listings of directories and exit OK }
  1298.     TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  1299.     TheFTPComponent.GetLocalDirectoryAndListing( TheReturnString ,
  1300.      Listbox2 );
  1301.     if Label5.Canvas.TextWidth( TheReturnString ) > Label5.Width then
  1302.      TheReturnString := TheFTPComponent.GetShortPathName( TheReturnString );
  1303.     Label5.Caption := TheReturnString;
  1304.     SetNormalCursors;
  1305.     Result := true;
  1306.     EnableFTPMenus;
  1307.     TheFTPComponent.FTPCommandInProgress := false;
  1308.     Panel1.Caption := '  Status : Connected to ' + PCRPointer^.CIPAddress;
  1309.   end;
  1310. end;
  1311.  
  1312. { This procedure actually attempts to connect to the internet at an nntp site }
  1313. function TCCINetCCForm.DoNNTPConnection( PCRPointer : PConnectionsRecord ) : boolean;
  1314. begin
  1315.   { Create the component }
  1316.   Result := false;
  1317.   { Do busy cursors }
  1318.   SetHGCursors;
  1319.   if not TheNNTPComponent.EstablishConnection( PCRPointer ) then
  1320.   begin
  1321.     { Do saved cursors }
  1322.     TheNNTPComponent.NNTPCommandInProgress := false;
  1323.     TheNNTPComponent.Connection_Established := false;
  1324.     SetNormalCursors;
  1325.     exit;
  1326.   end
  1327.   else
  1328.   begin { Connected; continue login process }
  1329.     SetNormalCursors;
  1330.     Result := true;
  1331.     EnableNNTPMenus;
  1332.     TheNNTPComponent.NNTPCommandInProgress := false;
  1333.     Panel1.Caption := '  Status : Connected to ' + PCRPointer^.CIPAddress;
  1334.   end;
  1335. end;
  1336.  
  1337. { This procedure actually attempts to disconnect to the internet at an ftp site}
  1338. procedure TCCINetCCForm.DoFTPDisconnect;
  1339. begin
  1340.   { Call QUIT command }
  1341.   TheFTPComponent.Disconnect;
  1342.   { Kill the socket }
  1343.   TheFTPComponent.Socket1.CCSockClose;
  1344. end;
  1345.  
  1346. { This procedure actually attempts to disconnect to the internet at an ftp site}
  1347. procedure TCCINetCCForm.DoNNTPDisconnect;
  1348. begin
  1349.   { Call QUIT command }
  1350.   TheNNTPComponent.Disconnect;
  1351.   { Kill the socket }
  1352.   TheNNTPComponent.Socket1.CCSockClose;
  1353. end;
  1354.  
  1355. { This procedure reads in the ini file and default path info }
  1356. procedure TCCINetCCForm.ReadIniData;
  1357. begin
  1358.   TheICCIniFile := TIniFile.Create( 'CCICC.INI' );
  1359.   MailPath := TheICCIniFile.ReadString( 'Paths','MailPath','C:\WINDOWS' );
  1360.   NewsPath := TheICCIniFile.ReadString( 'Paths','NewsPath','C:\WINDOWS' );
  1361.   FTPPath := TheICCIniFile.ReadString( 'Paths','FTPPath','C:\WINDOWS' );
  1362.   PasswordControlVector := TheICCIniFile.ReadInteger( 'Vectors','PWControl',2 );
  1363.   DefaultDownloadVector := TheICCIniFile.ReadInteger( 'Vectors','DefDL', 3 );
  1364.   TheAnonRedialVector := TheICCIniFile.ReadInteger( 'Vectors','AnonRD', 20 );
  1365.   NewsReadArticlePurgingVector := TheICCIniFile.ReadInteger( 'Vectors','NewsPurge', 1 );
  1366.   NewsPostQueueingVector := TheICCIniFile.ReadInteger( 'Vectors','NewsQueue', 1 );
  1367.   NewsReadArticleDisplayVector := TheICCIniFile.ReadInteger( 'Vectors','NewsRDisp', 1 );
  1368.   NewsUUMIMEVector := TheICCIniFile.ReadInteger( 'Vectors','NewsUUMIME', 2 );
  1369.   NewsInitialUpdateVector := TheICCIniFile.ReadInteger( 'Vectors','NewsInitUD', 1 );
  1370.   EMPasswordControlVector := TheICCIniFile.ReadInteger( 'Vectors','EMPWControl', 1 );
  1371.   EMRemoteDeletionVector  := TheICCIniFile.ReadInteger( 'Vectors','EMRemDel', 2 );
  1372.   EMChokeVector           := TheICCIniFile.ReadInteger( 'Vectors','EMChoke', 1 );
  1373.   EMDefaultDownloadVector := TheICCIniFile.ReadInteger( 'Vectors','EMInitUD', 1 );
  1374.   EMQueueVector           := TheICCIniFile.ReadInteger( 'Vectors','EMQueue', 1 );
  1375.   TheICCIniFile.Free;
  1376. end;
  1377.  
  1378. { This procedure writes out default path data to the ini file }
  1379. procedure TCCINetCCForm.WriteIniData;
  1380. begin
  1381.   TheICCIniFile := TIniFile.Create( 'CCICC.INI' );
  1382.   TheICCIniFile.WriteString( 'Paths','MailPath', MailPath );
  1383.   TheICCIniFile.WriteString( 'Paths','NewsPath', NewsPath );
  1384.   TheICCIniFile.WriteString( 'Paths','FTPPath', FTPPath );
  1385.   TheICCIniFile.WriteInteger( 'Vectors','PWControl', PasswordControlVector );
  1386.   TheICCIniFile.WriteInteger( 'Vectors','DefDL', DefaultDownloadVector );
  1387.   TheICCIniFile.WriteInteger( 'Vectors','AnonRD', TheAnonRedialVector );
  1388.   TheICCIniFile.WriteInteger( 'Vectors','NewsPurge',
  1389.    NewsReadArticlePurgingVector );
  1390.   TheICCIniFile.WriteInteger( 'Vectors','NewsQueue', NewsPostQueueingVector );
  1391.   TheICCIniFile.WriteInteger( 'Vectors','NewsRDisp',
  1392.    NewsReadArticleDisplayVector );
  1393.   TheICCIniFile.WriteInteger( 'Vectors','NewsUUMIME', NewsUUMIMEVector );
  1394.   TheICCIniFile.WriteInteger( 'Vectors','NewsInitUD', NewsInitialUpdateVector );
  1395.   TheICCIniFile.WriteInteger( 'Vectors','EMPWControl', EMPasswordControlVector );
  1396.   TheICCIniFile.WriteInteger( 'Vectors','EMRemDel', EMRemoteDeletionVector );
  1397.   TheICCIniFile.WriteInteger( 'Vectors','EMChoke', EMChokeVector );
  1398.   TheICCIniFile.WriteInteger( 'Vectors','EMInitUD', EMDefaultDownloadVector );
  1399.   TheICCIniFile.WriteInteger( 'Vectors','EMQueue', EMQueueVector );
  1400.   TheICCIniFile.Free;
  1401. end;
  1402.  
  1403. { Procedure to load the FTP Site list }
  1404. procedure TCCINetCCForm.LoadFTPSiteFile;
  1405. var TheTCRecord : PConnectionsRecord; { Generic TCR Pointer    }
  1406.     FTPSLName   : String;             { FTP Site List filename }
  1407.     Counter_1   : Integer;            { Loop counter           }
  1408. begin
  1409.   { Create the sites list list }
  1410.   TheFTPSiteList := TList.Create;
  1411.   { Set up the FTP sites list file name }
  1412.   FTPSLName := FTPPath + '\FTPSITES.TCR';
  1413.   { If the FTP Site List exists load it in }
  1414.   if FileExists( FTPSLName ) then
  1415.   begin
  1416.     { set up the file and open it }
  1417.     AssignFile( TheFTPSiteFile , FTPSLName );
  1418.     Reset( TheFTPSiteFile );
  1419.     { read in the records }
  1420.     for Counter_1 := 0 to FileSize( TheFTPSiteFile ) - 1 do
  1421.     begin
  1422.       { Create the TCRecord }
  1423.       New( TheTCRecord );
  1424.       { Read in the data record }
  1425.       Seek( TheFTPSiteFile , Counter_1 );
  1426.       Read( TheFTPSiteFile , TheTCRecord^ );
  1427.       { Add the record to the list }
  1428.       TheFTPSiteList.Add( TheTCRecord );
  1429.     end;
  1430.     { close the file }
  1431.     CloseFile( TheFTPSiteFile );
  1432.   end
  1433.   else
  1434.   { Otherwise create a default one with a few anonymous sites }
  1435.   begin
  1436.     { create new record }
  1437.     New( TheTCRecord );
  1438.     { fill in its info }
  1439.     with TheTCRecord^ do
  1440.     begin
  1441.       CProfile   := 'Winsite Windows Archive';
  1442.       CIPAddress := 'ftp.winsite.com';
  1443.       CUserName  := 'anonymous';
  1444.       CPassword  := 'guest@nowhere.com';
  1445.       CStartDir  := '/pub';
  1446.     end;
  1447.     { add it to the list }
  1448.     { do it three more times }
  1449.     TheFTPSiteList.Add( TheTCRecord );
  1450.     New( TheTCRecord );
  1451.     with TheTCRecord^ do
  1452.     begin
  1453.       CProfile   := 'Digital Equipment Corp';
  1454.       CIPAddress := 'gatekeeper.dec.com';
  1455.       CUserName  := 'anonymous';
  1456.       CPassword  := 'guest@nowhere.com';
  1457.       CStartDir  := '/pub';
  1458.     end;
  1459.     TheFTPSiteList.Add( TheTCRecord );
  1460.     New( TheTCRecord );
  1461.     with TheTCRecord^ do
  1462.     begin
  1463.       CProfile   := 'Microsoft FTP Site';
  1464.       CIPAddress := 'ftp.microsoft.com';
  1465.       CUserName  := 'anonymous';
  1466.       CPassword  := 'guest@nowhere.com';
  1467.       CStartDir  := '/pub';
  1468.     end;
  1469.     TheFTPSiteList.Add( TheTCRecord );
  1470.     New( TheTCRecord );
  1471.     with TheTCRecord^ do
  1472.     begin
  1473.       CProfile   := 'Oakland MSDOS Archive';
  1474.       CIPAddress := 'oak.oakland.edu';
  1475.       CUserName  := 'anonymous';
  1476.       CPassword  := 'guest@nowhere.com';
  1477.       CStartDir  := '/pub';
  1478.     end;
  1479.     TheFTPSiteList.Add( TheTCRecord );
  1480.     { create the file and write out the data, then close it }
  1481.     AssignFile( TheFTPSiteFile , FTPSLName );
  1482.     Rewrite( TheFTPSiteFile );
  1483.     for Counter_1 := 0 to 3 do
  1484.     begin
  1485.       TheTCRecord :=
  1486.        PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] );
  1487.       Seek( TheFTPSiteFile , Counter_1 );
  1488.       Write( TheFTPSiteFile , TheTCRecord^ );
  1489.     end;
  1490.     CloseFile( TheFTPSiteFile );
  1491.   end;
  1492.   { Create the working copy for use to make safe changes in info dlg }
  1493.   TheWorkingFTPSL := TList.Create;
  1494.   For Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  1495.   begin
  1496.     New( TheTCRecord );
  1497.     TheTCRecord^ := PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
  1498.     TheWorkingFTPSL.Add( TheTCRecord );
  1499.   end;
  1500. end;
  1501.  
  1502. { Procedure to load the NNTP Site list }
  1503. procedure TCCINetCCForm.LoadNNTPSiteFile;
  1504. var TheNGRecord : PConnectionsRecord; { Generic TCR Pointer    }
  1505.     NNTPSLName  : String;             { NNTP Site List filename }
  1506.     Counter_1   : Integer;            { Loop counter           }
  1507. begin
  1508.   { Create the sites list list }
  1509.   TheNewsServerList := TList.Create;
  1510.   { Set up the FTP sites list file name }
  1511.   NNTPSLName := NewsPath + '\NNTPSITE.TCR';
  1512.   { If the FTP Site List exists load it in }
  1513.   if FileExists( NNTPSLName ) then
  1514.   begin
  1515.     { set up the file and open it }
  1516.     AssignFile( TheNewsServerFile , NNTPSLName );
  1517.     Reset( TheNewsServerFile );
  1518.     { read in the records }
  1519.     for Counter_1 := 0 to FileSize( TheNewsServerFile ) - 1 do
  1520.     begin
  1521.       { Create the TCRecord }
  1522.       New( TheNGRecord );
  1523.       { Read in the data record }
  1524.       Seek( TheNewsServerFile , Counter_1 );
  1525.       Read( TheNewsServerFile , TheNGRecord^ );
  1526.       { Add the record to the list }
  1527.       TheNewsServerList.Add( TheNGRecord );
  1528.     end;
  1529.     { close the file }
  1530.     CloseFile( TheNewsServerFile );
  1531.   end
  1532.   else
  1533.   { Otherwise create a default one with a generic news site (?) }
  1534.   begin
  1535.     { create new record }
  1536.     New( TheNGRecord );
  1537.     { fill in its info }
  1538.     with TheNGRecord^ do
  1539.     begin
  1540.       CProfile   := 'My News Server';
  1541.       CIPAddress := 'news.myprovider.com';
  1542.       CUserName  := '';
  1543.       CPassword  := '';
  1544.       CStartDir  := '';
  1545.     end;
  1546.     { add it to the list }
  1547.     { do it three more times }
  1548.     TheNewsServerList.Add( TheNGRecord );
  1549.     { create the file and write out the data, then close it }
  1550.     AssignFile( TheNewsServerFile , NNTPSLName );
  1551.     Rewrite( TheNewsServerFile );
  1552.     TheNGRecord :=
  1553.        PConnectionsRecord( TheNewsServerList.Items[ 0 ] );
  1554.       Seek( TheNewsServerFile , 0 );
  1555.       Write( TheNewsServerFile , TheNGRecord^ );
  1556.     CloseFile( TheNewsServerFile );
  1557.   end;
  1558.   TheWorkingNSSL := TList.Create;
  1559.   For Counter_1 := 0 to TheNewsServerList.Count - 1 do
  1560.   begin
  1561.     New( TheNGRecord );
  1562.     TheNGRecord^ := PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
  1563.     TheWorkingNSSL.Add( TheNGRecord );
  1564.   end;
  1565. end;
  1566.  
  1567. { This procedure saves off the FTP Site List }
  1568. procedure TCCINetCCForm.SaveFTPSiteFile;
  1569. var TheTCRecord : PConnectionsRecord; { The TC Record pointer  }
  1570.     FTPSLName   : String;             { FTP Site List filename }
  1571.     Counter_1   : Integer;            { Loop counter           }
  1572. begin
  1573.   { Set up the file name }
  1574.   FTPSLName := FTPPath + '\FTPSITES.TCR';
  1575.   { Assign the file }
  1576.   AssignFile( TheFTPSiteFile , FTPSLName );
  1577.   { Rewrite it }
  1578.   Rewrite( TheFTPSiteFile );
  1579.   { run the list through the procedure }
  1580.   for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  1581.   begin
  1582.     { get the record from the list }
  1583.     TheTCRecord :=
  1584.      PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] );
  1585.     { Do the seek/write }
  1586.     Seek( TheFTPSiteFile , Counter_1 );
  1587.     Write( TheFTPSiteFile , TheTCRecord^ );
  1588.     { free the record }
  1589.     Dispose( TheTCRecord );
  1590.   end;
  1591.   { Close the file }
  1592.   CloseFile( TheFTPSiteFile );
  1593.   { Free the list pointers }
  1594.   TheFTPSiteList.Free;
  1595.   TheWorkingFTPSL.Free;
  1596. end;
  1597.  
  1598. { This procedure saves off the FTP Site List }
  1599. procedure TCCINetCCForm.SaveNNTPSiteFile;
  1600. var TheNGRecord : PConnectionsRecord; { The TC Record pointer   }
  1601.     NNTPSLName   : String;            { NNTP Site List filename }
  1602.     Counter_1   : Integer;            { Loop counter           }
  1603. begin
  1604.   { Set up the file name }
  1605.   NNTPSLName := NewsPath + '\NNTPSITE.TCR';
  1606.   { Assign the file }
  1607.   AssignFile( TheNewsServerFile , NNTPSLName );
  1608.   { Rewrite it }
  1609.   Rewrite( TheNewsServerFile );
  1610.   { run the list through the procedure }
  1611.   for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  1612.   begin
  1613.     { get the record from the list }
  1614.     TheNGRecord :=
  1615.      PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] );
  1616.     { Do the seek/write }
  1617.     Seek( TheNewsServerFile , Counter_1 );
  1618.     Write( TheNewsServerFile , TheNGRecord^ );
  1619.     { free the record }
  1620.     Dispose( TheNGRecord );
  1621.   end;
  1622.   { Close the file }
  1623.   CloseFile( TheNewsServerFile );
  1624.   { Free the list pointers }
  1625.   TheNewsServerList.Free;
  1626.   TheWorkingNSSL.Free;
  1627. end;
  1628.  
  1629. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1630. procedure TCCINetCCForm.SetupFTPSiteLists;
  1631. var Counter_1  : Integer;            { Loop counter        }
  1632. begin
  1633.   { Set up display for main form }
  1634.   CCINetCCForm.Tag := 2;
  1635.   CCINetCCForm.Caption := 'CC Internet Command Center -- FTP Mode';
  1636.   CCINetCCForm.ViewWinsockInfo1.Enabled := false;
  1637.   CCINetCCForm.FTP1.Enabled := false;
  1638.   CCINetCCForm.FTP2.Enabled := true;
  1639.   CCINetCCForm.Label1.Caption := 'FTP Site:';
  1640.   CCINetCCForm.Button1.Caption := 'Connect';
  1641.   CCINetCCForm.Label4.Caption := 'Local Dir';
  1642.   CCINetCCForm.Label5.Caption := 'Remote Dir';
  1643.   { Set tag for FTP stuff }
  1644.   CCICInfoDlg.Tag := 2;
  1645.   { set up caption of main label }
  1646.   CCICInfoDlg.Label2.Caption := 'FTP Sites';
  1647.   { hide outline panel }
  1648.   CCICInfoDlg.Panel6.Visible := false;
  1649.   { clear the list box }
  1650.   CCICInfoDlg.ListBox2.Clear;
  1651.   CCINetCCForm.ComboBox1.Clear;
  1652.   { add profile strings to the list box }
  1653.   for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  1654.   begin
  1655.     CCICInfoDlg.ListBox2.Items.Add( PConnectionsRecord(
  1656.      TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  1657.     CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  1658.      TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  1659.   end;
  1660.   { Set up caption of special button }
  1661.   CCICInfoDlg.Button1.Caption := 'Anonymous Login';
  1662.   { Start with top record }
  1663.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  1664.   CCINetCCForm.ComboBox1.ItemIndex := 0;
  1665.   { put in data from top record and reset captions }
  1666.   with PConnectionsRecord( TheFTPSiteList.Items[ 0 ] )^ do
  1667.   begin
  1668.     with CCICInfoDlg do
  1669.     begin
  1670.       Edit1.Text := CProfile;
  1671.       Panel2.Caption := '            Name:';
  1672.       Edit2.Text := CIPAddress;
  1673.       Panel3.Caption := '     IP Address:';
  1674.       Edit3.Text := CUserName;
  1675.       Panel5.Caption := '    User Name:';
  1676.       case PasswordControlVector of
  1677.         1 : Edit4.Text := CPassword;
  1678.         2 : Edit4.Text := '**********';
  1679.       end;
  1680.       Panel8.Caption := '      Password:';
  1681.       Edit5.Text := CStartDir;
  1682.       Panel9.Caption := '    Starting Dir:';
  1683.     end;
  1684.   end;
  1685. end;
  1686.  
  1687. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1688. procedure TCCINetCCForm.SetupNNTPSiteLists;
  1689. begin
  1690.   { Set up display for main form }
  1691.   CCINetCCForm.Tag := 4; { Usenet News Tag }
  1692.   CCINetCCForm.Caption := 'CC Internet Command Center -- Usenet News Mode';
  1693.   CCINetCCForm.ViewWinsockInfo1.Enabled := false;
  1694.   CCINetCCForm.FTP1.Enabled := true;
  1695.   CCINetCCForm.FTP2.Enabled := false;
  1696.   CCINetCCForm.UsenetNws1.Enabled := false;
  1697.   CCINetCCForm.News1.Enabled := true;
  1698.   CCINetCCForm.Label1.Caption := 'NNTP Server:';
  1699.   CCINetCCForm.Button1.Caption := 'Connect';
  1700.   CCINetCCForm.Label4.Caption := 'SubScribed Groups';
  1701.   CCINetCCForm.Label5.Caption := 'Unread Articles';
  1702.   { Create the working copy for use to make safe changes in info dlg }
  1703. end;
  1704.  
  1705. { This method saves off the Newsgroup and Article Lists }
  1706. procedure TCCINetCCForm.SaveNNTPNewsGroupLists;
  1707. var TheNGRecord : PNewsGroupRecord; { Generic NGR Pointer       }
  1708.     TheNGARecord : PNewsGroupArticleRecord; {  }
  1709.     WorkingList : TList;
  1710.     Counter_1 ,
  1711.     Counter_2   : Integer;          { Loop counter              }
  1712.     NNTPNGLName ,                   { NewsGroup Articles fname  }
  1713.     NNTPARName  : String;           { NNTP NewsRC filename      }
  1714. begin
  1715.   { Abort if no server to select }
  1716.   if ComboBox1.ItemIndex = -1 then exit;
  1717.   { Get number of server in list }
  1718.   WhichServer := ComboBox1.ItemIndex;
  1719.   { Set up the FTP sites list file name }
  1720.   NNTPNGLName := NewsPath + '\NEWSRC ' + IntToStr( WhichServer ) + '.NRC';
  1721.   { If the FTP Site List exists load it in }
  1722.   { set up the file and open it }
  1723.   AssignFile( TheNewsRCFile , NNTPNGLName );
  1724.   ReWrite( TheNewsRCFile );
  1725.   { read in the records }
  1726.   for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  1727.   begin
  1728.     { Create the TCRecord }
  1729.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  1730.     { Read in the data record }
  1731.     Seek( TheNewsRCFile , Counter_1 );
  1732.     Write( TheNewsRCFile , TheNGRecord^ );
  1733.     { Add the record to the list }
  1734.     WorkingList := TList( TheNGRecord^.GLTag );
  1735.     if WorkingList.Count > 0 then
  1736.     begin
  1737.       NNTPARName := TheNGRecord^.GFileName;
  1738.       TheNGArticlesList := TList.Create;
  1739.       AssignFile( TheNewsArticleFile , NewsPath + '\' + NNTPARName );
  1740.       ReWrite( TheNewsArticleFile );
  1741.       for Counter_2 := 0 to WorkingList.Count - 1 do
  1742.       begin
  1743.         TheNGARecord :=
  1744.          PNewsGroupArticleRecord( WorkingList.Items[ Counter_2 ] );
  1745.         Seek( TheNewsArticleFile , Counter_2 );
  1746.         Write( TheNewsArticleFile , TheNGARecord^ );
  1747.         Dispose( TheNGARecord );
  1748.       end;
  1749.       CloseFile( TheNewsArticleFile );
  1750.     end;
  1751.     WorkingList.Free;
  1752.     Dispose( TheNGRecord );
  1753.   end;
  1754.   { close the file }
  1755.   CloseFile( TheNewsRCFile );
  1756.   { Free the list itself }
  1757.   TheNewsRCList.Free;
  1758. end;
  1759.  
  1760. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1761. procedure TCCINetCCForm.SetupNNTPNewsGroupLists;
  1762. var TheNGRecord : PNewsGroupRecord; { Generic NGR Pointer       }
  1763.     TheNGARecord : PNewsGroupArticleRecord; {  }
  1764.     Counter_1 ,
  1765.     Counter_2   : Integer;          { Loop counter              }
  1766.     NNTPNGLName ,                   { NewsGroup Articles fname  }
  1767.     NNTPARName  : String;           { NNTP NewsRC filename      }
  1768. begin
  1769.   { Abort if no server to select }
  1770.   if ComboBox1.ItemIndex = -1 then exit;
  1771.   { Get number of server in list }
  1772.   WhichServer := ComboBox1.ItemIndex;
  1773.   { Create the sites list list }
  1774.   TheNewsRCList := TList.Create;
  1775.   { Set up the FTP sites list file name }
  1776.   NNTPNGLName := NewsPath + '\NEWSRC ' + IntToStr( WhichServer ) + '.NRC';
  1777.   { If the FTP Site List exists load it in }
  1778.   if FileExists( NNTPNGLName ) then
  1779.   begin
  1780.     { set up the file and open it }
  1781.     AssignFile( TheNewsRCFile , NNTPNGLName );
  1782.     Reset( TheNewsRCFile );
  1783.     { read in the records }
  1784.     for Counter_1 := 0 to FileSize( TheNewsRCFile ) - 1 do
  1785.     begin
  1786.       { Create the TCRecord }
  1787.       New( TheNGRecord );
  1788.       { Read in the data record }
  1789.       Seek( TheNewsRCFile , Counter_1 );
  1790.       Read( TheNewsRCFile , TheNGRecord^ );
  1791.       { Add the record to the list }
  1792.       TheNewsRCList.Add( TheNGRecord );
  1793.     end;
  1794.     { close the file }
  1795.     CloseFile( TheNewsRCFile );
  1796.   end
  1797.   else
  1798.   { Otherwise create a default one with 3 delphi newsgroups }
  1799.   begin
  1800.     { create new record }
  1801.     New( TheNGRecord );
  1802.     { fill in its info }
  1803.     with TheNGRecord^ do
  1804.     begin
  1805.       GName                := 'Delphi Comps';
  1806.       GRealName            := 'comp.lang.pascal.delphi.components';
  1807.       GLowest              := 0;
  1808.       GHighest             := 0;
  1809.       GPostable            := true;
  1810.       GSubscribed          := true;
  1811.       GTotalArticles       := 0;
  1812.       GTotalAvailable      := 0;
  1813.       GLowestAvailable     := 0;
  1814.       GHighestAvailable    := 0;
  1815.       GTotalUnReadArticles := 0;
  1816.       GIDNumber            := 1;
  1817.       GFileName            := 'NL' + IntToStr( WhichServer ) + 'G1.NGR';
  1818.       GLTag                := 0;
  1819.     end;
  1820.     { add it to the list }
  1821.     TheNewsRCList.Add( TheNGRecord );
  1822.     { create new record }
  1823.     New( TheNGRecord );
  1824.     { fill in its info }
  1825.     with TheNGRecord^ do
  1826.     begin
  1827.       GName                := 'Delphi DB';
  1828.       GRealName            := 'comp.lang.pascal.delphi.databases';
  1829.       GLowest              := 0;
  1830.       GHighest             := 0;
  1831.       GPostable            := true;
  1832.       GSubscribed          := true;
  1833.       GTotalArticles       := 0;
  1834.       GTotalAvailable      := 0;
  1835.       GLowestAvailable     := 0;
  1836.       GHighestAvailable    := 0;
  1837.       GTotalUnReadArticles := 0;
  1838.       GIDNumber            := 2;
  1839.       GFileName            := 'NL' + IntToStr( WhichServer ) + 'G2.NGR';
  1840.       GLTag                := 0;
  1841.     end;
  1842.     { add it to the list }
  1843.     TheNewsRCList.Add( TheNGRecord );
  1844.     { create new record }
  1845.     New( TheNGRecord );
  1846.     { fill in its info }
  1847.     with TheNGRecord^ do
  1848.     begin
  1849.       GName                := 'Delphi Misc';
  1850.       GRealName            := 'comp.lang.pascal.delphi.misc';
  1851.       GLowest              := 0;
  1852.       GHighest             := 0;
  1853.       GPostable            := true;
  1854.       GSubscribed          := true;
  1855.       GTotalArticles       := 0;
  1856.       GTotalAvailable      := 0;
  1857.       GLowestAvailable     := 0;
  1858.       GHighestAvailable    := 0;
  1859.       GTotalUnReadArticles := 0;
  1860.       GIDNumber            := 3;
  1861.       GFileName            := 'NL' + IntToStr( WhichServer ) + 'G3.NGR';
  1862.       GLTag                := 0;
  1863.     end;
  1864.     { add it to the list }
  1865.     TheNewsRCList.Add( TheNGRecord );
  1866.     { create the file and write out the data, then close it }
  1867.     AssignFile( TheNewsRCFile , NNTPNGLName );
  1868.     Rewrite( TheNewsRCFile );
  1869.     for Counter_1 := 0 to 2 do
  1870.     begin
  1871.       TheNGRecord :=
  1872.        PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  1873.       Seek( TheNewsRCFile , Counter_1 );
  1874.       Write( TheNewsRCFile , TheNGRecord^ );
  1875.     end;
  1876.     CloseFile( TheNewsRCFile );
  1877.   end;
  1878.   { Load in Articles Records and create storage lists }
  1879.   for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  1880.   begin
  1881.     NNTPARName := PNewsGroupRecord(
  1882.      TheNewsRCList.Items[ Counter_1 ] )^.GFileName;
  1883.     if FileExists( NewsPath + '\' + NNTPARName ) then
  1884.     begin
  1885.       TheNGArticlesList := TList.Create;
  1886.       AssignFile( TheNewsArticleFile , NewsPath + '\' + NNTPARName );
  1887.       Reset( TheNewsArticleFile );
  1888.       for Counter_2 := 0 to FileSize( TheNewsArticleFile ) - 1 do
  1889.       begin
  1890.         New( TheNGARecord );
  1891.         Seek( TheNewsArticleFile , Counter_2 );
  1892.         Read( TheNewsArticleFile , TheNGARecord^ );
  1893.         TheNGArticlesList.Add( TheNGARecord );
  1894.       end;
  1895.       CloseFile( TheNewsArticleFile );
  1896.       PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^.GLTag :=
  1897.        Longint( TheNGArticlesList );
  1898.     end
  1899.     else
  1900.     begin
  1901.       TheNGArticlesList := TList.Create;
  1902.       PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^.GLTag :=
  1903.        Longint( TheNGArticlesList );
  1904.     end;
  1905.   end;
  1906.   { Create working Newsgroup list for later }
  1907.   TheWorkingNRCSL := TList.Create;
  1908.   For Counter_1 := 0 to TheNewsRCList.Count - 1 do
  1909.   begin
  1910.     New( TheNGRecord );
  1911.     TheNGRecord^ := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^;
  1912.     TheWorkingNRCSL.Add( TheNGRecord );
  1913.   end;
  1914. end;
  1915.  
  1916. { This procedure populates LB2 with article subjects for any }
  1917. { available articles for a given newsgroup.                  }
  1918. procedure TCCINetCCForm.PopulateLB2WithArticleHeaders;
  1919. var Counter_1    : Integer;
  1920.     TheNGARecord : PNewsGroupArticleRecord;
  1921.     TempString   : String;
  1922. begin
  1923.   { Clear target list box }
  1924.   ListBox2.Clear;
  1925.   for Counter_1 := 0 to TheNGArticlesList.Count - 1 do
  1926.   begin
  1927.     TheNGARecord :=
  1928.      PNewsGroupArticleRecord( TheNGArticlesList.Items[ Counter_1 ] );
  1929.     TempString := '    [' + IntToStr( Counter_1 ) + '] ' +
  1930.      TheNGARecord^.NGASubject;
  1931.     if TheNGARecord^.NGADownloaded then TempString[ 1 ] :=
  1932.      'D';
  1933.     if TheNGARecord^.NGARead then TempString[ 3 ] := 'R';
  1934.     if TheNGARecord^.NGAPosted then TempString[ 3 ] := 'S';
  1935.     ListBox2.Items.Add( TempString );
  1936.   end;
  1937. end;
  1938.  
  1939. { This procedure swaps in the list of subscribed newsgroups to LB1 }
  1940. { and calls another procedure to populate LB2 with any available   }
  1941. { articles for the newsgroup.                                      }
  1942. procedure TCCINetCCForm.SetupNewsGroupListboxes;
  1943. var Counter_1   : Integer;
  1944.     TempString  : String;
  1945.     TheNGRecord : PNewsGroupRecord;
  1946. begin
  1947.   ListBox1.Clear;
  1948.   ListBox1.Tag := 5;
  1949.   ListBox2.Tag := 5;
  1950.   Label4.Caption := 'NewsGroups';
  1951.   Label5.Caption := 'Articles';
  1952.   if TheNewsRCList.Count = 0 then
  1953.   begin
  1954.     ListBox2.Clear;
  1955.     exit;
  1956.   end;
  1957.   ComboBox1.Clear;
  1958.   for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  1959.   begin
  1960.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  1961.     TempString := TheNGRecord^.GName;
  1962.     ComboBox1.Items.Add( TheNGRecord^.GRealName );
  1963.     if TheNGRecord^.GSubscribed then
  1964.      TempString := '[S] ' + TempString else TempString := '[U] ' + TempString;
  1965.     TempString := TempString + '{' + IntToStr( TheNGRecord^.GTotalNew ) + '}';
  1966.     ListBox1.Items.Add( TempString );
  1967.   end;
  1968.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ 0 ] );
  1969.   TheNGArticlesList := TList( TheNGRecord^.GLTag );
  1970.   PopulateLB2WithArticleHeaders;
  1971.   Label1.Caption := 'NewsGroup:';
  1972.   ComboBox1.ItemIndex := 0;
  1973.   Button1.Caption := 'DL Article(s)';
  1974.   Tag := 5; { Set download vector }
  1975. end;
  1976.  
  1977. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  1978. procedure TCCINetCCForm.SetupNNTPServersInfoDisplay;
  1979. var Counter_1  : Integer;            { Loop counter        }
  1980. begin
  1981.   { Set tag for NNTP stuff }
  1982.   CCICInfoDlg.Tag := 4; { Usenet News Tag -- servers }
  1983.   { set up caption of main label }
  1984.   CCICInfoDlg.Label2.Caption := 'News Server Sites';
  1985.   { hide outline panel }
  1986.   CCICInfoDlg.Panel6.Visible := false;
  1987.   CCICInfoDlg.Panel5.Visible := false;
  1988.   CCICInfoDlg.Panel8.Visible := false;
  1989.   CCICInfoDlg.Panel9.Visible := false;
  1990.   { clear the list box }
  1991.   CCICInfoDlg.ListBox2.Clear;
  1992.   CCINetCCForm.ComboBox1.Clear;
  1993.   { add profile strings to the list box }
  1994.   for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  1995.   begin
  1996.     CCICInfoDlg.ListBox2.Items.Add( PConnectionsRecord(
  1997.      TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  1998.     CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  1999.      TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  2000.   end;
  2001.   { Set up caption of special button }
  2002.   CCICInfoDlg.Button1.Visible := false;
  2003.   { Start with top record }
  2004.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  2005.   CCINetCCForm.ComboBox1.ItemIndex := 0;
  2006.   { put in data from top record and reset captions }
  2007.   with PConnectionsRecord( TheNewsServerList.Items[ 0 ] )^ do
  2008.   begin
  2009.     with CCICInfoDlg do
  2010.     begin
  2011.       Edit1.Text := CProfile;
  2012.       Panel2.Caption := '            Name:';
  2013.       Edit2.Text := CIPAddress;
  2014.       Panel3.Caption := '     IP Address:';
  2015.     end;
  2016.   end;
  2017. end;
  2018.  
  2019. { This procedure switches in the FTP sites list to the info dlg and main cbox }
  2020. procedure TCCINetCCForm.SetupNNTPNewsGroupsInfoDisplay;
  2021. var Counter_1  : Integer;            { Loop counter        }
  2022.     WorkingFileName : String;
  2023.     TheWorkingSL : TStringList;
  2024. begin
  2025.   { Set tag for NNTP stuff }
  2026.   CCICInfoDlg.Tag := 5; { Usenet News Tag -- newsgroups }
  2027.   { set up caption of main label }
  2028.   CCICInfoDlg.Label2.Caption := 'Active NewsGroups';
  2029.   { hide outline panel }
  2030.   CCICInfoDlg.Panel5.Visible := true;
  2031.   CCICInfoDlg.Panel6.Visible := true;
  2032.   CCICInfoDlg.Panel6.Height := 224;
  2033.   CCICInfoDlg.Panel6.Top := 120;
  2034.   CCICInfoDlg.Label1.Caption := 'Available NewsGroups';
  2035.   CCICInfoDlg.Panel8.Visible := false;
  2036.   CCICInfoDlg.Panel9.Visible := false;
  2037.   { clear the list box }
  2038.   CCICInfoDlg.ListBox2.Clear;
  2039.   { add profile strings to the list box }
  2040.   for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  2041.   begin
  2042.     CCICInfoDlg.ListBox2.Items.Add( PNewsGroupRecord(
  2043.      TheNewsRCList.Items[ Counter_1 ] )^.GName );
  2044.   end;
  2045.   { Set up caption of special button }
  2046.   CCICInfoDlg.Button1.Visible := true;
  2047.   CCICInfoDlg.Button1.Caption := 'Toggle Subscription';
  2048.   { Start with top record }
  2049.   CCICInfoDlg.ListBox2.ItemIndex := 0;
  2050.   { put in data from top record and reset captions }
  2051.   with PNewsGroupRecord( TheNewsRCList.Items[ 0 ] )^ do
  2052.   begin
  2053.     with CCICInfoDlg do
  2054.     begin
  2055.       Edit1.Text := GName;
  2056.       Panel2.Caption := 'NG Name:';
  2057.       Edit2.Text := GRealName;
  2058.       Panel3.Caption := 'NG Real Name:';
  2059.       if GSubscribed then
  2060.       Edit3.Text := 'Subscribed' else Edit3.Text := 'UnSubscribed';
  2061.       Panel5.Caption := 'Status:';
  2062.     end;
  2063.   end;
  2064.   if newsgroupListloaded then exit;
  2065.   WorkingFileName := NewsPath + '\NEWSGRP.TXT';
  2066.   if FileExists( WorkingFileName ) then
  2067.   begin
  2068.     if MessageDlg( 'Load News Groups File? (Long operation...)',
  2069.      mtConfirmation,mbYesNoCancel,0) = mrYes then
  2070.     begin
  2071.       CCICInfoDlg.ListBox1.Clear;
  2072.       TheWorkingSL := TStringList.Create;
  2073.       try
  2074.         TheWorkingSL.LoadFromFile( WorkingFileName );
  2075.         CCICInfoDlg.ListBox1.Items.Assign( TheWorkingSL );
  2076.       except
  2077.         MessageDlg( 'News Group List Too Large! Use WordPad/Write to view ' +
  2078.                       NewsPath + '\NEWGRP.TXT' , mtInformation,[mbOK],0);
  2079.         TheWorkingSL.Free;
  2080.         NewsgroupListLoaded := false;
  2081.         exit;
  2082.       end;
  2083.       TheWorkingSL.Free;
  2084.       NewsgroupListLoaded := true;
  2085.     end;
  2086.   end;
  2087. end;
  2088.  
  2089. { This procedure scans a line of UNIX-style text for #10's and }
  2090. { outputs them as lines to the memo. It stops at #0.           }
  2091. procedure TCCINetCCForm.AddNullTermTextToMemo( TheTextToAdd   : String;
  2092.                                  TheMemoToAddTo : TMemo   );
  2093. var
  2094.   TextLength ,            { Total chars to output         }
  2095.   Counter_1    : integer; { Loop Index                    }
  2096. begin
  2097.   { Make the target memo visible just in case }
  2098.   TheMemoToAddTo.Visible := true;
  2099.   { Find total chars to output }
  2100.   TextLength := Length( TheTextToAdd );
  2101.   { If none then leave }
  2102.   if TextLength = 0 then exit;
  2103.   { Loop along the string }
  2104.   for Counter_1 := 1 to TextLength do
  2105.   begin
  2106.     { If hit ASCII 10 then assume end of line and output }
  2107.     if TheTextToAdd[ Counter_1 ] = #10 then
  2108.     begin
  2109.       { Use a try loop incase memo fills up }
  2110.       try
  2111.         { Add the line }
  2112.         TheMemoToAddTo.Lines.Add( TheLine );
  2113.       except
  2114.         { If memo fills up }
  2115.         on EOutOfResources do
  2116.         begin
  2117.           { Clear the old data }
  2118.           TheMemoToAddTo.Clear;
  2119.           { Output the new }
  2120.           TheMemoToAddTo.Lines.Add( TheLine );
  2121.         end;
  2122.       end;
  2123.       { clear the output buffer }
  2124.       TheLine := '';
  2125.     end
  2126.     else
  2127.     { Otherwise look for null terminator from Winsock }
  2128.     begin
  2129.       { If don't hit null terminator then add the char to op buffer }
  2130.       if TheTextToAdd[ Counter_1 ] <> #0 then
  2131.       begin
  2132.         TheLine := TheLine + TheTextToAdd[ Counter_1 ];
  2133.       end
  2134.       else break; { Otherwise drop out of the loop }
  2135.     end;
  2136.   end;
  2137. end;
  2138.  
  2139. { This function scans a line of UNIX-style text for #10's and }
  2140. { outputs the first line as its return value,stopping at #0.  }
  2141. function TCCINetCCForm.AddNullTermTextToLabel( TheTextToAdd   : String ) : String;
  2142. var
  2143.   TheLine      : String;  { Buffer to output current line }
  2144.   TextLength ,            { Total chars to output         }
  2145.   Counter_1    : integer; { Loop Index                    }
  2146. begin
  2147.   { Clear output buffer }
  2148.   TheLine := '';
  2149.   { Find total chars to output }
  2150.   TextLength := Length( TheTextToAdd );
  2151.   { If none then leave }
  2152.   if TextLength = 0 then
  2153.   begin
  2154.     { Return nothing }
  2155.     Result := '';
  2156.     { Leave }
  2157.     exit;
  2158.   end;
  2159.   { Loop along the string }
  2160.   for Counter_1 := 1 to TextLength do
  2161.   begin
  2162.     { If hit ASCII 10 then assume end of line and output }
  2163.     if TheTextToAdd[ Counter_1 ] = #10 then
  2164.     begin
  2165.       { Return first line }
  2166.       Result := TheLine;
  2167.       { Leave }
  2168.       exit;
  2169.     end
  2170.     else
  2171.     { Otherwise look for null terminator from Winsock }
  2172.     begin
  2173.       { If don't hit null terminator then add the char to op buffer }
  2174.       if TheTextToAdd[ Counter_1 ] <> #0 then
  2175.       begin
  2176.         TheLine := TheLine + TheTextToAdd[ Counter_1 ];
  2177.       end
  2178.       else break; { Otherwise drop out of the loop }
  2179.     end;
  2180.   end;
  2181.   { If hit #0 before #10 return buffer }
  2182.   Result := TheLine;
  2183. end;
  2184.  
  2185. { Show busy cursors }
  2186. procedure TCCINetCCForm.SetHGCursors;
  2187. begin
  2188.   CCInetCCForm.Cursor := crHourGlass;
  2189.   CCInetCCForm.Memo1.Cursor := crHourGlass;
  2190. end;
  2191.  
  2192. { Show normal cursors }
  2193. procedure TCCINetCCForm.SetNormalCursors;
  2194. begin
  2195.   CCInetCCForm.Cursor := crDefault;
  2196.   CCInetCCForm.Memo1.Cursor := crDefault;
  2197. end;
  2198.  
  2199. { Exit method }
  2200. procedure TCCINetCCForm.Exit1Click(Sender: TObject);
  2201. begin
  2202.   Close;
  2203. end;
  2204.  
  2205. { This method adds a line to the progress text stringlist  }
  2206. { If an exception occurs, the list is full, and it is auto }
  2207. { saved to the progress text file name, then cleared.      }
  2208. procedure TCCINetCCForm.AddProgressText( WhatText : String );
  2209. begin
  2210.   { Use a try..except loop to catch list overflows }
  2211.   try
  2212.     { Try the normal add }
  2213.     ProgressList.Add( WhatText );
  2214.   except
  2215.     { Any list error is assumed to be a list overflow }
  2216.     on EListError do
  2217.     begin
  2218.       { Save the list to the preset file name }
  2219.       ProgressList.SaveToFile( ProgressFileName );
  2220.       { Clear the list to make more room }
  2221.       ProgressList.Clear;
  2222.       { And redo the add; any further errors will except normally }
  2223.       ProgressList.Add( WhatText );
  2224.     end;
  2225.     { This might happen too! }
  2226.     on EOutOfResources do
  2227.     begin
  2228.       { Save the list to the preset file name }
  2229.       ProgressList.SaveToFile( ProgressFileName );
  2230.       { Clear the list to make more room }
  2231.       ProgressList.Clear;
  2232.       { And redo the add; any further errors will except normally }
  2233.       ProgressList.Add( WhatText );
  2234.     end;
  2235.   end;
  2236. end;
  2237.  
  2238. { This method either adds the progress line to the current memo }
  2239. { or puts it in the status caption at normal colors.            }
  2240. procedure TCCINetCCForm.ShowProgressText( WhatText : String );
  2241. begin
  2242.   { Use the POV to determine where to show progress info }
  2243.   case ProgressOutputVector of
  2244.     POV_MEMO : begin { Output into the memo  }
  2245.                  AddNullTermTextToMemo( WhatText , Memo1 );
  2246.                end;
  2247.     POV_STAT : begin { Output on status line }
  2248.                  { Set panel caption font to black }
  2249.                  Panel1.Font.Color := clBlack;
  2250.                  { Get the first line of text and put in caption }
  2251.                  Panel1.Caption := AddNullTermTextToLabel( WhatText );
  2252.                end;
  2253.   end;
  2254. end;
  2255.  
  2256. { This method is identical with SPT except sets status color to red and beeps }
  2257. procedure TCCINetCCForm.ShowProgressErrorText( WhatText : String );
  2258. begin
  2259.   { Do error beep }
  2260.   MessageBeep( mb_IconExclamation );
  2261.   { Use the POV to determine where to show progress info }
  2262.   case ProgressOutputVector of
  2263.     POV_MEMO : begin { Output into the memo  }
  2264.                  AddNullTermTextToMemo( WhatText , Memo1 );
  2265.                end;
  2266.     POV_STAT : begin { Output on status line }
  2267.                  { Set panel caption font to black }
  2268.                  Panel1.Font.Color := clRed;
  2269.                  { Get the first line of text and put in caption }
  2270.                  Panel1.Caption := AddNullTermTextToLabel( WhatText );
  2271.                end;
  2272.   end;
  2273. end;
  2274.  
  2275. { This is the boilerplate method used to handle Socket errors gracefully }
  2276. procedure TCCINetCCForm.SocketsErrorOccurred( Sender     : TObject;
  2277.                                               ErrorCode  : Integer;
  2278.                                               TheMessage : String   );
  2279. begin
  2280.   { Set the global error code flag }
  2281.   GlobalErrorCode := ErrorCode;
  2282.   { If a timeout error }
  2283.   if ErrorCode = WSAETIMEDOUT then
  2284.   begin
  2285.     { Set the aborted flag }
  2286.     GlobalAbortedFlag := True;
  2287.     { But clear the error code for graceful handling }
  2288.     GlobalErrorCode := 0;
  2289.   end
  2290.   else
  2291.   begin
  2292.     { Otherwise set the progress buffer to the error message }
  2293.     AddProgressText( TheMessage );
  2294.     { And show the progress text as set by option }
  2295.     ShowProgressErrorText( TheMessage );
  2296.   end;
  2297. end;
  2298.  
  2299. procedure TCCINetCCForm.FormCreate(Sender: TObject);
  2300. begin
  2301.   { Create the progress string list }
  2302.   ProgressList := TStringList.Create;
  2303.   { Create the file name for saving the progress list }
  2304.   ProgressFileName := ExpandFileName( 'PROGRESS.TXT' );
  2305.   { Default progress output to status line }
  2306.   ProgressOutputVector := POV_STAT;
  2307.   { Set password control stuff }
  2308.   PasswordControlVector := 2;
  2309.   CurrentPasswordString := 'guest@nowhere.com';
  2310.   CurrentRealPWString := 'guest@nowhere.com';
  2311.   NewMessageInProgress := false;
  2312.   EmailLoaded := false;
  2313.   NewsGroupListLoaded := false;
  2314.   { Get Ini file Data }
  2315.   ReadIniData;
  2316.   LoadFTPSiteFile;
  2317.   LoadNNTPSiteFile;
  2318.   LoadEMailServerFile;
  2319.   TheFTPComponent := TFTPComponent.Create( CCInetCCForm );
  2320.   TheFTPComponent.Parent := CCInetCCForm;
  2321.   TheNNTPComponent := TNNTPComponent.Create( CCInetCCForm );
  2322.   TheNNTPComponent.Parent := CCInetCCForm;
  2323.   ThePOP3SMTPComponent := TPOP3SMTPComponent.Create( CCInetCCForm );
  2324.   ThePOP3SMTPComponent.Parent := CCInetCCForm;
  2325.   TheUUObject := TUUCodingObject.Create( Self );
  2326.   TheUUObject.Parent := self;
  2327.   TheMIMEObject := TMIMECodingObject.Create( Self );
  2328.   TheMIMEObject.Parent := self;
  2329. end;
  2330.  
  2331. procedure TCCINetCCForm.FormDestroy(Sender: TObject);
  2332. begin
  2333.   { Free the progress text stringlist if assigned }
  2334.   if assigned( ProgressList ) then ProgressList.Free;
  2335.   { Save off the Ini data }
  2336.   WriteIniData;
  2337.   { Save and remove FTP site list stuff }
  2338.   SaveFTPSiteFile;
  2339.   SaveNNTPSiteFile;
  2340.   SaveEmailServerFile;
  2341.   if Assigned( TheFTPComponent ) then TheFTPComponent.Free;
  2342.   if Assigned( TheNNTPComponent ) then TheNNTPComponent.Free;
  2343.   if Assigned( ThePOP3SMTPComponent ) then ThePOP3SMTPComponent.Free;
  2344.   if Assigned( TheUUObject ) then TheUUObject.Free;
  2345.   if Assigned( TheMIMEObject ) then TheMIMEObject.Free;
  2346. end;
  2347.  
  2348. procedure TCCINetCCForm.Description1Click(Sender: TObject);
  2349. var
  2350.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  2351.   TheData    : String;    { Holder for data                           }
  2352. begin
  2353.   { Create socket; auto calls WSAStartup }
  2354.   TempSocket := TCCSocket.Create( Self );
  2355.   { Do parent just for kicks; no longer needed }
  2356.   TempSocket.Parent := self;
  2357.   { Put in error handler }
  2358.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  2359.   TheData := StrPas( TempSocket.Socket_WSA_Data.Description_String );
  2360.   { Display the Description String }
  2361.   AddProgressText( TheData );
  2362.   { And show the progress text as set by option }
  2363.   ShowProgressText( TheData );
  2364.   { Free the socket; auto calls WSACleanup }
  2365.   TempSocket.Free;
  2366. end;
  2367.  
  2368. procedure TCCINetCCForm.SystemStatus1Click(Sender: TObject);
  2369. var
  2370.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  2371.   TheData    : String;    { Holder for data                           }
  2372. begin
  2373.   { Create socket; auto calls WSAStartup }
  2374.   TempSocket := TCCSocket.Create( Self );
  2375.   { Do parent just for kicks; no longer needed }
  2376.   TempSocket.Parent := self;
  2377.   { Put in error handler }
  2378.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  2379.   TheData := StrPas( TempSocket.Socket_WSA_Data.System_Status_String );
  2380.   { Display the Description String }
  2381.   AddProgressText( TheData );
  2382.   { And show the progress text as set by option }
  2383.   ShowProgressText( TheData );
  2384.   { Free the socket; auto calls WSACleanup }
  2385.   TempSocket.Free;
  2386. end;
  2387.  
  2388. procedure TCCINetCCForm.VendorSpecific1Click(Sender: TObject);
  2389. var
  2390.   TempSocket : TCCSocket; { Temporary socket just to get Winsock info }
  2391.   TheData    : String;    { Holder for data                           }
  2392. begin
  2393.   { Create socket; auto calls WSAStartup }
  2394.   TempSocket := TCCSocket.Create( Self );
  2395.   { Do parent just for kicks; no longer needed }
  2396.   TempSocket.Parent := self;
  2397.   { Put in error handler }
  2398.   TempSocket.OnErrorOccurred := SocketsErrorOccurred;
  2399.   TheData := StrPas( TempSocket.Socket_WSA_Data.Vendor_Specific_String );
  2400.   { Display the Description String }
  2401.   AddProgressText( TheData );
  2402.   { And show the progress text as set by option }
  2403.   ShowProgressText( TheData );
  2404.   { Free the socket; auto calls WSACleanup }
  2405.   TempSocket.Free;
  2406. end;
  2407.  
  2408. { This method sets the progress output vector to the memo }
  2409. procedure TCCINetCCForm.ViewInEditWindow1Click(Sender: TObject);
  2410. begin
  2411.   { Set the vector }
  2412.   ProgressOutputVector := POV_MEMO;
  2413.   { Keep the menu options consistent }
  2414.   ViewInEditWindow1.Checked := true;
  2415.   ViewInStatusLine1.Checked := false;
  2416. end;
  2417.  
  2418. { This method sets the progress output vector to the status line }
  2419. procedure TCCINetCCForm.ViewInStatusLine1Click(Sender: TObject);
  2420. begin
  2421.   { Set the vector }
  2422.   ProgressOutputVector := POV_STAT;
  2423.   { Keep the menus consistent }
  2424.   ViewInEditWindow1.Checked := false;
  2425.   ViewInStatusLine1.Checked := true;
  2426. end;
  2427.  
  2428. procedure TCCINetCCForm.SaveToFile1Click(Sender: TObject);
  2429. begin
  2430.   { Set up the dialog parameters }
  2431.   OpenDialog1.Filename := ProgressFileName;
  2432.   OpenDialog1.Title := 'Select Filename for Progress File';
  2433.   OpenDialog1.Filter := 'Text Files|*.txt';
  2434.   { If the dialog is not cancelled then save and clear }
  2435.   if OpenDialog1.Execute then
  2436.   begin
  2437.     ProgressFileName := OpenDialog1.FileName;
  2438.     ProgressList.SaveToFile( ProgressFileName );
  2439.     ProgressList.Clear;
  2440.   end;
  2441. end;
  2442.  
  2443. procedure TCCINetCCForm.IPAddress1Click(Sender: TObject);
  2444. begin
  2445.   { Set up info dialog for IP Address getting }
  2446.   CCICInfoDlg.Caption := 'CC Internet Center -- Translate IP Address';
  2447.   CCICInfoDlg.Panel4.Visible := false;
  2448.   CCICInfoDlg.Panel6.Visible := false;
  2449.   CCICInfoDlg.Panel9.Visible := false;
  2450.   CCICInfoDlg.Panel8.Visible := false;
  2451.   CCICInfoDlg.BitBtn2.Visible := false;
  2452.   CCICInfoDlg.Button1.Caption := 'Get IP Address';
  2453.   CCICInfoDlg.Button2.Visible := false;
  2454.   CCICInfoDlg.Button3.Visible := false;
  2455.   CCICInfoDlg.Button4.Visible := false;
  2456.   CCICInfoDlg.Panel2.Caption := 'IP Addr Name:';
  2457.   CCICInfoDlg.Panel3.Caption := '    Dotted Dec:';
  2458.   CCICInfoDlg.Panel5.Caption := '           Binary:';
  2459.   CCICInfoDlg.Edit1.Text := '';
  2460.   CCICInfoDlg.Edit2.Text := '';
  2461.   CCICInfoDlg.Edit3.Text := '';
  2462.   { Set IP Address Mode }
  2463.   CCICInfoDlg.Tag := 1;
  2464.   { Show Modally to get the information }
  2465.   CCICInfoDlg.ShowModal;
  2466.   { Reset the info dialog to default conditions }
  2467.   CCICInfoDlg.Caption := 'CC Internet Command Center Information Dialog';
  2468.   CCICInfoDlg.Panel4.Visible := true;
  2469.   CCICInfoDlg.Panel6.Visible := true;
  2470.   CCICInfoDlg.Panel9.Visible := true;
  2471.   CCICInfoDlg.Panel8.Visible := true;
  2472.   CCICInfoDlg.BitBtn2.Visible := true;
  2473.   CCICInfoDlg.Button1.Caption := 'Anonymous Login';
  2474.   CCICInfoDlg.Button2.Visible := true;
  2475.   CCICInfoDlg.Button3.Visible := true;
  2476.   CCICInfoDlg.Button4.Visible := true;
  2477.   CCICInfoDlg.Panel2.Caption := '             Name:';
  2478.   CCICInfoDlg.Panel3.Caption := '    IP Address:';
  2479.   CCICInfoDlg.Panel5.Caption := ' User Name:';
  2480.   CCICInfoDlg.Edit1.Text := '';
  2481.   CCICInfoDlg.Edit2.Text := '';
  2482.   CCICInfoDlg.Edit3.Text := '';
  2483. end;
  2484.  
  2485. procedure TCCINetCCForm.FTP1Click(Sender: TObject);
  2486. begin
  2487.   { Set up the FTP Data displays }
  2488.   SetupFTPSiteLists;
  2489.   ListBox1.Clear;
  2490.   ListBox2.Clear;
  2491. end;
  2492.  
  2493. procedure TCCINetCCForm.FormResize(Sender: TObject);
  2494. begin
  2495.   { Use tag vector to determine what to do }
  2496.   case Tag of
  2497.     { if FTP , make sure two list boxes are same height }
  2498.     2 : begin
  2499.           Panel6.Height := (( Panel4.Height div 2 ) - 30 );
  2500.           Panel4.Width := 185;
  2501.         end;
  2502.     4 : begin
  2503.           Panel6.Height := 118;
  2504.           Panel4.Width := 250;
  2505.         end;
  2506.   end;
  2507. end;
  2508.  
  2509. procedure TCCINetCCForm.FTPSites1Click(Sender: TObject);
  2510. begin
  2511.   { Show Modally to get the information }
  2512.   CCICInfoDlg.ShowModal;
  2513. end;
  2514.  
  2515. procedure TCCINetCCForm.FTP3Click(Sender: TObject);
  2516. begin
  2517.   CCICPrefsDlg.TabbedNoteBook1.PageIndex := 1;
  2518.   CCICPrefsDlg.Tag := 2;
  2519.   CCICPrefsDlg.ShowModal;
  2520. end;
  2521.  
  2522. procedure TCCINetCCForm.ConnectToSite1Click(Sender: TObject);
  2523. var Counter_1 : Integer;
  2524. begin
  2525.   if Lowercase( PConnectionsRecord( TheFTPSiteList.Items[
  2526.    ComboBox1.ItemIndex ] )^.CUserName ) = 'anonymous' then
  2527.   begin
  2528.     for Counter_1 := 1 to TheAnonRedialVector do
  2529.     begin
  2530.       DoFTPConnection( PConnectionsRecord(
  2531.          TheFTPSiteList.Items[ ComboBox1.ItemIndex ] ));
  2532.       if TheFTPComponent.Connection_Established then exit;
  2533.     end;
  2534.   end
  2535.   else DoFTPConnection( PConnectionsRecord(
  2536.    TheFTPSiteList.Items[ ComboBox1.ItemIndex ] ));
  2537. end;
  2538.  
  2539. procedure TCCINetCCForm.Button1Click(Sender: TObject);
  2540. begin
  2541.   case Tag of
  2542.     2 : begin
  2543.           if not TheFTPComponent.Connection_Established then
  2544.            ConnectToSite1Click( Self ) else
  2545.            begin
  2546.              DoFTPDisconnect;
  2547.              TheFTPComponent.Connection_Established := false;
  2548.              DisableFTPMenus;
  2549.            end;
  2550.         end;
  2551.     4 : begin
  2552.           ConnectAndUpdate1Click( Self );
  2553.         end;
  2554.     5 : begin
  2555.           GetMarked1Click( Self );
  2556.         end;
  2557.     6 : begin
  2558.            CheckMail1Click( Self );
  2559.         end;
  2560.   end;
  2561. end;
  2562.  
  2563. procedure TCCINetCCForm.ViewasText1Click(Sender: TObject);
  2564. begin
  2565.   { Assume valid FTP component and have it send its text into the progress text}
  2566.   TheFTPComponent.GetRemoteDirectoryListingToMemo;
  2567. end;
  2568.  
  2569. procedure TCCINetCCForm.Disconnect1Click(Sender: TObject);
  2570. begin
  2571.   DoFTPDisconnect;
  2572.   DisableFTPMenus;
  2573. end;
  2574.  
  2575. procedure TCCINetCCForm.EnableFTPMenus;
  2576. begin
  2577.   Button1.Caption := 'Disconnect';
  2578.   ConnectToSite1.Enabled := false;
  2579.   Disconnect1.Enabled := true;
  2580.   Directory1.Enabled := true;
  2581.   UploadMarked1.Enabled := true;
  2582.   DownloadMarked1.Enabled := true;
  2583. end;
  2584.  
  2585. procedure TCCINetCCForm.DisableFTPMenus;
  2586. begin
  2587.   Button1.Caption := 'Connect';
  2588.   ConnectToSite1.Enabled := true;
  2589.   Disconnect1.Enabled := false;
  2590.   Directory1.Enabled := false;
  2591.   UploadMarked1.Enabled := false;
  2592.   DownloadMarked1.Enabled := false;
  2593.   FTP1.Enabled := true;
  2594.   UseNetNws1.Enabled := true;
  2595.   IPAddress1.Enabled := true;
  2596.   FTP2.Enabled := false;
  2597. end;
  2598.  
  2599. procedure TCCINetCCForm.EnableNNTPMenus;
  2600. begin
  2601.   Button1.Caption := 'Disconnect';
  2602.   ConnectAndUpdate1.Enabled := false;
  2603.   Disconnect2.Enabled := true;
  2604.   CheckNewNews1.Enabled := true;
  2605.   GetMarked1.Enabled := true;
  2606.   Article1.Enabled := true;
  2607.   Post1.Enabled := true;
  2608.   SubScribedNewsgroups1.Enabled := true;
  2609.   Trash1.Enabled := true;
  2610.   Headers1.Enabled := true;
  2611.   DownLoadActiveNewsGroups1.Enabled := true;
  2612. end;
  2613.  
  2614. procedure TCCINetCCForm.DisableNNTPMenus;
  2615. begin
  2616.   Button1.Caption := 'Connect';
  2617.   ConnectAndUpdate1.Enabled := True;
  2618.   Disconnect2.Enabled := false;
  2619.   CheckNewNews1.Enabled := false;
  2620.   GetMarked1.Enabled := false;
  2621.   Article1.Enabled := false;
  2622.   Post1.Enabled := false;
  2623.   SubScribedNewsgroups1.Enabled := false;
  2624.   Trash1.Enabled := false;
  2625.   Headers1.Enabled := false;
  2626.   DownLoadActiveNewsGroups1.Enabled := false;
  2627. end;
  2628.  
  2629. procedure TCCINetCCForm.ToDisplay1Click(Sender: TObject);
  2630. var Counter_1 : Integer;
  2631. begin
  2632.   for Counter_1 := 0 to Listbox1.Items.Count - 1 do
  2633.   begin
  2634.     if Listbox1.Selected[ Counter_1 ] then
  2635.     begin
  2636.       FileNameToXFer := ListBox1.Items[ Counter_1 ];
  2637.       TheFTPComponent.
  2638.        ReceiveASCIIRemoteFileToMemo( Listbox1.Items[ Counter_1 ] );
  2639.     end;
  2640.   end;
  2641. end;
  2642.  
  2643. procedure TCCINetCCForm.ToFile1Click(Sender: TObject);
  2644. var Counter_1 : Integer;
  2645.     W16Name   : String;
  2646. begin
  2647.   for Counter_1 := 0 to Listbox1.Items.Count - 1 do
  2648.   begin
  2649.     if Listbox1.Selected[ Counter_1 ] then
  2650.     begin
  2651.       FileNameToXFer := ListBox1.Items[ Counter_1 ];
  2652.       W16Name := TheFTPComponent.GetWin16Filename( FileNameToXFer );
  2653.       TheFTPComponent.
  2654.        ReceiveASCIIRemoteFile( Listbox1.Items[ Counter_1 ] , W16Name );
  2655.     end;
  2656.   end;
  2657. end;
  2658.  
  2659. procedure TCCINetCCForm.Binary2Click(Sender: TObject);
  2660. var Counter_1 : Integer;
  2661.     W16Name   : String;
  2662. begin
  2663.   for Counter_1 := 0 to Listbox1.Items.Count - 1 do
  2664.   begin
  2665.     if Listbox1.Selected[ Counter_1 ] then
  2666.     begin
  2667.       FileNameToXFer := ListBox1.Items[ Counter_1 ];
  2668.       W16Name := TheFTPComponent.GetWin16Filename( FileNameToXFer );
  2669.       TheFTPComponent.
  2670.        ReceiveBinaryRemoteFile( Listbox1.Items[ Counter_1 ] , W16Name );
  2671.     end;
  2672.   end;
  2673. end;
  2674.  
  2675. procedure TCCINetCCForm.Change1Click(Sender: TObject);
  2676. var TheDir : String;
  2677. begin
  2678.   if ListBox1.ItemIndex = -1 then exit;
  2679.   TheDir := ListBox1.Items[ ListBox1.ItemIndex ];
  2680.   if TheFTPComponent.SetRemoteDirectory( TheDir ) then
  2681.   begin
  2682.     TheFTPComponent.GetRemoteWorkingDirectory( TheDir ); 
  2683.     { Put up remote directory via PWD and strip quotes }
  2684.     Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2685.     { Get the listings of directories and exit OK }
  2686.     TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2687.   end;
  2688. end;
  2689.  
  2690. procedure TCCINetCCForm.ChangeLocal1Click(Sender: TObject);
  2691. var TheDir : String;
  2692. begin
  2693.   if ListBox2.ItemIndex = -1 then exit;
  2694.   TheDir := ListBox2.Items[ ListBox2.ItemIndex ];
  2695.   TheDir := TheFTPComponent.StripBrackets( TheDir );
  2696.   if TheDir = '..' then
  2697.   begin
  2698.     ChDir( TheDir );
  2699.   end
  2700.   else
  2701.   begin
  2702.     TheDir := ExpandFileName( TheDir );
  2703.     ChDir( TheDir );
  2704.   end;
  2705.   TheFTPComponent.GetLocalDirectoryAndListing( TheDir , Listbox2 );
  2706.   if Label5.Canvas.TextWidth( TheDir ) > Label5.Width then
  2707.    TheDir := TheFTPComponent.GetShortPathName( TheDir );
  2708.   Label5.Caption := TheDir;
  2709. end;
  2710.  
  2711. procedure TCCINetCCForm.ListBox1DblClick(Sender: TObject);
  2712. begin
  2713.   case Tag of
  2714.     2 : begin
  2715.           case DefaultDownLoadVector of
  2716.             1 : Binary2Click( Self );
  2717.             2 : ToFile1Click( Self );
  2718.             3 : Change1Click( Self );
  2719.           end;
  2720.         end;
  2721.   end;
  2722. end;
  2723.  
  2724. procedure TCCINetCCForm.ListBox2DblClick(Sender: TObject);
  2725. var WorkingString ,
  2726.     NumberString    : String;
  2727.     TheIDNumber     : Integer;
  2728.     TheNGARecord    : PNewsGroupArticleRecord;
  2729. begin
  2730.   case Tag of
  2731.     2 : begin
  2732.           case DefaultDownLoadVector of
  2733.             1 : Binary1Click( Self );
  2734.             2 : ASCII1Click( Self );
  2735.             3 : ChangeLocal1Click( Self );
  2736.           end;
  2737.         end;
  2738.     5 : begin
  2739.           if ListBox2.Tag <> 5 then exit;
  2740.           if ListBox2.ItemIndex = -1 then exit;
  2741.           WorkingString := ListBox2.Items[ ListBox2.ItemIndex ];
  2742.           NumberString := TheFTPComponent.StripBrackets( WorkingString );
  2743.           TheIDNumber := StrToInt( NumberString );
  2744.           TheNGARecord := PNewsGroupArticleRecord(
  2745.            TheNGArticlesList.Items[ TheIDNumber ] );
  2746.           if TheNGARecord^.NGADownloaded then
  2747.           begin
  2748.             Memo1.Clear;
  2749.             try
  2750.               Memo1.Lines.LoadFromFile( NewsPath + '\' + TheNGARecord^.NGAArtFileName );
  2751.             except
  2752.               MessageDlg( 'Article Too Large to Load! Use Write to View [' +
  2753.                TheNGARecord^.NGAArtFilename + '.',
  2754.                mtError,[mbOK],0);
  2755.               exit;
  2756.             end;
  2757.             Label1.Caption := 'Subject:';
  2758.             ComboBox1.Text := TheNGARecord^.NGASubject;
  2759.             TheNGARecord^.NGARead := true;
  2760.             WorkingString := ListBox2.Items[ ListBox2.ItemIndex ];
  2761.             WorkingString[ 3 ] := 'R';
  2762.             ListBox2.Items[ ListBox2.ItemIndex ] := WorkingString;
  2763.           end
  2764.           else
  2765.           begin
  2766.             MessageDlg( 'Article Not Downloaded!',mtError,[mbOK],0);
  2767.           end;
  2768.         end;
  2769.     6 : begin
  2770.           if ListBox2.ItemIndex = -1 then exit;
  2771.           WorkingString := PEMailMessageRecord(
  2772.            TheMBMessagesList.Items[ ListBox2.ItemIndex ] )^.MRFileName;
  2773.           PEMailMessageRecord(
  2774.            TheMBMessagesList.Items[ ListBox2.ItemIndex ] )^.MRRead := true;;
  2775.           WorkingString := MailPath + '\' + WorkingString;
  2776.           Memo1.Clear;
  2777.           try
  2778.             Memo1.Lines.LoadFromFile( WorkingString );
  2779.           except
  2780.             MessageDlg( 'Article Too Large to Load! Use Write to View.',
  2781.              mtError,[mbOK],0);
  2782.             exit;
  2783.           end;
  2784.           Label1.Caption := 'Subject:';
  2785.           ComboBox1.Text := PEMailMessageRecord(
  2786.            TheMBMessagesList.Items[ ListBox2.ItemIndex ] )^.MRMessageSubject;
  2787.           PopulateLB2WithMessageHeaders;
  2788.         end;
  2789.   end;
  2790. end;
  2791.  
  2792. procedure TCCINetCCForm.ASCII1Click(Sender: TObject);
  2793. var Counter_1 : Integer;
  2794.     TheDir    : String;
  2795. begin
  2796.   for Counter_1 := 0 to Listbox2.Items.Count - 1 do
  2797.   begin
  2798.     if Listbox2.Selected[ Counter_1 ] then
  2799.     begin
  2800.       FileNameToXFer := ListBox2.Items[ Counter_1 ];
  2801.       TheFTPComponent.
  2802.        SendASCIILocalFile( Listbox2.Items[ Counter_1 ] );
  2803.     end;
  2804.   end;
  2805.   TheFTPComponent.GetRemoteWorkingDirectory( TheDir );
  2806.   { Put up remote directory via PWD and strip quotes }
  2807.   Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2808.   { Get the listings of directories and exit OK }
  2809.   TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2810. end;
  2811.  
  2812. procedure TCCINetCCForm.DeleteRemoteFiles1Click(Sender: TObject);
  2813. var Counter_1 : Integer;
  2814.     TheDir    : String;
  2815.     DoAll     : Boolean;
  2816.     TheResult : Integer;
  2817. begin
  2818.   DoAll := false;
  2819.   for Counter_1 := 0 to Listbox1.Items.Count - 1 do
  2820.   begin
  2821.     if Listbox1.Selected[ Counter_1 ] then
  2822.     begin
  2823.       if not DoAll then
  2824.       begin
  2825.         TheResult := MessageDlg( 'Delete Remote File ' +
  2826.          ListBox1.Items[ Counter_1 ] + ' ?',mtConfirmation,
  2827.           [mbYes,mbNo,mbCancel,mbAll],0 );
  2828.         case TheResult of
  2829.           mrYes : ;
  2830.           mrNo  : ;
  2831.           mrCancel : break;
  2832.           mrAll : begin
  2833.                     TheResult := mrYes;
  2834.                     DoAll := true;
  2835.                   end;
  2836.         end;
  2837.       end
  2838.       else TheResult := mrYes;
  2839.       if TheResult = mrYes then TheFTPComponent.
  2840.          DeleteRemoteFile( Listbox1.Items[ Counter_1 ] );
  2841.     end;
  2842.   end;
  2843.   TheFTPComponent.GetRemoteWorkingDirectory( TheDir );
  2844.   { Put up remote directory via PWD and strip quotes }
  2845.   Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2846.   { Get the listings of directories and exit OK }
  2847.   TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2848. end;
  2849.  
  2850. procedure TCCINetCCForm.Binary1Click(Sender: TObject);
  2851. var Counter_1 : Integer;
  2852.     TheDir    : String;
  2853. begin
  2854.   for Counter_1 := 0 to Listbox2.Items.Count - 1 do
  2855.   begin
  2856.     if Listbox2.Selected[ Counter_1 ] then
  2857.     begin
  2858.       FileNameToXFer := ListBox2.Items[ Counter_1 ];
  2859.       TheFTPComponent.
  2860.        SendBinaryLocalFile( Listbox2.Items[ Counter_1 ] );
  2861.     end;
  2862.   end;
  2863.   TheFTPComponent.GetRemoteWorkingDirectory( TheDir );
  2864.   { Put up remote directory via PWD and strip quotes }
  2865.   Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2866.   { Get the listings of directories and exit OK }
  2867.   TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2868. end;
  2869.  
  2870. procedure TCCINetCCForm.Delete3Click(Sender: TObject);
  2871. var Counter_1 : Integer;
  2872.     TheDir    : String;
  2873. begin
  2874.   for Counter_1 := 0 to Listbox1.Items.Count - 1 do
  2875.   begin
  2876.     if Listbox1.Selected[ Counter_1 ] then
  2877.     begin
  2878.       if ListBox1.Items[ Counter_1 ] <> '..' then
  2879.        TheFTPComponent.
  2880.         DeleteRemoteDirectory( Listbox1.Items[ Counter_1 ] );
  2881.     end;
  2882.   end;
  2883.   TheFTPComponent.GetRemoteWorkingDirectory( TheDir );
  2884.   { Put up remote directory via PWD and strip quotes }
  2885.   Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2886.   { Get the listings of directories and exit OK }
  2887.   TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2888. end;
  2889.  
  2890. procedure TCCINetCCForm.Create1Click(Sender: TObject);
  2891. var TheDir : String;
  2892. begin
  2893.   OpenDialog1.Filename := '*.*';
  2894.   OpenDialog1.Title := 'Enter Remote Directory Name';
  2895.   if OpenDialog1.Execute then
  2896.   begin
  2897.     TheFTPComponent.
  2898.      CreateRemoteDirectory( ExtractFileName( OpenDialog1.FileName ));
  2899.     TheFTPComponent.GetRemoteWorkingDirectory( TheDir );
  2900.     { Put up remote directory via PWD and strip quotes }
  2901.     Label4.Caption := TheFTPComponent.GetQuotedString( TheDir );
  2902.     { Get the listings of directories and exit OK }
  2903.     TheFTPComponent.GetRemoteDirectoryListing( Listbox1 );
  2904.   end;
  2905. end;
  2906.  
  2907. procedure TCCINetCCForm.ListBox1Click(Sender: TObject);
  2908. var TheNGRecord : PNewsGroupRecord;
  2909.     TheMBRecord : PEMailMailboxRecord;
  2910. begin
  2911.   case ListBox1.Tag of
  2912.     5 : begin
  2913.           if ListBox1.ItemIndex = -1 then exit;
  2914.           TheNGRecord :=
  2915.            PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  2916.           TheNGArticlesList := TList( TheNGRecord^.GLTag );
  2917.           PopulateLB2WithArticleHeaders;
  2918.           ComboBox1.ItemIndex := ListBox1.ItemIndex;
  2919.         end;
  2920.     6 : begin
  2921.           if ListBox1.ItemIndex = -1 then exit;
  2922.           TheMBRecord :=
  2923.            PEMailMailboxRecord( TheEMailMailboxList.Items[ ListBox1.ItemIndex ] );
  2924.           TheMBMessagesList := TList( TheMBRecord^.MBLTag );
  2925.           PopulateLB2WithMessageHeaders;
  2926.         end;
  2927.   end;
  2928. end;
  2929.  
  2930. procedure TCCINetCCForm.UsenetNws1Click(Sender: TObject);
  2931. begin
  2932.   if TheFTPComponent.Connection_Established then
  2933.   begin
  2934.     MessageDlg( 'Must disconnect from current FTP session first!',
  2935.      mtError,[mbOK],0);
  2936.     exit;
  2937.   end;
  2938.   { Show The NNTP servers display }
  2939.   ListBox1.Clear;
  2940.   ListBox2.Clear;
  2941.   SetupNNTPSiteLists;
  2942.   NewsGroupListLoaded := false;
  2943.   SetupNNTPServersInfoDisplay;
  2944. end;
  2945.  
  2946. procedure TCCINetCCForm.Disconnect2Click(Sender: TObject);
  2947. begin
  2948.   SaveNNTPNewsGroupLists;
  2949.   DoNNTPDisconnect;
  2950.   DisableNNTPMenus;
  2951.   ListBox1.Clear;
  2952.   ListBox2.Clear;
  2953. end;
  2954.  
  2955. procedure TCCINetCCForm.News2Click(Sender: TObject);
  2956. begin
  2957.   CCICPrefsDlg.TabbedNoteBook1.PageIndex := 2;
  2958.   CCICPrefsDlg.Tag := 4;
  2959.   CCICPrefsDlg.ShowModal;
  2960. end;
  2961.  
  2962. procedure TCCINetCCForm.ConnectandUpdate1Click(Sender: TObject);
  2963. begin
  2964.   DoNNTPConnection( PConnectionsRecord(
  2965.      TheNewsServerList.Items[ ComboBox1.ItemIndex ] ));
  2966.   if TheNNTPComponent.Connection_Established then
  2967.   begin
  2968.     SetupNNTPNewsGroupLists;
  2969.     if NewsInitialUpdateVector = 1 then
  2970.     begin { Update all active newsgroups }
  2971.       TheNNTPComponent.CheckAllNewNews;
  2972.     end;
  2973.     { Bring up the files with current NG information }
  2974.     SetupNewsGroupListboxes;
  2975.   end;
  2976. end;
  2977.  
  2978. procedure TCCINetCCForm.CheckNewNews1Click(Sender: TObject);
  2979. begin
  2980.   TheNNTPComponent.CheckAllNewNews;
  2981.   SetupNewsGroupListboxes;
  2982. end;
  2983.  
  2984. procedure TCCINetCCForm.NewsServers1Click(Sender: TObject);
  2985. begin
  2986.   { Reset display to NNTP Servers }
  2987.   SetupNNTPServersInfoDisplay;
  2988.   { Show Modally to get the information }
  2989.   CCICInfoDlg.ShowModal;
  2990. end;
  2991.  
  2992. procedure TCCINetCCForm.SubscribedNewsgroups1Click(Sender: TObject);
  2993. begin
  2994.   { Reset display to Usenet Newsgroups }
  2995.   SetupNNTPNewsGroupsInfoDisplay;
  2996.   { Show Modally to get the information }
  2997.   CCICInfoDlg.ShowModal;
  2998.   TheNNTPComponent.CheckAllNewNews;
  2999.   SetupNewsGroupListboxes;
  3000. end;
  3001.  
  3002. procedure TCCINetCCForm.RetrieveMarked1Click(Sender: TObject);
  3003. var Counter_1   : Integer;
  3004.     TheNGRecord : PNewsGroupRecord;
  3005. begin
  3006.   for Counter_1 := 0 to ListBox1.Items.Count - 1 do
  3007.   begin
  3008.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  3009.     if (( TheNGRecord^.GSubscribed ) and ( ListBox1.Selected[ Counter_1 ] )) then
  3010.     begin
  3011.       TheNNTPComponent.GetAllArticleHeaders( TheNGRecord );
  3012.     end;
  3013.   end;
  3014.   SetupNewsGroupListboxes;
  3015. end;
  3016.  
  3017. procedure TCCINetCCForm.RetrieveAll1Click(Sender: TObject);
  3018. var Counter_1   : Integer;
  3019.     TheNGRecord : PNewsGroupRecord;
  3020. begin
  3021.   for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  3022.   begin
  3023.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  3024.     if TheNGRecord^.GSubscribed then
  3025.     begin
  3026.       TheNNTPComponent.GetAllArticleHeaders( TheNGRecord );
  3027.     end;
  3028.   end;
  3029.   SetupNewsGroupListboxes;
  3030. end;
  3031.  
  3032. procedure TCCINetCCForm.GetMarked1Click(Sender: TObject);
  3033. var TheNGRecord : PNewsGroupRecord;
  3034. begin
  3035.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3036.   TheNNTPComponent.DownloadAllMarkedArticleListings( TheNGRecord , ListBox2 );
  3037.   SetupNewsGroupListboxes;
  3038. end;
  3039.  
  3040. procedure TCCINetCCForm.NewArticle1Click(Sender: TObject);
  3041. begin
  3042.   if ListBox1.ItemIndex = -1 then exit;
  3043.   Memo1.Clear;
  3044.   TheNNTPComponent.SetNewsHeaders( Memo1 , ListBox1.ItemIndex );
  3045. end;
  3046.  
  3047. procedure TCCINetCCForm.FollowupArticle1Click(Sender: TObject);
  3048. begin
  3049.   if ListBox1.ItemIndex = -1 then exit;
  3050.   if ListBox2.ItemIndex = -1 then exit;
  3051.   Memo1.Clear;
  3052.   TheNNTPComponent.SetFUNewsHeaders( Memo1              ,
  3053.                                      ListBox1.ItemIndex ,
  3054.                                      ListBox2.ItemIndex   );
  3055. end;
  3056.  
  3057. procedure TCCINetCCForm.PutinQueue1Click(Sender: TObject);
  3058. var TheNGRecord : PNewsGroupRecord;
  3059.     TheNGARecord : PNewsGroupArticleRecord;
  3060.     WorkingList : TList;
  3061.     WorkingFilename : String;
  3062.     Holdingposition : Integer;
  3063. begin
  3064.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3065.   WorkingList := TList( TheNGRecord^.GLTag );
  3066.   New( TheNGARecord );
  3067.   with TheNGARecord^ do
  3068.   begin
  3069.     NGAGroupname   := TheNGRecord^.GRealName;
  3070.     NGASubject     := TheNNTPComponent.GetHeaderSubject( TStringList( Memo1.Lines ));
  3071.     NGANumber      := TheNGRecord^.GHighestAvailable + WorkingList.Count;
  3072.     NGADownloaded  := true;
  3073.     NGASender      := 'CIUPKC158';
  3074.     NGARead        := false;
  3075.     NGAPosted      := false;
  3076.     WorkingFileName := 'AR' + IntToStr( NGANumber );
  3077.     if Length( WorkingFileName ) > 8 then
  3078.      WorkingFileName := Copy( WorkingFileName ,1 , 8 );
  3079.     WorkingFileName := WorkingFileName + '.' + IntToStr( TheNGRecord^.GIDNumber );
  3080.     NGAArtFileName := WorkingFileName;
  3081.   end;
  3082.   WorkingList.Add( TheNGARecord );
  3083.   Memo1.Lines.SaveToFile( NewsPath + '\' + WorkingFileName );
  3084.   HoldingPosition := ListBox1.itemindex;
  3085.   SetupNewsGroupListboxes;
  3086.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ HoldingPosition ] );
  3087.   TheNGArticlesList := TList( TheNGRecord^.GLTag );
  3088.   PopulateLB2WithArticleHeaders;
  3089. end;
  3090.  
  3091. procedure TCCINetCCForm.CurrentArticle1Click(Sender: TObject);
  3092. var TheNGARecord : PNewsGroupArticleRecord;
  3093.     TheNGRecord  : PNewsGroupRecord;
  3094.     HP : Integer;
  3095. begin
  3096.   HP := ListBox1.itemindex;
  3097.   PutInQueue1Click( Self );
  3098.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ HP ] );
  3099.   TheNGArticlesList := TList( TheNGRecord^.GLTag );
  3100.   TheNGARecord := PNewsGroupArticleRecord( TheNGArticlesList.Items[ TheNGArticlesList.Count - 1 ] );
  3101.   TheNNTPComponent.UploadArticleListing( TheNGARecord );
  3102. end;
  3103.  
  3104. procedure TCCINetCCForm.EntireQueue1Click(Sender: TObject);
  3105. var TheNGRecord : PNewsGroupRecord;
  3106. begin
  3107.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3108.   TheNNTPComponent.UploadAllArticleListings( TheNGRecord );
  3109. end;
  3110.  
  3111. procedure TCCINetCCForm.AllReadArticles1Click(Sender: TObject);
  3112. var TheNGRecord : PNewsGroupRecord;
  3113. begin
  3114.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3115.   TheNNTPComponent.PurgeReadSentArticleListings( TheNGRecord );
  3116.   SetupNewsGroupListboxes;
  3117. end;
  3118.  
  3119. procedure TCCINetCCForm.AllMarkedArticles1Click(Sender: TObject);
  3120. var TheNGRecord : PNewsGroupRecord;
  3121.     TheNGARecord : PNewsGroupArticleRecord;
  3122.     WorkingList : TList;
  3123.     Counter_1 : Integer;
  3124. begin
  3125.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3126.   WorkingList := TList( TheNGRecord^.GLTag );
  3127.   for Counter_1 := 0 to ListBox2.Items.Count - 1 do
  3128.   begin
  3129.     if ListBox2.Selected[ Counter_1 ] then
  3130.     begin
  3131.       TheNGARecord := PNewsGroupArticleRecord( WorkingList.Items[ Counter_1 ] );
  3132.       TheNGARecord^.NGARead := true;
  3133.     end;
  3134.   end;
  3135.   TheNNTPComponent.PurgeReadSentArticleListings( TheNGRecord );
  3136.   SetupNewsGroupListboxes;
  3137. end;
  3138.  
  3139. procedure TCCINetCCForm.AllAvailableArticles1Click(Sender: TObject);
  3140. var TheNGRecord : PNewsGroupRecord;
  3141.     TheNGARecord : PNewsGroupArticleRecord;
  3142.     WorkingList : TList;
  3143.     Counter_1  : Integer;
  3144. begin
  3145.   TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3146.   WorkingList := TList( TheNGRecord^.GLTag );
  3147.   for Counter_1 := 0 to ListBox2.Items.Count - 1 do
  3148.   begin
  3149.     TheNGARecord := PNewsGroupArticleRecord( WorkingList.Items[ Counter_1 ] );
  3150.     TheNGARecord^.NGARead := true;
  3151.   end;
  3152.   TheNNTPComponent.PurgeReadSentArticleListings( TheNGRecord );
  3153.   SetupNewsGroupListboxes;
  3154. end;
  3155.  
  3156. procedure TCCINetCCForm.DownloadActiveNewsgroups1Click(Sender: TObject);
  3157. begin
  3158.   if MessageDlg( 'This will take considerable time. Proceed?',mtConfirmation,
  3159.    mbYesNoCancel,0) = mrYes then
  3160.   begin
  3161.     Memo1.Clear;
  3162.     TheNNTPComponent.GetListofAvailableNewsGroups;
  3163.   end;
  3164. end;
  3165.  
  3166. procedure TCCINetCCForm.UUEncode1Click(Sender: TObject);
  3167. begin
  3168.   OpenDialog1.Filename := '*.*';
  3169.   OpenDialog1.Title := 'Select File to UUENCODE';
  3170.   if OpenDialog1.Execute then
  3171.   begin
  3172.     TheUUObject.SetInputFileName( OpenDialog1.FileName );
  3173.     TheUUObject.EncodeCurrentInputs;
  3174.   end;
  3175. end;
  3176.  
  3177. procedure TCCINetCCForm.Load1Click(Sender: TObject);
  3178. var Memo2 : TMemo;
  3179.     Counter_1 : Integer;
  3180. begin
  3181.   OpenDialog1.Filename := '*.txt';
  3182.   OpenDialog1.Title := 'Select File to load into Memo';
  3183.   if OpenDialog1.Execute then
  3184.   begin
  3185.     Memo2 := TMemo.Create( Self );
  3186.     Memo2.Parent := Self;
  3187.     Memo2.Visible := false;
  3188.     Memo2.Width := Memo1.Width;
  3189.     Memo2.Height := Memo1.Height;
  3190.     Memo2.Lines.LoadFromFile( OpenDialog1.FileName );
  3191.     for Counter_1 := 0 to Memo2.Lines.Count - 1 do
  3192.      Memo1.Lines.Add( Memo2.Lines[ Counter_1 ] );
  3193.     Memo2.Free;
  3194.   end;
  3195. end;
  3196.  
  3197. procedure TCCINetCCForm.Save1Click(Sender: TObject);
  3198. begin
  3199.   SaveDialog1.Filename := '*.txt';
  3200.   SaveDialog1.Title := 'Select File to Save Memo to';
  3201.   if OpenDialog1.Execute then
  3202.   begin
  3203.     Memo1.Lines.SaveToFile( SaveDialog1.FileName );
  3204.   end;
  3205. end;
  3206.  
  3207. procedure TCCINetCCForm.EMail1Click(Sender: TObject);
  3208. begin
  3209.   if TheFTPComponent.Connection_Established then
  3210.   begin
  3211.     MessageDlg( 'Must disconnect from current FTP session first!',
  3212.      mtError,[mbOK],0);
  3213.     exit;
  3214.   end;
  3215.   if TheNNTPComponent.Connection_Established then
  3216.   begin
  3217.     MessageDlg( 'Must disconnect from current NNTP session first!',
  3218.      mtError,[mbOK],0);
  3219.     exit;
  3220.   end;
  3221.   { Show The POP3SMTP servers display }
  3222.   ListBox1.Clear;
  3223.   ListBox2.Clear;
  3224.   SetupEMailServerStatus;
  3225.   EnablePOP3SMTPMenus;
  3226.   SetupEMailServersInfoDisplay;
  3227. end;
  3228.  
  3229. procedure TCCINetCCForm.CheckMail1Click(Sender: TObject);
  3230. begin
  3231.   WhichServer := ComboBox1.ItemIndex + 1;
  3232.   if not EMailLoaded then
  3233.   begin
  3234.     LoadEMailMailBoxFile( WhichServer );
  3235.     LoadEMailCorrespondentsFile;
  3236.     EmailLoaded := true;
  3237.   end;
  3238.   DoPOP3Connection( TheEMailServerList.Items[ WhichServer - 1 ] );
  3239.   ThePOP3SMTPComponent.DownloadAllMessageListings(
  3240.    PEMailMailBoxRecord( TheEMailMailboxList.Items[ 0 ] ));
  3241.   ThePOP3SMTPComponent.POP3Disconnect;
  3242.   SetupEMailListBoxes;
  3243. end;
  3244.  
  3245. procedure TCCINetCCForm.CreateNewMessage1Click(Sender: TObject);
  3246. begin
  3247.   Label2.Visible := true;
  3248.   Label3.visible := true;
  3249.   ComboBox2.Visible := true;
  3250.   ComboBox3.visible := true;
  3251.   ThePOP3SMTPComponent.SetMailHeaders( Memo1 ,
  3252.    PConnectionsRecord( TheEMailServerList.Items[ WhichServer - 1 ] ));
  3253.   NewMessageInProgress := true;
  3254. end;
  3255.  
  3256. procedure TCCINetCCForm.ReplyToCurrentMessage1Click(Sender: TObject);
  3257. begin
  3258.   Label2.Visible := true;
  3259.   Label3.visible := true;
  3260.   ComboBox2.Visible := true;
  3261.   ComboBox3.visible := true;
  3262.   ThePOP3SMTPComponent.SetReplyMailHeaders( Memo1 ,
  3263.    PConnectionsRecord( TheEMailServerList.Items[ WhichServer - 1 ] ) ,
  3264.    PEMailMailboxRecord( TheEMailMailboxList.Items[ ListBox1.ItemIndex ] ) ,
  3265.    ListBox2.ItemIndex );
  3266.   NewMessageInProgress := true;
  3267. end;
  3268.  
  3269. procedure TCCINetCCForm.SendCurrentMessage1Click(Sender: TObject);
  3270. var TheEMMRecord : PEMailMessageRecord;
  3271.     WorkingNumber : Integer;
  3272.     WorkingFileName : String;
  3273.     WorkingList     : TList;
  3274. begin
  3275.   Label2.Visible := false;
  3276.   Label3.visible := false;
  3277.   ComboBox2.Visible := false;
  3278.   ComboBox3.visible := false;
  3279.   if not NewMessageInProgress then exit;
  3280.   NewMessageInProgress := false;
  3281.   New( TheEMMRecord );
  3282.   ThePOP3SMTPComponent.ExtractHeaderInfoFromMemo( Memo1 , TheEMMRecord );
  3283.   WorkingNumber := ListBox2.Items.Count + 1;
  3284.   with TheEMMRecord^ do
  3285.   begin
  3286.     MRSent := false;
  3287.     WorkingFileName := 'EM' + IntToStr( WorkingNumber );
  3288.     if Length( WorkingFileName ) > 8 then WorkingFileName :=
  3289.      Copy( WorkingFileName , 1 , 8 );
  3290.     WorkingFileName := WorkingFileName + '.2';
  3291.     MRFileName := WorkingFileName;
  3292.     WorkingFileName := MailPath + '\' + WorkingFileName;
  3293.     Memo1.Lines.SaveToFile( WorkingFileName );
  3294.   end;
  3295.    Inc( PEMailMailBoxRecord(
  3296.    TheEMailMailBoxList.Items[ 1 ] )^.MBTotal );
  3297.    Inc( PEMailMailBoxRecord(
  3298.    TheEMailMailBoxList.Items[ 1 ] )^.MBUnSentTotal );
  3299.    WorkingList := TList( PEMailMailBoxRecord(
  3300.    TheEMailMailBoxList.Items[ 1 ] )^.MBLTag );
  3301.   WorkingList.Add( TheEMMRecord );
  3302.   PEMailMailBoxRecord(
  3303.    TheEMailMailBoxList.Items[ 1 ] )^.MBLTag :=
  3304.     Longint( WorkingList );
  3305.   If EMQueueVector = 2 then
  3306.   begin
  3307.     DoSMTPConnection( TheEMailServerList.Items[ WhichServer - 1 ] );
  3308.     ThePOP3SMTPComponent.UploadMessageListing( TheEMMRecord );
  3309.     {ThePOP3SMTPComponent.SMTPDisconnect;}
  3310.   end;
  3311.   TheMBMessagesList := WorkingList;
  3312.   SetupEMailListBoxes;
  3313.   Memo1.Clear;
  3314. end;
  3315.  
  3316. procedure TCCINetCCForm.SendQueue1Click(Sender: TObject);
  3317. var WorkingList     : TList;
  3318. begin
  3319.   SendCurrentMessage1Click( Self );
  3320.   Memo1.Clear;
  3321.   DoSMTPConnection( TheEMailServerList.Items[ WhichServer - 1 ] );
  3322.   ThePOP3SMTPComponent.UploadAllMessageListings( PConnectionsRecord(
  3323.    TheEMailServerList.Items[ WhichServer - 1 ] ),
  3324.    PEMailMailboxRecord( TheEMailMailboxList.Items[ 1 ] ));
  3325.   {ThePOP3SMTPComponent.SMTPDisconnect;}
  3326.    WorkingList := TList( PEMailMailBoxRecord(
  3327.    TheEMailMailBoxList.Items[ 1 ] )^.MBLTag );
  3328.   TheMBMessagesList := WorkingList;
  3329.   SetupEMailListBoxes;
  3330. end;
  3331.  
  3332. procedure TCCINetCCForm.MailServers1Click(Sender: TObject);
  3333. begin
  3334.   SetupEmailServersInfoDisplay;
  3335.   CCICInfoDlg.ShowModal;
  3336. end;
  3337.  
  3338. procedure TCCINetCCForm.Mailboxes1Click(Sender: TObject);
  3339. begin
  3340.   SetupEmailMailboxInfoDisplay;
  3341.   CCICInfoDlg.ShowModal;
  3342.   SetupEMailListBoxes;
  3343. end;
  3344.  
  3345. procedure TCCINetCCForm.Correspondents1Click(Sender: TObject);
  3346. begin
  3347.   SetupEmailCorrespondentsInfoDisplay;
  3348.   CCICInfoDlg.ShowModal;
  3349. end;
  3350.  
  3351. procedure TCCINetCCForm.EMail3Click(Sender: TObject);
  3352. begin
  3353.   CCICPrefsDlg.TabbedNoteBook1.PageIndex := 0;
  3354.   CCICPrefsDlg.Tag := 6;
  3355.   CCICPrefsDlg.ShowModal;
  3356. end;
  3357.  
  3358. procedure TCCINetCCForm.Paths1Click(Sender: TObject);
  3359. begin
  3360.   CCICPrefsDlg.TabbedNoteBook1.PageIndex := 3;
  3361.   CCICPrefsDlg.Tag := 3;
  3362.   CCICPrefsDlg.ShowModal;
  3363. end;
  3364.  
  3365. procedure TCCINetCCForm.ExitEMailRequired1Click(Sender: TObject);
  3366. begin
  3367.   if not ThePOP3SMTPComponent.Connection_Established then exit;
  3368.   DoPOP3SMTPDisconnect;
  3369.   SaveEMailMailBoxFile( WhichServer );
  3370.   SaveEMailCorrespondentsFile;
  3371.   DisablePOP3SMTPMenus;
  3372.   EMailLoaded := false;
  3373. end;
  3374.  
  3375. procedure TCCINetCCForm.TrashMarkedMessages1Click(Sender: TObject);
  3376. begin
  3377.   ThePOP3SMTPComponent.TrashAllMarkedMessages( ListBox2 ,
  3378.    PEMailMailboxRecord( TheEMailMailBoxList.Items[ ListBox1.Itemindex ] ));
  3379.   TheMBMessagesList := TList( PEMailMailboxRecord(
  3380.    TheEMailMailBoxList.Items[ ListBox1.Itemindex ] )^.MBLTag );
  3381.   PopulateLB2WithMessageHeaders;
  3382. end;
  3383.  
  3384. procedure TCCINetCCForm.EmptyTrash1Click(Sender: TObject);
  3385. var Counter_1 : Integer;
  3386. begin
  3387.   for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  3388.   begin
  3389.     ThePOP3SMTPComponent.PurgeTrashedMessageListings(
  3390.      PEMailMailBoxRecord( TheEMailMailboxList.Items[ Counter_1 ] ));
  3391.   end;
  3392.   TheMBMessagesList := TList( PEMailMailboxRecord(
  3393.    TheEMailMailBoxList.Items[ 0 ] )^.MBLTag );
  3394.   SetupEmailListboxes;
  3395. end;
  3396.  
  3397. procedure TCCINetCCForm.ComboBox2Change(Sender: TObject);
  3398. var WhichCorrespondent : Integer;
  3399.     TheName            : String;
  3400. begin
  3401.   case Tag of
  3402.     6 : begin
  3403.           if not NewMessageInProgress then exit;
  3404.           WhichCorrespondent := ComboBox2.ItemIndex;
  3405.           if WhichCorrespondent = -1 then exit;
  3406.           TheName := PConnectionsRecord(
  3407.            TheCorrespondentsList.Items[ WhichCorrespondent ] )^.CIPAddress;
  3408.           ThePOP3SMTPComponent.SetRecipient( Memo1 , TheName );
  3409.         end;
  3410.   end;
  3411. end;
  3412.  
  3413. procedure TCCINetCCForm.ComboBox3Change(Sender: TObject);
  3414. var WhichCorrespondent : Integer;
  3415.     TheName            : String;
  3416. begin
  3417.   case Tag of
  3418.     6 : begin
  3419.           if not NewMessageInProgress then exit;
  3420.           WhichCorrespondent := ComboBox3.ItemIndex;
  3421.           if WhichCorrespondent = -1 then exit;
  3422.           TheName := PConnectionsRecord(
  3423.            TheCorrespondentsList.Items[ WhichCorrespondent ] )^.CIPAddress;
  3424.           ThePOP3SMTPComponent.SetCarbonCopy( Memo1 , TheName );
  3425.         end;
  3426.   end;
  3427. end;
  3428.  
  3429. procedure TCCINetCCForm.MIMEDecode1Click(Sender: TObject);
  3430. var Counter_1    : Integer;
  3431.     TheEMMRecord : PEmailMessageRecord;
  3432. begin
  3433.   for Counter_1 := 0 to ListBox2.Items.Count - 1 do
  3434.   begin
  3435.     if ListBox2.Selected[ Counter_1 ] then
  3436.     begin
  3437.       TheEMMRecord :=
  3438.        PEMailMessageRecord( TheMBMessagesList.Items[ Counter_1 ] );
  3439.       TheMIMEObject.TheInputFileName := MailPath + '\' +
  3440.        TheEMMRecord^.MRFileName;
  3441.       TheMIMEObject.DecodeMIMEFile;
  3442.     end;
  3443.   end;
  3444. end;
  3445.  
  3446. procedure TCCINetCCForm.Cut1Click(Sender: TObject);
  3447. begin
  3448.   Memo1.CutToClipboard;
  3449. end;
  3450.  
  3451. procedure TCCINetCCForm.Copy1Click(Sender: TObject);
  3452. begin
  3453.   Memo1.CopyToClipboard;
  3454. end;
  3455.  
  3456. procedure TCCINetCCForm.CopytoFile1Click(Sender: TObject);
  3457. var TempMemo : TMemo;
  3458. begin
  3459.   TempMemo := TMemo.Create( self );
  3460.   TempMemo.parent := self;
  3461.   Tempmemo.Visible := false;
  3462.   TempMemo.Width := Memo1.Width;
  3463.   TempMemo.Height := Memo1.Height;
  3464.   Memo1.CopyToClipboard;
  3465.   TempMemo.PasteFromClipboard;
  3466.   SaveDialog1.Filename := '*.TXT';
  3467.   SaveDialog1.Title := 'Select File to Save To';
  3468.   if SaveDialog1.Execute then TempMemo.Lines.SaveToFile( SaveDialog1.Filename );
  3469.   TempMemo.Free;
  3470. end;
  3471.  
  3472. procedure TCCINetCCForm.Paste1Click(Sender: TObject);
  3473. begin
  3474.   Memo1.PasteFromClipboard;
  3475. end;
  3476.  
  3477. procedure TCCINetCCForm.PastefromFile1Click(Sender: TObject);
  3478. var TempMemo : TMemo;
  3479. begin
  3480.   TempMemo := TMemo.Create( self );
  3481.   TempMemo.parent := self;
  3482.   Tempmemo.Visible := false;
  3483.   TempMemo.Width := Memo1.Width;
  3484.   TempMemo.Height := Memo1.Height;
  3485.   OpenDialog1.Filename := '*.*';
  3486.   OpenDialog1.Title := 'Select File to Paste From';
  3487.   if OpenDialog1.Execute then TempMemo.Lines.LoadFromFile( OpenDialog1.Filename );
  3488.   TempMemo.SelectAll;
  3489.   TempMemo.CopyToClipboard;
  3490.   Memo1.PasteFromClipboard;
  3491.   TempMemo.Free;
  3492. end;
  3493.  
  3494. procedure TCCINetCCForm.ToCurrentMessage1Click(Sender: TObject);
  3495. var TheEncodingHeader : TStringList;
  3496. begin
  3497.   OpenDialog1.Filename := '*.*';
  3498.   OpenDialog1.Title := 'Select File to MIME Encode';
  3499.   if OpenDialog1.Execute then
  3500.   begin
  3501.     TheMIMEObject.TheBoundaryString := '=====================_CIUPKC158==_';
  3502.     TheEncodingHeader := TStringList.Create;
  3503.     with TheEncodingHeader do
  3504.     begin
  3505.       Add( '--' + TheMIMEObject.TheBoundaryString );
  3506.       Add( 'Content-Type: octet-stream; name="' +
  3507.        ExtractFileName( OpenDialog1.FileName ) + '"' );
  3508.       Add( 'Content-Transfer-Encoding: base64' );
  3509.       Add( 'Content-Disposition: attachment; filename="' +
  3510.        ExtractFileName( OpenDialog1.Filename ) + '"' );
  3511.       Add( '' );
  3512.     end;
  3513.     TheMIMEObject.TheEncodingHeader := TheEncodingHeader;
  3514.     TheMIMEObject.TheInputFileName := OpenDialog1.Filename;
  3515.     TheMIMEObject.TheOutputFilename := ExpandFileName( 'MIME1.MIM' );
  3516.     TheMIMEObject.EncodeMIMEFile;
  3517.     TheEncodingHeader.Free;
  3518.   end;
  3519.   ThePOP3SMTPComponent.AddMIMEAttachment( Memo1 ,
  3520.    TheMIMEObject.TheOutputFileName );
  3521. end;
  3522.  
  3523. procedure TCCINetCCForm.ToNewMessage1Click(Sender: TObject);
  3524. var TheEncodingHeader : TStringList;
  3525. begin
  3526.   OpenDialog1.Filename := '*.*';
  3527.   OpenDialog1.Title := 'Select File to MIME Encode';
  3528.   if OpenDialog1.Execute then
  3529.   begin
  3530.     TheMIMEObject.TheBoundaryString := '=====================_CIUPKC158==_';
  3531.     TheEncodingHeader := TStringList.Create;
  3532.     with TheEncodingHeader do
  3533.     begin
  3534.       Add( '--' + TheMIMEObject.TheBoundaryString );
  3535.       Add( 'Content-Type: octet-stream; name="' +
  3536.        ExtractFileName( OpenDialog1.FileName ) + '"' );
  3537.       Add( 'Content-Transfer-Encoding: base64' );
  3538.       Add( 'Content-Disposition: attachment; filename="' +
  3539.        ExtractFileName( OpenDialog1.Filename ) + '"' );
  3540.       Add( '' );
  3541.     end;
  3542.     TheMIMEObject.TheEncodingHeader := TheEncodingHeader;
  3543.     TheMIMEObject.TheInputFileName := OpenDialog1.Filename;
  3544.     TheMIMEObject.TheOutputFilename := ExpandFileName( 'MIME1.MIM' );
  3545.     TheMIMEObject.EncodeMIMEFile;
  3546.     TheEncodingHeader.Free;
  3547.   end;
  3548.   Memo1.Clear;
  3549.   ThePOP3SMTPComponent.NewMIMEMessage( Memo1 ,
  3550.     TheMIMEObject.TheOutputFileName ,
  3551.      PConnectionsRecord( TheEMailServerList.Items[ WhichServer - 1 ] ) );
  3552.   NewMessageInProgress := true;
  3553. end;
  3554.  
  3555. procedure TCCINetCCForm.ToFile2Click(Sender: TObject);
  3556. begin
  3557.   OpenDialog1.Filename := '*.*';
  3558.   OpenDialog1.Title := 'Select File to MIME Encode';
  3559.   if OpenDialog1.Execute then
  3560.   begin
  3561.     SaveDialog1.FileName := '*.*';
  3562.     SaveDialog1.Title := 'Select Filename for MIME Output';
  3563.     if not SaveDialog1.Execute then exit;
  3564.     TheMIMEObject.TheInputFileName := OpenDialog1.Filename;
  3565.     TheMIMEObject.TheOutputFilename := SaveDialog1.Filename;
  3566.     TheMIMEObject.EncodeMIMEFile;
  3567.   end;
  3568. end;
  3569.  
  3570. procedure TCCINetCCForm.SpeedButton5Click(Sender: TObject);
  3571. begin
  3572.   case Tag of
  3573.     5 : AllMarkedArticles1Click( Self );
  3574.     6 : TrashMarkedMessages1Click( self ); 
  3575.   end;
  3576. end;
  3577.  
  3578. procedure TCCINetCCForm.SpeedButton3Click(Sender: TObject);
  3579. begin
  3580.   case Tag of
  3581.     6 : MIMEDecode1Click( self );
  3582.   end;
  3583. end;
  3584.  
  3585. procedure TCCINetCCForm.SpeedButton1Click(Sender: TObject);
  3586. begin
  3587.   case Tag of
  3588.     5 : begin
  3589.           if ListBox2.Items.Count = 0 then exit;
  3590.           Listbox2.multiselect := false;
  3591.           If ListBox2.ItemIndex = -1 then ListBox2.ItemIndex := 0;
  3592.           ListBox2.ItemIndex := Listbox2.ItemIndex - 1;
  3593.           if ListBox2.Itemindex < 0 then
  3594.            Listbox2.Itemindex := ListBox2.Items.Count - 1;
  3595.           ListBox2DblClick( Self );
  3596.           ListBox2.Multiselect := true;
  3597.           ListBox2.SetFocus;
  3598.         end;
  3599.     6 : begin
  3600.           if ListBox2.Items.Count = 0 then exit;
  3601.           Listbox2.multiselect := false;
  3602.           If ListBox2.ItemIndex = -1 then ListBox2.ItemIndex := 0;
  3603.           ListBox2.ItemIndex := Listbox2.ItemIndex - 1;
  3604.           if ListBox2.Itemindex < 0 then
  3605.            Listbox2.Itemindex := ListBox2.Items.Count - 1;
  3606.           ListBox2DblClick( Self );
  3607.           ListBox2.Multiselect := true;
  3608.           ListBox2.SetFocus;
  3609.         end;
  3610.   end;
  3611. end;
  3612.  
  3613. procedure TCCINetCCForm.SpeedButton2Click(Sender: TObject);
  3614. begin
  3615.   case Tag of
  3616.     5 : begin
  3617.           if ListBox2.Items.Count = 0 then exit;
  3618.           ListBox2.MultiSelect := false;
  3619.           If ListBox2.ItemIndex = -1 then ListBox2.ItemIndex := 0;
  3620.           ListBox2.ItemIndex := Listbox2.ItemIndex + 1;
  3621.           if ListBox2.Itemindex > ListBox2.Items.Count - 1 then
  3622.            Listbox2.Itemindex := 0;
  3623.           ListBox2DblClick( Self );
  3624.           ListBox2.MultiSelect := true;
  3625.           ListBox2.SetFocus;
  3626.         end;
  3627.     6 : begin
  3628.           if ListBox2.Items.Count = 0 then exit;
  3629.           ListBox2.MultiSelect := false;
  3630.           If ListBox2.ItemIndex = -1 then ListBox2.ItemIndex := 0;
  3631.           ListBox2.ItemIndex := Listbox2.ItemIndex + 1;
  3632.           if ListBox2.Itemindex > ListBox2.Items.Count - 1 then
  3633.            Listbox2.Itemindex := 0;
  3634.           ListBox2DblClick( Self );
  3635.           ListBox2.MultiSelect := true;
  3636.           ListBox2.SetFocus;
  3637.         end;
  3638.   end;
  3639. end;
  3640.  
  3641. procedure TCCINetCCForm.ListBox2Click(Sender: TObject);
  3642. var TheWorkingList : TList;
  3643.     TheNGARecord : PNewsGroupArticleRecord;
  3644.     TheNGRecord : PNewsGroupRecord;
  3645.     TheWorkingName : String;
  3646. begin
  3647.   if ListBox2.Tag = 9 then
  3648.   begin
  3649.     TheNGRecord :=
  3650.      PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3651.     TheWorkingList := TList( TheNGRecord^.GLTag );
  3652.     TheNGARecord := PNewsGroupArticleRecord(
  3653.      TheWorkingList.Items[ ListBox2.ItemIndex ] );
  3654.     TheWorkingName := NewsPath + '\' + TheNGARecord^.NGAArtFileName;
  3655.     TheUUDecodeList.Add( TheWorkingName );
  3656.     exit;
  3657.   end;
  3658.   case Tag of
  3659.     5 : begin
  3660.           If ListBox2.Items.Count = 0 then exit;
  3661.           ComboBox1.Text := ListBox2.Items[ ListBox2.ItemIndex ];
  3662.         end;
  3663.   end;
  3664. end;
  3665.  
  3666. procedure TCCINetCCForm.AbortNewsgroupDownload1Click(Sender: TObject);
  3667. begin
  3668.   GlobalAbortedFlag := true;
  3669. end;
  3670.  
  3671. procedure TCCINetCCForm.Marked1Click(Sender: TObject);
  3672. var Counter_1,
  3673.     Counter_2   : Integer;
  3674.     TheNGRecord : PNewsGroupRecord;
  3675.     TheNGARecord : PNewsGroupArticleRecord;
  3676.     WorkingList : TList;
  3677. begin
  3678.   for Counter_1 := 0 to ListBox1.Items.Count - 1 do
  3679.   begin
  3680.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  3681.     if (( TheNGRecord^.GSubscribed ) and ( ListBox1.Selected[ Counter_1 ] )) then
  3682.     begin
  3683.       WorkingList := TList( TheNGRecord^.GLTag );
  3684.       for Counter_2 := 0 to ListBox2.Items.Count - 1 do
  3685.       begin
  3686.         TheNGARecord := PNewsGroupArticleRecord( WorkingList.Items[ Counter_2 ] );
  3687.         TheNGARecord^.NGARead := true;
  3688.       end;
  3689.       TheNNTPComponent.PurgeReadSentArticleListings( TheNGRecord );
  3690.       TheNGRecord^.GLowest := TheNGRecord^.GHighestAvailable;
  3691.       TheNGRecord^.GHighest := TheNGRecord^.GLowest;
  3692.       TheNGRecord^.GTotalNew := 0;
  3693.       TheNGRecord^.GTotalArticles := 0;
  3694.     end;
  3695.   end;
  3696.   SetupNewsGroupListboxes;
  3697. end;
  3698.  
  3699. procedure TCCINetCCForm.All1Click(Sender: TObject);
  3700. var Counter_1,
  3701.     Counter_2   : Integer;
  3702.     TheNGRecord : PNewsGroupRecord;
  3703.     TheNGARecord : PNewsGroupArticleRecord;
  3704.     WorkingList : TList;
  3705. begin
  3706.   for Counter_1 := 0 to ListBox1.Items.Count - 1 do
  3707.   begin
  3708.     TheNGRecord := PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] );
  3709.     if TheNGRecord^.GSubscribed then
  3710.     begin
  3711.       WorkingList := TList( TheNGRecord^.GLTag );
  3712.       for Counter_2 := 0 to ListBox2.Items.Count - 1 do
  3713.       begin
  3714.         TheNGARecord := PNewsGroupArticleRecord( WorkingList.Items[ Counter_2 ] );
  3715.         TheNGARecord^.NGARead := true;
  3716.       end;
  3717.       TheNGRecord^.GLowest := TheNGRecord^.GHighestAvailable;
  3718.       TheNGRecord^.GHighest := TheNGRecord^.GLowest;
  3719.       TheNGRecord^.GTotalNew := 0;
  3720.       TheNGRecord^.GTotalArticles := 0;
  3721.       TheNNTPComponent.PurgeReadSentArticleListings( TheNGRecord );
  3722.     end;
  3723.   end;
  3724.   SetupNewsGroupListboxes;
  3725. end;
  3726.  
  3727. procedure TCCINetCCForm.File1Click(Sender: TObject);
  3728. begin
  3729.   OpenDialog1.Filename := '*.uue';
  3730.   OpenDialog1.Filter := 'UUEncode Files|*.uue|All Files *.*';
  3731.   OpenDialog1.Title := 'Select File To Decode';
  3732.   if OpenDialog1.Execute then
  3733.   begin
  3734.     TheUUObject.SetInputFileName( OpenDialog1.FileName );
  3735.     TheUUObject.SetMultifileVector( CMV_SINGLE );
  3736.     TheUUObject.Decode;
  3737.   end;
  3738. end;
  3739.  
  3740. procedure TCCINetCCForm.SelectedArticle1Click(Sender: TObject);
  3741. var TheWorkingList : TList;
  3742.     TheNGARecord : PNewsGroupArticleRecord;
  3743.     TheNGRecord : PNewsGroupRecord;
  3744.     TheWorkingName : String;
  3745. begin
  3746.   TheNGRecord :=
  3747.    PNewsGroupRecord( TheNewsRCList.Items[ ListBox1.ItemIndex ] );
  3748.   TheWorkingList := TList( TheNGRecord^.GLTag );
  3749.   TheNGARecord := PNewsGroupArticleRecord(
  3750.    TheWorkingList.Items[ ListBox2.ItemIndex ] );
  3751.   TheWorkingName := NewsPath + '\' + TheNGARecord^.NGAArtFileName;
  3752.   TheUUObject.SetInputFileName( TheWorkingName );
  3753.   TheUUObject.SetMultifileVector( CMV_SINGLE );
  3754.   TheUUObject.Decode;
  3755. end;
  3756.  
  3757. procedure TCCINetCCForm.SelectMultipleArticles1Click(Sender: TObject);
  3758. begin
  3759.   { Set tag so that listbox knows to keep track of hits}
  3760.   ListBox2.Tag := 9;
  3761.   ListBox2.MultiSelect := false;
  3762.   TheUUDecodeList := TStringList.Create;
  3763. end;
  3764.  
  3765. procedure TCCINetCCForm.DecodeSelections1Click(Sender: TObject);
  3766. begin
  3767.   ListBox2.Tag := 5;
  3768.   ListBox2.MultiSelect := True;
  3769.   if TheUUDecodeList.Count = 0 then exit;
  3770.   TheUUObject.SetMultipleFilesList( TheUUDecodeList );
  3771.   TheUUObject.SetMultifileVector( CMV_MULTI );
  3772.   TheUUObject.Decode;
  3773.   TheUUDecodeList.Free;
  3774. end;
  3775.  
  3776. procedure TCCINetCCForm.SpeedButton4Click(Sender: TObject);
  3777. begin
  3778.   case Tag of
  3779.     5 : begin
  3780.           SelectedArticle1Click( Self );
  3781.         end;
  3782.   end;
  3783. end;
  3784.  
  3785. end.
  3786.  
  3787.