** See bug #47765.
authorNot Zed <NotZed@Ximian.com>
Wed, 3 Sep 2003 18:05:54 +0000 (18:05 +0000)
committerMichael Zucci <zucchi@src.gnome.org>
Wed, 3 Sep 2003 18:05:54 +0000 (18:05 +0000)
2003-08-20  Not Zed  <NotZed@Ximian.com>

        ** See bug #47765.

        * camel-folder-search.h: Removed match1 member.

        * camel-folder-search.c (camel_folder_search_match_expression):
        use current directly rather than match1.  This method isn't used
        anywhere anyway.
        (search_not): remove match1 stuff.
        (search_match_all): properly handle the match-all against 1
        message as a scalar result, not an array result.

2003-09-03  Not Zed  <NotZed@Ximian.com>

        * camel-http-stream.c (camel_http_stream_set_proxy): handle NULL
        proxy_url - unset the proxy.

camel/ChangeLog
camel/camel-folder-search.c
camel/camel-folder-search.h
camel/camel-http-stream.c

index 073d3b6..2790fb3 100644 (file)
@@ -1,3 +1,21 @@
+2003-08-20  Not Zed  <NotZed@Ximian.com>
+
+       ** See bug #47765.
+
+       * camel-folder-search.h: Removed match1 member.
+
+       * camel-folder-search.c (camel_folder_search_match_expression):
+       use current directly rather than match1.  This method isn't used
+       anywhere anyway.
+       (search_not): remove match1 stuff.
+       (search_match_all): properly handle the match-all against 1
+       message as a scalar result, not an array result.
+
+2003-09-03  Not Zed  <NotZed@Ximian.com>
+
+       * camel-http-stream.c (camel_http_stream_set_proxy): handle NULL
+       proxy_url - unset the proxy.
+
 2003-08-29  Not Zed  <NotZed@Ximian.com>
 
        * camel-object.c (camel_object_state_write): 
index 89fb8f1..bf76247 100644 (file)
@@ -426,7 +426,7 @@ camel_folder_search_match_expression(CamelFolderSearch *search, const char *expr
        GPtrArray *uids;
        int ret = FALSE;
 
-       search->match1 = (CamelMessageInfo *)info;
+       search->current = (CamelMessageInfo *)info;
 
        uids = camel_folder_search_execute_expression(search, expr, ex);
        if (uids) {
@@ -434,7 +434,7 @@ camel_folder_search_match_expression(CamelFolderSearch *search, const char *expr
                        ret = TRUE;
                camel_folder_search_free_result(search, uids);
        }
-       search->match1 = NULL;
+       search->current = NULL;
 
        return ret;
 }
@@ -492,14 +492,10 @@ search_not(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSe
                        r->value.ptrarray = g_ptr_array_new();
 
                        /* not against a single message?*/
-                       if (search->match1 || search->current) {
+                       if (search->current) {
                                int found = FALSE;
 
-                               if (search->match1)
-                                       uid = camel_message_info_uid(search->match1);
-                               else
-                                       uid = camel_message_info_uid(search->current);
-
+                               uid = camel_message_info_uid(search->current);
                                for (i=0;!found && i<v->len;i++) {
                                        if (strcmp(uid, v->pdata[i]) == 0)
                                                found = TRUE;
@@ -555,33 +551,32 @@ search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFold
        if (argc>1) {
                g_warning("match-all only takes a single argument, other arguments ignored");
        }
-       r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
-       r->value.ptrarray = g_ptr_array_new();
-
-       /* we are only matching a single message? */
-       if (search->match1) {
-               search->current = search->match1;
 
+       /* we are only matching a single message?  or already inside a match-all? */
+       if (search->current) {
                d(printf("matching against 1 message: %s\n", camel_message_info_subject(search->current)));
 
+               r = e_sexp_result_new(f, ESEXP_RES_BOOL);
+               r->value.bool = FALSE;
+
                if (argc>0) {
                        r1 = e_sexp_term_eval(f, argv[0]);
                        if (r1->type == ESEXP_RES_BOOL) {
-                               if (r1->value.bool)
-                                       g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current));
+                               r->value.bool = r1->value.bool;
                        } else {
                                g_warning("invalid syntax, matches require a single bool result");
                                e_sexp_fatal_error(f, _("(match-all) requires a single bool result"));
                        }
                        e_sexp_result_free(f, r1);
                } else {
-                       g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(search->current));
+                       r->value.bool = TRUE;
                }
-               search->current = NULL;
-
                return r;
        }
 
+       r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
+       r->value.ptrarray = g_ptr_array_new();
+
        if (search->summary == NULL) {
                /* TODO: make it work - e.g. use the folder and so forth for a slower search */
                g_warning("No summary supplied, match-all doesn't work with no summary");
index 128e97a..e4d2253 100644 (file)
@@ -52,7 +52,6 @@ struct _CamelFolderSearch {
        GPtrArray *summary;     /* summary array for current search */
        GHashTable *summary_hash; /* hashtable of summary items */
        CamelMessageInfo *current; /* current message info, when searching one by one */
-       CamelMessageInfo *match1; /* message info, when searching a single message only */
        CamelMimeMessage *current_message; /* cache of current message, if required */
        CamelIndex *body_index;
 };
index d9dc6e0..3217a11 100644 (file)
@@ -557,8 +557,11 @@ camel_http_stream_set_proxy (CamelHttpStream *http_stream, const char *proxy_url
        
        if (http_stream->proxy)
                camel_url_free (http_stream->proxy);
-       
-       http_stream->proxy = camel_url_new (proxy_url, NULL);
+
+       if (proxy_url == NULL)
+               http_stream->proxy = NULL;
+       else
+               http_stream->proxy = camel_url_new (proxy_url, NULL);
 }
 
 void