/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* Test search api */ #include #include #include #include #include #include #include #include #include #include #include static char * auth_callback(char *prompt, gboolean secret, CamelService *service, char *item, CamelException *ex) { printf ("auth_callback called: %s\n", prompt); return NULL; } int main (int argc, char**argv) { CamelSession *session; CamelException *ex; CamelStore *store; gchar *store_url = "mbox:///tmp/evmail"; CamelFolder *folder, *outbox; GList *n, *matches; gtk_init (&argc, &argv); camel_init (); ex = camel_exception_new (); session = camel_session_new (auth_callback); camel_provider_load (session, "../camel/providers/mbox/.libs/libcamelmbox.so.0", ex); if (camel_exception_get_id (ex)) { printf ("Exceptions suck: %s\n", camel_exception_get_description (ex)); return 1; } store = camel_session_get_store (session, store_url, ex); if (camel_exception_get_id (ex)) { printf ("Exception caught in camel_session_get_store\n" "Full description : %s\n", camel_exception_get_description (ex)); return -1; } printf("get folder\n"); folder = camel_store_get_folder (store, "Inbox", ex); if (camel_exception_get_id (ex)) { printf ("Exception caught in camel_store_get_folder\n" "Full description : %s\n", camel_exception_get_description (ex)); return -1; } printf("open folder\n"); camel_folder_open (folder, FOLDER_OPEN_READ, ex); if (camel_exception_get_id (ex)) { printf ("Exception caught when trying to open the folder\n" "Full description : %s\n", camel_exception_get_description (ex)); return -1; } printf("create output folder ...\n"); outbox = camel_store_get_folder (store, "Gnome", ex); if (!camel_folder_exists(outbox, ex)) { camel_folder_create(outbox, ex); } camel_folder_open (outbox, FOLDER_OPEN_WRITE, ex); printf("Search for messages\n"); matches = camel_folder_search_by_expression (folder, /* "(match-all (header-contains \"subject\" \"gnome\"))",*/ "(body-contains \"gnome\")", ex); printf("search found matches:\n"); n = matches; while (n) { CamelMimeMessage *m; printf("uid: %s\n", (char *) n->data); m = camel_folder_get_message_by_uid(folder, n->data, ex); if (camel_exception_get_id (ex)) { printf ("Cannot get message\n" "Full description : %s\n", camel_exception_get_description (ex)); camel_exception_init(ex); } else { #if 1 camel_folder_append_message(outbox, m, ex); if (camel_exception_get_id (ex)) { printf ("Cannot save message\n" "Full description : %s\n", camel_exception_get_description (ex)); } printf("Removing matching message from source folder?\n"); camel_mime_message_set_flags(m, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); /* camel_mime_message_set_flags(m, CAMEL_MESSAGE_ANSWERED, CAMEL_MESSAGE_ANSWERED);*/ #endif } if (m) gtk_object_unref(m); n = g_list_next(n); } camel_folder_close (outbox, TRUE, ex); camel_folder_close (folder, TRUE, ex); gtk_object_unref((GtkObject *)outbox); gtk_object_unref((GtkObject *)folder); return 0; } tion> FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* Bump the version of the curl shared library after the ftp/curl updateroam2009-01-231-1/+2
* Fix on FreeBSD 7 and up. Define uint using typedef directive, not #define.sobomax2009-01-131-1/+1
* o Update to 1.2.30.2;sobomax2009-01-136-10/+7227
* Bump PORTREVISION's after OpenLDAP update.delphij2009-01-061-1/+1
* - Remove duplicates from MAKE_ENV after inclusion of CC and CXX in default MA...pav2008-07-251-2/+1
* Bump portrevision due to upgrade of devel/gettext.edwin2008-06-061-0/+1
* Update net/asterisk and net/asterisk12 to 1.4.18.1 and 1.2.17 respectively.sobomax2008-03-192-4/+4
* Update the codec negotiaion patch to the latest version.sobomax2008-01-192-4/+4
* o Update to 1.2.26.1;sobomax2008-01-182-10/+9
* Migration from bison 1.x to 2.xade2007-10-171-1/+2
* Update to 1.2.24.sobomax2007-09-032-4/+4
* o Upgrade to 1.2.23.sobomax2007-08-017-27/+41
* Fix a critical bug in the channel code, which can result in a threadsobomax2007-07-272-0/+14
* o Update zaptel to 1.4.1;sobomax2007-04-2623-82/+312
* Remove d3adc0d3.sobomax2007-04-141-6/+0
* h.323 module compiles file on amd64 so that don't limit it to i386.sobomax2007-04-141-1/+0
* Use PKGNAMESUFFIX to make sure we don't have the same package name assobomax2007-04-131-0/+1
* Chase the shared library version of speex, bump the PORTREVISION.mezz2007-02-241-2/+2
* Fix breagake due to recent BIND9 changes to resolver.sobomax2007-01-301-0/+14
* 1. Fix a typo: dmsmgr.conf -> dnsmgr.conf.bsam2007-01-042-2/+9
* Update the ftp/curl port to 7.16.0.roam2006-12-131-2/+2
* Add another local patch that will be submitted to the vendor.sobomax2006-12-051-10/+22
* Update codec negotiation patch to the latest version.sobomax2006-12-052-4/+5
* Allow secure digest auth to be requested for outgoing call legs by AGI.sobomax2006-12-042-13/+23
* - Update to 1.2.13mnag2006-10-203-20/+21
* Update to 1.2.12.1.sobomax2006-10-045-80/+34
* Fix crash caused by the recent BIND upgrade from version 8 to version 9.sobomax2006-08-242-4/+7
* Fix build on 4.x. Untested due to the lack of 4.x system.sobomax2006-07-202-2/+6
* Fix patch to apply.sobomax2006-06-211-39/+0
* Merge in patch from Asterisk's ticket 7305. This patch should be part of thesobomax2006-06-201-0/+62
* Make asterisk_pidfile actually working.sobomax2006-06-202-1/+3
* Make patcheable.sobomax2006-06-172-28/+0
* Update to 1.2.9.1.sobomax2006-06-178-139/+161
* Allow pidfile location to be altered via asterisk_pidfile variable insobomax2006-05-261-1/+2
* Fix on sparc64.sobomax2006-05-232-1/+15
* Doesn't compile on sparc64. Patches are welcome.sobomax2006-05-231-1/+1
* Remove USE_REINPLACE from all categories starting with Nedwin2006-05-121-1/+0
* Remove dead MASTER_SITEs.sobomax2006-05-121-3/+1
* - Update to 1.2.7.1 [1]fjoe2006-04-2611-117/+64
* Mark the port as forbidden due to a security issue which could lead toremko2006-04-261-0/+2
* 1. PROVIDE -> PROVIDE:.sobomax2006-04-131-3/+2
* - Bring back bristuff support (bristuff-0.3.0-PRE-1l).fjoe2006-03-155-22/+54
* Remove the FreeBSD KEYWORD from all rc.d scripts where it appears.dougb2006-02-211-1/+1
* Use corrected version of the codec negotiation patch.sobomax2006-02-152-4/+5
* Fix PLIST on 4.x (one of the modules can not be built due to absend va_copy()sobomax2006-02-072-1/+7
* Fix build on 4.x.sobomax2006-02-071-0/+13
* Update to 1.2.4.sobomax2006-02-062-8/+8
* Depend upon the repocopied pwlib152 and and openh323-112 ports, to ease thenetchild2006-02-051-4/+4
* Update to 1.2.3.sobomax2006-01-277-38/+49
* Fix build on amd64. No PORTREVISION bump since it doesn't change contentsobomax2006-01-271-0/+15
* When building with zaptel disabled make sure to set WITHOUT_ZAPTEL makesobomax2006-01-211-0/+1
* Update to 1.2.1.sobomax2006-01-1836-2802/+1008
* Use correct WRKSRC paths for pwlib and openh323 when WRKDIRPREFIXlawrance2005-12-171-2/+5
* Add support for amd64 (untested). No PORTREVISION bump since it doesn't affectsobomax2005-11-08