/[mailutils]/mailutils/imap4d/status.c
ViewVC logotype

Diff of /mailutils/imap4d/status.c

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

revision 1.13 by gray, Fri Feb 22 13:17:59 2002 UTC revision 1.14 by gray, Wed Feb 27 11:54:01 2002 UTC
# Line 62  imap4d_status (struct imap4d_command *co Line 62  imap4d_status (struct imap4d_command *co
62    mailbox_t smbox = NULL;    mailbox_t smbox = NULL;
63    int status;    int status;
64    int count = 0;    int count = 0;
65      char *err_msg = NULL;
66      
67    if (! (command->states & state))    if (! (command->states & state))
68      return util_finish (command, RESP_BAD, "Wrong state");      return util_finish (command, RESP_BAD, "Wrong state");
69    
# Line 76  imap4d_status (struct imap4d_command *co Line 77  imap4d_status (struct imap4d_command *co
77        struct passwd *pw = mu_getpwuid (getuid());        struct passwd *pw = mu_getpwuid (getuid());
78        if (!pw)        if (!pw)
79          return util_finish (command, RESP_NO, "Cannot map UID to username");          return util_finish (command, RESP_NO, "Cannot map UID to username");
80        mailbox_name = malloc (strlen (maildir) + strlen (pw->pw_name) + 1);        mailbox_name = malloc (strlen (mu_path_maildir) +
81                                 strlen (pw->pw_name) + 1);
82        if (!mailbox_name)        if (!mailbox_name)
83          {          {
84            syslog (LOG_ERR, "Not enough memory");            syslog (LOG_ERR, "Not enough memory");
85            return util_finish (command, RESP_NO, "Not enough memory");            return util_finish (command, RESP_NO, "Not enough memory");
86          }          }
87        sprintf (mailbox_name, "%s%s", maildir, pw->pw_name);        sprintf (mailbox_name, "%s%s", mu_path_maildir, pw->pw_name);
88      }      }
89    else    else
90      mailbox_name = namespace_getfullpath (name, delim);      mailbox_name = namespace_getfullpath (name, delim);
# Line 113  imap4d_status (struct imap4d_command *co Line 115  imap4d_status (struct imap4d_command *co
115                fun = status_get_handler (item);                fun = status_get_handler (item);
116                if (!fun)                if (!fun)
117                  {                  {
118                    count = -1;                    err_msg = "Invalid flag in list";
119                    break;                    break;
120                  }                  }
121                                        
# Line 123  imap4d_status (struct imap4d_command *co Line 125  imap4d_status (struct imap4d_command *co
125                if (!fun (smbox))                if (!fun (smbox))
126                  util_send (" ");                  util_send (" ");
127              }              }
128            if (count)            if (count > 0)
129              util_send (")\r\n");              util_send (")\r\n");
130            mailbox_close (smbox);            mailbox_close (smbox);
131          }          }
# Line 131  imap4d_status (struct imap4d_command *co Line 133  imap4d_status (struct imap4d_command *co
133      }      }
134    free (mailbox_name);    free (mailbox_name);
135    
136    if (count == 0)    if (status == 0)
137      return util_finish (command, RESP_BAD, "Too few args (empty list)");      {
138    else if (count == -1)        if (count == 0)
139      return util_finish (command, RESP_BAD, "Invalid flag in list");          return util_finish (command, RESP_BAD, "Too few args (empty list)");
140    else if (status == 0)        else if (err_msg)
141      return util_finish (command, RESP_OK, "Completed");          return util_finish (command, RESP_BAD, err_msg);
142          return util_finish (command, RESP_OK, "Completed");
143        }
144      
145    return util_finish (command, RESP_NO, "Error opening mailbox");    return util_finish (command, RESP_NO, "Error opening mailbox");
146  }  }
147    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26