Changeset 78f6c35
- Timestamp:
- May 24, 2011, 9:36:28 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 697221f
- Parents:
- 2d415cc
- git-author:
- David Benjamin <davidben@mit.edu> (04/04/11 01:27:16)
- git-committer:
- David Benjamin <davidben@mit.edu> (05/24/11 21:36:28)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r2d415cc r78f6c35 2464 2464 owl_list * fl; 2465 2465 owl_filter * f; 2466 char * text;2467 2466 int i; 2468 2467 … … 2483 2482 } 2484 2483 } 2485 text = owl_string_build_quoted("filter %q", argv[1]); 2486 owl_function_punt(text, unpunt); 2487 g_free(text); 2484 const char *filter[] = {"filter", argv[1]}; 2485 owl_function_punt(2, filter, unpunt); 2488 2486 } else { 2489 owl_function_punt(skiptokens(buff, 1), unpunt); 2487 /* Pass in argv[1]..argv[argc-1]. */ 2488 owl_function_punt(argc - 1, argv + 1, unpunt); 2490 2489 } 2491 2490 } -
functions.c
rf97c1a6 r78f6c35 2781 2781 void owl_function_zpunt(const char *class, const char *inst, const char *recip, int direction) 2782 2782 { 2783 G String *buf;2783 GPtrArray *argv; 2784 2784 char *quoted; 2785 2785 2786 buf = g_string_new("");2786 argv = g_ptr_array_new(); 2787 2787 if (!strcmp(class, "*")) { 2788 g_string_append(buf, "class .*"); 2788 g_ptr_array_add(argv, g_strdup("class")); 2789 g_ptr_array_add(argv, g_strdup(".*")); 2789 2790 } else { 2790 2791 quoted=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2791 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)); 2792 2794 g_free(quoted); 2793 2795 } 2794 2796 if (!strcmp(inst, "*")) { 2795 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(".*")); 2796 2800 } else { 2797 2801 quoted=owl_text_quote(inst, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2798 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)); 2799 2805 g_free(quoted); 2800 2806 } 2801 2807 if (!strcmp(recip, "*")) { 2802 /* g_string_append(buf, "");*/2808 /* nothing */ 2803 2809 } else { 2804 2810 if(!strcmp(recip, "%me%")) { … … 2806 2812 } 2807 2813 quoted=owl_text_quote(recip, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 2808 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)); 2809 2817 g_free(quoted); 2810 2818 } 2811 2819 2812 owl_function_punt(buf->str, direction); 2813 g_string_free(buf, true); 2814 } 2815 2816 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) 2817 2826 { 2818 2827 owl_filter *f; … … 2822 2831 2823 2832 /* first, create the filter */ 2824 owl_function_debugmsg("About to filter %s", filter); 2825 f = owl_filter_new_fromstring("punt-filter", filter); 2833 f = owl_filter_new("punt-filter", argc, argv); 2826 2834 if (f == NULL) { 2827 2835 owl_function_error("Error creating filter for zpunt");
Note: See TracChangeset
for help on using the changeset viewer.