[2909] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: Fixes to punt and filters

daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Sat Feb 12 01:06:29 2011

Date: Sat, 12 Feb 2011 01:06:25 -0500 (EST)
From: Anders Kaseorg <andersk@MIT.EDU>
To: David A Benjamin <davidben@mit.edu>
cc: barnowl-dev@mit.edu
In-Reply-To: <alpine.DEB.2.02.1102110222500.22897@dr-wily.mit.edu>

The following changes since commit 3472845ecdabe9cd1549dd2b2355ca745059ea36:

  Replace owl_sprintf with g_strdup_printf. (2011-02-11 17:18:45 -0500)

are available in the git repository at:
  git://andersk.mit.edu/barnowl.git filter

Anders Kaseorg (3):
      owl_function_smartfilter_cc: Do not turn spaces into -
      Replace owl_text_tr with g_strdelimit
      Use owl_util_makepath instead of faking ~ expansion by owl_text_substitute

 functions.c |    1 -
 logging.c   |   10 +++++-----
 text.c      |   14 --------------
 3 files changed, 5 insertions(+), 20 deletions(-)

-- 8< --
From c3d30ab93b3453b771e9139a69f27830e8325f15 Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Fri, 11 Feb 2011 02:10:48 -0500
Subject: [PATCH 1/3] owl_function_smartfilter_cc: Do not turn spaces into -

Theoretically, this could have resulted in ambiguities with usernames
containing -.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 functions.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/functions.c b/functions.c
index ddb3eac..6dc483b 100644
--- a/functions.c
+++ b/functions.c
@@ -2521,7 +2521,6 @@ static char *owl_function_smartfilter_cc(const owl_message *m) {
   ccs = owl_message_get_attribute_value(m, "zephyr_ccs");
 
   filtname = g_strdup_printf("conversation-%s", ccs);
-  owl_text_tr(filtname, ' ', '-');
 
   if (owl_global_get_filter(&g, filtname)) {
     return filtname;
-- 
1.7.4


From 1945e40ea0ccc72626e6bfda896ee0b4b9fd0d5f Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Fri, 11 Feb 2011 02:22:14 -0500
Subject: [PATCH 2/3] Replace owl_text_tr with g_strdelimit

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 logging.c |    2 +-
 text.c    |   14 --------------
 2 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/logging.c b/logging.c
index faa45ea..cc2a0ba 100644
--- a/logging.c
+++ b/logging.c
@@ -149,7 +149,7 @@ void owl_log_outgoing(const owl_message *m)
     to = short_zuser(owl_message_get_recipient(m));
   } else if (owl_message_is_type_jabber(m)) {
     to = g_strdup_printf("jabber:%s", owl_message_get_recipient(m));
-    owl_text_tr(to, '/', '_');
+    g_strdelimit(to, "/", '_');
   } else if (owl_message_is_type_aim(m)) {
     char *temp2;
     temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
diff --git a/text.c b/text.c
index 30a03f0..49eff1a 100644
--- a/text.c
+++ b/text.c
@@ -298,20 +298,6 @@ char *owl_text_substitute(const char *in, const char *from, const char *to)
   return(out);
 }
 
-/* replace all instances of character a in buff with the character
- * b.  buff must be null terminated.
- */
-void owl_text_tr(char *buff, char a, char b)
-{
-  int i;
-
-  owl_function_debugmsg("In: %s", buff);
-  for (i=0; buff[i]!='\0'; i++) {
-    if (buff[i]==a) buff[i]=b;
-  }
-  owl_function_debugmsg("Out: %s", buff);
-}
-
 /* Return a string which is like 'in' except that every instance of
  * any character in 'toquote' found in 'in' is preceeded by the string
  * 'quotestr'.  For example, owl_text_quote(in, "+*.", "\") would
-- 
1.7.4


From a69d3c05192031760f54d1fc1620fe8fd0a47677 Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Sat, 12 Feb 2011 00:50:27 -0500
Subject: [PATCH 3/3] Use owl_util_makepath instead of faking ~ expansion by owl_text_substitute

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 logging.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/logging.c b/logging.c
index cc2a0ba..d47955a 100644
--- a/logging.c
+++ b/logging.c
@@ -130,7 +130,7 @@ void owl_log_outgoing(const owl_message *m)
   GList *cc;
 
   /* expand ~ in path names */
-  logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
+  logpath = owl_util_makepath(owl_global_get_logpath(&g));
 
   /* Figure out what path to log to */
   if (owl_message_is_type_zephyr(m)) {
@@ -193,7 +193,7 @@ void owl_log_outgoing_zephyr_error(const owl_zwrite *zw, const char *text)
   tobuff = short_zuser(owl_list_get_element(&(zw->recips), 0));
 
   /* expand ~ in path names */
-  logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
+  logpath = owl_util_makepath(owl_global_get_logpath(&g));
 
   snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff);
   file=fopen(filename, "a");
@@ -309,13 +309,13 @@ void owl_log_incoming(const owl_message *m)
 
   /* create the filename (expanding ~ in path names) */
   if (personal) {
-    logpath = owl_text_substitute(owl_global_get_logpath(&g), "~", owl_global_get_homedir(&g));
+    logpath = owl_util_makepath(owl_global_get_logpath(&g));
     snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from);
     snprintf(allfilename, MAXPATHLEN, "%s/all", logpath);
     owl_log_append(m, allfilename);
 
   } else {
-    logpath = owl_text_substitute(owl_global_get_classlogpath(&g), "~", owl_global_get_homedir(&g));
+    logpath = owl_util_makepath(owl_global_get_classlogpath(&g));
     snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from);
   }
 
-- 
1.7.4


home help back first fref pref prev next nref lref last post