NeoMutt  2020-09-25
Teaching an old dog new tricks
Go to the documentation of this file.
23 #ifndef MUTT_EMAIL_URL_H
24 #define MUTT_EMAIL_URL_H
26 #include <stddef.h>
27 #include "mutt/lib.h"
33 {
46 };
48 #define U_PATH (1 << 1)
55 struct UrlQuery
56 {
57  char *name;
58  char *value;
59  STAILQ_ENTRY(UrlQuery) entries;
60 };
61 STAILQ_HEAD(UrlQueryList, UrlQuery);
66 struct Url
67 {
68  enum UrlScheme scheme;
69  char *user;
70  char *pass;
71  char *host;
72  unsigned short port;
73  char *path;
74  struct UrlQueryList query_strings;
75  char *src;
76 };
78 enum UrlScheme url_check_scheme(const char *s);
79 void url_free (struct Url **ptr);
80 struct Url *url_parse (const char *src);
81 int url_pct_decode (char *s);
82 void url_pct_encode (char *buf, size_t buflen, const char *src);
83 int url_tobuffer (struct Url *url, struct Buffer *dest, int flags);
84 int url_tostring (struct Url *url, char *buf, size_t buflen, int flags);
86 #endif /* MUTT_EMAIL_URL_H */
char * name
Query name.
Definition: url.h:57
Url is notmuch://.
Definition: url.h:45
char * pass
Definition: url.h:70
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:66
Url is imaps://.
Definition: url.h:39
String manipulation buffer.
Definition: buffer.h:33
Parsed Query String.
Definition: url.h:55
Url wasn&#39;t recognised.
Definition: url.h:34
Url is imap://.
Definition: url.h:38
char * value
Query value.
Definition: url.h:58
STAILQ_ENTRY(UrlQuery) entries
Linked list.
All recognised Url types.
Definition: url.h:32
int url_tostring(struct Url *url, char *buf, size_t buflen, int flags)
Output the URL string for a given Url object.
Definition: url.c:418
Url is nntps://.
Definition: url.h:41
char * user
Definition: url.h:69
Url is smtps://.
Definition: url.h:43
enum UrlScheme url_check_scheme(const char *s)
Check the protocol of a URL.
Definition: url.c:221
int url_tobuffer(struct Url *url, struct Buffer *dest, int flags)
Output the URL string for a given Url object.
Definition: url.c:353
char * host
Definition: url.h:71
char * path
Definition: url.h:73
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:234
Url is pop://.
Definition: url.h:36
unsigned short port
Definition: url.h:72
STAILQ_HEAD(UrlQueryList, UrlQuery)
Url is nntp://.
Definition: url.h:40
int url_pct_decode(char *s)
Decode a percent-encoded string.
Definition: url.c:189
Url is smtp://.
Definition: url.h:42
Url is mailto://.
Definition: url.h:44
void url_pct_encode(char *buf, size_t buflen, const char *src)
Percent-encode a string.
Definition: url.c:151
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123
Convenience wrapper for the library headers.
char * src
Raw URL string.
Definition: url.h:75
Url is file://.
Definition: url.h:35
Url is pops://.
Definition: url.h:37