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