131 |
return mu_normalize_path (p, delim); |
return mu_normalize_path (p, delim); |
132 |
} |
} |
133 |
|
|
134 |
|
static int |
135 |
|
comp_int (const void *a, const void *b) |
136 |
|
{ |
137 |
|
return *(int*)a - *(int*)b; |
138 |
|
} |
139 |
|
|
140 |
/* Return in set an allocated array contain (n) numbers, for imap messsage set |
/* Return in set an allocated array contain (n) numbers, for imap messsage set |
141 |
set ::= sequence_num / (sequence_num ":" sequence_num) / (set "," set) |
set ::= sequence_num / (sequence_num ":" sequence_num) / (set "," set) |
142 |
sequence_num ::= nz_number / "*" |
sequence_num ::= nz_number / "*" |
157 |
int done = 0; |
int done = 0; |
158 |
int status = 0; |
int status = 0; |
159 |
size_t max = 0; |
size_t max = 0; |
160 |
|
size_t *tmp; |
161 |
|
int i,j; |
162 |
|
|
163 |
status = mailbox_messages_count (mbox, &max); |
status = mailbox_messages_count (mbox, &max); |
164 |
if (status != 0) |
if (status != 0) |
291 |
return status; |
return status; |
292 |
} |
} |
293 |
} |
} |
294 |
|
|
295 |
|
qsort (*set, *n, sizeof (**set), comp_int); |
296 |
|
|
297 |
|
tmp = *set; |
298 |
|
for (i = 0, j = 1; i < *n; i++) |
299 |
|
if (tmp[j-1] != (*set)[i]) |
300 |
|
tmp[j++] = tmp[i]; |
301 |
|
*n = j; |
302 |
return 0; |
return 0; |
303 |
} |
} |
304 |
|
|
363 |
int status; |
int status; |
364 |
va_list ap; |
va_list ap; |
365 |
asprintf (&buf, "* %s%s\r\n", sc2string (rc), format); |
asprintf (&buf, "* %s%s\r\n", sc2string (rc), format); |
|
if (daemon_param.transcript) |
|
|
syslog (LOG_DEBUG, "sent: %s", buf); |
|
366 |
va_start (ap, format); |
va_start (ap, format); |
367 |
|
if (daemon_param.transcript) |
368 |
|
{ |
369 |
|
char *buf1 = NULL; |
370 |
|
vasprintf (&buf1, buf, ap); |
371 |
|
if (buf1) |
372 |
|
{ |
373 |
|
syslog (LOG_DEBUG, "sent: %s", buf1); |
374 |
|
free (buf1); |
375 |
|
} |
376 |
|
} |
377 |
status = vfprintf (ofile, buf, ap); |
status = vfprintf (ofile, buf, ap); |
378 |
va_end (ap); |
va_end (ap); |
379 |
free (buf); |
free (buf); |
392 |
asprintf (&buf, "%s %s%s %s\r\n", command->tag, sc2string (rc), |
asprintf (&buf, "%s %s%s %s\r\n", command->tag, sc2string (rc), |
393 |
command->name, format); |
command->name, format); |
394 |
|
|
395 |
|
va_start (ap, format); |
396 |
if (daemon_param.transcript) |
if (daemon_param.transcript) |
397 |
syslog (LOG_DEBUG, "send: %s", buf); |
{ |
398 |
|
char *buf1 = NULL; |
399 |
|
vasprintf (&buf1, buf, ap); |
400 |
|
if (buf1) |
401 |
|
{ |
402 |
|
syslog (LOG_DEBUG, "sent: %s", buf1); |
403 |
|
free (buf1); |
404 |
|
} |
405 |
|
} |
406 |
|
|
|
va_start (ap, format); |
|
407 |
status = vfprintf (ofile, buf, ap); |
status = vfprintf (ofile, buf, ap); |
408 |
va_end (ap); |
va_end (ap); |
409 |
free (buf); |
free (buf); |