Indy 9 and TidPOP3Server: why the client go in List error command?

Giganews Newsgroups
Subject: Indy 9 and TidPOP3Server: why the client go in List error command?
Posted by:  Marcello Scala (msca…@emails.it)
Date: Tue, 23 Dec 2003

Hi All.
Why this source work perfectly with Telnet but with a client go n List
command error?

my source:
void __fastcall Tdm1::srvPOP31LIST(TIdCommand *ASender, int AMessageNum)
{

  int filter_status = 0, sizMsg = 0, numMsg = 0;

  tbServerPOP3->Filter = "Deleted = False";
  tbServerPOP3->Filtered = true;

  TStringList *tmpString = new TStringList;
  tmpString->Clear();

  if(AMessageNum == -1)
    {
      filter_status = tbServerPOP3->FindFirst();

      if(filter_status == 0)
        {
          ASender->Thread->Connection->WriteLn("+OK");
          ASender->Thread->Connection->WriteLn(".");
        }

      if(filter_status == 1)
        {
          while(filter_status)
            {
              numMsg = tbServerPOP3->FieldByName("Id")->AsInteger;
              sizMsg = tbServerPOP3->FieldByName("Size")->AsInteger;
              tmpString->Add(AnsiString(numMsg) + " " + AnsiString(sizMsg));
              filter_status = tbServerPOP3->FindNext();
            }
          ASender->Thread->Connection->WriteLn("+OK"); // at this point the
client go in List error
          ASender->Thread->Connection->WriteRFCStrings(tmpString);

          tmpString->Free();
          tmpString = NULL;
        }
    }
  if(AMessageNum == 0)
    {
      ASender->Thread->Connection->WriteLn("-ERR invalid sequence number");
      ASender->Thread->Connection->WriteLn(".");
    }

  if(AMessageNum > 0)
    {
      tbServerPOP3->Filtered = false;
      tbServerPOP3->Filter = "Cancellato = False AND Id = " +
IntToStr(AMessageNum);
      tbServerPOP3->Filtered = true;

      filter_status = tbServerPOP3->FindFirst();

      if(filter_status == 1)
        {
          numMsg = tbServerPOP3->FieldByName("Id")->AsInteger;
          sizMsg = tbServerPOP3->FieldByName("Size")->AsInteger;
          ASender->Thread->Connection->WriteLn("+OK");
          ASender->Thread->Connection->WriteLn(IntToStr(numMsg) + " "
+IntToStr(sizMsg));
          ASender->Thread->Connection->WriteLn(".");
        }
      else if(filter_status == 0)
        {
          ASender->Thread->Connection->WriteLn("-ERR invalid sequence
number");
          ASender->Thread->Connection->WriteLn(".");
        }
    }
}
// -------------------------------------------------------------------------
--------------

Repeat: with Telnet the List command work perfectly.

Why?

Thanks
Marcello

Replies