-
Notifications
You must be signed in to change notification settings - Fork 0
/
uPSI_JvMail.pas
373 lines (321 loc) · 16.1 KB
/
uPSI_JvMail.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
unit uPSI_JvMail;
{
This file has been generated by UnitParser v0.4b, written by M. Knight
and updated by NP. v/d Spek.
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ifps3 are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok''s conv unility
}
interface
uses
SysUtils, Classes, uPSComponent, uPSCompiler, uPSRuntime;
type
(*----------------------------------------------------------------------------*)
TPSImport_JvMail = class(TPSPlugin)
protected
procedure CompOnUses(CompExec: TPSScript); override;
procedure ExecOnUses(CompExec: TPSScript); override;
procedure CompileImport1(CompExec: TPSScript); override;
procedure CompileImport2(CompExec: TPSScript); override;
procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
procedure ExecImport2(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
end;
implementation
uses
Windows
,Controls
,Forms
,Mapi
,JclBase
,JclMapi
,JvComponent
,JvMail
;
(* === compile-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure SIRegister_TJvMail(CL: TPSPascalCompiler);
begin
//with RegClassS(CL,'TJvComponent', 'TJvMail') do
with CL.AddClassN(CL.FindClass('TComponent'),'TJvMail') do
begin
RegisterMethod('Function Address( const Caption : string; EditFields : Integer) : Boolean');
RegisterMethod('Procedure Clear');
RegisterMethod('Function ErrorCheck( Res : DWORD) : DWORD');
RegisterMethod('Function FindFirstMail : Boolean');
RegisterMethod('Function FindNextMail : Boolean');
RegisterMethod('Procedure FreeSimpleMapi');
RegisterMethod('Procedure LogOff');
RegisterMethod('Procedure LogOn');
RegisterMethod('Procedure ReadMail');
RegisterMethod('Function ResolveName( const Name : string) : string');
RegisterMethod('Function SaveMail( const MessageID : string) : string');
RegisterMethod('Procedure SendMail( ShowDialog : Boolean)');
RegisterProperty('ReadedMail', 'TJvMailReadedData', iptr);
RegisterProperty('SeedMessageID', 'string', iptrw);
RegisterProperty('SessionHandle', 'THandle', iptr);
RegisterProperty('SimpleMAPI', 'TJclSimpleMapi', iptr);
RegisterProperty('UserLogged', 'Boolean', iptr);
RegisterProperty('Attachment', 'TStrings', iptrw);
RegisterProperty('BlindCopy', 'TJvMailRecipients', iptrw);
RegisterProperty('Body', 'TStrings', iptrw);
RegisterProperty('CarbonCopy', 'TJvMailRecipients', iptrw);
RegisterProperty('LogonOptions', 'TJvMailLogonOptions', iptrw);
RegisterProperty('LongMsgId', 'Boolean', iptrw);
RegisterProperty('Password', 'string', iptrw);
RegisterProperty('ProfileName', 'string', iptrw);
RegisterProperty('ReadOptions', 'TJvMailReadOptions', iptrw);
RegisterProperty('Recipient', 'TJvMailRecipients', iptrw);
RegisterProperty('Subject', 'string', iptrw);
end;
end;
(*----------------------------------------------------------------------------*)
procedure SIRegister_TJvMailRecipients(CL: TPSPascalCompiler);
begin
//with RegClassS(CL,'TCollection', 'TJvMailRecipients') do
with CL.AddClassN(CL.FindClass('TCollection'),'TJvMailRecipients') do
begin
RegisterMethod('Constructor Create( AOwner : TJvMail; ARecipientClass : DWORD)');
RegisterMethod('Function Add : TJvMailRecipient');
RegisterMethod('Function AddRecipient( const Address : string; const Name : string) : Integer');
RegisterProperty('Items', 'TJvMailRecipient Integer', iptrw);
SetDefaultPropery('Items');
RegisterProperty('RecipientClass', 'DWORD', iptr);
end;
end;
(*----------------------------------------------------------------------------*)
procedure SIRegister_TJvMailRecipient(CL: TPSPascalCompiler);
begin
//with RegClassS(CL,'TCollectionItem', 'TJvMailRecipient') do
with CL.AddClassN(CL.FindClass('TCollectionItem'),'TJvMailRecipient') do
begin
RegisterProperty('AddressAndName', 'string', iptr);
RegisterProperty('Address', 'string', iptrw);
RegisterProperty('Name', 'string', iptrw);
RegisterProperty('Valid', 'Boolean', iptr);
end;
end;
(*----------------------------------------------------------------------------*)
procedure SIRegister_JvMail(CL: TPSPascalCompiler);
begin
CL.AddClassN(CL.FindClass('TOBJECT'),'TJvMail');
SIRegister_TJvMailRecipient(CL);
SIRegister_TJvMailRecipients(CL);
CL.AddTypeS('TJvMailLogonOption', '( loLogonUI, loNewSession )');
CL.AddTypeS('TJvMailReadOption', '( roUnreadOnly, roFifo, roPeek, roHeaderOnl'
+'y, roAttachments )');
CL.AddTypeS('TJvMailLogonOptions', 'set of TJvMailLogonOption');
CL.AddTypeS('TJvMailReadOptions', 'set of TJvMailReadOption');
CL.AddTypeS('TJvMailReadedData', 'record RecipientAddress : string; Recipient'
+'Name : string; ConversationID : string; DateReceived : TDateTime; end');
SIRegister_TJvMail(CL);
end;
(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure TJvMailSubject_W(Self: TJvMail; const T: string);
begin Self.Subject := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailSubject_R(Self: TJvMail; var T: string);
begin T := Self.Subject; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipient_W(Self: TJvMail; const T: TJvMailRecipients);
begin Self.Recipient := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipient_R(Self: TJvMail; var T: TJvMailRecipients);
begin T := Self.Recipient; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailReadOptions_W(Self: TJvMail; const T: TJvMailReadOptions);
begin Self.ReadOptions := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailReadOptions_R(Self: TJvMail; var T: TJvMailReadOptions);
begin T := Self.ReadOptions; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailProfileName_W(Self: TJvMail; const T: string);
begin Self.ProfileName := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailProfileName_R(Self: TJvMail; var T: string);
begin T := Self.ProfileName; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailPassword_W(Self: TJvMail; const T: string);
begin Self.Password := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailPassword_R(Self: TJvMail; var T: string);
begin T := Self.Password; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailLongMsgId_W(Self: TJvMail; const T: Boolean);
begin Self.LongMsgId := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailLongMsgId_R(Self: TJvMail; var T: Boolean);
begin T := Self.LongMsgId; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailLogonOptions_W(Self: TJvMail; const T: TJvMailLogonOptions);
begin Self.LogonOptions := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailLogonOptions_R(Self: TJvMail; var T: TJvMailLogonOptions);
begin T := Self.LogonOptions; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailCarbonCopy_W(Self: TJvMail; const T: TJvMailRecipients);
begin Self.CarbonCopy := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailCarbonCopy_R(Self: TJvMail; var T: TJvMailRecipients);
begin T := Self.CarbonCopy; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailBody_W(Self: TJvMail; const T: TStrings);
begin Self.Body := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailBody_R(Self: TJvMail; var T: TStrings);
begin T := Self.Body; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailBlindCopy_W(Self: TJvMail; const T: TJvMailRecipients);
begin Self.BlindCopy := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailBlindCopy_R(Self: TJvMail; var T: TJvMailRecipients);
begin T := Self.BlindCopy; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailAttachment_W(Self: TJvMail; const T: TStrings);
begin Self.Attachment := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailAttachment_R(Self: TJvMail; var T: TStrings);
begin T := Self.Attachment; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailUserLogged_R(Self: TJvMail; var T: Boolean);
begin T := Self.UserLogged; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailSimpleMAPI_R(Self: TJvMail; var T: TJclSimpleMapi);
begin T := Self.SimpleMAPI; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailSessionHandle_R(Self: TJvMail; var T: THandle);
begin T := Self.SessionHandle; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailSeedMessageID_W(Self: TJvMail; const T: string);
begin Self.SeedMessageID := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailSeedMessageID_R(Self: TJvMail; var T: string);
begin T := Self.SeedMessageID; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailReadedMail_R(Self: TJvMail; var T: TJvMailReadedData);
begin T := Self.ReadedMail; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientsRecipientClass_R(Self: TJvMailRecipients; var T: DWORD);
begin T := Self.RecipientClass; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientsItems_W(Self: TJvMailRecipients; const T: TJvMailRecipient; const t1: Integer);
begin Self.Items[t1] := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientsItems_R(Self: TJvMailRecipients; var T: TJvMailRecipient; const t1: Integer);
begin T := Self.Items[t1]; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientValid_R(Self: TJvMailRecipient; var T: Boolean);
begin T := Self.Valid; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientName_W(Self: TJvMailRecipient; const T: string);
begin Self.Name := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientName_R(Self: TJvMailRecipient; var T: string);
begin T := Self.Name; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientAddress_W(Self: TJvMailRecipient; const T: string);
begin Self.Address := T; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientAddress_R(Self: TJvMailRecipient; var T: string);
begin T := Self.Address; end;
(*----------------------------------------------------------------------------*)
procedure TJvMailRecipientAddressAndName_R(Self: TJvMailRecipient; var T: string);
begin T := Self.AddressAndName; end;
(*----------------------------------------------------------------------------*)
procedure RIRegister_TJvMail(CL: TPSRuntimeClassImporter);
begin
with CL.Add(TJvMail) do
begin
RegisterMethod(@TJvMail.Address, 'Address');
RegisterMethod(@TJvMail.Clear, 'Clear');
RegisterMethod(@TJvMail.ErrorCheck, 'ErrorCheck');
RegisterMethod(@TJvMail.FindFirstMail, 'FindFirstMail');
RegisterMethod(@TJvMail.FindNextMail, 'FindNextMail');
RegisterMethod(@TJvMail.FreeSimpleMapi, 'FreeSimpleMapi');
RegisterMethod(@TJvMail.LogOff, 'LogOff');
RegisterMethod(@TJvMail.LogOn, 'LogOn');
RegisterMethod(@TJvMail.ReadMail, 'ReadMail');
RegisterMethod(@TJvMail.ResolveName, 'ResolveName');
RegisterMethod(@TJvMail.SaveMail, 'SaveMail');
RegisterMethod(@TJvMail.SendMail, 'SendMail');
RegisterPropertyHelper(@TJvMailReadedMail_R,nil,'ReadedMail');
RegisterPropertyHelper(@TJvMailSeedMessageID_R,@TJvMailSeedMessageID_W,'SeedMessageID');
RegisterPropertyHelper(@TJvMailSessionHandle_R,nil,'SessionHandle');
RegisterPropertyHelper(@TJvMailSimpleMAPI_R,nil,'SimpleMAPI');
RegisterPropertyHelper(@TJvMailUserLogged_R,nil,'UserLogged');
RegisterPropertyHelper(@TJvMailAttachment_R,@TJvMailAttachment_W,'Attachment');
RegisterPropertyHelper(@TJvMailBlindCopy_R,@TJvMailBlindCopy_W,'BlindCopy');
RegisterPropertyHelper(@TJvMailBody_R,@TJvMailBody_W,'Body');
RegisterPropertyHelper(@TJvMailCarbonCopy_R,@TJvMailCarbonCopy_W,'CarbonCopy');
RegisterPropertyHelper(@TJvMailLogonOptions_R,@TJvMailLogonOptions_W,'LogonOptions');
RegisterPropertyHelper(@TJvMailLongMsgId_R,@TJvMailLongMsgId_W,'LongMsgId');
RegisterPropertyHelper(@TJvMailPassword_R,@TJvMailPassword_W,'Password');
RegisterPropertyHelper(@TJvMailProfileName_R,@TJvMailProfileName_W,'ProfileName');
RegisterPropertyHelper(@TJvMailReadOptions_R,@TJvMailReadOptions_W,'ReadOptions');
RegisterPropertyHelper(@TJvMailRecipient_R,@TJvMailRecipient_W,'Recipient');
RegisterPropertyHelper(@TJvMailSubject_R,@TJvMailSubject_W,'Subject');
end;
end;
(*----------------------------------------------------------------------------*)
procedure RIRegister_TJvMailRecipients(CL: TPSRuntimeClassImporter);
begin
with CL.Add(TJvMailRecipients) do
begin
RegisterConstructor(@TJvMailRecipients.Create, 'Create');
RegisterMethod(@TJvMailRecipients.Add, 'Add');
RegisterMethod(@TJvMailRecipients.AddRecipient, 'AddRecipient');
RegisterPropertyHelper(@TJvMailRecipientsItems_R,@TJvMailRecipientsItems_W,'Items');
RegisterPropertyHelper(@TJvMailRecipientsRecipientClass_R,nil,'RecipientClass');
end;
end;
(*----------------------------------------------------------------------------*)
procedure RIRegister_TJvMailRecipient(CL: TPSRuntimeClassImporter);
begin
with CL.Add(TJvMailRecipient) do
begin
RegisterPropertyHelper(@TJvMailRecipientAddressAndName_R,nil,'AddressAndName');
RegisterPropertyHelper(@TJvMailRecipientAddress_R,@TJvMailRecipientAddress_W,'Address');
RegisterPropertyHelper(@TJvMailRecipientName_R,@TJvMailRecipientName_W,'Name');
RegisterPropertyHelper(@TJvMailRecipientValid_R,nil,'Valid');
end;
end;
(*----------------------------------------------------------------------------*)
procedure RIRegister_JvMail(CL: TPSRuntimeClassImporter);
begin
with CL.Add(TJvMail) do
RIRegister_TJvMailRecipient(CL);
RIRegister_TJvMailRecipients(CL);
RIRegister_TJvMail(CL);
end;
{ TPSImport_JvMail }
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.CompOnUses(CompExec: TPSScript);
begin
{ nothing }
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.ExecOnUses(CompExec: TPSScript);
begin
{ nothing }
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.CompileImport1(CompExec: TPSScript);
begin
SIRegister_JvMail(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.CompileImport2(CompExec: TPSScript);
begin
{ nothing }
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
RIRegister_JvMail(ri);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_JvMail.ExecImport2(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
{ nothing }
end;
end.