]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_imap.c
* The size constant "256" which shows up everywhere as a buffer size has now
[citadel.git] / citadel / serv_imap.c
index 3b544fd29eb883b622132b6a0a48a24b28499513..53491a28495660bdbcaa19ed47f4d9d52ca02684 100644 (file)
@@ -41,6 +41,7 @@
 #include "serv_imap.h"
 #include "imap_tools.h"
 #include "imap_fetch.h"
+#include "imap_search.h"
 
 
 long SYM_IMAP;
@@ -161,7 +162,7 @@ void imap_login(int num_parms, char *parms[]) {
  * Implements the AYTHENTICATE command
  */
 void imap_authenticate(int num_parms, char *parms[]) {
-       char buf[256];
+       char buf[SIZ];
 
        if (num_parms != 3) {
                cprintf("%s BAD incorrect number of parameters\r\n", parms[0]);
@@ -183,7 +184,7 @@ void imap_authenticate(int num_parms, char *parms[]) {
 }
 
 void imap_auth_login_user(char *cmd) {
-       char buf[256];
+       char buf[SIZ];
 
        decode_base64(buf, cmd);
        CtdlLoginExistingUser(buf);
@@ -194,7 +195,7 @@ void imap_auth_login_user(char *cmd) {
 }
 
 void imap_auth_login_pass(char *cmd) {
-       char buf[256];
+       char buf[SIZ];
 
        decode_base64(buf, cmd);
        if (CtdlTryPassword(buf) == pass_ok) {
@@ -225,8 +226,8 @@ void imap_capability(int num_parms, char *parms[]) {
  * implements the SELECT command
  */
 void imap_select(int num_parms, char *parms[]) {
-       char towhere[256];
-       char augmented_roomname[256];
+       char towhere[SIZ];
+       char augmented_roomname[SIZ];
        int c = 0;
        int ok = 0;
        int ra = 0;
@@ -322,7 +323,7 @@ void imap_close(int num_parms, char *parms[]) {
  * may or may not be the desired behavior in the future.
  */
 void imap_lsub_listroom(struct quickroom *qrbuf, void *data) {
-       char buf[256];
+       char buf[SIZ];
        int ra;
 
        /* Only list rooms to which the user has access!! */
@@ -350,7 +351,7 @@ void imap_lsub(int num_parms, char *parms[]) {
  * Back end for imap_list()
  */
 void imap_list_listroom(struct quickroom *qrbuf, void *data) {
-       char buf[256];
+       char buf[SIZ];
        int ra;
 
        /* Only list rooms to which the user has access!! */
@@ -379,8 +380,8 @@ void imap_list(int num_parms, char *parms[]) {
  * Main command loop for IMAP sessions.
  */
 void imap_command_loop(void) {
-       char cmdbuf[256];
-       char *parms[256];
+       char cmdbuf[SIZ];
+       char *parms[SIZ];
        int num_parms;
 
        time(&CC->lastcmd);
@@ -480,6 +481,15 @@ void imap_command_loop(void) {
                imap_uidfetch(num_parms, parms);
        }
 
+       else if (!strcasecmp(parms[1], "SEARCH")) {
+               imap_search(num_parms, parms);
+       }
+
+       else if ( (!strcasecmp(parms[1], "UID"))
+               && (!strcasecmp(parms[2], "SEARCH")) ) {
+               imap_uidsearch(num_parms, parms);
+       }
+
        else if (!strcasecmp(parms[1], "CLOSE")) {
                imap_close(num_parms, parms);
        }