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

Diff of /imapfilter/response.c

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

revision 1.23 by lefcha, Fri Jul 26 18:21:11 2002 UTC revision 1.23.2.2 by lefcha, Mon Aug 26 20:20:23 2002 UTC
# Line 61  int greeting_response(int *sock) Line 61  int greeting_response(int *sock)
61    
62      receive_response(sock, buf);      receive_response(sock, buf);
63    
64      if (strcasestr(buf, "BYE"))      if (strcasestr(buf, "* BYE"))
65          return RESPONSE_BYE;          return RESPONSE_BYE;
66      else if (strcasestr(buf, "PREAUTH"))      else if (strcasestr(buf, "* PREAUTH"))
67          return RESPONSE_PREAUTH;          return RESPONSE_PREAUTH;
68    
69      return RESPONSE_OK;      return RESPONSE_OK;
# Line 71  int greeting_response(int *sock) Line 71  int greeting_response(int *sock)
71    
72    
73  /*  /*
74     * Process the data that server sent due to IMAP LOGOUT client request.
75     */
76    int logout_response(int *sock, unsigned int tag)
77    {
78        char buf[RESPONSE_BUF];
79    
80        reset_vbuf();
81    
82        do {
83            receive_response(sock, buf);
84            check_vbuf(strlen(buf));
85            strncat(vbuf, buf, vbufs - strlen(vbuf));
86        } while (!strcasestr(buf, ultostr(tag, 16)));
87    
88        return analyze_response(buf);
89    }
90    
91    
92    /*
93   * Process the data that server sent due to IMAP CAPABILITY client request.   * Process the data that server sent due to IMAP CAPABILITY client request.
94   */   */
95  int capability_response(int *sock, unsigned int tag)  int capability_response(int *sock, unsigned int tag)
# Line 107  int namespace_response(int *sock, unsign Line 126  int namespace_response(int *sock, unsign
126      reset_vbuf();      reset_vbuf();
127    
128      do {      do {
129            receive_response(sock, buf);
130          check_vbuf(strlen(buf));          check_vbuf(strlen(buf));
131          strncat(vbuf, buf, vbufs - strlen(vbuf));          strncat(vbuf, buf, vbufs - strlen(vbuf));
         receive_response(sock, buf);  
132      } while (!strcasestr(buf, ultostr(tag, 16)));      } while (!strcasestr(buf, ultostr(tag, 16)));
133    
134      if ((c = strcasestr(vbuf, "* NAMESPACE"))) {      if ((c = strcasestr(vbuf, "* NAMESPACE"))) {
# Line 223  int search_response(int *sock, unsigned Line 242  int search_response(int *sock, unsigned
242    
243          c += 9;          c += 9;
244    
245          while (*c && (isdigit(*c) || *c == ' '))          while (*c && (isdigit((unsigned char)(*c)) || *c == ' '))
246              *(m++) = *(c++);              *(m++) = *(c++);
247    
248          *m = 0;          *m = 0;
# Line 383  int analyze_response(char *buf) Line 402  int analyze_response(char *buf)
402   */   */
403  void init_vbuf(void)  void init_vbuf(void)
404  {  {
405      vbuf = xmalloc(4096);      vbuf = xmalloc(VIRTUAL_BUF);
406      *vbuf = 0;      *vbuf = 0;
407      vbufs = 4096;      vbufs = VIRTUAL_BUF;
408  }  }
409    
410    
# Line 404  void reset_vbuf(void) Line 423  void reset_vbuf(void)
423  void check_vbuf(size_t n)  void check_vbuf(size_t n)
424  {  {
425      if (n + strlen(vbuf) >= vbufs) {      if (n + strlen(vbuf) >= vbufs) {
426          vbufs += 4096;          vbufs += VIRTUAL_BUF;
427          vbuf = xrealloc(vbuf, vbufs);          vbuf = xrealloc(vbuf, vbufs);
428      }      }
429  }  }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.23.2.2

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26