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

Diff of /imapfilter/response.c

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

revision 1.9 by lefcha, Mon Oct 8 08:52:49 2001 UTC revision 1.10 by lefcha, Wed Oct 17 14:06:20 2001 UTC
# Line 4  Line 4 
4  #include <ctype.h>  #include <ctype.h>
5  #include <errno.h>  #include <errno.h>
6  #include <string.h>  #include <string.h>
 #include <fcntl.h>  
7  #include <sys/time.h>  #include <sys/time.h>
8  #include <sys/types.h>  #include <sys/types.h>
9  #include <regex.h>  #include <regex.h>
10    
   
11  #include "config.h"  #include "config.h"
12  #include "imapfilter.h"  #include "imapfilter.h"
13    
14    
 extern int sock;  
15  extern unsigned int options;  extern unsigned int options;
16    
17    
# Line 23  extern unsigned int options; Line 20  extern unsigned int options;
20   */   */
21  int receive_response(char *buf)  int receive_response(char *buf)
22  {  {
23      int flags;      socket_read(buf);
     fd_set fds;  
     struct timeval tv;  
   
     memset(buf, 0, RESPONSE_BUF);  
   
     tv.tv_sec = 20;  
     tv.tv_usec = 0;  
   
     flags = fcntl(sock, F_GETFL, 0);  
     fcntl(sock, F_SETFL, flags | O_NONBLOCK);  
   
     FD_ZERO(&fds);  
     FD_SET(sock, &fds);  
24    
     if ((select(sock + 1, &fds, NULL, NULL, &tv) > 0)  
         && FD_ISSET(sock, &fds)) {  
         if (read(sock, buf, RESPONSE_BUF - 1) != -1) {  
25  #ifdef DEBUG  #ifdef DEBUG
26              printf("\n%s\n", buf);              printf("\n%s\n", buf);
27  #endif  #endif
28              fcntl(sock, F_SETFL, flags);      
29        return analyze_response(buf);
             return analyze_response(buf);  
         }  
     }  
     fcntl(sock, F_SETFL, flags);  
   
     fatal(ERROR_NETWORK, "imapfilter: waiting input from socket; %s\n",  
           strerror(errno));  
   
     return ERROR_NETWORK;  
30  }  }
31    
32    
# Line 217  int fetch_response(unsigned int tag) Line 189  int fetch_response(unsigned int tag)
189              headers[i] = *(pos + 3 + i);              headers[i] = *(pos + 3 + i);
190    
191          headers[i] = 0;          headers[i] = 0;
192            pos += i;
193    
194          if (*headers) {          if (*headers) {
195              if (options & OPTION_HEADERS)              if (options & OPTION_HEADERS)

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26