Changeset 4727d31


Ignore:
Timestamp:
May 7, 2010, 9:40:39 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
ecaec21
Parents:
839697d
git-author:
Nelson Elhage <nelhage@mit.edu> (05/07/10 20:44:07)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/07/10 21:40:39)
Message:
Cache Zephyr CCs into an attribute on the message object.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r839697d r4727d31  
    723723  owl_message_set_recipient(m, "looprecip");
    724724  owl_message_set_isprivate(m);
     725}
     726
     727void owl_message_save_ccs(owl_message *m) {
     728  GList *cc;
     729  char *tmp;
     730
     731  cc = owl_message_get_cc_without_recipient(m);
     732
     733  if (cc != NULL) {
     734    GString *recips = g_string_new("");
     735    cc = g_list_prepend(cc, short_zuser(owl_message_get_sender(m)));
     736    cc = g_list_prepend(cc, short_zuser(owl_message_get_recipient(m)));
     737    cc = g_list_sort(cc, (GCompareFunc)strcasecmp);
     738
     739    while(cc != NULL) {
     740      /* Collapse any identical entries */
     741      while (cc->next && strcasecmp(cc->data, cc->next->data) == 0) {
     742        owl_free(cc->data);
     743        cc = g_list_delete_link(cc, cc);
     744      }
     745
     746      tmp = short_zuser(cc->data);
     747      g_string_append(recips, tmp);
     748
     749      owl_free(tmp);
     750      owl_free(cc->data);
     751      cc = g_list_delete_link(cc, cc);
     752
     753      if (cc)
     754        g_string_append_c(recips, ' ');
     755    }
     756
     757    owl_message_set_attribute(m, "zephyr_ccs", recips->str);
     758    g_string_free(recips, true);
     759  }
    725760}
    726761
     
    860895    }
    861896  }
     897
     898  owl_message_save_ccs(m);
    862899}
    863900#else
     
    954991    owl_message_set_isprivate(m);
    955992  }
     993
     994  owl_message_save_ccs(m);
    956995}
    957996
Note: See TracChangeset for help on using the changeset viewer.