Difference between revisions of "Unit POP3"

From Ultibo.org
Jump to: navigation, search
 
(13 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo POP3 Interface unit'''
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''POP3 specific constants''' <code> POP3_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>POP3_LINE_END = Chr(13) + Chr(10);</code>
 +
| CR LF
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>POP3_BUFFER_SIZE = SIZE_4K;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''POP3 status''' <code> POP3_STATUS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>POP3_STATUS_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>POP3_STATUS_CONN = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STATUS_USER = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STATUS_PASS = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STATUS_APOP = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STATUS_DATA = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STATUS_QUIT = 6;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>POP3_MAX_STATUS = 6;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''POP3 command''' <code> POP3_COMMAND_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>POP3_COMMAND_STAT = 'STAT';</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>POP3_COMMAND_LIST = 'LIST';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_RETR = 'RETR';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_DELE = 'DELE';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_NOOP = 'NOOP';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_RSET = 'RSET';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_QUIT = 'QUIT';</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>POP3_COMMAND_TOP  = 'TOP';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_UIDL = 'UIDL';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_USER = 'USER';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_PASS = 'PASS';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_COMMAND_APOP = 'APOP';</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''POP3 string''' <code> POP3_STRING_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>POP3_STRING_SUCCESS = '+OK ';</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>POP3_STRING_FAILURE = '-ERR ';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_COMPLETE = '.';</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>POP3_STRING_SIGNON = 'Ultibo POP3 server (version ' + ULTIBO_RELEASE_VERSION + ')';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_SIGNOFF = 'Ultibo POP3 server closing connection';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_EMPTY_STAT = '0 0';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_EMPTY_LIST = '0 messages (0 octets)';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_BAD_COMMAND = 'Bad command';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_BAD_MESSAGE = 'No such message';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_BAD_USERNAME = 'Invalid username or password';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_BAD_PASSWORD = 'Invalid username or password';</code>
 +
| &nbsp;
 +
|-
 +
| <code>POP3_STRING_NO_PERMISSION = 'Permission denied';</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''POP3 logging''' <code> POP3_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>POP3_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| POP3 debugging messages
 +
|-
 +
| <code>POP3_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| POP3 informational messages
 +
|-
 +
| <code>POP3_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| POP3 warning messages
 +
|-
 +
| <code>POP3_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| POP3 error messages
 +
|-
 +
| <code>POP3_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No POP3 messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''POP3 client notify event'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code> TPOP3ClientNotifyEvent = procedure(const ARequest:String) of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 host event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3HostEvent = function(AConnection:TPOP3Connection):Boolean of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 count event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3CountEvent = function(AConnection:TPOP3Connection):Boolean of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 notify event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3NotifyEvent = procedure(AConnection:TPOP3Connection; const ARequest:String) of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 request event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3RequestEvent = function(AConnection:TPOP3Connection; const ARequest:String; var AReply:String):Boolean of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 request extended event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3RequestExEvent = function(AConnection:TPOP3Connection; const ARequest,AData:String; var AReply:String):Boolean of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''POP3 connection event'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TPOP3ConnectionEvent = procedure(AConnection:TPOP3Connection) of Object;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
 +
 
 +
=== Class definitions ===
 +
----
 +
 
 +
 
 +
'''POP3 helper classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TPOP3Buffer|<code>TPOP3Buffer = class(TObject)</code>]]
 +
|-
 +
|}
 +
 
 +
'''POP3 client classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TPOP3Client|<code>TPOP3Client = class(TWinsock2TCPClient)</code>]]
 +
|-
 +
|}
 +
 
 +
'''POP3 server classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TPOP3Connection|<code>TPOP3Connection = class(TListObject)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TPOP3Listener|<code>TPOP3Listener = class(TWinsock2TCPListener)</code>]]
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''POP3 logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>POP3_DEFAULT_LOG_LEVEL:LongWord = POP3_LOG_LEVEL_DEBUG;</code>
 +
| style="width: 40%;"|Minimum level for POP3 messages. Only messages with level greater than or equal to this will be printed.
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>POP3_LOG_ENABLED:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 34: Line 312:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 41: Line 319:
 
<br />
 
<br />
  
 +
'''POP3 helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure POP3Log(Level:LongWord; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure POP3LogInfo(const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure POP3LogWarn(const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure POP3LogError(const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure POP3LogDebug(const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 05:28, 31 August 2021

Return to Unit Reference


Description


Ultibo POP3 Interface unit

Constants



POP3 specific constants POP3_*
POP3_LINE_END = Chr(13) + Chr(10); CR LF
 
POP3_BUFFER_SIZE = SIZE_4K;  


POP3 status POP3_STATUS_*
POP3_STATUS_NONE = 0;  
POP3_STATUS_CONN = 1;  
POP3_STATUS_USER = 2;  
POP3_STATUS_PASS = 3;  
POP3_STATUS_APOP = 4;  
POP3_STATUS_DATA = 5;  
POP3_STATUS_QUIT = 6;  
 
POP3_MAX_STATUS = 6;  


POP3 command POP3_COMMAND_*
POP3_COMMAND_STAT = 'STAT';  
POP3_COMMAND_LIST = 'LIST';  
POP3_COMMAND_RETR = 'RETR';  
POP3_COMMAND_DELE = 'DELE';  
POP3_COMMAND_NOOP = 'NOOP';  
POP3_COMMAND_RSET = 'RSET';  
POP3_COMMAND_QUIT = 'QUIT';  
 
POP3_COMMAND_TOP = 'TOP';  
POP3_COMMAND_UIDL = 'UIDL';  
POP3_COMMAND_USER = 'USER';  
POP3_COMMAND_PASS = 'PASS';  
POP3_COMMAND_APOP = 'APOP';  


POP3 string POP3_STRING_*
POP3_STRING_SUCCESS = '+OK ';  
POP3_STRING_FAILURE = '-ERR ';  
POP3_STRING_COMPLETE = '.';  
 
POP3_STRING_SIGNON = 'Ultibo POP3 server (version ' + ULTIBO_RELEASE_VERSION + ')';  
POP3_STRING_SIGNOFF = 'Ultibo POP3 server closing connection';  
POP3_STRING_EMPTY_STAT = '0 0';  
POP3_STRING_EMPTY_LIST = '0 messages (0 octets)';  
POP3_STRING_BAD_COMMAND = 'Bad command';  
POP3_STRING_BAD_MESSAGE = 'No such message';  
POP3_STRING_BAD_USERNAME = 'Invalid username or password';  
POP3_STRING_BAD_PASSWORD = 'Invalid username or password';  
POP3_STRING_NO_PERMISSION = 'Permission denied';  


POP3 logging POP3_LOG_*
POP3_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; POP3 debugging messages
POP3_LOG_LEVEL_INFO = LOG_LEVEL_INFO; POP3 informational messages
POP3_LOG_LEVEL_WARN = LOG_LEVEL_WARN; POP3 warning messages
POP3_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; POP3 error messages
POP3_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No POP3 messages


Type definitions



POP3 client notify event

TPOP3ClientNotifyEvent = procedure(const ARequest:String) of Object;

POP3 host event

TPOP3HostEvent = function(AConnection:TPOP3Connection):Boolean of Object;

POP3 count event

TPOP3CountEvent = function(AConnection:TPOP3Connection):Boolean of Object;

POP3 notify event

TPOP3NotifyEvent = procedure(AConnection:TPOP3Connection; const ARequest:String) of Object;

POP3 request event

TPOP3RequestEvent = function(AConnection:TPOP3Connection; const ARequest:String; var AReply:String):Boolean of Object;

POP3 request extended event

TPOP3RequestExEvent = function(AConnection:TPOP3Connection; const ARequest,AData:String; var AReply:String):Boolean of Object;

POP3 connection event

TPOP3ConnectionEvent = procedure(AConnection:TPOP3Connection) of Object;


Class definitions



POP3 helper classes

TPOP3Buffer = class(TObject)

POP3 client classes

TPOP3Client = class(TWinsock2TCPClient)

POP3 server classes

TPOP3Connection = class(TListObject)
TPOP3Listener = class(TWinsock2TCPListener)


Public variables



POP3 logging

POP3_DEFAULT_LOG_LEVEL:LongWord = POP3_LOG_LEVEL_DEBUG; Minimum level for POP3 messages. Only messages with level greater than or equal to this will be printed.
POP3_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure POP3Init;
Description: To be documented
Note None documented


POP3 helper functions

procedure POP3Log(Level:LongWord; const AText:String);
Description: To be documented
Note None documented


procedure POP3LogInfo(const AText:String); inline;
Description: To be documented
Note None documented


procedure POP3LogWarn(const AText:String); inline;
Description: To be documented
Note None documented


procedure POP3LogError(const AText:String); inline;
Description: To be documented
Note None documented


procedure POP3LogDebug(const AText:String); inline;
Description: To be documented
Note None documented


Return to Unit Reference