home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap10 / howto05 / cciccinf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-12  |  22.7 KB  |  643 lines

  1. unit Cciccinf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
  8.  
  9. type
  10.   TCCICInfoDlg = class(TForm)
  11.     Panel1: TPanel;
  12.     BitBtn1: TBitBtn;
  13.     BitBtn2: TBitBtn;
  14.     Panel4: TPanel;
  15.     ListBox2: TListBox;
  16.     Panel2: TPanel;
  17.     Edit1: TEdit;
  18.     Panel3: TPanel;
  19.     Edit2: TEdit;
  20.     Panel5: TPanel;
  21.     Edit3: TEdit;
  22.     Panel8: TPanel;
  23.     Edit4: TEdit;
  24.     Panel9: TPanel;
  25.     Edit5: TEdit;
  26.     Panel6: TPanel;
  27.     Label1: TLabel;
  28.     Label2: TLabel;
  29.     Button1: TButton;
  30.     Button2: TButton;
  31.     Button3: TButton;
  32.     Button4: TButton;
  33.     ListBox1: TListBox;
  34.     procedure Button1Click(Sender: TObject);
  35.     procedure ListBox2Click(Sender: TObject);
  36.     procedure BitBtn1Click(Sender: TObject);
  37.     procedure BitBtn2Click(Sender: TObject);
  38.     procedure Edit4Exit(Sender: TObject);
  39.     procedure Button2Click(Sender: TObject);
  40.     procedure Button3Click(Sender: TObject);
  41.     procedure Button4Click(Sender: TObject);
  42.     procedure ListBox1DblClick(Sender: TObject);
  43.   private
  44.     { Private declarations }
  45.   public
  46.     { Public declarations }
  47.   end;
  48.  
  49. var
  50.   CCICInfoDlg: TCCICInfoDlg;
  51. const
  52.   LBClickVector : Integer = 0;
  53.   ActiveMailbox : Integer = 0;
  54.  
  55. implementation
  56.  
  57. uses CCICCFrm;
  58.  
  59. {$R *.DFM}
  60. procedure TCCICInfoDlg.Button1Click(Sender: TObject);
  61. var TempSocket : TCCSocket; { Used for IP Address info }
  62.     DataBuffer : array[ 0 .. 256 ] of char;
  63. begin
  64.   case Tag of
  65.     1 : begin  { Get IP Address Mode }
  66.           { Create the dummy socket }
  67.           TempSocket := TCCSocket.Create( Self );
  68.           TempSocket.Parent := Self;
  69.           { Use it to get the info }
  70.           with TempSocket do
  71.           begin
  72.             { Move the IP address into the data buffer }
  73.             StrPCopy( DataBuffer , Edit1.Text );
  74.             { Turn it into a real IP address in binary form }
  75.             Socket_IP_Address.Socket_Address.Full_Internet_Address :=
  76.              inet_addr( DataBuffer );
  77.             { If not found then do remote lookup }
  78.             if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
  79.             begin
  80.               { Call blocking function on IP name }
  81.               Socket_Host_Entry := gethostbyname( DataBuffer );
  82.               { If still no good then error out and exit }
  83.               if Socket_Host_Entry = nil then
  84.               begin
  85.                 Edit2.Text := 'Could Not Convert Host Name';
  86.                 Edit3.Text := '';
  87.               end
  88.               else
  89.               begin
  90.                 { Otherwise get the address }
  91.                 Socket_IP_Address.Socket_Address :=
  92.                  Socket_Host_Entry^.Host_Address^^;
  93.                 Edit2.Text :=
  94.                  IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
  95.                  IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
  96.                  IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
  97.                  '.' + IntToStr(
  98.                  Socket_IP_Address.Socket_Address.Local_Machine_Byte );
  99.                 Edit3.Text :=
  100.                  IntToStr( Socket_IP_Address.Socket_Address.
  101.                             Full_Internet_Address );
  102.               end;
  103.             end;
  104.           end;
  105.           { Free the dummy socket }
  106.           TempSocket.Free;
  107.         end;
  108.     2 : begin { Anonymous login punch }
  109.           Edit3.Text := 'anonymous';
  110.           CurrentRealPWString := CurrentPassWordString;
  111.           case PasswordControlVector of
  112.             1 : Edit4.Text := CurrentPassWordString;
  113.             2 : Edit4.Text := '**********';
  114.           end;
  115.         end;
  116.     5 : begin { Toggle subscribe/unsubscribe status }
  117.           if Edit3.Text = 'Subscribed' then Edit3.Text := 'UnSubscribed' else
  118.            Edit3.Text := 'Subscribed';
  119.         end;
  120.   end;
  121. end;
  122.  
  123. procedure TCCICInfoDlg.ListBox2Click(Sender: TObject);
  124. var TheWorkingList  : TList;
  125.     Counter_1       : Integer;
  126.     Finished        : Boolean;
  127. begin
  128.   { Use Tag vector to find out how to interpret a click }
  129.   case Tag of
  130.     2 : begin
  131.           { If nothing in list box then exit }
  132.           if ListBox2.ItemIndex = -1 then exit;
  133.           { Use the data in the Working FTP Site List TList }
  134.           with PConnectionsRecord(
  135.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  136.           begin
  137.               Edit1.Text := CProfile;
  138.               Edit2.Text := CIPAddress;
  139.               Edit3.Text := CUserName;
  140.               CurrentRealPWString := CPassword;
  141.               case PasswordControlVector of
  142.                 1 : Edit4.Text := CPassword;
  143.                 2 : Edit4.Text := '**********';
  144.               end;
  145.               Edit5.Text := CStartDir;
  146.           end;
  147.         end;
  148.     4 : begin
  149.           { If nothing in list box then exit }
  150.           if ListBox2.ItemIndex = -1 then exit;
  151.           { Use the data in the Working FTP Site List TList }
  152.           with PConnectionsRecord(
  153.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  154.           begin
  155.               Edit1.Text := CProfile;
  156.               Edit2.Text := CIPAddress;
  157.           end;
  158.         end;
  159.     5 : begin
  160.           { If nothing in list box then exit }
  161.           if ListBox2.ItemIndex = -1 then exit;
  162.           { Use the data in the Working FTP Site List TList }
  163.           with PNewsGroupRecord(
  164.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  165.           begin
  166.               Edit1.Text := GName;
  167.               Edit2.Text := GRealName;
  168.               if GSubScribed then Edit3.Text := 'Subscribed' else
  169.                Edit3.Text := 'UnSubscribed';
  170.           end;
  171.         end;
  172.   end;
  173. end;
  174.  
  175. { This procedure saves the newly modified list of stuff to its base }
  176. procedure TCCICInfoDlg.BitBtn1Click(Sender: TObject);
  177. var Counter_1  : Integer;            { Loop counter        }
  178.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  179.     TheNGRecord : PNewsGroupRecord;
  180. begin
  181.   { Use the tag vector to find out what to do }
  182.   case Tag of
  183.     2 : begin { Do FTP Site List }
  184.           { dispose the old FTP site list's pointers }
  185.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  186.           begin
  187.             Dispose( PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] ));
  188.           end;
  189.           { Clear the lists }
  190.           TheFTPSiteList.Clear;
  191.           CCInetCCForm.ComboBox1.Clear;
  192.           { Add the new info }
  193.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  194.           begin
  195.             { Create a new pointer }
  196.             New( ThePointer );
  197.             { Move the data into it }
  198.             ThePointer^ :=
  199.              PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] )^;
  200.             { Add the item }
  201.             TheFTPSiteList.Add( ThePointer );
  202.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  203.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  204.           end;
  205.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  206.         end;
  207.     4 : begin { Do NNTP Site List }
  208.           { dispose the old FTP site list's pointers }
  209.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  210.           begin
  211.             Dispose( PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] ));
  212.           end;
  213.           { Clear the lists }
  214.           TheNewsServerList.Clear;
  215.           CCInetCCForm.ComboBox1.Clear;
  216.           { Add the new info }
  217.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  218.           begin
  219.             { Create a new pointer }
  220.             New( ThePointer );
  221.             { Move the data into it }
  222.             ThePointer^ :=
  223.              PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] )^;
  224.             { Add the item }
  225.             TheNewsServerList.Add( ThePointer );
  226.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  227.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  228.           end;
  229.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  230.         end;
  231.     5 : begin { Do NNTP Newsgroups List }
  232.           { dispose the old NG list's pointers }
  233.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  234.           begin
  235.             Dispose( PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] ));
  236.           end;
  237.           { Clear the lists }
  238.           TheNewsRCList.Clear;
  239.           { Add the new info }
  240.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  241.           begin
  242.             { Create a new pointer }
  243.             New( TheNGRecord );
  244.             { Move the data into it }
  245.             TheNGRecord^ :=
  246.              PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] )^;
  247.             { Add the item }
  248.             TheNewsRCList.Add( TheNGRecord );
  249.           end;
  250.         end;
  251.   end;
  252.   { Leave }
  253.   Close;
  254. end;
  255.  
  256. { This method cancels any changes made from entries in current setup & exits}
  257. procedure TCCICInfoDlg.BitBtn2Click(Sender: TObject);
  258. var Counter_1  : Integer;            { Loop counter        }
  259.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  260.     TheNGRecord : PNewsGroupRecord;
  261. begin
  262.   { Use Tag vector do decide what to reset }
  263.   case Tag of
  264.     2 : begin { Reset FTP Site list }
  265.           { Dispose of all the old pointers }
  266.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  267.           begin
  268.             Dispose( PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] ));
  269.           end;
  270.           { Clear the working list }
  271.           TheWorkingFTPSL.Clear;
  272.           { Clear the listbox }
  273.           ListBox2.Clear;
  274.           { Then rebuild the working list and display listbox }
  275.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  276.           begin
  277.             { Create the record }
  278.             New( ThePointer );
  279.             { Move data in }
  280.             ThePointer^ :=
  281.              PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
  282.             { Add the pointer to the list }
  283.             TheWorkingFTPSL.Add( ThePointer );
  284.             { Add the profile name to the list }
  285.             ListBox2.Items.Add( PConnectionsRecord(
  286.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  287.           end;
  288.         end;
  289.     4 : begin { Reset NNTP Site list }
  290.           { Dispose of all the old pointers }
  291.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  292.           begin
  293.             Dispose( PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] ));
  294.           end;
  295.           { Clear the working list }
  296.           TheWorkingNSSL.Clear;
  297.           { Clear the listbox }
  298.           ListBox2.Clear;
  299.           { Then rebuild the working list and display listbox }
  300.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  301.           begin
  302.             { Create the record }
  303.             New( ThePointer );
  304.             { Move data in }
  305.             ThePointer^ :=
  306.              PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
  307.             { Add the pointer to the list }
  308.             TheWorkingNSSL.Add( ThePointer );
  309.             { Add the profile name to the list }
  310.             ListBox2.Items.Add( PConnectionsRecord(
  311.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  312.           end;
  313.         end;
  314.     5 : begin { Reset NNTP NG list }
  315.           { Dispose of all the old pointers }
  316.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  317.           begin
  318.             Dispose( PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] ));
  319.           end;
  320.           { Clear the working list }
  321.           TheWorkingNRCSL.Clear;
  322.           { Clear the listbox }
  323.           ListBox2.Clear;
  324.           { Then rebuild the working list and display listbox }
  325.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  326.           begin
  327.             { Create the record }
  328.             New( TheNGRecord );
  329.             { Move data in }
  330.             TheNGRecord^ :=
  331.              PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^;
  332.             { Add the pointer to the list }
  333.             TheWorkingNRCSL.Add( TheNGRecord );
  334.             { Add the profile name to the list }
  335.             ListBox2.Items.Add( PNewsGroupRecord(
  336.              TheNewsRCList.Items[ Counter_1 ] )^.GName );
  337.           end;
  338.         end;
  339.   end;
  340.   { Leave }
  341.   Close;
  342. end;
  343.  
  344. procedure TCCICInfoDlg.Edit4Exit(Sender: TObject);
  345. begin
  346.   { Use tag vector to determine action }
  347.   case Tag of
  348.     2 : begin
  349.           { If Edit4 is modified then mangle pw }
  350.           if Edit4.Modified then
  351.           begin
  352.             { Save pw in either case, but mangle if masked }
  353.             case PasswordControlVector of
  354.               1 : CurrentRealPWString := Edit4.Text;
  355.               2 : begin
  356.                     CurrentRealPWString := Edit4.Text;
  357.                     Edit4.Text := '***********';
  358.                   end;
  359.             end;
  360.           end;
  361.         end;
  362.   end;
  363. end;
  364.  
  365. { Add button; do various add actions }
  366. procedure TCCICInfoDlg.Button2Click(Sender: TObject);
  367. var ThePointer  : PConnectionsRecord; { PCR Pointer }
  368.     TheNGRecord : PNewsGroupRecord;
  369.     TempList    : TList;
  370. begin
  371.   { Tag vector control as usual }
  372.   case Tag of
  373.     2 : begin { add new FTP site list entry }
  374.           { Creat new PCR pointer }
  375.           New( ThePointer );
  376.           { Add in the data from the text fields }
  377.           with ThePointer^ do
  378.           begin
  379.             CProfile   := Edit1.Text;
  380.             CIPAddress := Edit2.Text;;
  381.             CUserName  := Edit3.Text;
  382.             { Put in the real pw string }
  383.             CPassword  := CurrentRealPWString;
  384.             CStartDir  := Edit5.Text;
  385.           end;
  386.           { Add pointer to working list }
  387.           TheWorkingFTPSL.Add( ThePointer );
  388.           { Add it to the listbox }
  389.           ListBox2.Items.Add( ThePointer^.CProfile );
  390.           { And set the pointer to it }
  391.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  392.         end;
  393.     4 : begin { add new NNTP site list entry }
  394.           { Creat new PCR pointer }
  395.           New( ThePointer );
  396.           { Add in the data from the text fields }
  397.           with ThePointer^ do
  398.           begin
  399.             CProfile   := Edit1.Text;
  400.             CIPAddress := Edit2.Text;;
  401.             CUserName  := '';
  402.             CPassword  := '';
  403.             CStartDir  := '';
  404.           end;
  405.           { Add pointer to working list }
  406.           TheWorkingNSSL.Add( ThePointer );
  407.           { Add it to the listbox }
  408.           ListBox2.Items.Add( ThePointer^.CProfile );
  409.           { And set the pointer to it }
  410.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  411.         end;
  412.     5 : begin { add new NNTP newsgroup list entry }
  413.           { Creat new PCR pointer }
  414.           New( TheNGRecord );
  415.           TempList := TList.Create;
  416.           { Add in the data from the text fields }
  417.           with TheNGRecord^ do
  418.           begin
  419.             GName     := Edit1.Text;
  420.             GRealName := Edit2.Text;;
  421.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  422.              GSubScribed := true;
  423.             GLowest              := 0;
  424.             GHighest             := 0;
  425.             GTotalNew            := 0;
  426.             GTotalAvailable      := 0;
  427.             GLowestAvailable     := 0;
  428.             GHighestAvailable    := 0;
  429.             GPostable            := true;
  430.             GTotalArticles       := 0;
  431.             GTotalUnReadArticles := 0;
  432.             GIDNumber            := TheWorkingNRCSL.Count + 1;
  433.             GFileName            := 'NL' + IntToStr( WhichServer ) + 'G' +
  434.                                     IntToStr( GIDNumber) + '.NGR';
  435.             GLTag                := Longint( TempList );
  436.           end;
  437.           { Add pointer to working list }
  438.           TheWorkingNRCSL.Add( TheNGRecord );
  439.           { Add it to the listbox }
  440.           ListBox2.Items.Add( TheNGRecord^.GName );
  441.           { And set the pointer to it }
  442.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  443.         end;
  444.   end;
  445. end;
  446.  
  447. { This is the modify button }
  448. procedure TCCICInfoDlg.Button3Click(Sender: TObject);
  449. begin
  450.   { Use Tag vector as usual }
  451.   case Tag of
  452.     2 : begin
  453.           { if nothing to modify the exit }
  454.           if ListBox2.ItemIndex = -1 then exit;
  455.           { get record of current listbox pointer & put in data }
  456.           with PConnectionsRecord(
  457.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  458.           begin
  459.             CProfile   := Edit1.Text;
  460.             CIPAddress := Edit2.Text;;
  461.             CUserName  := Edit3.Text;
  462.             { Put in the real pw string }
  463.             CPassword  := CurrentRealPWString;
  464.             CStartDir  := Edit5.Text;
  465.           end;
  466.           { Make sure the display matches the edit control }
  467.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  468.         end;
  469.     4 : begin
  470.           { if nothing to modify the exit }
  471.           if ListBox2.ItemIndex = -1 then exit;
  472.           { get record of current listbox pointer & put in data }
  473.           with PConnectionsRecord(
  474.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  475.           begin
  476.             CProfile   := Edit1.Text;
  477.             CIPAddress := Edit2.Text;
  478.             CUserName  := '';
  479.             CPassword  := '';
  480.             CStartDir  := '';
  481.           end;
  482.           { Make sure the display matches the edit control }
  483.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  484.         end;
  485.     5 : begin
  486.           { if nothing to modify the exit }
  487.           if ListBox2.ItemIndex = -1 then exit;
  488.           { get record of current listbox pointer & put in data }
  489.           with PNewsGroupRecord(
  490.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  491.           begin
  492.             GName     := Edit1.Text;
  493.             GRealName := Edit2.Text;;
  494.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  495.              GSubScribed := true;
  496.           end;
  497.           { Make sure the display matches the edit control }
  498.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  499.         end;
  500.   end;
  501. end;
  502.  
  503. { This is the delete button }
  504. procedure TCCICInfoDlg.Button4Click(Sender: TObject);
  505. var MessageString : String; { String holder }
  506. begin
  507.   { Use tag control vector }
  508.   case Tag of
  509.     2 : begin
  510.           { If nothing to delete then leave }
  511.           if Listbox2.Itemindex = -1 then exit;
  512.           { Set up display }
  513.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  514.           { Display message box and get result }
  515.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  516.            = mrYes then
  517.           begin
  518.             { if ok delete then remove item from working sl }
  519.             TheWorkingFTPSL.Delete( ListBox2.ItemIndex );
  520.             { delete from listbox }
  521.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  522.             { If nothing left set itemindex and clear edits }
  523.             if ListBox2.Items.Count = 0 then
  524.             begin
  525.               ListBox2.ItemIndex := -1;
  526.               Edit1.Text := '';
  527.               Edit2.Text := '';
  528.               Edit3.Text := '';
  529.               Edit4.Text := '';
  530.               Edit5.Text := '';
  531.             end
  532.             else
  533.             begin
  534.               { Reset listbox pointer }
  535.               ListBox2.ItemIndex  := 0;
  536.               { and reset display to new item }
  537.               with PConnectionsRecord(
  538.                TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  539.               begin
  540.                 Edit1.Text := CProfile;
  541.                 Edit2.Text := CIPAddress;
  542.                 Edit3.Text := CUserName;
  543.                 CurrentRealPWString := CPassword;
  544.                 case PasswordControlVector of
  545.                   1 : Edit4.Text := CPassword;
  546.                   2 : Edit4.Text := '**********';
  547.                 end;
  548.                 Edit5.Text := CStartDir;
  549.               end;
  550.             end;
  551.           end;
  552.         end;
  553.     4 : begin
  554.           { If nothing to delete then leave }
  555.           if Listbox2.Itemindex = -1 then exit;
  556.           { Set up display }
  557.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  558.           { Display message box and get result }
  559.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  560.            = mrYes then
  561.           begin
  562.             { if ok delete then remove item from working sl }
  563.             TheWorkingNSSL.Delete( ListBox2.ItemIndex );
  564.             { delete from listbox }
  565.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  566.             { If nothing left set itemindex and clear edits }
  567.             if ListBox2.Items.Count = 0 then
  568.             begin
  569.               ListBox2.ItemIndex := -1;
  570.               Edit1.Text := '';
  571.               Edit2.Text := '';
  572.               Edit3.Text := '';
  573.               Edit4.Text := '';
  574.               Edit5.Text := '';
  575.             end
  576.             else
  577.             begin
  578.               { Reset listbox pointer }
  579.               ListBox2.ItemIndex  := 0;
  580.               { and reset display to new item }
  581.               with PConnectionsRecord(
  582.                TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  583.               begin
  584.                 Edit1.Text := CProfile;
  585.                 Edit2.Text := CIPAddress;
  586.               end;
  587.             end;
  588.           end;
  589.         end;
  590.     5 : begin
  591.           { If nothing to delete then leave }
  592.           if Listbox2.Itemindex = -1 then exit;
  593.           { Set up display }
  594.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  595.           { Display message box and get result }
  596.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  597.            = mrYes then
  598.           begin
  599.             { if ok delete then remove item from working sl }
  600.             TheWorkingNRCSL.Delete( ListBox2.ItemIndex );
  601.             { delete from listbox }
  602.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  603.             { If nothing left set itemindex and clear edits }
  604.             if ListBox2.Items.Count = 0 then
  605.             begin
  606.               ListBox2.ItemIndex := -1;
  607.               Edit1.Text := '';
  608.               Edit2.Text := '';
  609.               Edit3.Text := '';
  610.               Edit4.Text := '';
  611.               Edit5.Text := '';
  612.             end
  613.             else
  614.             begin
  615.               { Reset listbox pointer }
  616.               ListBox2.ItemIndex  := 0;
  617.               { and reset display to new item }
  618.               with PNewsGroupRecord(
  619.                TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  620.               begin
  621.                 Edit1.Text := GName;
  622.                 Edit2.Text := GRealName;
  623.                 if not GSubscribed then Edit3.Text := 'UnSubscribed' else
  624.                  Edit3.Text := 'SubScribed';
  625.               end;
  626.             end;
  627.           end;
  628.         end;
  629.   end;
  630. end;
  631.  
  632. procedure TCCICInfoDlg.ListBox1DblClick(Sender: TObject);
  633. begin
  634.   case Tag of
  635.     5 : begin
  636.           if ListBox1.ItemIndex <> -1 then
  637.            Edit2.Text := ListBox1.Items[ Listbox1.ItemIndex ];
  638.         end;
  639.   end;
  640. end;
  641.  
  642. end.
  643.