24 |
printf("debug: sending command: %s", cmd); |
printf("debug: sending command: %s", cmd); |
25 |
#endif |
#endif |
26 |
|
|
27 |
if (write(sock, cmd, strlen(cmd)) == -1) { |
if (write(sock, cmd, strlen(cmd)) == -1) |
28 |
error("imapfilter: error while sending command; %s", |
fatal(ERROR_NETWORK, "imapfilter: error while sending command; %s", |
29 |
strerror(errno)); |
strerror(errno)); |
|
return 1; |
|
|
} |
|
30 |
|
|
31 |
return 0; |
return 0; |
32 |
} |
} |
82 |
|
|
83 |
/* |
/* |
84 |
* IMAP EXAMINE: access a mailbox in READ-ONLY mode. |
* IMAP EXAMINE: access a mailbox in READ-ONLY mode. |
85 |
*/ |
* |
86 |
int imap_examine(char *mbox) |
int imap_examine(char *mbox) |
87 |
{ |
{ |
88 |
char cmd[MEDIUM_CMD]; |
char cmd[MEDIUM_CMD]; |
92 |
snprintf(cmd, MEDIUM_CMD, "%X EXAMINE \"%s\"\r\n", tag++, mbox); |
snprintf(cmd, MEDIUM_CMD, "%X EXAMINE \"%s\"\r\n", tag++, mbox); |
93 |
|
|
94 |
return send_command(cmd); |
return send_command(cmd); |
95 |
} |
}*/ |
|
|
|
96 |
|
|
97 |
|
|
98 |
/* |
/* |
159 |
/* |
/* |
160 |
* IMAP FETCH: retrieves data associated with a message. |
* IMAP FETCH: retrieves data associated with a message. |
161 |
*/ |
*/ |
162 |
int imap_fetch(char *mesg, char *headers) |
int imap_fetch(int peek, char *mesg, char *headers) |
163 |
{ |
{ |
164 |
char cmd[MEDIUM_CMD]; |
char cmd[MEDIUM_CMD]; |
165 |
|
|
166 |
verbose("Client request: FETCH\n"); |
verbose("Client request: FETCH\n"); |
167 |
|
|
168 |
snprintf(cmd, MEDIUM_CMD, |
snprintf(cmd, MEDIUM_CMD, |
169 |
"%X FETCH %s BODY[HEADER.FIELDS (%s)]\r\n", tag++, mesg, |
"%X FETCH %s BODY%s[HEADER.FIELDS (%s)]\r\n", tag++, mesg, |
170 |
headers); |
(peek ? ".PEEK" : ""), headers); |
171 |
|
|
172 |
return send_command(cmd); |
return send_command(cmd); |
173 |
} |
} |