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

Diff of /imapfilter/response.c

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

revision 1.44 by lefcha, Thu Oct 2 11:03:43 2003 UTC revision 1.45 by lefcha, Tue Jan 20 01:51:46 2004 UTC
# Line 356  fetch_response(conn_t * conn, unsigned i Line 356  fetch_response(conn_t * conn, unsigned i
356    
357    
358  /*  /*
359   * Process the data that server sent due to IMAP FETCH RFC822.SIZE client   * Process the data that server sent due to IMAP FETCH FAST client request.
  * request.  
360   */   */
361  int  int
362  fetchsize_response(conn_t * conn, unsigned int *size, unsigned int tag)  fetchfast_response(conn_t * conn, char **flags, char **date,
363        unsigned int *size, unsigned int tag)
364  {  {
365          char *c;          char *c, *m;
366            unsigned int blen;
367    
368          *size = 0;          *size = 0;
369    
# Line 374  fetchsize_response(conn_t * conn, unsign Line 375  fetchsize_response(conn_t * conn, unsign
375                  bye_response(ibuf.data);                  bye_response(ibuf.data);
376          } while (!strcasestr(ibuf.data, ultostr(tag, 16)));          } while (!strcasestr(ibuf.data, ultostr(tag, 16)));
377    
378          if ((c = strcasestr(ibuf.data, "FETCH (RFC822.SIZE "))) {          if ((c = strcasestr(ibuf.data, "FETCH (FLAGS ("))) {
379                  c += 19;                  blen = strlen(ibuf.data);
380    
381                    m = *flags = (char *)xmalloc(blen + 1);
382    
383                    c += 14;
384                    
385                    while (*c != '\0' && *c != ')') {
386                            /* The \Recent flag can not be altered by the client. */
387                            if (*c == '\\') {
388                                    if (strcasestr(c - 1, "(\\Recent)") ||
389                                        strcasestr(c - 1, " \\Recent)"))
390                                            break;
391                                    else if (strcasestr(c, "\\Recent "))
392                                            c += 8;
393                            }
394    
395                            *(m++) = *(c++);
396                    }
397    
398                    *m = 0;
399            }
400    
401            if ((c = strcasestr(ibuf.data, " INTERNALDATE \""))) {
402                    blen = strlen(ibuf.data);
403    
404                    m = *date = (char *)xmalloc(blen + 1);
405    
406                    c += 15;
407                    
408                    while (*c != '\0' && *c != '"')
409                            *(m++) = *(c++);
410    
411                    *m = 0;
412            }
413    
414            if ((c = strcasestr(ibuf.data, " RFC822.SIZE "))) {
415                    c += 13;
416                  *size = strtoul(c, NULL, 10);                  *size = strtoul(c, NULL, 10);
417          }          }
418          return analyze_response(conn, ibuf.data);          return analyze_response(conn, ibuf.data);

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26