[628] in BarnOwl Developers
[D-O-H] r729 - trunk/owl
daemon@ATHENA.MIT.EDU (chmrr@MIT.EDU)
Thu Oct 29 18:08:06 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: chmrr@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Date: Wed, 06 Jun 2007 23:31:49 -0400
Author: chmrr
Date: 2007-06-06 23:31:49 -0400 (Wed, 06 Jun 2007)
New Revision: 729
Modified:
trunk/owl/
trunk/owl/logging.c
trunk/owl/message.c
Log:
r1612@utwig: chmrr | 2007-06-06 23:31:44 -0400
* Outgoing CC'd messages get logged to all recipients
Property changes on: trunk/owl
___________________________________________________________________
Name: svk:merge
- 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1610
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:17717
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
+ 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1612
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:17717
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
Modified: trunk/owl/logging.c
===================================================================
--- trunk/owl/logging.c 2007-06-07 01:06:17 UTC (rev 728)
+++ trunk/owl/logging.c 2007-06-07 03:31:49 UTC (rev 729)
@@ -131,34 +131,44 @@
void owl_log_outgoing(owl_message *m)
{
char filename[MAXPATHLEN], *logpath;
- char *to;
+ char *to, *temp;
+ /* expand ~ in path names */
+ logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
+
/* Figure out what path to log to */
if (owl_message_is_type_zephyr(m)) {
- to = short_zuser(owl_message_get_recipient(m));
+ // If this has CC's, do all but the "recipient" which we'll do below
+ to = owl_message_get_cc_without_recipient(m);
+ if (to != NULL) {
+ temp = strtok(to, " ");
+ while (temp != NULL) {
+ temp = short_zuser(temp);
+ snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp);
+ owl_log_append(m, filename);
+ temp = strtok(NULL, " ");
+ }
+ owl_free(to);
+ }
+ to = short_zuser(owl_message_get_recipient(m));
} else if (owl_message_is_type_jabber(m)) {
- to = owl_sprintf("jabber:%s", owl_message_get_recipient(m));
+ to = owl_sprintf("jabber:%s", owl_message_get_recipient(m));
} else if (owl_message_is_type_aim(m)) {
- char *temp;
- temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
- downstr(temp);
- to = owl_sprintf("aim:%s", temp);
- owl_free(temp);
+ temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
+ downstr(temp);
+ to = owl_sprintf("aim:%s", temp);
+ owl_free(temp);
} else {
- to = owl_sprintf("loopback");
+ to = owl_sprintf("loopback");
}
- /* expand ~ in path names */
- logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
snprintf(filename, MAXPATHLEN, "%s/%s", logpath, to);
+ owl_log_append(m, filename);
owl_free(to);
+ snprintf(filename, MAXPATHLEN, "%s/all", logpath);
owl_log_append(m, filename);
-
- snprintf(filename, MAXPATHLEN, "%s/all", logpath);
owl_free(logpath);
-
- owl_log_append(m, filename);
}
Modified: trunk/owl/message.c
===================================================================
--- trunk/owl/message.c 2007-06-07 01:06:17 UTC (rev 728)
+++ trunk/owl/message.c 2007-06-07 03:31:49 UTC (rev 729)
@@ -662,15 +662,19 @@
/* caller must free return value */
char *owl_message_get_cc_without_recipient(owl_message *m)
{
- char *cc, *out, *end, *user;
+ char *cc, *out, *end, *user, *recip;
cc = owl_message_get_cc(m);
+ if (cc == NULL)
+ return NULL;
+
+ recip = short_zuser(owl_message_get_recipient(m));
out = owl_malloc(strlen(cc));
end = out;
user = strtok(cc, " ");
while (user != NULL) {
- if (strcasecmp(user, short_zuser(owl_message_get_recipient(m))) != 0) {
+ if (strcasecmp(user, recip) != 0) {
strcpy(end, user);
end[strlen(user)] = ' ';
end += strlen(user) + 1;
@@ -679,7 +683,14 @@
}
end[0] = '\0';
+ owl_free(recip);
owl_free(cc);
+
+ if (strlen(out) == 0) {
+ owl_free(out);
+ out = NULL;
+ }
+
return(out);
}