/[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.18 by lefcha, Sat Dec 8 14:42:25 2001 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, char *prefix, char delim)
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(prefix, c, d - c - 1);
107                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 288  int copy_response(unsigned int tag) Line 318  int copy_response(unsigned int tag)
318          receive_response(buf);          receive_response(buf);
319      while (!strcasestr(buf, ultostr(tag, 16)));      while (!strcasestr(buf, ultostr(tag, 16)));
320    
321      if (analyze_response(buf) == RESPONSE_NO && strcasestr(buf, "[TRYCREATE]"))      if (analyze_response(buf) == RESPONSE_NO &&
322            strcasestr(buf, "[TRYCREATE]"))
323          return RESPONSE_TRYCREATE;          return RESPONSE_TRYCREATE;
324    
325      return RESPONSE_OK;      return RESPONSE_OK;

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26