Changeset 9c590d4


Ignore:
Timestamp:
Jun 6, 2007, 11:31:49 PM (13 years ago)
Author:
Alex Vandiver <alexmv@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
d0961fe
Parents:
48609ce
git-author:
Alex Vandiver <alexmv@mit.edu> (06/06/07 23:31:44)
git-committer:
Alex Vandiver <alexmv@mit.edu> (06/06/07 23:31:49)
Message:
Outgoing CC'd messages get logged to all recipients
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    r42947f1 r9c590d4  
    132132{
    133133  char filename[MAXPATHLEN], *logpath;
    134   char *to;
     134  char *to, *temp;
     135
     136  /* expand ~ in path names */
     137  logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
    135138
    136139  /* Figure out what path to log to */
    137140  if (owl_message_is_type_zephyr(m)) {
    138       to = short_zuser(owl_message_get_recipient(m));
     141    // If this has CC's, do all but the "recipient" which we'll do below
     142    to = owl_message_get_cc_without_recipient(m);
     143    if (to != NULL) {
     144      temp = strtok(to, " ");
     145      while (temp != NULL) {
     146          temp = short_zuser(temp);
     147          snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
     148          owl_log_append(m, filename);
     149          temp = strtok(NULL, " ");
     150      }
     151      owl_free(to);
     152    }
     153    to = short_zuser(owl_message_get_recipient(m));
    139154  } else if (owl_message_is_type_jabber(m)) {
    140       to = owl_sprintf("jabber:%s", owl_message_get_recipient(m));
     155    to = owl_sprintf("jabber:%s", owl_message_get_recipient(m));
    141156  } else if (owl_message_is_type_aim(m)) {
    142       char *temp;
    143       temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
    144       downstr(temp);
    145       to = owl_sprintf("aim:%s", temp);
    146       owl_free(temp);
    147   } else {
    148       to = owl_sprintf("loopback");
    149   }
    150 
    151   /* expand ~ in path names */
    152   logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
     157    temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
     158    downstr(temp);
     159    to = owl_sprintf("aim:%s", temp);
     160    owl_free(temp);
     161  } else {
     162    to = owl_sprintf("loopback");
     163  }
     164
    153165  snprintf(filename, MAXPATHLEN, "%s/%s", logpath, to);
     166  owl_log_append(m, filename);
    154167  owl_free(to);
    155168
     169  snprintf(filename, MAXPATHLEN, "%s/all", logpath);
    156170  owl_log_append(m, filename);
    157 
    158   snprintf(filename, MAXPATHLEN, "%s/all", logpath);
    159171  owl_free(logpath);
    160 
    161   owl_log_append(m, filename);
    162172}
    163173
  • message.c

    r48609ce r9c590d4  
    663663char *owl_message_get_cc_without_recipient(owl_message *m)
    664664{
    665   char *cc, *out, *end, *user;
     665  char *cc, *out, *end, *user, *recip;
    666666
    667667  cc = owl_message_get_cc(m);
     668  if (cc == NULL)
     669    return NULL;
     670
     671  recip = short_zuser(owl_message_get_recipient(m));
    668672  out = owl_malloc(strlen(cc));
    669673  end = out;
     
    671675  user = strtok(cc, " ");
    672676  while (user != NULL) {
    673     if (strcasecmp(user, short_zuser(owl_message_get_recipient(m))) != 0) {
     677    if (strcasecmp(user, recip) != 0) {
    674678      strcpy(end, user);
    675679      end[strlen(user)] = ' ';
     
    680684  end[0] = '\0';
    681685
     686  owl_free(recip);
    682687  owl_free(cc);
     688
     689  if (strlen(out) == 0) {
     690    owl_free(out);
     691    out = NULL;
     692  }
     693
    683694  return(out);
    684695}
Note: See TracChangeset for help on using the changeset viewer.