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

Diff of /imapfilter/imap.c

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

revision 1.15 by lefcha, Thu Oct 4 15:47:49 2001 UTC revision 1.16 by lefcha, Mon Oct 8 08:52:49 2001 UTC
# Line 17  static unsigned int tag = 0xF00000;    /* E Line 17  static unsigned int tag = 0xF00000;    /* E
17  /*  /*
18   * Send to server data; a command.   * Send to server data; a command.
19   */   */
20  int send_command(char *cmd)  unsigned int send_command(char *cmd)
21  {  {
22    
23  #ifdef DEBUG  #ifdef DEBUG
# Line 28  int send_command(char *cmd) Line 28  int send_command(char *cmd)
28          fatal(ERROR_NETWORK, "imapfilter: error while sending command; %s",          fatal(ERROR_NETWORK, "imapfilter: error while sending command; %s",
29                strerror(errno));                strerror(errno));
30    
31      return 0;      return tag++;
32  }  }
33    
34    
# Line 40  int imap_noop(void) Line 40  int imap_noop(void)
40  {  {
41      char cmd[SMALL_CMD];      char cmd[SMALL_CMD];
42    
43      verbose("Client request:  NOOP\n");      verbose("Client request: NOOP\n");
44    
45      snprintf(cmd, SMALL_CMD, "%X NOOP\r\n", tag++);      snprintf(cmd, SMALL_CMD, "%X NOOP\r\n", tag);
46    
47      return send_command(cmd);      return send_command(cmd);
48  }  }
# Line 50  int imap_noop(void) Line 50  int imap_noop(void)
50    
51    
52  /*  /*
53     * IMAP CAPABILITY: requests listing of capabilities that the server supports
54     */
55    int imap_capability(void)
56    {
57        char cmd[SMALL_CMD];
58    
59        verbose("Client request: CAPABILITY\n");
60    
61        snprintf(cmd, SMALL_CMD, "%X CAPABILITY\r\n", tag);
62    
63        return send_command(cmd);
64    }
65    
66    
67    /*
68   * IMAP LOGOUT: informs server that client is done.   * IMAP LOGOUT: informs server that client is done.
69   */   */
70  int imap_logout(void)  int imap_logout(void)
71  {  {
72      char cmd[SMALL_CMD];      char cmd[SMALL_CMD];
73    
74      verbose("Client request:  LOGOUT\n");      verbose("Client request: LOGOUT\n");
75    
76      snprintf(cmd, SMALL_CMD, "%X LOGOUT\r\n", tag++);      snprintf(cmd, SMALL_CMD, "%X LOGOUT\r\n", tag);
77    
78      return send_command(cmd);      return send_command(cmd);
79  }  }
# Line 71  int imap_login(char *user, char *pass) Line 86  int imap_login(char *user, char *pass)
86  {  {
87      char cmd[MEDIUM_CMD];      char cmd[MEDIUM_CMD];
88    
89      verbose("Client request:  LOGIN\n");      verbose("Client request: LOGIN\n");
90    
91      snprintf(cmd, MEDIUM_CMD, "%X LOGIN \"%s\" \"%s\"\r\n", tag++, user,      snprintf(cmd, MEDIUM_CMD, "%X LOGIN \"%s\" \"%s\"\r\n", tag, user,
92               pass);               pass);
93    
94      return send_command(cmd);      return send_command(cmd);
# Line 82  int imap_login(char *user, char *pass) Line 97  int imap_login(char *user, char *pass)
97    
98  /*  /*
99   * IMAP EXAMINE: access a mailbox in READ-ONLY mode.   * IMAP EXAMINE: access a mailbox in READ-ONLY mode.
100   */   *
101  int imap_examine(char *mbox)  int imap_examine(char *mbox)
102  {  {
103      char cmd[MEDIUM_CMD];      char cmd[MEDIUM_CMD];
104    
105      verbose("Client request: EXAMINE %s\n", mbox);      verbose("Client request: EXAMINE %s\n", mbox);
106    
107      snprintf(cmd, MEDIUM_CMD, "%X EXAMINE \"%s\"\r\n", tag++, mbox);      snprintf(cmd, MEDIUM_CMD, "%X EXAMINE \"%s\"\r\n", tag, mbox);
108    
109      return send_command(cmd);      return send_command(cmd);
110  }  }*/
111    
112    
113  /*  /*
# Line 102  int imap_select(char *mbox) Line 117  int imap_select(char *mbox)
117  {  {
118      char cmd[SMALL_CMD];      char cmd[SMALL_CMD];
119    
120      verbose("Client request:  SELECT\n");      verbose("Client request: SELECT\n");
121    
122      snprintf(cmd, SMALL_CMD, "%X SELECT \"%s\"\r\n", tag++, mbox);      snprintf(cmd, SMALL_CMD, "%X SELECT \"%s\"\r\n", tag, mbox);
123    
124      return send_command(cmd);      return send_command(cmd);
125  }  }
# Line 119  int imap_status(char *mbox, char *items) Line 134  int imap_status(char *mbox, char *items)
134    
135      verbose("Client request: STATUS\n");      verbose("Client request: STATUS\n");
136    
137      snprintf(cmd, MEDIUM_CMD, "%X STATUS %s (%s)\r\n", tag++, mbox, items);      snprintf(cmd, MEDIUM_CMD, "%X STATUS %s (%s)\r\n", tag, mbox, items);
138    
139      return send_command(cmd);      return send_command(cmd);
140  }  }
# Line 134  int imap_create(char *mbox) Line 149  int imap_create(char *mbox)
149    
150      verbose("Client request: CREATE\n");      verbose("Client request: CREATE\n");
151    
152      snprintf(cmd, MEDIUM_CMD, "%X CREATE %s\r\n", tag++, mbox);      snprintf(cmd, MEDIUM_CMD, "%X CREATE %s\r\n", tag, mbox);
153    
154      return send_command(cmd);      return send_command(cmd);
155  }  }
# Line 150  int imap_search(char *search) Line 165  int imap_search(char *search)
165    
166      verbose("Client request: SEARCH\n");      verbose("Client request: SEARCH\n");
167    
168      snprintf(cmd, BIG_CMD, "%X SEARCH %s\r\n", tag++, search);      snprintf(cmd, BIG_CMD, "%X SEARCH %s\r\n", tag, search);
169    
170      return send_command(cmd);      return send_command(cmd);
171  }  }
# Line 159  int imap_search(char *search) Line 174  int imap_search(char *search)
174  /*  /*
175   * IMAP FETCH: retrieves data associated with a message.   * IMAP FETCH: retrieves data associated with a message.
176   */   */
177  int imap_fetch(int peek, char *mesg, char *headers)  int imap_fetch(char *mesg, char *headers, int peek)
178  {  {
179      char cmd[MEDIUM_CMD];      char cmd[MEDIUM_CMD];
180    
181      verbose("Client request:  FETCH\n");      verbose("Client request: FETCH\n");
182    
183      snprintf(cmd, MEDIUM_CMD,      snprintf(cmd, MEDIUM_CMD,
184               "%X FETCH %s BODY%s[HEADER.FIELDS (%s)]\r\n", tag++, mesg,               "%X FETCH %s BODY%s[HEADER.FIELDS (%s)]\r\n", tag, mesg,
185               (peek ? ".PEEK" : ""), headers);               (peek ? ".PEEK" : ""), headers);
186    
187      return send_command(cmd);      return send_command(cmd);
# Line 180  int imap_store(char *mesg, char *flags) Line 195  int imap_store(char *mesg, char *flags)
195  {  {
196      char cmd[MEDIUM_CMD];      char cmd[MEDIUM_CMD];
197    
198      verbose("Client request:  STORE\n");      verbose("Client request: STORE\n");
199    
200      snprintf(cmd, MEDIUM_CMD, "%X STORE %s +FLAGS (%s)\r\n", tag++, mesg,      snprintf(cmd, MEDIUM_CMD, "%X STORE %s +FLAGS.SILENT (%s)\r\n", tag, mesg,
201               flags);               flags);
202    
203      return send_command(cmd);      return send_command(cmd);
# Line 198  int imap_copy(char *mesg, char *mbox) Line 213  int imap_copy(char *mesg, char *mbox)
213    
214      verbose("Client request: COPY\n");      verbose("Client request: COPY\n");
215    
216      snprintf(cmd, SMALL_CMD, "%X COPY %s \"%s\"\r\n", tag++, mesg, mbox);      snprintf(cmd, SMALL_CMD, "%X COPY %s \"%s\"\r\n", tag, mesg, mbox);
217    
218      return send_command(cmd);      return send_command(cmd);
219  }  }
# Line 213  int imap_close(void) Line 228  int imap_close(void)
228    
229      verbose("Client request: CLOSE\n");      verbose("Client request: CLOSE\n");
230    
231      snprintf(cmd, SMALL_CMD, "%X CLOSE\r\n", tag++);      snprintf(cmd, SMALL_CMD, "%X CLOSE\r\n", tag);
232    
233      return send_command(cmd);      return send_command(cmd);
234  }  }
# Line 229  int imap_expunge(void) Line 244  int imap_expunge(void)
244    
245      verbose("Client request: EXPUNGE\n");      verbose("Client request: EXPUNGE\n");
246    
247      snprintf(cmd, SMALL_CMD, "%X EXPUNGE\r\n", tag++);      snprintf(cmd, SMALL_CMD, "%X EXPUNGE\r\n", tag);
248    
249      return send_command(cmd);      return send_command(cmd);
250  }  }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26