enriched.o enter.o filter.o flags.o group.o handler.o \
hdrline.o help.o hook.o init.o keymap.o \
main.o menu.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
- mutt_history.o mutt_logging.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o mx.o \
+ mutt_history.o mutt_logging.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_url.o mutt_window.o mx.o \
pager.o parse.o pattern.o \
postpone.o progress.o query.o recvattach.o recvcmd.o resize.o rfc1524.o \
rfc2047.o rfc2231.o rfc3676.o safe_asprintf.o score.o send.o \
sendlib.o sidebar.o smtp.o sort.o state.o status.o system.o \
- terminal.o url.o version.o
+ terminal.o version.o
@if !HAVE_WCSCASECMP
NEOMUTTOBJS+= wcscasecmp.o
# libemail
LIBEMAIL= libemail.a
LIBEMAILOBJS= email/address.o email/attach.o email/body.o email/envelope.o \
- email/from.o email/header.o email/parameter.o email/tags.o email/thread.o
+ email/from.o email/header.o email/parameter.o email/tags.o email/thread.o email/url.o
CLEANFILES+= $(LIBEMAIL) $(LIBEMAILOBJS)
MUTTLIBS+= $(LIBEMAIL)
ALLOBJS+= $(LIBEMAILOBJS)
#include "mutt_account.h"
#include "muttlib.h"
#include "protos.h"
-#include "url.h"
+#include "email/email.h"
/* These Config Variables are only used in bcache.c */
char *MessageCachedir;
#include "protos.h"
#include "sendlib.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_IMAP
#include "imap/imap.h"
#endif
* | email/parameter.c | @subpage email_parameter |
* | email/tags.c | @subpage email_tags |
* | email/thread.c | @subpage email_thread |
+ * | email/url.c | @subpage email_url |
*/
#ifndef _EMAIL_EMAIL_H
#include "parameter.h"
#include "tags.h"
#include "thread.h"
+#include "url.h"
#endif /* _EMAIL_EMAIL_H */
#include <stdio.h>
#include <string.h>
#include "mutt/mutt.h"
-#include "email/email.h"
-#include "mutt.h"
#include "url.h"
-#include "globals.h"
-#include "parse.h"
-#include "protos.h"
-#include "rfc2047.h"
static const struct Mapping UrlMap[] = {
- { "file", U_FILE }, { "imap", U_IMAP }, { "imaps", U_IMAPS },
- { "pop", U_POP }, { "pops", U_POPS }, { "news", U_NNTP },
- { "snews", U_NNTPS }, { "mailto", U_MAILTO },
-#ifdef USE_NOTMUCH
- { "notmuch", U_NOTMUCH },
-#endif
- { "smtp", U_SMTP }, { "smtps", U_SMTPS }, { NULL, U_UNKNOWN },
+ { "file", U_FILE }, { "imap", U_IMAP }, { "imaps", U_IMAPS },
+ { "pop", U_POP }, { "pops", U_POPS }, { "news", U_NNTP },
+ { "snews", U_NNTPS }, { "mailto", U_MAILTO }, { "notmuch", U_NOTMUCH },
+ { "smtp", U_SMTP }, { "smtps", U_SMTPS }, { NULL, U_UNKNOWN },
};
int url_pct_decode(char *s)
return 0;
}
-int url_parse_mailto(struct Envelope *e, char **body, const char *src)
-{
- char *p = NULL;
- char *tag = NULL, *value = NULL;
-
- int rc = -1;
-
- char *t = strchr(src, ':');
- if (!t)
- return -1;
-
- /* copy string for safe use of strtok() */
- char *tmp = mutt_str_strdup(t + 1);
- if (!tmp)
- return -1;
-
- char *headers = strchr(tmp, '?');
- if (headers)
- *headers++ = '\0';
-
- if (url_pct_decode(tmp) < 0)
- goto out;
-
- e->to = mutt_addr_parse_list(e->to, tmp);
-
- tag = headers ? strtok_r(headers, "&", &p) : NULL;
-
- for (; tag; tag = strtok_r(NULL, "&", &p))
- {
- value = strchr(tag, '=');
- if (value)
- *value++ = '\0';
- if (!value || !*value)
- continue;
-
- if (url_pct_decode(tag) < 0)
- goto out;
- if (url_pct_decode(value) < 0)
- goto out;
-
- /* Determine if this header field is on the allowed list. Since NeoMutt
- * interprets some header fields specially (such as
- * "Attach: ~/.gnupg/secring.gpg"), care must be taken to ensure that
- * only safe fields are allowed.
- *
- * RFC2368, "4. Unsafe headers"
- * The user agent interpreting a mailto URL SHOULD choose not to create
- * a message if any of the headers are considered dangerous; it may also
- * choose to create a message with only a subset of the headers given in
- * the URL.
- */
- if (mutt_list_match(tag, &MailToAllow))
- {
- if (mutt_str_strcasecmp(tag, "body") == 0)
- {
- if (body)
- mutt_str_replace(body, value);
- }
- else
- {
- char *scratch = NULL;
- size_t taglen = mutt_str_strlen(tag);
-
- safe_asprintf(&scratch, "%s: %s", tag, value);
- scratch[taglen] = 0; /* overwrite the colon as mutt_rfc822_parse_line expects */
- value = mutt_str_skip_email_wsp(&scratch[taglen + 1]);
- mutt_rfc822_parse_line(e, NULL, scratch, value, 1, 0, 1);
- FREE(&scratch);
- }
- }
- }
-
- /* RFC2047 decode after the RFC822 parsing */
- rfc2047_decode_addrlist(e->from);
- rfc2047_decode_addrlist(e->to);
- rfc2047_decode_addrlist(e->cc);
- rfc2047_decode_addrlist(e->bcc);
- rfc2047_decode_addrlist(e->reply_to);
- rfc2047_decode_addrlist(e->mail_followup_to);
- rfc2047_decode_addrlist(e->return_path);
- rfc2047_decode_addrlist(e->sender);
- mutt_rfc2047_decode(&e->x_label);
- mutt_rfc2047_decode(&e->subject);
-
- rc = 0;
-
-out:
- FREE(&tmp);
- return rc;
-}
* Parse and identify different URL schemes
*
* @authors
+ * Copyright (C) 2000-2002,2004 Thomas Roessler <roessler@does-not-exist.org>
+ *
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _MUTT_URL_H
-#define _MUTT_URL_H
+#ifndef _EMAIL_URL_H
+#define _EMAIL_URL_H
#include <stddef.h>
#include "mutt/mutt.h"
-#include "email/email.h"
/**
* enum UrlScheme - All recognised Url types
U_SMTP,
U_SMTPS,
U_MAILTO,
-#ifdef USE_NOTMUCH
- U_NOTMUCH
-#endif
+ U_NOTMUCH,
};
#define U_DECODE_PASSWD (1 << 0)
};
enum UrlScheme url_check_scheme(const char *s);
-int url_parse(struct Url *u, char *src);
-void url_free(struct Url *u);
-int url_tostring(struct Url *u, char *dest, size_t len, int flags);
-int url_parse_mailto(struct Envelope *e, char **body, const char *src);
-int url_pct_decode(char *s);
-void url_pct_encode(char *dst, size_t l, const char *src);
+void url_free(struct Url *u);
+int url_parse(struct Url *u, char *src);
+int url_pct_decode(char *s);
+void url_pct_encode(char *dst, size_t l, const char *src);
+int url_tostring(struct Url *u, char *dest, size_t len, int flags);
-#endif /* _MUTT_URL_H */
+#endif /* _EMAIL_URL_H */
#include "mx.h"
#include "options.h"
#include "protos.h"
-#include "url.h"
/* These Config Variables are only used in imap/command.c */
bool ImapServernoise;
#include "progress.h"
#include "protos.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_HCACHE
#include "hcache/hcache.h"
#endif
#include <unistd.h>
#include "imap_private.h"
#include "mutt/mutt.h"
+#include "email/email.h"
#include "conn/conn.h"
#include "bcache.h"
#include "context.h"
#include "mx.h"
#include "options.h"
#include "protos.h"
-#include "url.h"
#ifdef USE_HCACHE
#include "hcache/hcache.h"
#endif
#include "send.h"
#include "sendlib.h"
#include "terminal.h"
-#include "url.h"
#include "version.h"
#ifdef ENABLE_NLS
#include <libintl.h>
#include <stdio.h>
#include <string.h>
#include "mutt/mutt.h"
+#include "email/email.h"
#include "conn/conn.h"
#include "mutt_account.h"
#include "curs_lib.h"
#include "globals.h"
#include "options.h"
#include "protos.h"
-#include "url.h"
/* These Config Variables are only used in mutt_account.c */
char *ImapLogin;
#include <stdio.h>
#include <string.h>
#include "mutt/mutt.h"
+#include "email/email.h"
#include "conn/conn.h"
#include "mutt_socket.h"
#include "hook.h"
#include "mutt_account.h"
#include "protos.h"
-#include "url.h"
/**
* mutt_conn_find - Find a connection from a list
--- /dev/null
+/**
+ * @file
+ * Parse and identify different URL schemes
+ *
+ * @authors
+ * Copyright (C) 2000-2002,2004 Thomas Roessler <roessler@does-not-exist.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * 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/>.
+ */
+
+#include "config.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include "mutt/mutt.h"
+#include "email/email.h"
+#include "mutt.h"
+#include "globals.h"
+#include "rfc2047.h"
+#include "parse.h"
+
+int url_parse_mailto(struct Envelope *e, char **body, const char *src)
+{
+ char *p = NULL;
+ char *tag = NULL, *value = NULL;
+
+ int rc = -1;
+
+ char *t = strchr(src, ':');
+ if (!t)
+ return -1;
+
+ /* copy string for safe use of strtok() */
+ char *tmp = mutt_str_strdup(t + 1);
+ if (!tmp)
+ return -1;
+
+ char *headers = strchr(tmp, '?');
+ if (headers)
+ *headers++ = '\0';
+
+ if (url_pct_decode(tmp) < 0)
+ goto out;
+
+ e->to = mutt_addr_parse_list(e->to, tmp);
+
+ tag = headers ? strtok_r(headers, "&", &p) : NULL;
+
+ for (; tag; tag = strtok_r(NULL, "&", &p))
+ {
+ value = strchr(tag, '=');
+ if (value)
+ *value++ = '\0';
+ if (!value || !*value)
+ continue;
+
+ if (url_pct_decode(tag) < 0)
+ goto out;
+ if (url_pct_decode(value) < 0)
+ goto out;
+
+ /* Determine if this header field is on the allowed list. Since NeoMutt
+ * interprets some header fields specially (such as
+ * "Attach: ~/.gnupg/secring.gpg"), care must be taken to ensure that
+ * only safe fields are allowed.
+ *
+ * RFC2368, "4. Unsafe headers"
+ * The user agent interpreting a mailto URL SHOULD choose not to create
+ * a message if any of the headers are considered dangerous; it may also
+ * choose to create a message with only a subset of the headers given in
+ * the URL.
+ */
+ if (mutt_list_match(tag, &MailToAllow))
+ {
+ if (mutt_str_strcasecmp(tag, "body") == 0)
+ {
+ if (body)
+ mutt_str_replace(body, value);
+ }
+ else
+ {
+ char *scratch = NULL;
+ size_t taglen = mutt_str_strlen(tag);
+
+ safe_asprintf(&scratch, "%s: %s", tag, value);
+ scratch[taglen] = 0; /* overwrite the colon as mutt_rfc822_parse_line expects */
+ value = mutt_str_skip_email_wsp(&scratch[taglen + 1]);
+ mutt_rfc822_parse_line(e, NULL, scratch, value, 1, 0, 1);
+ FREE(&scratch);
+ }
+ }
+ }
+
+ /* RFC2047 decode after the RFC822 parsing */
+ rfc2047_decode_addrlist(e->from);
+ rfc2047_decode_addrlist(e->to);
+ rfc2047_decode_addrlist(e->cc);
+ rfc2047_decode_addrlist(e->bcc);
+ rfc2047_decode_addrlist(e->reply_to);
+ rfc2047_decode_addrlist(e->mail_followup_to);
+ rfc2047_decode_addrlist(e->return_path);
+ rfc2047_decode_addrlist(e->sender);
+ mutt_rfc2047_decode(&e->x_label);
+ mutt_rfc2047_decode(&e->subject);
+
+ rc = 0;
+
+out:
+ FREE(&tmp);
+ return rc;
+}
#include "ncrypt/ncrypt.h"
#include "options.h"
#include "protos.h"
-#include "url.h"
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
#include "protos.h"
#include "score.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
#endif
#include <unistd.h>
#include "nntp_private.h"
#include "mutt/mutt.h"
+#include "email/email.h"
#include "conn/conn.h"
#include "mutt.h"
#include "bcache.h"
#include "options.h"
#include "protos.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_HCACHE
#include "hcache/hcache.h"
#endif
#include "progress.h"
#include "protos.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_HCACHE
#include "hcache/hcache.h"
#endif
#include "mx.h"
#include "progress.h"
#include "protos.h"
-#include "url.h"
/* These Config Variables are only used in notmuch/mutt_notmuch.c */
int NmDbLimit;
#include "recvattach.h"
#include "rfc2047.h"
#include "rfc2231.h"
-#include "url.h"
struct Context;
#include "parse.h"
#include "progress.h"
#include "protos.h"
-#include "url.h"
#ifdef USE_HCACHE
#include "hcache/hcache.h"
#endif
#include "pop.h"
#include "progress.h"
#include "protos.h"
-#include "url.h"
/* These Config Variables are only used in pop/pop_lib.c */
unsigned char PopReconnect;
struct Context;
struct EnterState;
+struct Envelope;
struct Header;
/**
int mutt_num_postponed(int force);
int mutt_thread_set_flag(struct Header *hdr, int flag, int bf, int subthread);
void mutt_update_num_postponed(void);
+int url_parse_mailto(struct Envelope *e, char **body, const char *src);
#ifndef HAVE_WCSCASECMP
int wcscasecmp(const wchar_t *a, const wchar_t *b);
#include "sendlib.h"
#include "smtp.h"
#include "sort.h"
-#include "url.h"
#ifdef USE_NNTP
#include "mx.h"
#include "nntp/nntp.h"
#include "progress.h"
#include "protos.h"
#include "sendlib.h"
-#include "url.h"
#ifdef USE_SASL
#include <sasl/sasl.h>
#include <sasl/saslutil.h>