/[imapfilter]/imapfilter/response.c
ViewVC logotype

Diff of /imapfilter/response.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by lefcha, Thu Nov 8 17:52:06 2001 UTC revision 1.15 by lefcha, Fri Nov 9 15:52:20 2001 UTC
# Line 144  int search_response(unsigned int tag, ch Line 144  int search_response(unsigned int tag, ch
144  {  {
145      char buf[RESPONSE_BUF];      char buf[RESPONSE_BUF];
146      char *c, *m;      char *c, *m;
147      unsigned long f, blen, mlen;      short f;
148        unsigned int blen, mlen;
149    
150      f = blen = mlen = 0;      f = blen = mlen = 0;
151    
# Line 161  int search_response(unsigned int tag, ch Line 162  int search_response(unsigned int tag, ch
162              while (*c && (isdigit(*c) || *c == ' '))              while (*c && (isdigit(*c) || *c == ' '))
163                  *(m++) = *(c++);                  *(m++) = *(c++);
164              *m = 0;              *m = 0;
165          } else {          } else {                /* Search results are continued from
166                                       previous packet. */
167              c = buf;              c = buf;
168              blen = strlen(buf);              blen = strlen(buf);
169              mlen = strlen(*mesgs);              mlen = strlen(*mesgs);
# Line 184  int search_response(unsigned int tag, ch Line 186  int search_response(unsigned int tag, ch
186   */   */
187  int fetch_response(unsigned int tag)  int fetch_response(unsigned int tag)
188  {  {
     int sa, sb, n, i, f;  
     char s[6];  
     char *b;  
189      char buf[RESPONSE_BUF];      char buf[RESPONSE_BUF];
190      char hdrs[HEADERS_BUF];      char hdrs[HEADERS_BUF];
191        short f;
192        unsigned int sa, sb, i, n;
193        char s[8];
194        char *b;
195    
196      hdrs[0] = 0;      hdrs[0] = 0;
197      sa = sb = i = f = 0;      sa = sb = i = f = 0;
# Line 200  int fetch_response(unsigned int tag) Line 203  int fetch_response(unsigned int tag)
203          b = buf;          b = buf;
204    
205          while (f || (b = strchr(b, '{'))) {          while (f || (b = strchr(b, '{'))) {
206                /* Headers are continued from previous packet. */
207              if (f) {              if (f) {
208                  f = 0;                  f = 0;
209                  for (; i < HEADERS_BUF - 1 && i < sa - 2; i++) {                  for (; i < HEADERS_BUF - 1 && i < sa - 2; i++) {
210                        /* Continued in next packet. */
211                      if (!*b) {                      if (!*b) {
212                          f = 1;                          f = 1;
213                          break;                          break;
# Line 210  int fetch_response(unsigned int tag) Line 215  int fetch_response(unsigned int tag)
215                      hdrs[i] = *(b++);                      hdrs[i] = *(b++);
216                  }                  }
217              } else {              } else {
218                  if (b == buf + RESPONSE_BUF - 1) {                  /* Left bracket is last byte of buffer. */
219                    if (b == buf + RESPONSE_BUF - 2) {
220                      receive_response(buf);                      receive_response(buf);
221                      b = buf;                      b = buf;
222                  }                  } else
223                  sa = atoi(++b);                      b++;
224    
225                    sa = atoi(b);
226    
227                    /* Headers length may be continued in next packet. */
228                  if (!(b = strchr(b, '}'))) {                  if (!(b = strchr(b, '}'))) {
229                      receive_response(buf);                      receive_response(buf);
230                      if (buf != (b = strchr(buf, '}'))) {                      if (buf != (b = strchr(buf, '}'))) {
231                          sb = atoi(buf);                          sb = atoi(buf);
232                          snprintf(s, 6, "%d%d", sa, sb);                          strncat(s, ultostr(sa, 10), 7);
233                            strncat(s, ultostr(sb, 10), 7);
234                          sa = atoi(s);                          sa = atoi(s);
235                            s[0] = 0;
236                      }                      }
237                      b += 3;                      b += 3;
238                  } else if ((n = RESPONSE_BUF - 1 - (b - buf)) < 3) {                  } else if ((n = RESPONSE_BUF - 1 - (b - buf)) < 3) {

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26