Changes in functions.c [47128d9:697221f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r47128d9 r697221f 32 32 char *rv; 33 33 rv=owl_function_command(cmdbuff); 34 if (rv)g_free(rv);34 g_free(rv); 35 35 } 36 36 … … 453 453 454 454 if (rv || status) { 455 if(cryptmsg)g_free(cryptmsg);455 g_free(cryptmsg); 456 456 g_free(old_msg); 457 457 owl_function_error("Error in zcrypt, possibly no key found. Message not sent."); … … 991 991 /* execute the commands in shutdown */ 992 992 ret = owl_perlconfig_execute("BarnOwl::Hooks::_shutdown();"); 993 if (ret)g_free(ret);993 g_free(ret); 994 994 995 995 /* signal our child process, if any */ … … 1817 1817 owl_global_get_cols(&g)); 1818 1818 1819 if ( owl_global_get_hascolors(&g)) {1819 if (has_colors()) { 1820 1820 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()); 1822 1822 owl_fmtext_appendf_normal(&fm, "Can change colors: %s\n", can_change_color() ? "yes" : "no"); 1823 1823 } else { … … 2226 2226 f = fl->data; 2227 2227 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)); 2233 2231 owl_fmtext_append_normal(&fm, "\n"); 2234 2232 } … … 2360 2358 done: 2361 2359 g_free(class); 2362 if (instance) { 2363 g_free(instance); 2364 } 2360 g_free(instance); 2365 2361 return(filtname); 2366 2362 } … … 2523 2519 2524 2520 filtname = g_strdup_printf("conversation-%s", ccs); 2525 owl_text_tr(filtname, ' ', '-');2521 g_strdelimit(filtname, " ", '-'); 2526 2522 2527 2523 if (owl_global_get_filter(&g, filtname)) { … … 2785 2781 void owl_function_zpunt(const char *class, const char *inst, const char *recip, int direction) 2786 2782 { 2787 G String *buf;2783 GPtrArray *argv; 2788 2784 char *quoted; 2789 2785 2790 buf = g_string_new("");2786 argv = g_ptr_array_new(); 2791 2787 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(".*")); 2793 2790 } else { 2794 2791 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)); 2796 2794 g_free(quoted); 2797 2795 } 2798 2796 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(".*")); 2800 2800 } else { 2801 2801 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)); 2803 2805 g_free(quoted); 2804 2806 } 2805 2807 if (!strcmp(recip, "*")) { 2806 /* g_string_append(buf, "");*/2808 /* nothing */ 2807 2809 } else { 2808 2810 if(!strcmp(recip, "%me%")) { … … 2810 2812 } 2811 2813 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)); 2813 2817 g_free(quoted); 2814 2818 } 2815 2819 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 2825 void owl_function_punt(int argc, const char *const *argv, int direction) 2821 2826 { 2822 2827 owl_filter *f; … … 2826 2831 2827 2832 /* 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); 2830 2834 if (f == NULL) { 2831 2835 owl_function_error("Error creating filter for zpunt"); … … 2854 2858 } 2855 2859 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 */ 2859 2863 owl_list_append_element(fl, f); 2860 } 2864 } else if (direction == 1) { 2865 owl_function_makemsg("No matching punt filter"); 2866 } 2861 2867 } 2862 2868 … … 2959 2965 2960 2966 if (viewsize==0) { 2961 owl_function_ error("No messages present");2967 owl_function_makemsg("No messages present"); 2962 2968 return; 2963 2969 } … … 2973 2979 /* bounds check */ 2974 2980 if (start>=viewsize || start<0) { 2975 owl_function_ error("No further matches found");2981 owl_function_makemsg("No further matches found"); 2976 2982 return; 2977 2983 } … … 3002 3008 } 3003 3009 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3004 owl_function_ error("No matches found");3010 owl_function_makemsg("No matches found"); 3005 3011 } 3006 3012
Note: See TracChangeset
for help on using the changeset viewer.