/usr/share/ada/adainclude/aws/aws-pop.ads is in libaws3.3.2.2-dev 17.2.2017-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
with Ada.Finalization;
with Ada.Strings.Unbounded;
with AWS.Headers;
with AWS.Net.Std;
with AWS.Resources.Streams;
with AWS.Utils;
package AWS.POP is
use Ada.Strings.Unbounded;
POP_Error : exception;
-- Raised by all routines when an error has been detected
-------------
-- Mailbox --
-------------
Default_POP_Port : constant := 110;
type Mailbox is private;
type Authenticate_Mode is (Clear_Text, APOP);
function Initialize
(Server_Name : String;
User : String;
Password : String;
Authenticate : Authenticate_Mode := Clear_Text;
Port : Positive := Default_POP_Port) return Mailbox;
-- Connect on the given Port to Server_Name and open User's Mailbox. This
-- mailbox object will be used to retrieve messages.
procedure Close (Mailbox : POP.Mailbox);
-- Close mailbox
function User_Name (Mailbox : POP.Mailbox) return String;
-- Returns User's name for this mailbox
function Message_Count (Mailbox : POP.Mailbox) return Natural;
-- Returns the number of messages in the user's mailbox
function Size (Mailbox : POP.Mailbox) return Natural;
-- Returns the total size in bytes of the user's mailbox
-------------
-- Message --
-------------
type Message is tagged private;
function Get
(Mailbox : POP.Mailbox;
N : Positive;
Remove : Boolean := False) return Message;
-- Retrieve Nth message from the mailbox, let the message on the mailbox
-- if Remove is False.
procedure Delete
(Mailbox : POP.Mailbox;
N : Positive);
-- Detele message number N from the mailbox
function Get_Header
(Mailbox : POP.Mailbox;
N : Positive) return Message;
-- Retrieve headers for the Nth message from the mailbox, let the message
-- on the mailbox. This is useful to build a quick summary of the mailbox.
generic
with procedure Action
(Message : POP.Message;
Index : Positive;
Quit : in out Boolean);
procedure For_Every_Message
(Mailbox : POP.Mailbox;
Remove : Boolean := False);
-- Calls Action for each message read on the mailbox, delete the message
-- from the mailbox if Remove is True. Set Quit to True to stop the
-- iterator. Index is the mailbox's message index.
generic
with procedure Action
(Message : POP.Message;
Index : Positive;
Quit : in out Boolean);
procedure For_Every_Message_Header (Mailbox : POP.Mailbox);
-- Calls Action for each message read on the mailbox. Only the headers are
-- read from the mailbox. Set Quit to True to stop the iterator. Index is
-- the mailbox's message index.
function Size (Message : POP.Message) return Natural;
-- Returns the message size in bytes
function Content (Message : POP.Message) return Unbounded_String;
-- Returns message's content as an Unbounded_String. Each line are
-- separated by CR+LF characters.
function From (Message : POP.Message) return String;
-- Returns From header value
function To (Message : POP.Message; N : Natural := 0) return String;
-- Returns the To header value. If N = 0 returns all recipients separated
-- by a coma otherwise it returns the Nth To recipient.
function To_Count (Message : POP.Message) return Natural;
-- Returns the number of To recipient for Message. returns 0 if there is
-- no To for this message.
function CC (Message : POP.Message; N : Natural := 0) return String;
-- Retruns the CC header value. If N = 0 returns all recipients separated
-- by a coma otherwise it returns the Nth CC recipient.
function CC_Count (Message : POP.Message) return Natural;
-- Returns the number of CC recipient for Message. Returns 0 if there is
-- no CC for this message.
function Subject (Message : POP.Message) return String;
-- Returns Subject header value
function Date (Message : POP.Message) return String;
-- Returns Date header value
function Header
(Message : POP.Message;
Header : String) return String;
-- Returns header value for header named Header, returns the empty string
-- if such header does not exist.
----------------
-- Attachment --
----------------
type Attachment is private;
function Attachment_Count (Message : POP.Message) return Natural;
-- Returns the number of Attachments into Message
function Get
(Message : POP.Message'Class;
Index : Positive) return Attachment;
-- Returns the Nth Attachment for Message, Raises Constraint_Error if
-- there is not such attachment.
generic
with procedure Action
(Attachment : POP.Attachment;
Index : Positive;
Quit : in out Boolean);
procedure For_Every_Attachment (Message : POP.Message);
-- Calls action for every Attachment in Message. Stop iterator if Quit is
-- set to True, Quit is set to False by default.
function Content
(Attachment : POP.Attachment)
return AWS.Resources.Streams.Stream_Access;
-- Returns Attachment's content as a memory stream. Note that the stream
-- has already been decoded. Most attachments are MIME Base64 encoded.
function Content (Attachment : POP.Attachment) return Unbounded_String;
-- Returns Attachment's content as an Unbounded_String. This routine must
-- only be used for non file attachments. Raises Constraint_Error if
-- called for a file attachment.
function Filename (Attachment : POP.Attachment) return String;
-- Returns the Attachment filename or the empty string if it is not a file
-- but an embedded message.
function Is_File (Attachment : POP.Attachment) return Boolean;
-- Returns True if Attachment is a file
procedure Write (Attachment : POP.Attachment; Directory : String);
-- Writes Attachment's file content into Directory. This must only be used
-- for a file attachment.
private
use Ada;
-------------
-- Mailbox --
-------------
type Mailbox is record
Sock : Net.Std.Socket_Type;
Name : Unbounded_String;
User_Name : Unbounded_String;
Message_Count : Natural;
Size : Natural;
end record;
type Attachment_Access is access Attachment;
-------------
-- Message --
-------------
type Message is new Finalization.Controlled with record
Ref_Count : AWS.Utils.Counter_Access;
Size : Natural;
Headers : AWS.Headers.List;
Content : Unbounded_String;
Attachments : Attachment_Access;
Last : Attachment_Access;
end record;
overriding procedure Initialize (Message : in out POP.Message);
overriding procedure Adjust (Message : in out POP.Message);
overriding procedure Finalize (Message : in out POP.Message);
----------------
-- Attachment --
----------------
type Attachment is new Finalization.Controlled with record
Ref_Count : AWS.Utils.Counter_Access;
Headers : AWS.Headers.List;
Content : AWS.Resources.Streams.Stream_Access;
Filename : Unbounded_String;
Next : Attachment_Access;
end record;
overriding procedure Initialize (Attachment : in out POP.Attachment);
overriding procedure Adjust (Attachment : in out POP.Attachment);
overriding procedure Finalize (Attachment : in out POP.Attachment);
end AWS.POP;
|