Commit c6848f52 c6848f52257191abb36b694be61ce333a8992b4b by Sergey Poznyakoff

Remove old compatibility quirks

1 parent ca496753
...@@ -53,6 +53,4 @@ libmu_mailer_la_SOURCES = \ ...@@ -53,6 +53,4 @@ libmu_mailer_la_SOURCES = \
53 smtp_send.c\ 53 smtp_send.c\
54 smtp_starttls.c\ 54 smtp_starttls.c\
55 smtp_trace.c\ 55 smtp_trace.c\
56 smtp_url.c\ 56 smtp_url.c
57 remote.c
58
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2009-2012, 2014-2016 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library. If not,
16 see <http://www.gnu.org/licenses/>. */
17
18 /* This file provides backward-compatible "remote+" mailbox types,
19 introduced in v. 2.0.
20
21 They are only used by maidag.
22
23 This file will be removed in v. 2.2
24 */
25
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29
30 #include <stdlib.h>
31 #include <string.h>
32
33 #include <mailutils/errno.h>
34 #include <mailutils/error.h>
35 #include <mailutils/diag.h>
36
37 #include <mailutils/sys/url.h>
38 #include <mailutils/sys/mailer.h>
39 #include <mailutils/sys/registrar.h>
40
41 #ifdef ENABLE_SMTP
42
43 static int
44 _url_remote_init (mu_url_t url, const char *new_scheme)
45 {
46 char *scheme;
47 mu_record_t record;
48 int rc;
49
50 mu_diag_output (MU_DIAG_WARNING,
51 "%s: this URL scheme is deprecated, use %s instead",
52 url->name, new_scheme);
53
54 rc = mu_registrar_lookup_scheme (new_scheme, &record);
55 if (rc)
56 return rc;
57
58 scheme = strdup (new_scheme);
59 if (!scheme)
60 return ENOMEM;
61
62 free (url->scheme);
63 url->scheme = scheme;
64
65 return record->_url ? record->_url (url) : 0;
66 }
67
68
69 static int
70 _url_remote_smtp_init (mu_url_t url)
71 {
72 return _url_remote_init (url, "smtp");
73 }
74
75 static struct _mu_record _mu_remote_smtp_record = {
76 MU_SMTP_PRIO,
77 "remote+smtp",
78 MU_RECORD_DEFAULT,
79 MU_URL_SCHEME | MU_URL_CRED | MU_URL_INET | MU_URL_PATH | MU_URL_PARAM,
80 MU_URL_HOST,
81 _url_remote_smtp_init, /* url init. */
82 _mu_mailer_mailbox_init, /* Mailbox init. */
83 NULL, /* Mailer init. */
84 _mu_mailer_folder_init, /* Folder init. */
85 NULL, /* No need for a back pointer. */
86 NULL, /* _is_scheme method. */
87 NULL, /* _get_url method. */
88 NULL, /* _get_mailbox method. */
89 NULL, /* _get_mailer method. */
90 NULL /* _get_folder method. */
91 };
92
93 mu_record_t mu_remote_smtp_record = &_mu_remote_smtp_record;
94 #else
95 mu_record_t mu_remote_smtp_record = NULL;
96 #endif
97
98
99 #ifdef ENABLE_SENDMAIL
100 static int
101 _url_remote_sendmail_init (mu_url_t url)
102 {
103 return _url_remote_init (url, "sendmail");
104 }
105
106 static struct _mu_record _mu_remote_sendmail_record =
107 {
108 MU_SENDMAIL_PRIO,
109 "remote+sendmail",
110 MU_RECORD_DEFAULT,
111 MU_URL_SCHEME | MU_URL_PATH,
112 MU_URL_PATH,
113 _url_remote_sendmail_init, /* url init. */
114 _mu_mailer_mailbox_init, /* Mailbox entry. */
115 _mu_mailer_sendmail_init, /* Mailer entry. */
116 _mu_mailer_folder_init, /* Folder entry. */
117 NULL, /* No need for a back pointer. */
118 NULL, /* _is_scheme method. */
119 NULL, /* _get_url method. */
120 NULL, /* _get_mailbox method. */
121 NULL, /* _get_mailer method. */
122 NULL /* _get_folder method. */
123 };
124
125
126 mu_record_t mu_remote_sendmail_record = &_mu_remote_sendmail_record;
127
128
129 static int
130 _url_remote_prog_init (mu_url_t url)
131 {
132 return _url_remote_init (url, "prog");
133 }
134
135 static struct _mu_record _mu_remote_prog_record =
136 {
137 MU_PROG_PRIO,
138 "remote+prog",
139 MU_RECORD_DEFAULT,
140 MU_URL_SCHEME | MU_URL_CRED | MU_URL_PATH | MU_URL_QUERY,
141 MU_URL_PATH,
142 _url_remote_prog_init, /* url init. */
143 _mu_mailer_mailbox_init, /* Mailbox entry. */
144 _mu_mailer_prog_init, /* Mailer entry. */
145 _mu_mailer_folder_init, /* Folder entry. */
146 NULL, /* No need for a back pointer. */
147 NULL, /* _is_scheme method. */
148 NULL, /* _get_url method. */
149 NULL, /* _get_mailbox method. */
150 NULL, /* _get_mailer method. */
151 NULL /* _get_folder method. */
152 };
153
154 mu_record_t mu_remote_prog_record = &_mu_remote_prog_record;
155
156 #else
157 mu_record_t mu_remote_sendmail_record = NULL;
158 mu_record_t mu_remote_prog_record = NULL;
159 #endif
...@@ -602,5 +602,4 @@ _mailer_smtp_init (mu_mailer_t mailer) ...@@ -602,5 +602,4 @@ _mailer_smtp_init (mu_mailer_t mailer)
602 #include <stdio.h> 602 #include <stdio.h>
603 #include <mailutils/sys/registrar.h> 603 #include <mailutils/sys/registrar.h>
604 mu_record_t mu_smtp_record = NULL; 604 mu_record_t mu_smtp_record = NULL;
605 mu_record_t mu_remote_smtp_record = NULL;
606 #endif 605 #endif
......
...@@ -508,13 +508,6 @@ struct mu_cli_setup cli = { ...@@ -508,13 +508,6 @@ struct mu_cli_setup cli = {
508 l - sieve action logs\n\ 508 l - sieve action logs\n\
509 0-9 - Set maidag debugging level\n") 509 0-9 - Set maidag debugging level\n")
510 }; 510 };
511
512 /* FIXME: These are for compatibility with MU 2.0.
513 Remove in 2.2 */
514 extern mu_record_t mu_remote_smtp_record;
515 extern mu_record_t mu_remote_sendmail_record;
516 extern mu_record_t mu_remote_prog_record;
517
518 511
519 int 512 int
520 main (int argc, char *argv[]) 513 main (int argc, char *argv[])
......