1
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Authors: Jeffrey Stedfast <fejj@ximian.com>
4
* Michael Zucchi <NotZed@Ximian.com>
6
3
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
8
* This library is free software you can redistribute it and/or modify it
5
* This library is free software: you can redistribute it and/or modify it
9
6
* under the terms of the GNU Lesser General Public License as published by
10
7
* the Free Software Foundation.
12
9
* This library is distributed in the hope that it will be useful, but
13
10
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15
12
* for more details.
17
14
* You should have received a copy of the GNU Lesser General Public License
18
* along with this library; if not, see <http://www.gnu.org/licenses/>.
15
* along with this library. If not, see <http://www.gnu.org/licenses/>.
17
* Authors: Jeffrey Stedfast <fejj@ximian.com>
18
* Michael Zucchi <NotZed@Ximian.com>
22
21
#ifdef HAVE_CONFIG_H
90
90
static CamelSExpResult *get_size (struct _CamelSExp *f, gint argc, struct _CamelSExpResult **argv, FilterMessageSearch *fms);
91
91
static CamelSExpResult *pipe_message (struct _CamelSExp *f, gint argc, struct _CamelSExpResult **argv, FilterMessageSearch *fms);
92
92
static CamelSExpResult *junk_test (struct _CamelSExp *f, gint argc, struct _CamelSExpResult **argv, FilterMessageSearch *fms);
93
static CamelSExpResult *message_location (struct _CamelSExp *f, gint argc, struct _CamelSExpResult **argv, FilterMessageSearch *fms);
94
95
/* builtin functions */
121
122
{ "get-size", (CamelSExpFunc) get_size, 0 },
122
123
{ "pipe-message", (CamelSExpFunc) pipe_message, 0 },
123
124
{ "junk-test", (CamelSExpFunc) junk_test, 0 },
125
{ "message-location", (CamelSExpFunc) message_location, 0 }
126
128
static CamelMimeMessage *
1024
/* this is copied from Evolution's libemail-engine/e-mail-folder-utils.c */
1026
mail_folder_uri_build (CamelStore *store,
1027
const gchar *folder_name)
1030
gchar *encoded_name;
1034
g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
1035
g_return_val_if_fail (folder_name != NULL, NULL);
1037
/* Skip the leading slash, if present. */
1038
if (*folder_name == '/')
1041
uid = camel_service_get_uid (CAMEL_SERVICE (store));
1043
encoded_uid = camel_url_encode (uid, ":;@/");
1044
encoded_name = camel_url_encode (folder_name, "#");
1046
uri = g_strdup_printf ("folder://%s/%s", encoded_uid, encoded_name);
1048
g_free (encoded_uid);
1049
g_free (encoded_name);
1054
static CamelSExpResult *
1055
message_location (struct _CamelSExp *f,
1057
struct _CamelSExpResult **argv,
1058
FilterMessageSearch *fms)
1061
gboolean same = FALSE;
1063
if (argc != 1 || argv[0]->type != CAMEL_SEXP_RES_STRING)
1064
camel_sexp_fatal_error (f, _("Invalid arguments to (message-location)"));
1066
if (fms->folder && argv[0]->value.string) {
1071
store = camel_folder_get_parent_store (fms->folder);
1072
name = camel_folder_get_full_name (fms->folder);
1073
uri = mail_folder_uri_build (store, name);
1075
same = g_str_equal (uri, argv[0]->value.string);
1080
r = camel_sexp_result_new (f, CAMEL_SEXP_RES_BOOL);
1081
r->value.boolean = same;
1023
1087
* camel_filter_search_match: