Qore Pop3Client Module Reference 2.0
Loading...
Searching...
No Matches
Pop3Client.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Pop3Client.qm Copyright 2013 - 2024 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
28
29// assume local var scope, do not use "$" for vars, members, and method calls
30
31
126
132namespace Pop3Client {
135
138
140
167class Pop3Client : public Logger::LoggerWrapper, public ConnectionProvider::OptionHelper {
168
169public:
171 const POP3Port = 110;
172
174 const POP3SPort = 995;
175
177 const Protocols = ...;
178
179
181 const CtrlA = chr(1);
182
184protected:
185 Socket sock();
186
187 // connect string
188 string connect;
189
190 // ensures exclusive access to the object
191 Mutex mutex();
192
193 // "tls" flag
194 bool tls = False;
195
196 // "starttls" flag
197 bool starttls = False;
198
199 // "noquit" flag
200 bool noquit = False;
201
202 // authentication credentials
203 string user;
204 string pass;
205 string token;
206
207 // logged in flag
208 bool logged_in = False;
209
210 // i/o timeout in milliseconds
211 timeout ioTimeout;
212
213 // connect timeout in milliseconds
214 timeout connectTimeout;
215
216 // log password
217 bool log_pass = False;
218
219 // sasl flag
220 bool sasl;
221
222 const MaxDebugLine = 2048;
223
224public:
226
228
261 constructor(string url, *hash<auto> opts);
262
263
265
268
269
271
273 string getTarget();
274
275
277
284 logPassword(bool pwd);
285
286
288
295
296
298
306 tls(bool tls);
307
308
310
316 bool tls();
317
318
320
333 starttls(bool starttls);
334
335
337
343 bool starttls();
344
345
347
355 noquit(bool noquit);
356
357
359
370 bool noquit();
371
372
374
389
390
392
404 *hash<auto> getMail();
405
406
408
415
416
418
438 hash<auto> stat();
439
440
442
464 *hash<auto> list();
465
466
468
483 del(softstring msg);
484
485
487
500 del(list<auto> l);
501
502
504
518
519
521
535
536
538
545
546
548
554
555
557
562 setIoTimeout(timeout to);
563
564
566
572
573
575
581
582
584
589 setConnectTimeout(timeout to);
590
591
593
599
600
602
608
609
611
619
620
622
632
633
635
673 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
674
675
677
701 hash<auto> getUsageInfo();
702
703
705
715
716
718
734 setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
735
736
738
748
749
751 // don't reimplement this method; fix/enhance it in the module
752protected:
753 final disconnectIntern();
754public:
755
756
757 // don't reimplement this method; fix/enhance it in the module
758protected:
759 final MailMessage::Message retrIntern(softstring id);
760public:
761
762
763 // don't reimplement this method; fix/enhance it in the module
764protected:
765 final hash statIntern();
766public:
767
768
769 // don't reimplement this method; fix/enhance it in the module
770protected:
771 final *hash<auto> listIntern();
772public:
773
774
775 // read a line from the socket (terminated with \n)
776protected:
777 string readLine(timeout to);
778public:
779
780
781 // gets a trimmed one-line response from the server, throws an exception if an error response is received
782 // don't reimplement this method; fix/enhance it in the module
783protected:
784 final string getResponse();
785public:
786
787
788 // gets a trimmed multi-line response from the server, throws an exception if an error response is received
789 // don't reimplement this method; fix/enhance it in the module
790protected:
791 final list<string> getResponseMulti();
792public:
793
794
795 // gets a multi-line response from the server, throws an exception if an error response is received
796 // does not include the first line in the response
797 // don't reimplement this method; fix/enhance it in the module
798protected:
799 final string getResponseMultiStr();
800public:
801
802
803protected:
804 log(string msg, ...);
805public:
806
807
808protected:
809 logError(string msg, ...);
810public:
811
812
813protected:
814 logDbg(string msg, ...);
815public:
816
817
818 // don't reimplement this method; fix/enhance it in the module
819protected:
820 final sendCommandIntern(string str, *bool masked);
821public:
822
823
824 // don't reimplement this method; fix/enhance it in the module
825protected:
826 final list<string> sendCommandMulti(string str, ...);
827public:
828
829
830 // don't reimplement this method; fix/enhance it in the module
831protected:
832 final string sendCommandMultiStr(string str, ...);
833public:
834
835
836 // don't reimplement this method; fix/enhance it in the module
837protected:
838 final string sendCommand(string str, ...);
839public:
840
841
842 // don't reimplement this method; fix/enhance it in the module
843protected:
844 final string sendCommandMasked(string str, ...);
845public:
846
847
848protected:
849 loginIntern(string r);
850public:
851
852
853protected:
854 doApopLogin(string apop);
855public:
856
857
858protected:
859 doLogin();
860public:
861
862
863protected:
864 doSaslXoauth2Login();
865public:
866
867
868protected:
869 doSSLIntern();
870public:
871
872
873 // when this method returns without an exception, the object is in the TRANSACTION state
874protected:
875 connectIntern();
876public:
877
878
879protected:
880 forceDisconnectIntern();
881public:
882
884};
885
887
894
895public:
897 const ConnectionScheme = ...;
898
899
901
911 constructor(string name, string description, string url, hash attributes = {}, hash options = {})
912 ;
913
914
916
933 constructor(hash<auto> config, *hash<auto> attr) ;
934
935
937 string getType();
938
939
941
946protected:
947 Pop3Client getImpl(bool connect = True, *hash<auto> rtopts);
948public:
949
950
952protected:
953 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
954public:
955
956};
957};
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
del(list< auto > l)
Sends a "DELE" command to delete one or more messages on the server.
noquit(bool noquit)
Sets the "noquit" flag.
setConnectTimeout(timeout to)
sets the connect timeout
MailMessage::Message getMessage(string id)
Retrieves a particular mail message by its ID.
constructor(string url, *hash< auto > opts)
Creates the Pop3Client object.
connect()
Connect to the server with the connection parameters set in the constructor()
reset()
Send a "RSET" command to the POP3 server which will unmark messages marked for deletion.
setIoTimeout(timeout to)
sets the I/o timeout
*hash< auto > getMail()
returns a hash of mail messages keyed by message ID or NOTHING if no messages are available on the se...
destructor()
disconnects if connected and destroys the object
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)
tls(bool tls)
sets the TLS/SSL flag
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.
int getIoTimeoutMs()
returns the i/o timeout as an integer giving milliseconds
setEventQueue()
Removes any Queue object, prohibiting the collection of socket events.
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
*hash< auto > list()
Returns a hash with message information from the "LIST" command.
bool isConnected()
return connection status
disconnect()
disconnect from the server
starttls(bool starttls)
sets the flag for using the "STLS" command after connecting
del(softstring msg)
Sends a "DELE" command to delete a single message on the server.
noop()
send a "NOOP" command to the POP3 server
hash< auto > stat()
Returns a hash with status information from the "STAT" command.
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...
clearStats()
Clears performance statistics.
string getTarget()
Returns the connection target string.
forceDisconnect()
force disconnect of socket without error
date getIoTimeoutDate()
returns the i/o timeout as a relative time value
class for POP3 connections; returns an object of class Pop3Client for receiving or polling for emails
Definition Pop3Client.qm.dox.h:893
constructor(hash< auto > config, *hash< auto > attr)
creates the Pop3Connection connection object
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
const ConnectionScheme
Connection entry info.
Definition Pop3Client.qm.dox.h:897
string getType()
returns "pop3"
constructor(string name, string description, string url, hash attributes={}, hash options={})
creates the Pop3Connection connection object
Pop3Client getImpl(bool connect=True, *hash< auto > rtopts)
returns a Pop3Client object
the main namespace for the Pop3Client module
Definition Pop3Client.qm.dox.h:132
const DefaultIoTimeout
15 second I/O timeout
Definition Pop3Client.qm.dox.h:134
const DefaultConnectTimeout
30 second connect timeout
Definition Pop3Client.qm.dox.h:137