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

Diff of /imapfilter/response.c

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

revision 1.17 by lefcha, Sat Nov 10 15:31:59 2001 UTC revision 1.17.2.2 by lefcha, Mon Jan 21 15:43:42 2002 UTC
# Line 13  Line 13 
13    
14    
15  extern unsigned int options;  extern unsigned int options;
16    extern unsigned int capabilities;
17    
18    
19  /*  /*
# Line 77  int capability_response(unsigned int tag Line 78  int capability_response(unsigned int tag
78          error("imapfilter: server does not support IMAP4rev1 protocol\n");          error("imapfilter: server does not support IMAP4rev1 protocol\n");
79          return -2;          return -2;
80      }      }
81        if (strcasestr(buf, "NAMESPACE"))
82            capabilities |= CAPABILITY_NAMESPACE;
83    
84        return analyze_response(buf);
85    }
86    
87    
88    /*
89     * Process the data that server sent due to IMAP NAMESPACE client request.
90     */
91    int namespace_response(unsigned int tag, struct namespace_t * namesp)
92    {
93        char buf[RESPONSE_BUF];
94        char *c, *d;
95    
96        do
97            receive_response(buf);
98        while (!strcasestr(buf, ultostr(tag, 16)));
99    
100        if ((c = strcasestr(buf, "* NAMESPACE"))) {
101            c += 12;
102            if (strncasecmp(c, "NIL", 3)) {
103                c = strchr(c, '"') + 1;
104                d = strchr(c, '"') + 1;
105    
106                strncat(namesp->prefix, c, d - c - 1);
107                namesp->delim = *(strchr(d, '"') + 1);
108            }
109        }
110      return analyze_response(buf);      return analyze_response(buf);
111  }  }
112    
# Line 118  int status_response(unsigned int tag, ch Line 148  int status_response(unsigned int tag, ch
148          info("No messages in mailbox %s.\n", mbox);          info("No messages in mailbox %s.\n", mbox);
149          return -2;          return -2;
150      }      }
151      info("%d message%s, %d recent, %d unseen, in mailbox %s.\n", exist, plural(exist),      info("%d message%s, %d recent, %d unseen, in mailbox \"%s\".\n", exist,
152           recent, unseen, mbox);           plural(exist), recent, unseen, mbox);
153    
154      return r;      return r;
155  }  }
# Line 282  int fetch_response(unsigned int tag) Line 312  int fetch_response(unsigned int tag)
312   */   */
313  int copy_response(unsigned int tag)  int copy_response(unsigned int tag)
314  {  {
315        int r = RESPONSE_OK;
316      char buf[RESPONSE_BUF];      char buf[RESPONSE_BUF];
317    
318      do      do
319          receive_response(buf);          receive_response(buf);
320      while (!strcasestr(buf, ultostr(tag, 16)));      while (!strcasestr(buf, ultostr(tag, 16)));
321    
322      if (analyze_response(buf) == RESPONSE_NO && strcasestr(buf, "[TRYCREATE]"))      if ((r = analyze_response(buf)) == RESPONSE_NO
323            && strcasestr(buf, "[TRYCREATE]"))
324          return RESPONSE_TRYCREATE;          return RESPONSE_TRYCREATE;
325        
326      return RESPONSE_OK;      return r;
327  }  }
328    
329    

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.17.2.2

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26