Changes in functions.c [697221f:47128d9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r697221f r47128d9 32 32 char *rv; 33 33 rv=owl_function_command(cmdbuff); 34 g_free(rv);34 if (rv) g_free(rv); 35 35 } 36 36 … … 453 453 454 454 if (rv || status) { 455 g_free(cryptmsg);455 if(cryptmsg) 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 g_free(ret);993 if (ret) g_free(ret); 994 994 995 995 /* signal our child process, if any */ … … 1817 1817 owl_global_get_cols(&g)); 1818 1818 1819 if ( has_colors()) {1819 if (owl_global_get_hascolors(&g)) { 1820 1820 owl_fmtext_append_normal(&fm, "Color: Yes\n"); 1821 owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_ util_get_colorpairs());1821 owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_global_get_colorpairs(&g)); 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 owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f), 2229 owl_filter_get_fgcolor(f), 2230 owl_filter_get_bgcolor(f)); 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 } 2231 2233 owl_fmtext_append_normal(&fm, "\n"); 2232 2234 } … … 2358 2360 done: 2359 2361 g_free(class); 2360 g_free(instance); 2362 if (instance) { 2363 g_free(instance); 2364 } 2361 2365 return(filtname); 2362 2366 } … … 2519 2523 2520 2524 filtname = g_strdup_printf("conversation-%s", ccs); 2521 g_strdelimit(filtname, " ", '-');2525 owl_text_tr(filtname, ' ', '-'); 2522 2526 2523 2527 if (owl_global_get_filter(&g, filtname)) { … … 2781 2785 void owl_function_zpunt(const char *class, const char *inst, const char *recip, int direction) 2782 2786 { 2783 G PtrArray *argv;2787 GString *buf; 2784 2788 char *quoted; 2785 2789 2786 argv = g_ptr_array_new();2790 buf = g_string_new(""); 2787 2791 if (!strcmp(class, "*")) { 2788 g_ptr_array_add(argv, g_strdup("class")); 2789 g_ptr_array_add(argv, g_strdup(".*")); 2792 g_string_append(buf, "class .*"); 2790 2793 } else { 2791 2794 quoted=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2792 g_ptr_array_add(argv, g_strdup("class")); 2793 g_ptr_array_add(argv, g_strdup_printf("^(un)*%s(\\.d)*$", quoted)); 2795 owl_string_appendf_quoted(buf, "class ^(un)*%q(\\.d)*$", quoted); 2794 2796 g_free(quoted); 2795 2797 } 2796 2798 if (!strcmp(inst, "*")) { 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(".*")); 2799 g_string_append(buf, " and instance .*"); 2800 2800 } else { 2801 2801 quoted=owl_text_quote(inst, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 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)); 2802 owl_string_appendf_quoted(buf, " and instance ^(un)*%q(\\.d)*$", quoted); 2805 2803 g_free(quoted); 2806 2804 } 2807 2805 if (!strcmp(recip, "*")) { 2808 /* nothing*/2806 /* g_string_append(buf, ""); */ 2809 2807 } else { 2810 2808 if(!strcmp(recip, "%me%")) { … … 2812 2810 } 2813 2811 quoted=owl_text_quote(recip, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 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)); 2812 owl_string_appendf_quoted(buf, " and recipient ^%q$", quoted); 2817 2813 g_free(quoted); 2818 2814 } 2819 2815 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) 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) 2826 2821 { 2827 2822 owl_filter *f; … … 2831 2826 2832 2827 /* first, create the filter */ 2833 f = owl_filter_new("punt-filter", argc, argv); 2828 owl_function_debugmsg("About to filter %s", filter); 2829 f = owl_filter_new_fromstring("punt-filter", filter); 2834 2830 if (f == NULL) { 2835 2831 owl_function_error("Error creating filter for zpunt"); … … 2858 2854 } 2859 2855 2860 if (direction == 0) {2861 owl_function_debugmsg("punting");2862 /* If we're punting, add the filter to the global punt list */2856 owl_function_debugmsg("punting"); 2857 /* If we're punting, add the filter to the global punt list */ 2858 if (direction==0) { 2863 2859 owl_list_append_element(fl, f); 2864 } else if (direction == 1) { 2865 owl_function_makemsg("No matching punt filter"); 2866 } 2860 } 2867 2861 } 2868 2862 … … 2965 2959 2966 2960 if (viewsize==0) { 2967 owl_function_ makemsg("No messages present");2961 owl_function_error("No messages present"); 2968 2962 return; 2969 2963 } … … 2979 2973 /* bounds check */ 2980 2974 if (start>=viewsize || start<0) { 2981 owl_function_ makemsg("No further matches found");2975 owl_function_error("No further matches found"); 2982 2976 return; 2983 2977 } … … 3008 3002 } 3009 3003 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3010 owl_function_ makemsg("No matches found");3004 owl_function_error("No matches found"); 3011 3005 } 3012 3006
Note: See TracChangeset
for help on using the changeset viewer.