aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test10.c
blob: efe069242a5f27583329f0a8c2e020b9a0e2c560 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */


#include "camel.h"
#include "camel-mbox-folder.h"
#include "camel-exception.h"
#include "md5-utils.h"
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>


static CamelMimeMessage *
create_sample_mime_message ()
{
    CamelMimeMessage *message;
    CamelMimePart *body_part;
    CamelMultipart *multipart;


    message = camel_mime_message_new ();

    camel_mime_part_set_description (CAMEL_MIME_PART (message), "a test");

    camel_medium_add_header (CAMEL_MEDIUM (message), "X-test1", "the value of a test");
    camel_medium_add_header (CAMEL_MEDIUM (message), "X-test2", "the value of another test");

    camel_mime_message_set_date (message, time(0), 200);
    camel_mime_message_set_subject (message, "A test message");
    camel_mime_message_set_reply_to (message, "toto@toto.com");
    camel_mime_message_set_from (message, "Bertrand.Guiheneuf@aful.org");

    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, 
                      "Franck DeChamps", "franck.dechamps@alseve.fr");
    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, 
                      NULL, "mc@alseve.fr");
    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, 
                      "Richo", "richard.lengagne@inria.fr");
    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, 
                      "Frank", "Francois.fleuret@inria.fr");
    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, 
                      NULL, "maury@justmagic.com");
    camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_BCC, 
                      "Bertie", "Bertrand.Guiheneuf@aful.org");

    multipart = camel_multipart_new ();
    body_part = camel_mime_part_new ();
    camel_mime_part_set_content (CAMEL_MIME_PART (body_part), "This is a test.\nThis is only a test.\n",
                     strlen("This is a test.\nThis is only a test.\n"), "text/plain");
    camel_multipart_add_part (multipart, body_part);
    camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart));
    
    return message;
}

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;
    CamelMimeMessage *message;
    GList *uid_list;

    gtk_init (&argc, &argv);
    camel_init ();      
    ex = camel_exception_new ();
    
    session = camel_session_new (auth_callback);
    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;
    }

    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;
    }

    camel_folder_open (folder, FOLDER_OPEN_RW, 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;
    }

    message = create_sample_mime_message ();
    camel_folder_append_message (folder, message, ex);
    if (camel_exception_get_id (ex)) {
        printf ("Exception caught when trying to append a message to the folder\n"
            "Full description : %s\n", camel_exception_get_description (ex));
        return -1;
    }
    
    uid_list = camel_folder_get_uid_list (folder, ex);
    
    
    camel_folder_get_message_by_uid (folder, (gchar *)uid_list->data, ex);
    camel_folder_close (folder, FALSE, ex); 
    return 1;
}




ass='commitgraph'>* add enum for e-card pilot status.Chris Toshok2000-07-265-89/+161 * add comment headers to signals that didn't have any.Chris Toshok2000-07-262-3/+93 * use the user's Contact db. not toshok's.Chris Toshok2000-07-262-2/+15 * add textual exception printout. (set_editor_text): close pre tags & checkMichael Meeks2000-07-263-1/+12 * build static versions of some util libraries for the conduit to link withSeth Alves2000-07-266-5/+30 * Added a #define for "X-EVOLUTION-PILOTID". Added a parse_pilot_id to readChristopher James Lahey2000-07-252-13/+37 * add pilot_id.Chris Toshok2000-07-253-2/+25 * more stuff. too much to use a changelog for.Chris Toshok2000-07-255-444/+326 * Remove the idle handler when we're destroyed.Christopher James Lahey2000-07-243-4/+16 * Fixed the oaf info.Christopher James Lahey2000-07-2114-122/+460 * Update the components to match the changes in the libeshell API.Ettore Perazzoli2000-07-212-1/+6 * Added the Turkish desktop entryFatih Demir2000-07-202-0/+7 * Added "text/vCard" to the list of mime types we support.Christopher James Lahey2000-07-183-2/+11 * Added gui/minicard/e-minicard-control.c,Christopher James Lahey2000-07-1814-120/+260 * New files for using a minicard as a widget or a bonobo control.Christopher James Lahey2000-07-189-0/+1218 * a building but non-functional address conduitSeth Alves2000-07-156-0/+1642 * duh. don't save the port in the host slot either.Chris Toshok2000-07-152-1/+6 * Added these.Christopher James Lahey2000-07-145-0/+194 * Switched the order of compilation of printing and contact-editor.Christopher James Lahey2000-07-1415-39/+358 * oops. fix typo that was saving the port in the rootdn spot.Chris Toshok2000-07-132-7/+67 * From addressbook/ChangeLog:Christopher James Lahey2000-07-133-3/+11 * Add icons to the toolbars.Christopher James Lahey2000-07-133-16/+32 * Added installation of arrow.png.Christopher James Lahey2000-07-135-6/+24 * Removed an unused functionChristopher James Lahey2000-07-122-7/+4 * Add the OAF stuff to `EXTRA_DIST'.Ettore Perazzoli2000-07-111-2/+1 * add idl file to EXTRA_DISTDan Winship2000-07-112-1/+8 * Get rid of the ESelectNames test menu entry.Ettore Perazzoli2000-07-112-38/+5 * Fix the address entry box for more than one address being specifiedPeter Williams2000-07-102-19/+27 * Switched from ETable to ETableScrolled.Christopher James Lahey2000-07-108-19/+30 * Added a field that gives the name if it exists and the company nameChristopher James Lahey2000-07-107-11/+66 * Fixed a small off by one error that was causing an extra character to getChristopher James Lahey2000-07-092-1/+8 * Several contacts list bugfixes.Anders Carlsson2000-07-098-38/+75 * Removed unused do_nothing_cb function.Christopher James Lahey2000-07-099-36/+177 * Link the toolbar print button to the print callback.Not Zed2000-07-092-1/+6 * Hitting OK or Cancel at least closes the dialog now.Christopher James Lahey2000-07-092-0/+7 * Set the returned entry to use the ellipsis.Christopher James Lahey2000-07-092-0/+7 * Include e-select-names-factory.h.Christopher James Lahey2000-07-098-8/+86 * Ignore dynamically created source filesJeffrey Stedfast2000-07-092-0/+9 * Added code for initializing the values of the fields in the messageEttore Perazzoli2000-07-082-2/+29 * Wrap the ESelectNames stuff into a Bonobo interface, so that we canEttore Perazzoli2000-07-0813-11/+622 * Added an "editable" argument.Christopher James Lahey2000-07-086-24/+63 * Changed to line mode.Christopher James Lahey2000-07-082-0/+14 * Implemented the get_cards function.Christopher James Lahey2000-07-084-3/+84 * Make the entry widgets we create editable.Christopher James Lahey2000-07-086-12/+64 * Since ELDAPServer->port is a char *, allocate a string with the number 389Christopher James Lahey2000-07-0811-25/+224 * add scope to ELDAPServer, and make port a string.Chris Toshok2000-07-074-20/+73 * Changed "FIXME: Save and Close" to "Save and Close". Removed some toolbarChristopher James Lahey2000-07-068-37/+375 * call e_ldap_storage_add_server call.Chris Toshok2000-07-068-94/+216 * remove hack to read "uri" file from local directory.Chris Toshok2000-07-066-9/+267 * Fixed more compile errors.Christopher James Lahey2000-07-044-3/+11 * Fixed compile error.Christopher James Lahey2000-07-042-2/+4 * Removed e-card-iterator.c, e-card-iterator.h, e-card-list-iterator.c,Christopher James Lahey2000-07-0434-866/+1186 * EvolutionShellClient.Ettore Perazzoli2000-06-302-1/+7 * New select names manager interface (Not complete.)Christopher James Lahey2000-06-293-0/+227 * Calculate height including if clip_height is set to -1.Christopher James Lahey2000-06-2710-11/+94 * remove spew. (pas_backend_ldap_ensure_connected): duh, don't access aChris Toshok2000-06-272-21/+26 * Remove usage of "x" and "y" arguments.Christopher James Lahey2000-06-217-12/+6 * Fix compilation with builddir != srcdir.Ettore Perazzoli2000-06-193-2/+8 * Made the left column of minicards not get any wider than the widestChristopher James Lahey2000-06-177-18/+137 * Build a `libeshell.a' library in `shell/' so that we don't need toEttore Perazzoli2000-06-132-9/+7 * Removed the ETableModel thaw handler. Likewise.Federico Mena Quintero2000-06-136-53/+12 * Fixed the widget reparenting.Christopher James Lahey2000-06-112-2/+8 * Added glade files.Christopher James Lahey2000-06-117-15/+62 * Forgot ChangeLog for my latest commit.Ettore Perazzoli2000-06-111-0/+9 * Make ETable use EScrollFrame instead of GtkScrolledWindow.Ettore Perazzoli2000-06-115-4/+13 * Renamed a bunch of functions for better readability.Christopher James Lahey2000-06-115-53/+119 * Glade files for Select Names dialog.Christopher James Lahey2000-06-113-0/+260 * Do e_card_simple_sync and extract_info more often.Christopher James Lahey2000-06-114-7/+119 * Initial support for creating/removing folders. This implies some newEttore Perazzoli2000-06-102-3/+22 * Bind Save As to save the current view of the contact as a vcard.Christopher James Lahey2000-06-093-2/+29 * Doh, sync the card simple and extract the card info.Federico Mena Quintero2000-06-093-0/+11 * Now this derives from GtkObject. It follows the same strategy as theFederico Mena Quintero2000-06-0916-4314/+5182 * Fix Makefiles so that (guess what?) they work with builddir != srcdir.Ettore Perazzoli2000-06-085-26/+38 * Bind right click on the ETable to "Save to VCard."Christopher James Lahey2000-06-062-0/+26 * a bunch of patches to make evolution compile with bonobo in strange prefixes....Mathieu Lacage2000-06-054-22/+22 * Made phone/email/address labels change correctly again.Christopher James Lahey2000-06-033-6/+11 * Made evolution-addressbook shut down when the shell is done with it.Christopher James Lahey2000-06-032-2/+24 * Made double click only work on the first button.Christopher James Lahey2000-06-025-2/+9 * return TRUE if opening a contact editor so that we don't get a "newChristopher James Lahey2000-06-0211-28/+420 * Use stock Cancel buttons in the addressbook dialogs.Ettore Perazzoli2000-06-012-3/+12 * Added accelerators for the remaining items.Miguel de Icaza2000-06-015-534/+319 * Make the toolbar look like a standard GNOME toolbar my putting it intoEttore Perazzoli2000-06-012-2/+16 * New files for card list.Christopher James Lahey2000-05-313-0/+277 * Made the alphabet buttons not focusable.Christopher James Lahey2000-05-316-55/+22 * Added a bit of space around the alphabet bar.Christopher James Lahey2000-05-313-4/+11 * Added alphabet.glade and alphabet.glade.h.Christopher James Lahey2000-05-3113-13/+1023 * Added BONOBO_GNOME_CFLAGS to CPPFLAGS.Christopher James Lahey2000-05-302-1/+6 * Made double clicking create a new card. Set the empty message.Christopher James Lahey2000-05-3010-58/+305 * Added "sequence_complete" signal.Christopher James Lahey2000-05-3012-9/+138 * Remove storage test code that I committed by accident.Ettore Perazzoli2000-05-282-5/+7 * Added double click to open contact editor.Christopher James Lahey2000-05-286-0/+105 * Fix 'make dist' errors.Ross Golder2000-05-282-2/+3 * Removed some columns.Christopher James Lahey2000-05-262-4/+4 * Reorganized the shell to allow dynamic registration of storages andEttore Perazzoli2000-05-2511-4/+261 * Switched printing and gui.Christopher James Lahey2000-05-2415-169/+301 * Fixed some memory leaks.Christopher James Lahey2000-05-242-0/+6 * Added e-contact-editor-save-as.c and e-contact-editor-save-as.h.Christopher James Lahey2000-05-239-2/+274 * Added initialize_value and value_is_empty callbacks.Christopher James Lahey2000-05-205-0/+78 * Fixed a bug that broke address field support.Christopher James Lahey2000-05-193-2/+7 * Added support for arbitrary fields in the contact editor.Christopher James Lahey2000-05-195-0/+214 * Fixed e_card_name_copy and e_card_arbitrary_copy to deal correctly with aChristopher James Lahey2000-05-1912-1113/+1159 * Fixed the code to write out and read in arbitrary fields.Christopher James Lahey2000-05-182-18/+46 * Implemented "MAILER" field. Added arbitrary field support.Christopher James Lahey2000-05-188-246/+303 * Added E_CARD_SIMPLE_FIELD_MAILER. Not implemented yet.Christopher James Lahey2000-05-173-0/+7 * convert to use ECardSimple. (poll_ldap): same.Chris Toshok2000-05-172-38/+23 * add typedefs for the can_write functions, and add parameters toChris Toshok2000-05-176-15/+146 * Fixed a large memory leak.Christopher James Lahey2000-05-162-1/+7 * Fixed another memory leak.Christopher James Lahey2000-05-162-2/+5