Discussion:
Moving to D20077 from D7 cant compile
(too old to reply)
Del Murray
2008-07-23 18:14:40 UTC
Permalink
Hi all

I'm sure it is a simple thing but I'm stuck. Why wont this compile under
D2007 ???

if (msg.messageparts.items[i]) is TIdAttachment then begin

Compiler says TIdAttachment is undeclared identifier, so is TIdText.


this is the uses clause.

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, IdMessage, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdPOP3, IdBaseComponent,
IdAntiFreezeBase, IdAntiFreeze, ComCtrls, IdExplicitTLSClientServerBase;

What did I leave out ???

TIA,
Del
Del Murray
2008-07-23 18:15:36 UTC
Permalink
Should read ... moving from D5 to D2007 ... cant type as well as cant
program :-)
Del Murray
2008-07-23 18:40:56 UTC
Permalink
Never mind. I found the files that were missing from the uses clause. idtext
and idattachment. I wonder why they dont get added automatically when I
drop a popserver on a form ??? oh well
Remy Lebeau (TeamB)
2008-07-24 00:00:22 UTC
Permalink
Post by Del Murray
I wonder why they dont get added automatically when
I drop a popserver on a form ???
Because they are not supposed to.


Gambit
Mike Williams (TeamB)
2008-07-24 02:46:40 UTC
Permalink
I wonder why they dont get added automatically when I drop a
popserver on a form ?
Only the unit that the component is defined in and any units that
ancestor components are defined in get added to the uses clause when
dropping a component. When I drop a PopServer on a new project form it
adds the following units:

IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer,
IdCmdTCPServer, IdExplicitTLSClientServerBase, IdPOP3Server

Without adding anything manually the project will compile without
complaint. Since not all POP servers must deal with attachments it's
not clear that the attachments code should declared in any of the above
listed units. Since attachments might also be needed elsewhere, for
instance in an STMP component, it's not clear that the unit hierarchy
could be properly set up for automatic class availability.
--
-Mike (TeamB)
Remy Lebeau (TeamB)
2008-07-23 23:59:41 UTC
Permalink
Post by Del Murray
Compiler says TIdAttachment is undeclared identifier, so is TIdText.
Sounds like you were using Indy 9 previously and have now upgraded to Indy
10. TIdAttachment and TIdText were moved into their own units in Indy 10.
You need to add "IdAttachment" and "IdText" to your 'uses' clause.


Gambit
Del Murray
2008-07-24 13:36:08 UTC
Permalink
Yea, I figured that out. Thanks for the explanation Mike. Long time no talk.

It appears that messageparts works a little different also. I have an email
that was forwarded around a few times before my program grabbed it. It
"appears" that if the message went thru one email client as plain text, then
thru another as html or rtf, that 2 messageparts are recognized, one in plan
text containing the complete message (all the forwards and additions to the
text) and the other in the HTML fromat (all the forwards and additions to
the text),

If this is right, that there is really two copies of the message text , one
encoded in html and one not, I wonder if there is a way to tell what the
encoding is on the messagepart.

Is there some documentation around somewhere on this ??

Loading...