Qore Pop3Client Module Reference 1.9
Loading...
Searching...
No Matches
Pop3Client.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Pop3Client.qm Copyright 2013 - 2022 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum qore version
26
27// need mime definitions
28
29// need MailMessage classes
30
31// requires the ConnectionProvider module
32
33// assume local var scope, do not use "$" for vars, members, and method calls
34
35}
36
123
129namespace Pop3Client {
132
135
137
151
152public:
154protected:
155 Socket sock();
156
157 // connect string
158 string connect;
159
160 // ensures exclusive access to the object
161 Mutex mutex();
162
163 // optional info log closure
164 *code log_info;
165
166 // optional debug log closure
167 *code log_debug;
168
169 // "tls" flag
170 bool tls = False;
171
172 // "starttls" flag
173 bool starttls = False;
174
175 // "noquit" flag
176 bool noquit = False;
177
178 // authentication credentials
179 string user;
180 string pass;
181
182 // logged in flag
183 bool logged_in = False;
184
185 // read timeout in milliseconds
186 timeout readTimeout = DefaultReadTimeout;
187
188 // connect timeout in milliseconds
189 timeout connectTimeout = DefaultConnectTimeout;
190
191 // log password
192 bool log_pass = False;
193
194 const MaxDebugLine = 2048;
195
196public:
198
200 const POP3Port = 110;
201
203 const POP3SPort = 995;
204
206 const Protocols = {
207 "pop3": {"tls": False, "port": POP3Port},
208 "pop3s": {"tls": True, "port": POP3SPort},
209 };
210
212
229 constructor(string url, *code log, *code dbglog);
230
231
233
236
237
239
241 string getTarget();
242
243
245
252 logPassword(bool pwd);
253
254
256
263
264
266
273 tls(bool n_tls);
274
275
277
283 bool tls();
284
285
287
294 starttls(bool n_starttls);
295
296
298
304 bool starttls();
305
306
308
315 noquit(bool n_noquit);
316
317
319
328 bool noquit();
329
330
332
345
346
348
359 *hash getMail();
360
361
363
378 hash stat();
379
380
382
397 *hash list();
398
399
401
412 del(softstring msg);
413
414
416
425 del(list l);
426
427
429
439
440
442
452
453
455
462
463
465
471
472
474
479 setReadTimeout(timeout to);
480
481
483
489
490
492
498
499
501
506 setConnectTimeout(timeout to);
507
508
510
516
517
519
525
526
528
536
537
539
549
550
552
582 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
583
584
586
604 hash<auto> getUsageInfo();
605
606
608
618
619
621
637 setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
638
639
641
651
652
654 // don't reimplement this method; fix/enhance it in the module
655protected:
656 final disconnectIntern();
657public:
658
659
660 // don't reimplement this method; fix/enhance it in the module
661protected:
662 final MailMessage::Message retrIntern(softstring id);
663public:
664
665
666 // don't reimplement this method; fix/enhance it in the module
667protected:
668 final hash statIntern();
669public:
670
671
672 // don't reimplement this method; fix/enhance it in the module
673protected:
674 final *hash listIntern();
675public:
676
677
678 // read a line from the socket (terminated with \n)
679protected:
680 string readLine(timeout to);
681public:
682
683
684 // gets a trimmed one-line response from the server, throws an exception if an error response is received
685 // don't reimplement this method; fix/enhance it in the module
686protected:
687 final string getResponse();
688public:
689
690
691 // gets a trimmed multi-line response from the server, throws an exception if an error response is received
692 // don't reimplement this method; fix/enhance it in the module
693protected:
694 final list getResponseMulti();
695public:
696
697
698 // gets a multi-line response from the server, throws an exception if an error response is received
699 // does not include the first line in the response
700 // don't reimplement this method; fix/enhance it in the module
701protected:
702 final string getResponseMultiStr();
703public:
704
705
706protected:
707 log(string msg);
708public:
709
710
711protected:
712 logDbg(string msg);
713public:
714
715
716 // don't reimplement this method; fix/enhance it in the module
717protected:
718 final sendCommandIntern(string str, bool masked = False);
719public:
720
721
722 // don't reimplement this method; fix/enhance it in the module
723protected:
724 final list sendCommandMulti(string str);
725public:
726
727
728 // don't reimplement this method; fix/enhance it in the module
729protected:
730 final string sendCommandMultiStr(string str);
731public:
732
733
734 // don't reimplement this method; fix/enhance it in the module
735protected:
736 final string sendCommand(string str);
737public:
738
739
740 // don't reimplement this method; fix/enhance it in the module
741protected:
742 final string sendCommandMasked(string str);
743public:
744
745
746protected:
747 loginIntern(string r);
748public:
749
750
751protected:
752 doSSLIntern();
753public:
754
755
756 // when this method returns without an exception, the object is in the TRANSACTION state
757protected:
758 connectIntern();
759public:
760
761
762protected:
763 forceDisconnectIntern();
764public:
765
767};
768
770
777
778public:
780 const ConnectionScheme = <ConnectionSchemeInfo>{
781 "cls": Class::forName("Pop3Connection"),
782 };
783
785
795 constructor(string name, string description, string url, hash attributes = {}, hash options = {})
796 ;
797
798
800 string getType();
801
802
804
808 *hash<auto> getRuntimeOptions();
809
810
812
819protected:
820 Pop3Client getImpl(bool connect = True, *hash rtopts);
821public:
822
823
825protected:
826 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
827public:
828
829};
830};
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
del(list l)
sends a "DELE" command (http://tools.ietf.org/html/rfc1939#page-8) to the POP3 server to mark the giv...
setConnectTimeout(timeout to)
sets the connect timeout
connect()
Connect to the server with the connection parameters set in the constructor()
reset()
send a "RSET" command (http://tools.ietf.org/html/rfc1939#page-9) to the POP3 server which will unmar...
noquit(bool n_noquit)
sets the "noquit" flag
starttls(bool n_starttls)
sets the flag for using the "STLS" command after connecting (RFC 2595); this is only used if the TLS/...
destructor()
disconnects if connected and destroys the object
setReadTimeout(timeout to)
sets the read timeout
setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive socket events.
bool tls()
returns the TLS/SSL flag
bool starttls()
returns the "starttls" flag (RFC 2595)
logPassword(bool pwd)
log password
int getConnectTimeoutMs()
returns the connect timeout as an integer giving milliseconds
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
setEventQueue()
Removes any Queue object so that socket events are no longer added to the Queue.
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
*hash list()
returns a hash with message information from the "LIST" command (http://tools.ietf....
constructor(string url, *code log, *code dbglog)
creates the Pop3Client object
hash stat()
returns a hash with status information from the "STAT" command (http://tools.ietf....
bool isConnected()
return connection status
disconnect()
disconnect from the server
tls(bool n_tls)
sets the TLS/SSL flag
del(softstring msg)
sends a "DELE" command (http://tools.ietf.org/html/rfc1939#page-8) to the POP3 server to mark the giv...
noop()
send a "NOOP" command (http://tools.ietf.org/html/rfc1939#page-9) to the POP3 server
date getConnectTimeoutDate()
returns the connect timeout as a relative time value
bool logPassword()
returns the log password flag
bool noquit()
return the "noquit" flag; if this flag is True, then no "QUIT" command is sent to the POP3 server whe...
date getReadTimeoutDate()
returns the read timeout as a relative time value
clearStats()
Clears performance statistics.
*hash getMail()
returns a hash of mail messages keyed by message ID or NOTHING if no messages are available on the se...
string getTarget()
Returns the connection target string.
forceDisconnect()
force disconnect of socket without error
int getReadTimeoutMs()
returns the read timeout as an integer giving milliseconds
class for POP3 connections; returns an object of class Pop3Client for receiving or polling for emails
Definition: Pop3Client.qm.dox.h:776
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
const ConnectionScheme
Connection entry info.
Definition: Pop3Client.qm.dox.h:780
string getType()
returns "pop3"
*hash< auto > getRuntimeOptions()
returns runtime options
Pop3Client getImpl(bool connect=True, *hash rtopts)
returns a Pop3Client object
constructor(string name, string description, string url, hash attributes={}, hash options={})
creates the RestConnection connection object
the main namespace for the Pop3Client module
Definition: Pop3Client.qm.dox.h:129
const DefaultConnectTimeout
30 second connect timeout
Definition: Pop3Client.qm.dox.h:134
const DefaultReadTimeout
15 second read timeout
Definition: Pop3Client.qm.dox.h:131