~ubuntu-branches/ubuntu/precise/topal/precise

« back to all changes in this revision

Viewing changes to topal.adb

  • Committer: Bazaar Package Importer
  • Author(s): Phil Brooke
  • Date: 2008-07-18 07:57:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080718075738-i1szqvmxz0evz32p
Tags: upstream-62
ImportĀ upstreamĀ versionĀ 62

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--
2
 
--
3
 
--
4
 
--
 
1
-- Topal: GPG/GnuPG and Alpine/Pine integration
 
2
-- Copyright (C) 2001--2008  Phillip J. Brooke
 
3
--
 
4
-- This program is free software: you can redistribute it and/or modify
 
5
-- it under the terms of the GNU General Public License version 3 as
 
6
-- published by the Free Software Foundation.
 
7
--
 
8
-- This program is distributed in the hope that it will be useful,
 
9
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
-- GNU General Public License for more details.
 
12
--
 
13
-- You should have received a copy of the GNU General Public License
 
14
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
5
15
 
6
16
with Ada.Command_Line;
7
17
with Ada.Exceptions;
28
25
with Help;
29
26
with Menus;
30
27
with Misc;                  use Misc;
 
28
with Readline;
31
29
with Receiving;
 
30
with Remote_Mode;
32
31
with Sending;
33
32
with Workaround;
34
33
 
40
39
   -- Set defaults.
41
40
   Topal_Directory := ToUBS(Externals.Get_Env("HOME")
42
41
                            & "/.topal");
 
42
   -- Load history and config.
43
43
   Configuration.Default_Configuration(Config);
 
44
   Readline.Load_History;
44
45
   -- .topal had better exist if we are going to read the configuration file.
45
46
   if Externals.Simple.Test_R(ToStr(Topal_Directory) & "/config") then
46
47
      Configuration.Read_Config_File;
112
113
                         Recipients => Recipients.all,
113
114
                         Non_Pine   => True);
114
115
         end if;
 
116
      when Remote_Send =>
 
117
         Remote_Mode.Remote_Send(Tmpfile    => ToStr(Tmpfile),
 
118
                                 Resultfile => ToStr(Invocation.Resultfile),
 
119
                                 MIME       => False,
 
120
                                 Mimefile   => "",
 
121
                                 Recipients => Recipients.all);
 
122
      when Remote_MIME_Send =>
 
123
         Remote_Mode.Remote_Send(Tmpfile    => ToStr(Tmpfile),
 
124
                                 Resultfile => ToStr(Invocation.Resultfile),
 
125
                                 MIME       => True,
 
126
                                 Mimefile   => ToStr(Mimefile),
 
127
                                 Recipients => Recipients.all);
115
128
      when Clear_Temp =>
116
129
         Disclaimer;
117
130
         Ada.Text_IO.Put_Line("Clearing temporary files...");
139
152
      when Fix_Folders =>
140
153
         Disclaimer;
141
154
         Workaround.Fix_Folders(Folders => Folders.all);
 
155
      when Server =>
 
156
         Disclaimer;
 
157
         -- Now accept connections....
 
158
         Remote_Mode.Server;
142
159
   end case;
143
160
   if not Config.No_Clean then
144
161
      Externals.Simple.Rm_Tempfiles_PID;
146
163
   if Run_Mode /= Fix_Email then
147
164
      -- Only do this with a real console.  This is nasty.
148
165
      Echo.Set_Echo;
149
 
      Externals.Simple.Stty_Sane;
150
166
   end if;
 
167
   Readline.Save_History;
151
168
   Close_Result_File;
152
169
exception
153
170
   when Externals.System_Abort_By_User =>
155
172
      Ada.Command_Line.Set_Exit_Status(Ada.Command_Line.Failure);
156
173
      Echo.Set_Echo;
157
174
      Externals.Simple.Stty_Sane;
 
175
      Readline.Save_History;
158
176
   when The_Exception : others =>
159
177
      -- Dump info.
160
178
      if Ada.Text_IO.Is_Open(Result_File) then
180
198
      -- Clean up terminal settings.
181
199
      Echo.Set_Echo;
182
200
      Externals.Simple.Stty_Sane;
 
201
      Readline.Save_History;
183
202
end Topal;