(_url_pop_init, _url_pops_init): Call mu_url_init.
Showing
1 changed file
with
25 additions
and
14 deletions
... | @@ -41,36 +41,47 @@ url_pop_destroy (mu_url_t url MU_ARG_UNUSED) | ... | @@ -41,36 +41,47 @@ url_pop_destroy (mu_url_t url MU_ARG_UNUSED) |
41 | } | 41 | } |
42 | 42 | ||
43 | /* | 43 | /* |
44 | POP URL: | 44 | POP URLs: |
45 | pop://[<user>[;AUTH=<auth>]@]<host>[:<port>] | 45 | pop://[<user>[;AUTH=<auth>]@]<host>[:<port>] |
46 | or: | ||
47 | pop://[<user>[:pass]@]<host>[:<port>] | 46 | pop://[<user>[:pass]@]<host>[:<port>] |
48 | */ | 47 | */ |
49 | 48 | ||
50 | int | 49 | int |
51 | _url_pop_init (mu_url_t url) | 50 | _url_pop_init (mu_url_t url) |
52 | { | 51 | { |
53 | int status = 0; | 52 | int status = mu_url_init (url, MU_POP_PORT, "pop"); |
53 | if (status) | ||
54 | return status; | ||
54 | 55 | ||
55 | url->_destroy = url_pop_destroy; | 56 | url->_destroy = url_pop_destroy; |
56 | 57 | ||
57 | status = mu_url_parse(url); | 58 | /* not valid in pop url */ |
59 | if (url->path || url->query || !url->host) | ||
60 | return EINVAL; | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | POPS URLs: | ||
67 | pops://[<user>[;AUTH=<auth>]@]<host>[:<port>] | ||
68 | pops://[<user>[:pass]@]<host>[:<port>] | ||
69 | */ | ||
58 | 70 | ||
59 | if(status) | 71 | int |
72 | _url_pops_init (mu_url_t url) | ||
73 | { | ||
74 | int status = mu_url_init (url, MU_POPS_PORT, "pops"); | ||
75 | if (status) | ||
60 | return status; | 76 | return status; |
61 | 77 | ||
62 | /* is it pop? */ | 78 | url->_destroy = url_pop_destroy; |
63 | if (strcmp ("pop", url->scheme) != 0) | ||
64 | return EINVAL; | ||
65 | 79 | ||
66 | /* not valid in a pop url */ | 80 | /* not valid in pops url */ |
67 | if (url->path || url->query || !url->host) | 81 | if (url->path || url->query || !url->host) |
68 | return EINVAL; | 82 | return EINVAL; |
69 | 83 | ||
70 | if (url->port == 0) | 84 | return 0; |
71 | url->port = MU_POP_PORT; | ||
72 | |||
73 | return status; | ||
74 | } | 85 | } |
75 | 86 | ||
76 | #endif | 87 | #endif /* ENABLE_POP */ | ... | ... |
-
Please register or sign in to post a comment