File: externals-mail.ads

package info (click to toggle)
topal 80-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 1,084 kB
  • sloc: ada: 11,196; ansic: 783; sh: 174; makefile: 113
file content (146 lines) | stat: -rw-r--r-- 6,478 bytes parent folder | download
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
-- Topal: GPG/GnuPG and Alpine/Pine integration
-- Copyright (C) 2001--2018  Phillip J. Brooke
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3 as
-- published by the Free Software Foundation.
--
-- This program 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.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

package Externals.Mail is

   -- Figure out the MIME boundary by heuristic.
   function Find_Mime_Boundary (Infile : String) return UBS;

   -- Given an infile, a boundary, and a MIME file that we hope is in two
   -- parts, split it into the two parts
   procedure Split_Two_Parts (Infile   : in String;
                              Part_One : in String;
                              Part_Two : in String;
                              Boundary : in UBS);
   
   -- Given a file, guess the boundary, then eat write the first part
   --  only into the given target.  See detailed notes in .adb file.
   procedure Get_First_Part (Infile : in String;
			     Prolog : in String;
			     Boundary : out UBS;
			     Part_Hdr : in String;
			     Part_Body : in String;
			     Remainder : in String);

   -- Extract a content-type from the header of a header-body mail into a
   -- file.
   procedure Extract_Content_Type_From_Header (Email_Filename  : in String;
                                               Target_Filename : in String;
                                               Ignore_Missing  : in Boolean := False;
                                               Substitute      : in Boolean := False);

   -- Ditto, for content-transfer-encoding.
   procedure Extract_Content_Transfer_Encoding_From_Header (Email_Filename  : in String;
                                                            Target_Filename : in String;
                                                            Ignore_Missing  : in Boolean := False;
                                                            Substitute      : in Boolean := False);

   -- Get the header from a header-body mail into a file.
   procedure Extract_Header (Email_Filename  : in String;
                             Target_Filename : in String);

   -- Get the body from a header-body mail into a file.
   procedure Extract_Body (Email_Filename  : in String;
                           Target_Filename : in String);

   procedure Delete_Trailing_Blank_Lines (Infile  : in String;
                                          Outfile : in String);
   
   -- Clean up an email address in a file.
   procedure Clean_Email_Address (F : in String);
   -- Or string-to-string.
   function Clean_Email_Address (E : in String) return String;

   procedure Formail_Concat_Extract_InOut (Header : in String;
                                           Source : in String;
                                           Target : in String);

   procedure Formail_Drop_InOut (Header : in UBS_Array;
                                  Source : in String;
                                  Target : in String);

   -- Equivalent of `formail -s Action'.
   procedure Formail_Action_InOut (Source : in String;
                                   Target : in String;
                                   Action : in String);
   
   -- Runs formail -I Header
   procedure Formail_Replace_Header_InOut (Source : in String;
					   Target : in String;
					   Header : in String);
   procedure Formail_Replace_Header (File   : in String;
				     Header : in String);
   

   -- Construct a top-level 2 part MIME email.
   procedure Mimeconstruct2 (Part1_Filename  : in String;
                             Part2_Filename  : in String;
                             Output_Filename : in String;
                             Content_Type    : in String;
                             Prolog          : in String := "");

   -- Construct a subpart of a MIME email.  This is a drop-in
   --  replacement for an older subroutine.  Content-Type is
   --  explicitly used.  Use_Encoding => False forces it to be omitted.
   type Dispositions is (None, Inline, Attachment);
   procedure Mimeconstruct_Subpart (Infile          : in String;
                                    Outfile         : in String;
                                    Content_Type    : in String;
                                    Dos2UnixU       : in Boolean;
                                    Use_Encoding    : in Boolean;
                                    Disposition     : in Dispositions := None;
                                    Encoding        : in String := "";
                                    Attachment_Name : in String := "");

   -- Construct an entire multipart/mixed email.
   procedure Mimeconstruct_Mixed (Filenames : in UBS_Array;
                                  Outfile   : in String);

   -- View a MIME file.
   procedure View_MIME (F       : in String;
                        Decrypt : in Boolean);

   -- Base 64 decode from infile to outfile.
   procedure Base64_Decode (Infile, Outfile : in String);

   -- Quoted-printable decode from infile to outfile.
   procedure QP_Decode (Infile, Outfile : in String);
   
   -- Replace message-id or content-id....
   procedure Replace_Message_ID(Hdrfile  : in String;
				Alt_Sign : in String;
			        Encrypt_Message_ID : in Boolean;
			        Encrypt_Key : in String);
   procedure Replace_Content_IDs(Tmpfile  : in String;
				 Alt_Sign : in String);
   
   -- Calculate a token for an X-Topal-Send-Token header.
   function Calculate_Send_Token(Hdrfile        : in String;
				 Per_User_Token : in String) return String;
   
   -- Filter an email.  Write an X-Topal-Check-Send-Token header, Yes or No.
   -- Only call this if procmail reports that the user matches (in
   --  From:) and that there is an X-Topal-Send-Token header.
   procedure Check_Send_Token(Per_User_Token : in String);
   
   -- Encrypt any X-Topal-Fcc headers and replace with X-Topal-Fcce
   procedure Replace_Fcc(Hdrfile     : in String;
			 Encrypt_Key : in String);
   
   -- Add an encrypted X-Topal-Bcc header if there's a Bcc header.
   procedure Add_Bcc(Hdrfile     : in String;
		     Encrypt_Key : in String);

end Externals.Mail;