92 |
|
|
93 |
|
|
94 |
/* |
/* |
95 |
* IMAP NAMESPACE: discovers the prefix and delimeter of namespaces used by |
* IMAP NAMESPACE: discovers the prefix and delimeter of namespaces used by the |
96 |
* the server for mailboxes (RFC 2342). |
* server for mailboxes (RFC 2342). |
97 |
*/ |
*/ |
98 |
int |
int |
99 |
imap_namespace(connection_t * conn) |
imap_namespace(connection_t * conn) |
209 |
|
|
210 |
|
|
211 |
/* |
/* |
212 |
* IMAP SUBSCRIBE: adds the specified mailbox name to the server's |
* IMAP SUBSCRIBE: adds the specified mailbox name to the server's set of |
213 |
* set of "active" or "subscribed" mailboxes. |
* "active" or "subscribed" mailboxes. |
214 |
*/ |
*/ |
215 |
int |
int |
216 |
imap_subscribe(connection_t * conn, char *mbox) |
imap_subscribe(connection_t * conn, char *mbox) |
268 |
buffer_check(&obuf, strlen("STATUS") + strlen(mbox) + |
buffer_check(&obuf, strlen("STATUS") + strlen(mbox) + |
269 |
strlen(items) + 18); |
strlen(items) + 18); |
270 |
|
|
271 |
snprintf(obuf.data, obuf.size, "%04X STATUS \"%s\" (%s)\r\n", tag, mbox, items); |
snprintf(obuf.data, obuf.size, "%04X STATUS \"%s\" (%s)\r\n", tag, |
272 |
|
mbox, items); |
273 |
|
|
274 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
275 |
} |
} |
303 |
strlen(search) + 15); |
strlen(search) + 15); |
304 |
|
|
305 |
if (*charset) |
if (*charset) |
306 |
snprintf(obuf.data, obuf.size, "%04X SEARCH CHARSET \"%s\" %s\r\n", |
snprintf(obuf.data, obuf.size, |
307 |
tag, charset, search); |
"%04X SEARCH CHARSET \"%s\" %s\r\n", tag, charset, search); |
308 |
else |
else |
309 |
snprintf(obuf.data, obuf.size, "%04X SEARCH %s\r\n", tag, search); |
snprintf(obuf.data, obuf.size, "%04X SEARCH %s\r\n", tag, |
310 |
|
search); |
311 |
|
|
312 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
313 |
} |
} |
321 |
{ |
{ |
322 |
|
|
323 |
buffer_reset(&obuf); |
buffer_reset(&obuf); |
324 |
buffer_check(&obuf, strlen("FETCH") + strlen(mesg) + strlen(items) + 14); |
buffer_check(&obuf, |
325 |
|
strlen("FETCH") + strlen(mesg) + strlen(items) + 14); |
326 |
|
|
327 |
snprintf(obuf.data, obuf.size, "%04X FETCH %s %s\r\n", tag, mesg, items); |
snprintf(obuf.data, obuf.size, "%04X FETCH %s %s\r\n", tag, mesg, |
328 |
|
items); |
329 |
|
|
330 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
331 |
} |
} |
344 |
|
|
345 |
snprintf(obuf.data, obuf.size, "%04X STORE %s %sFLAGS.SILENT (%s)\r\n", |
snprintf(obuf.data, obuf.size, "%04X STORE %s %sFLAGS.SILENT (%s)\r\n", |
346 |
tag, mesg, (mode == ACTION_FLAG_REPLACE ? "" : |
tag, mesg, (mode == ACTION_FLAG_REPLACE ? "" : |
347 |
mode == ACTION_FLAG_ADD ? "+" : "-"), flags); |
mode == ACTION_FLAG_ADD ? "+" : "-"), flags); |
348 |
|
|
349 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
350 |
} |
} |
360 |
buffer_reset(&obuf); |
buffer_reset(&obuf); |
361 |
buffer_check(&obuf, strlen("COPY") + strlen(mesg) + strlen(mbox) + 16); |
buffer_check(&obuf, strlen("COPY") + strlen(mesg) + strlen(mbox) + 16); |
362 |
|
|
363 |
snprintf(obuf.data, obuf.size, "%04X COPY %s \"%s\"\r\n", tag, mesg, mbox); |
snprintf(obuf.data, obuf.size, "%04X COPY %s \"%s\"\r\n", tag, mesg, |
364 |
|
mbox); |
365 |
|
|
366 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
367 |
} |
} |
378 |
buffer_check(&obuf, strlen("APPEND") + strlen(mbox) + strlen(flags) + |
buffer_check(&obuf, strlen("APPEND") + strlen(mbox) + strlen(flags) + |
379 |
strlen(date) + strlen(ultostr(size, 10)) + 24); |
strlen(date) + strlen(ultostr(size, 10)) + 24); |
380 |
|
|
381 |
snprintf(obuf.data, obuf.size, "%04X APPEND \"%s\" (%s) \"%s\" {%d}\r\n", |
snprintf(obuf.data, obuf.size, |
382 |
tag, mbox, flags, date, size); |
"%04X APPEND \"%s\" (%s) \"%s\" {%d}\r\n", tag, mbox, flags, date, |
383 |
|
size); |
384 |
|
|
385 |
return send_command(conn, obuf.data, NULL); |
return send_command(conn, obuf.data, NULL); |
386 |
} |
} |