Diffstat (limited to 'kmicromail/libetpan/imap/mailimap_keywords.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libetpan/imap/mailimap_keywords.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/libetpan/imap/mailimap_keywords.c b/kmicromail/libetpan/imap/mailimap_keywords.c index b277aed..4ec156e 100644 --- a/kmicromail/libetpan/imap/mailimap_keywords.c +++ b/kmicromail/libetpan/imap/mailimap_keywords.c | |||
@@ -8,97 +8,97 @@ | |||
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. Neither the name of the libEtPan! project nor the names of its | 15 | * 3. Neither the name of the libEtPan! project nor the names of its |
16 | * contributors may be used to endorse or promote products derived | 16 | * contributors may be used to endorse or promote products derived |
17 | * from this software without specific prior written permission. | 17 | * from this software without specific prior written permission. |
18 | * | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * $Id$ | 33 | * $Id$ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "mailimap_keywords.h" | 36 | #include "mailimap_keywords.h" |
37 | #include "mailimap_types.h" | 37 | #include "mailimap_types.h" |
38 | #include <string.h> | 38 | #include <string.h> |
39 | #include <stdio.h> | 39 | #include <stdio.h> |
40 | 40 | ||
41 | #ifndef UNSTRICT_SYNTAX | 41 | #ifndef UNSTRICT_SYNTAX |
42 | #define UNSTRICT_SYNTAX | 42 | #define UNSTRICT_SYNTAX |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | struct mailimap_token_value { | 45 | struct mailimap_token_value { |
46 | int value; | 46 | int value; |
47 | const char * str; | 47 | const char * str; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | int mailimap_token_case_insensitive_parse(mailstream * fd, | 50 | int mailimap_token_case_insensitive_parse(mailstream * fd, |
51 | MMAPString * buffer, | 51 | MMAPString * buffer, |
52 | size_t * index, | 52 | size_t * index, |
53 | const char * token) | 53 | const char * token) |
54 | { | 54 | { |
55 | int len; | 55 | int len; |
56 | int cur_token; | 56 | size_t cur_token; |
57 | int r; | 57 | int r; |
58 | 58 | ||
59 | cur_token = * index; | 59 | cur_token = * index; |
60 | len = strlen(token); | 60 | len = strlen(token); |
61 | 61 | ||
62 | #ifdef UNSTRICT_SYNTAX | 62 | #ifdef UNSTRICT_SYNTAX |
63 | r = mailimap_space_parse(fd, buffer, &cur_token); | 63 | r = mailimap_space_parse(fd, buffer, &cur_token); |
64 | if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE)) | 64 | if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE)) |
65 | return r; | 65 | return r; |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | if (strncasecmp(buffer->str + cur_token, token, len) == 0) { | 68 | if (strncasecmp(buffer->str + cur_token, token, len) == 0) { |
69 | cur_token += len; | 69 | cur_token += len; |
70 | * index = cur_token; | 70 | * index = cur_token; |
71 | return MAILIMAP_NO_ERROR; | 71 | return MAILIMAP_NO_ERROR; |
72 | } | 72 | } |
73 | else | 73 | else |
74 | return MAILIMAP_ERROR_PARSE; | 74 | return MAILIMAP_ERROR_PARSE; |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
78 | static int is_space_or_tab(char ch) | 78 | static int is_space_or_tab(char ch) |
79 | { | 79 | { |
80 | return (ch == ' ') || (ch == '\t'); | 80 | return (ch == ' ') || (ch == '\t'); |
81 | } | 81 | } |
82 | 82 | ||
83 | int mailimap_char_parse(mailstream * fd, MMAPString * buffer, | 83 | int mailimap_char_parse(mailstream * fd, MMAPString * buffer, |
84 | size_t * index, char token) | 84 | size_t * index, char token) |
85 | { | 85 | { |
86 | int cur_token; | 86 | int cur_token; |
87 | 87 | ||
88 | cur_token = * index; | 88 | cur_token = * index; |
89 | 89 | ||
90 | if (buffer->str[cur_token] == token) { | 90 | if (buffer->str[cur_token] == token) { |
91 | cur_token ++; | 91 | cur_token ++; |
92 | * index = cur_token; | 92 | * index = cur_token; |
93 | return MAILIMAP_NO_ERROR; | 93 | return MAILIMAP_NO_ERROR; |
94 | } | 94 | } |
95 | else | 95 | else |
96 | return MAILIMAP_ERROR_PARSE; | 96 | return MAILIMAP_ERROR_PARSE; |
97 | } | 97 | } |
98 | 98 | ||
99 | int mailimap_space_parse(mailstream * fd, MMAPString * buffer, | 99 | int mailimap_space_parse(mailstream * fd, MMAPString * buffer, |
100 | size_t * index) | 100 | size_t * index) |
101 | { | 101 | { |
102 | #ifdef UNSTRICT_SYNTAX | 102 | #ifdef UNSTRICT_SYNTAX |
103 | 103 | ||
104 | /* can accept unstrict syntax */ | 104 | /* can accept unstrict syntax */ |