Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r47128d9 r697221f  
    3232  char *rv;
    3333  rv=owl_function_command(cmdbuff);
    34   if (rv) g_free(rv);
     34  g_free(rv);
    3535}
    3636
     
    453453
    454454  if (rv || status) {
    455     if(cryptmsg) g_free(cryptmsg);
     455    g_free(cryptmsg);
    456456    g_free(old_msg);
    457457    owl_function_error("Error in zcrypt, possibly no key found.  Message not sent.");
     
    991991  /* execute the commands in shutdown */
    992992  ret = owl_perlconfig_execute("BarnOwl::Hooks::_shutdown();");
    993   if (ret) g_free(ret);
     993  g_free(ret);
    994994
    995995  /* signal our child process, if any */
     
    18171817          owl_global_get_cols(&g));
    18181818
    1819   if (owl_global_get_hascolors(&g)) {
     1819  if (has_colors()) {
    18201820    owl_fmtext_append_normal(&fm, "Color: Yes\n");
    1821     owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_global_get_colorpairs(&g));
     1821    owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_util_get_colorpairs());
    18221822    owl_fmtext_appendf_normal(&fm, "Can change colors: %s\n", can_change_color() ? "yes" : "no");
    18231823  } else {
     
    22262226    f = fl->data;
    22272227    owl_fmtext_append_normal(&fm, "   ");
    2228     if (owl_global_get_hascolors(&g)) {
    2229       owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f), owl_filter_get_fgcolor(f), owl_filter_get_bgcolor(f));
    2230     } else {
    2231       owl_fmtext_append_normal(&fm, owl_filter_get_name(f));
    2232     }
     2228    owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f),
     2229                                   owl_filter_get_fgcolor(f),
     2230                                   owl_filter_get_bgcolor(f));
    22332231    owl_fmtext_append_normal(&fm, "\n");
    22342232  }
     
    23602358done:
    23612359  g_free(class);
    2362   if (instance) {
    2363     g_free(instance);
    2364   }
     2360  g_free(instance);
    23652361  return(filtname);
    23662362}
     
    25232519
    25242520  filtname = g_strdup_printf("conversation-%s", ccs);
    2525   owl_text_tr(filtname, ' ', '-');
     2521  g_strdelimit(filtname, " ", '-');
    25262522
    25272523  if (owl_global_get_filter(&g, filtname)) {
     
    27852781void owl_function_zpunt(const char *class, const char *inst, const char *recip, int direction)
    27862782{
    2787   GString *buf;
     2783  GPtrArray *argv;
    27882784  char *quoted;
    27892785
    2790   buf = g_string_new("");
     2786  argv = g_ptr_array_new();
    27912787  if (!strcmp(class, "*")) {
    2792     g_string_append(buf, "class .*");
     2788    g_ptr_array_add(argv, g_strdup("class"));
     2789    g_ptr_array_add(argv, g_strdup(".*"));
    27932790  } else {
    27942791    quoted=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    2795     owl_string_appendf_quoted(buf, "class ^(un)*%q(\\.d)*$", quoted);
     2792    g_ptr_array_add(argv, g_strdup("class"));
     2793    g_ptr_array_add(argv, g_strdup_printf("^(un)*%s(\\.d)*$", quoted));
    27962794    g_free(quoted);
    27972795  }
    27982796  if (!strcmp(inst, "*")) {
    2799     g_string_append(buf, " and instance .*");
     2797    g_ptr_array_add(argv, g_strdup("and"));
     2798    g_ptr_array_add(argv, g_strdup("instance"));
     2799    g_ptr_array_add(argv, g_strdup(".*"));
    28002800  } else {
    28012801    quoted=owl_text_quote(inst, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    2802     owl_string_appendf_quoted(buf, " and instance ^(un)*%q(\\.d)*$", quoted);
     2802    g_ptr_array_add(argv, g_strdup("and"));
     2803    g_ptr_array_add(argv, g_strdup("instance"));
     2804    g_ptr_array_add(argv, g_strdup_printf("^(un)*%s(\\.d)*$", quoted));
    28032805    g_free(quoted);
    28042806  }
    28052807  if (!strcmp(recip, "*")) {
    2806     /* g_string_append(buf, ""); */
     2808    /* nothing */
    28072809  } else {
    28082810    if(!strcmp(recip, "%me%")) {
     
    28102812    }
    28112813    quoted=owl_text_quote(recip, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    2812     owl_string_appendf_quoted(buf, " and recipient ^%q$", quoted);
     2814    g_ptr_array_add(argv, g_strdup("and"));
     2815    g_ptr_array_add(argv, g_strdup("recipient"));
     2816    g_ptr_array_add(argv, g_strdup_printf("^%s$", quoted));
    28132817    g_free(quoted);
    28142818  }
    28152819
    2816   owl_function_punt(buf->str, direction);
    2817   g_string_free(buf, true);
    2818 }
    2819 
    2820 void owl_function_punt(const char *filter, int direction)
     2820  owl_function_punt(argv->len, (const char *const*) argv->pdata, direction);
     2821  g_ptr_array_foreach(argv, (GFunc)g_free, NULL);
     2822  g_ptr_array_free(argv, true);
     2823}
     2824
     2825void owl_function_punt(int argc, const char *const *argv, int direction)
    28212826{
    28222827  owl_filter *f;
     
    28262831
    28272832  /* first, create the filter */
    2828   owl_function_debugmsg("About to filter %s", filter);
    2829   f = owl_filter_new_fromstring("punt-filter", filter);
     2833  f = owl_filter_new("punt-filter", argc, argv);
    28302834  if (f == NULL) {
    28312835    owl_function_error("Error creating filter for zpunt");
     
    28542858  }
    28552859
    2856   owl_function_debugmsg("punting");
    2857   /* If we're punting, add the filter to the global punt list */
    2858   if (direction==0) {
     2860  if (direction == 0) {
     2861    owl_function_debugmsg("punting");
     2862    /* If we're punting, add the filter to the global punt list */
    28592863    owl_list_append_element(fl, f);
    2860   }
     2864  } else if (direction == 1) {
     2865    owl_function_makemsg("No matching punt filter");
     2866 }
    28612867}
    28622868
     
    29592965 
    29602966  if (viewsize==0) {
    2961     owl_function_error("No messages present");
     2967    owl_function_makemsg("No messages present");
    29622968    return;
    29632969  }
     
    29732979  /* bounds check */
    29742980  if (start>=viewsize || start<0) {
    2975     owl_function_error("No further matches found");
     2981    owl_function_makemsg("No further matches found");
    29762982    return;
    29772983  }
     
    30023008  }
    30033009  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    3004   owl_function_error("No matches found");
     3010  owl_function_makemsg("No matches found");
    30053011}
    30063012
Note: See TracChangeset for help on using the changeset viewer.