~ubuntu-branches/ubuntu/precise/mutt/precise

« back to all changes in this revision

Viewing changes to imap/util.c

  • Committer: Package Import Robot
  • Author(s): أحمد المحمودي (Ahmed El-Mahmoudy)
  • Date: 2010-12-17 14:28:28 UTC
  • mfrom: (16.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20101217142828-ve8yy0xf1zomtnx9
Tags: 1.5.21-1ubuntu1
* Merge with Debian experimental (LP: #691512), remaining changes:
  + debian/control, debian/patches/debian-specific/build_doc_adjustments.diff:
    Use w3m (main) instead of elinks (universe) for generating documentation.
  + Drop libtokyocabinet-dev (universe) from Build-Depends, use always
    libgdbm-dev and also use gdbm for the header cache backend. (lp: #607448)

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
  {
130
130
    if (*uv == idata->uid_validity)
131
131
      h = mutt_hcache_restore ((unsigned char*)uv, NULL);
 
132
    else
 
133
      dprint (3, (debugfile, "hcache uidvalidity mismatch: %u", *uv));
132
134
    FREE (&uv);
133
135
  }
134
136
 
316
318
    {
317
319
      if (! hlen)
318
320
        home_match = 1;
319
 
      else
 
321
      else if (ImapDelimChars)
320
322
        for (delim = ImapDelimChars; *delim != '\0'; delim++)
321
323
          if (target.mbox[hlen] == *delim)
322
324
            home_match = 1;
421
423
  while (mailbox && *mailbox && i < plen - 1)
422
424
  {
423
425
    if ((ImapDelimChars && strchr(ImapDelimChars, *mailbox))
424
 
        || *mailbox == delim)
 
426
        || (delim && *mailbox == delim))
425
427
    {
426
428
      /* use connection delimiter if known. Otherwise use user delimiter */
427
429
      if (!idata)
428
430
        delim = *mailbox;
429
431
 
430
 
      while (*mailbox &&
431
 
             (strchr(ImapDelimChars, *mailbox) || *mailbox == delim))
 
432
      while (*mailbox
 
433
             && ((ImapDelimChars && strchr(ImapDelimChars, *mailbox))
 
434
                 || (delim && *mailbox == delim)))
432
435
        mailbox++;
433
436
      path[i] = delim;
434
437
    }
577
580
  return (mutt_mktime (&t, 0) + tz);
578
581
}
579
582
 
 
583
/* format date in IMAP style: DD-MMM-YYYY HH:MM:SS +ZZzz.
 
584
 * Caller should provide a buffer of IMAP_DATELEN bytes */
 
585
void imap_make_date (char *buf, time_t timestamp)
 
586
{
 
587
  struct tm* tm = localtime (&timestamp);
 
588
  time_t tz = mutt_local_tz (timestamp);
 
589
 
 
590
  tz /= 60;
 
591
 
 
592
  snprintf (buf, IMAP_DATELEN, "%02d-%s-%d %02d:%02d:%02d %+03d%02d",
 
593
      tm->tm_mday, Months[tm->tm_mon], tm->tm_year + 1900,
 
594
      tm->tm_hour, tm->tm_min, tm->tm_sec,
 
595
      (int) tz / 60, (int) abs (tz) % 60);
 
596
}
 
597
 
580
598
/* imap_qualify_path: make an absolute IMAP folder target, given IMAP_MBOX
581
599
 *   and relative path. */
582
600
void imap_qualify_path (char *dest, size_t len, IMAP_MBOX *mx, char* path)
731
749
  {
732
750
    if (conn->account.type == M_ACCT_TYPE_IMAP)
733
751
    {
 
752
      int need_free = 0;
 
753
 
734
754
      idata = (IMAP_DATA*) conn->data;
735
755
 
736
756
      if (idata->state >= IMAP_AUTHENTICATED
742
762
        {
743
763
          ctx = safe_calloc (1, sizeof (CONTEXT));
744
764
          ctx->data = idata;
 
765
          /* imap_close_mailbox will set ctx->iadata->ctx to NULL, so we can't
 
766
           * rely on the value of iadata->ctx to determine if this placeholder
 
767
           * context needs to be freed.
 
768
           */
 
769
          need_free = 1;
745
770
        }
 
771
        /* if the imap connection closes during this call, ctx may be invalid
 
772
         * after this point, and thus should not be read.
 
773
         */
746
774
        imap_check_mailbox (ctx, NULL, 1);
747
 
        if (!idata->ctx)
 
775
        if (need_free)
748
776
          FREE (&ctx);
749
777
      }
750
778
    }