Changes in / [89ab5c8:aa0a0b5]
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r2cfc6d7 r2cfc6d7 2501 2501 } 2502 2502 2503 static char *owl_function_smartfilter_cc(const owl_message *m) {2504 const char *ccs;2505 char *filtname;2506 char *text;2507 owl_filter *f;2508 2509 ccs = owl_message_get_attribute_value(m, "zephyr_ccs");2510 2511 filtname = owl_sprintf("conversation-%s", ccs);2512 owl_text_tr(filtname, ' ', '-');2513 2514 if (owl_global_get_filter(&g, filtname)) {2515 return filtname;2516 }2517 2518 text = owl_sprintf("type ^zephyr$ and filter personal and "2519 "zephyr_ccs ^%s%s%s$",2520 owl_getquoting(ccs), ccs, owl_getquoting(ccs));2521 2522 f = owl_filter_new_fromstring(filtname, text);2523 2524 owl_global_add_filter(&g, f);2525 2526 owl_free(text);2527 2528 return filtname;2529 }2530 2531 2503 /* Create a filter based on the current message. Returns the name of 2532 2504 * a filter or null. The caller must free this name. … … 2582 2554 if (owl_message_is_type_zephyr(m)) { 2583 2555 if (owl_message_is_personal(m) || owl_message_is_loginout(m)) { 2584 if (owl_message_get_attribute_value(m, "zephyr_ccs") != NULL) {2585 return owl_function_smartfilter_cc(m);2586 }2587 2588 2556 if (owl_message_is_direction_in(m)) { 2589 2557 zperson=short_zuser(owl_message_get_sender(m)); -
logging.c
r839697d r91634ec 128 128 char filename[MAXPATHLEN], *logpath; 129 129 char *to, *temp; 130 GList *cc;131 130 132 131 /* expand ~ in path names */ … … 136 135 if (owl_message_is_type_zephyr(m)) { 137 136 /* If this has CC's, do all but the "recipient" which we'll do below */ 138 cc = owl_message_get_cc_without_recipient(m); 139 while (cc != NULL) { 140 temp = short_zuser(cc->data); 141 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp); 142 owl_log_append(m, filename); 143 144 owl_free(cc->data); 145 cc = g_list_delete_link(cc, cc); 146 } 147 137 to = owl_message_get_cc_without_recipient(m); 138 if (to != NULL) { 139 temp = strtok(to, " "); 140 while (temp != NULL) { 141 temp = short_zuser(temp); 142 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp); 143 owl_log_append(m, filename); 144 temp = strtok(NULL, " "); 145 } 146 owl_free(to); 147 } 148 148 to = short_zuser(owl_message_get_recipient(m)); 149 149 } else if (owl_message_is_type_jabber(m)) { … … 325 325 * the sender, as well. 326 326 */ 327 char *temp; 328 GList *cc; 327 char *cc, *temp; 329 328 cc = owl_message_get_cc_without_recipient(m); 330 while (cc != NULL) { 331 temp = short_zuser(cc->data); 332 if (strcasecmp(temp, frombuff) != 0) { 333 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp); 334 owl_log_append(m, filename); 329 if (cc != NULL) { 330 temp = strtok(cc, " "); 331 while (temp != NULL) { 332 temp = short_zuser(temp); 333 if (strcasecmp(temp, frombuff) != 0) { 334 snprintf(filename, MAXPATHLEN, "%s/%s", logpath, temp); 335 owl_log_append(m, filename); 336 } 337 temp = strtok(NULL, " "); 335 338 } 336 337 owl_free(cc->data); 338 cc = g_list_delete_link(cc, cc); 339 owl_free(cc); 339 340 } 340 341 } -
message.c
rc314f39 rc314f39 593 593 594 594 /* caller must free return value */ 595 GList*owl_message_get_cc_without_recipient(const owl_message *m)596 { 597 char *cc, * shortuser, *recip;595 char *owl_message_get_cc_without_recipient(const owl_message *m) 596 { 597 char *cc, *out, *end, *shortuser, *recip; 598 598 const char *user; 599 GList *out = NULL;600 599 601 600 cc = owl_message_get_cc(m); … … 604 603 605 604 recip = short_zuser(owl_message_get_recipient(m)); 605 out = owl_malloc(strlen(cc) + 2); 606 end = out; 606 607 607 608 user = strtok(cc, " "); … … 609 610 shortuser = short_zuser(user); 610 611 if (strcasecmp(shortuser, recip) != 0) { 611 out = g_list_prepend(out, owl_strdup(user)); 612 strcpy(end, user); 613 end[strlen(user)] = ' '; 614 end += strlen(user) + 1; 612 615 } 613 616 owl_free(shortuser); 614 617 user = strtok(NULL, " "); 615 618 } 619 end[0] = '\0'; 616 620 617 621 owl_free(recip); 618 622 owl_free(cc); 623 624 if (strlen(out) == 0) { 625 owl_free(out); 626 out = NULL; 627 } 619 628 620 629 return(out); … … 732 741 owl_message_set_recipient(m, "looprecip"); 733 742 owl_message_set_isprivate(m); 734 }735 736 void owl_message_save_ccs(owl_message *m) {737 GList *cc;738 char *tmp;739 740 cc = owl_message_get_cc_without_recipient(m);741 742 if (cc != NULL) {743 GString *recips = g_string_new("");744 cc = g_list_prepend(cc, short_zuser(owl_message_get_sender(m)));745 cc = g_list_prepend(cc, short_zuser(owl_message_get_recipient(m)));746 cc = g_list_sort(cc, (GCompareFunc)strcasecmp);747 748 while(cc != NULL) {749 /* Collapse any identical entries */750 while (cc->next && strcasecmp(cc->data, cc->next->data) == 0) {751 owl_free(cc->data);752 cc = g_list_delete_link(cc, cc);753 }754 755 tmp = short_zuser(cc->data);756 g_string_append(recips, tmp);757 758 owl_free(tmp);759 owl_free(cc->data);760 cc = g_list_delete_link(cc, cc);761 762 if (cc)763 g_string_append_c(recips, ' ');764 }765 766 owl_message_set_attribute(m, "zephyr_ccs", recips->str);767 g_string_free(recips, true);768 }769 743 } 770 744 … … 904 878 } 905 879 } 906 907 owl_message_save_ccs(m);908 880 } 909 881 #else … … 1000 972 owl_message_set_isprivate(m); 1001 973 } 1002 1003 owl_message_save_ccs(m);1004 974 } 1005 975
Note: See TracChangeset
for help on using the changeset viewer.