2394
2394
/* otherwise try to make into UID EXPUNGE */
2395
2395
else if (mail_sequence (stream,sequence)) {
2396
2396
unsigned long i,j;
2397
char *s = LOCAL->tmp;
2397
char *t = (char *) fs_get (IMAPTMPLEN);
2398
2399
/* search through mailbox */
2399
for (s = '\0',i = 1; i <= stream->nmsgs; ++i)
2400
for (*s = '\0', i = 1; i <= stream->nmsgs; ++i)
2400
2401
if (mail_elt (stream,i)->sequence) {
2401
/* prepend with comma if not first time */
2402
if (LOCAL->tmp[0]) *s++ = ',';
2403
sprintf (s,"%lu",mail_uid (stream,j = i));
2404
s += strlen (s); /* point at end of string */
2402
if (t[0]) *s++ = ','; /* prepend with comma if not first time */
2403
sprintf (s,"%lu",mail_uid (stream,j = i));
2404
s += strlen (s); /* point at end of string */
2405
2405
/* search for possible end of range */
2406
while ((i < stream->nmsgs) && mail_elt (stream,i+1)->sequence) i++;
2407
if (i != j) { /* output end of range */
2408
sprintf (s,":%lu",mail_uid (stream,i));
2409
s += strlen (s); /* point at end of string */
2411
if ((s - LOCAL->tmp) > (IMAPTMPLEN - 50)) {
2412
mm_log ("Excessively complex sequence",ERROR);
2406
while ((i < stream->nmsgs) && mail_elt (stream,i+1)->sequence) i++;
2407
if (i != j) { /* output end of range */
2408
sprintf (s,":%lu",mail_uid (stream,i));
2409
s += strlen (s); /* point at end of string */
2411
if ((s - t) > (IMAPTMPLEN - 50)) {
2412
mm_log ("Excessively complex sequence",ERROR);
2416
2416
/* now do as UID EXPUNGE */
2417
ret = imap_expunge (stream,s = cpystr (s),EX_UID);
2418
fs_give ((void **) &s);
2417
ret = imap_expunge (stream,t,EX_UID);
2418
fs_give ((void **) &t);
2421
2421
/* ordinary EXPUNGE */