Changeset d222c44 for functions.c


Ignore:
Timestamp:
Jan 2, 2011, 3:35:15 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
719119de
Parents:
2bc6ad35
git-author:
David Benjamin <davidben@mit.edu> (12/14/10 23:53:38)
git-committer:
David Benjamin <davidben@mit.edu> (01/02/11 15:35:15)
Message:
Kill owl_getquoting and fix quoting bugs

That function is nonsense. Fix a number of quoting bugs relating to its
use (and lack thereof).

Also quote regex characters in CC narrows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r1279f21 rd222c44  
    16321632
    16331633  owl_function_popless_text(str->str);
    1634   g_string_free(str, TRUE);
     1634  g_string_free(str, true);
    16351635}
    16361636
     
    24922492static char *owl_function_smartfilter_cc(const owl_message *m) {
    24932493  const char *ccs;
     2494  char *ccs_quoted;
    24942495  char *filtname;
    2495   char *text;
    24962496  owl_filter *f;
     2497  GString *buf;
    24972498
    24982499  ccs = owl_message_get_attribute_value(m, "zephyr_ccs");
     
    25052506  }
    25062507
    2507   text = owl_sprintf("type ^zephyr$ and filter personal and "
    2508                      "zephyr_ccs ^%s%s%s$",
    2509                      owl_getquoting(ccs), ccs, owl_getquoting(ccs));
    2510 
    2511   f = owl_filter_new_fromstring(filtname, text);
     2508  buf = g_string_new("type ^zephyr$ and filter personal and "
     2509                     "zephyr_ccs ^");
     2510  ccs_quoted = owl_text_quote(ccs, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2511  owl_string_append_quoted_arg(buf, ccs_quoted);
     2512  g_string_append_c(buf, '$');
     2513  owl_free(ccs_quoted);
     2514
     2515  f = owl_filter_new_fromstring(filtname, buf->str);
     2516  g_string_free(buf, true);
    25122517
    25132518  owl_global_add_filter(&g, f);
    2514 
    2515   owl_free(text);
    25162519
    25172520  return filtname;
     
    26112614  const owl_view *v;
    26122615  const owl_message *m;
    2613   const char *cmdprefix, *mclass, *minst;
    2614   char *cmd;
     2616  const char *mclass, *minst;
     2617  GString *buf;
    26152618 
    26162619  v=owl_global_get_current_view(&g);
     
    26382641                         mclass, minst);
    26392642  } else {
    2640     cmdprefix = "start-command zpunt ";
    2641     cmd = owl_malloc(strlen(cmdprefix)+strlen(mclass)+strlen(minst)+10);
    2642     strcpy(cmd, cmdprefix);
    2643     strcat(cmd, owl_getquoting(mclass));
    2644     strcat(cmd, mclass);
    2645     strcat(cmd, owl_getquoting(mclass));
     2643    buf = g_string_new("start-command zpunt ");
     2644    owl_string_append_quoted_arg(buf, mclass);
    26462645    if (type) {
    2647       strcat(cmd, " ");
    2648       strcat(cmd, owl_getquoting(minst));
    2649       strcat(cmd, minst);
    2650       strcat(cmd, owl_getquoting(minst));
     2646      g_string_append_c(buf, ' ');
     2647      owl_string_append_quoted_arg(buf, minst);
    26512648    } else {
    2652       strcat(cmd, " *");
    2653     }
    2654     owl_function_command(cmd);
    2655     owl_free(cmd);
     2649      g_string_append(buf, " *");
     2650    }
     2651    owl_function_command(buf->str);
     2652    g_string_free(buf, true);
    26562653  }
    26572654}
Note: See TracChangeset for help on using the changeset viewer.