aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-folder-search.c24
-rw-r--r--camel/camel-folder-search.h3
3 files changed, 32 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e95b59616e..8e4640fb72 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,11 @@
2003-02-14 Jeffrey Stedfast <fejj@ximian.com>
+ * camel-folder-search.c: Added a (get-size ) function to fix bug
+ #38073.
+ (search_get_size): Implemented.
+
+2003-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
* camel-url-scanner.c (url_scanner_table_init): Mark chars with
the high-bit set as CTRL chars.
(camel_url_web_end): If the char before the start of the url is an
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 92b73e6f59..ef6dfc8564 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -70,6 +70,7 @@ static ESExpResult *search_system_flag(struct _ESExp *f, int argc, struct _ESExp
static ESExpResult *search_get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
static ESExpResult *search_get_received_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
static ESExpResult *search_get_current_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
+static ESExpResult *search_get_size(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
static ESExpResult *search_uid(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
static ESExpResult *search_dummy(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
@@ -100,6 +101,7 @@ camel_folder_search_class_init (CamelFolderSearchClass *klass)
klass->get_sent_date = search_get_sent_date;
klass->get_received_date = search_get_received_date;
klass->get_current_date = search_get_current_date;
+ klass->get_size = search_get_size;
klass->uid = search_uid;
}
@@ -199,6 +201,7 @@ struct {
{ "get-sent-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_sent_date), 1 },
{ "get-received-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_received_date), 1 },
{ "get-current-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_current_date), 1 },
+ { "get-size", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_size), 1 },
{ "uid", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, uid), 1 },
};
@@ -241,7 +244,7 @@ camel_folder_search_construct (CamelFolderSearch *search)
CamelFolderSearch *
camel_folder_search_new (void)
{
- CamelFolderSearch *new = CAMEL_FOLDER_SEARCH ( camel_object_new (camel_folder_search_get_type ()));
+ CamelFolderSearch *new = CAMEL_FOLDER_SEARCH (camel_object_new (camel_folder_search_get_type ()));
camel_folder_search_construct(new);
return new;
@@ -1124,6 +1127,25 @@ search_get_current_date(struct _ESExp *f, int argc, struct _ESExpResult **argv,
}
static ESExpResult *
+search_get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s)
+{
+ ESExpResult *r;
+
+ r(printf("executing get-size\n"));
+
+ /* are we inside a match-all? */
+ if (s->current) {
+ r = e_sexp_result_new (f, ESEXP_RES_INT);
+ r->value.number = s->current->size / 1024;
+ } else {
+ r = e_sexp_result_new (f, ESEXP_RES_ARRAY_PTR);
+ r->value.ptrarray = g_ptr_array_new ();
+ }
+
+ return r;
+}
+
+static ESExpResult *
search_uid(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
{
ESExpResult *r;
diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h
index 701178b0b4..128e97aae9 100644
--- a/camel/camel-folder-search.h
+++ b/camel/camel-folder-search.h
@@ -108,6 +108,9 @@ struct _CamelFolderSearchClass {
/* (get-current-date) Retrieve 'now' as a time_t */
ESExpResult * (*get_current_date)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
+ /* (get-size) Retrieve message size as an int (in kilobytes) */
+ ESExpResult * (*get_size)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
+
/* (uid "uid" ...) True if the uid is in the list */
ESExpResult * (*uid)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
};