Changeset 138
- Timestamp:
- 03/07/06 16:26:49
- Files:
-
- trunk/libtinymail-camel/Makefile.am (modified) (1 diff)
- trunk/libtinymail-camel/tny-account.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-shared.h (added)
- trunk/libtinymail-camel/tny-camel-stream.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-msg-folder.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-msg-header.c (modified) (6 diffs)
- trunk/libtinymail-camel/tny-msg-mime-part.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-msg.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-session-camel.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-stream-camel.c (modified) (2 diffs)
- trunk/libtinymail-test/tny-msg-header-iface-test.c (modified) (5 diffs)
- trunk/libtinymail-test/tny-msg-header-iface-test.h (modified) (1 diff)
- trunk/libtinymail/tny-msg-mime-part-iface.c (modified) (1 diff)
- trunk/tinymail/tny-main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/Makefile.am
r96 r138 12 12 tny-camel-stream.h \ 13 13 tny-stream-camel.h \ 14 tny-camel-shared.h \ 14 15 tny-session-camel.h 15 16 trunk/libtinymail-camel/tny-account.c
r108 r138 40 40 #include "tny-account-priv.h" 41 41 42 #include <tny-camel-shared.h> 43 42 44 #define TNY_ACCOUNT_GET_PRIVATE(o) \ 43 45 (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_ACCOUNT_TYPE, TnyAccountPriv)) … … 418 420 { 419 421 static GType type = 0; 422 423 if (!camel_type_init_done) 424 { 425 camel_type_init (); 426 camel_type_init_done = TRUE; 427 } 420 428 421 429 if (type == 0) trunk/libtinymail-camel/tny-camel-stream.c
r109 r138 19 19 20 20 #include <tny-camel-stream.h> 21 22 #include <tny-camel-shared.h> 21 23 22 24 static CamelStreamClass *parent_class = NULL; … … 154 156 static CamelType type = CAMEL_INVALID_TYPE; 155 157 158 if (!camel_type_init_done) 159 { 160 camel_type_init (); 161 camel_type_init_done = TRUE; 162 } 163 156 164 if (type == CAMEL_INVALID_TYPE) { 157 165 parent_class = (CamelStreamClass *)camel_stream_get_type(); trunk/libtinymail-camel/tny-msg-folder.c
r109 r138 40 40 #include "tny-account-priv.h" 41 41 #include "tny-msg-folder-priv.h" 42 43 #include <tny-camel-shared.h> 42 44 43 45 #include <camel/camel.h> … … 516 518 { 517 519 static GType type = 0; 520 521 if (!camel_type_init_done) 522 { 523 camel_type_init (); 524 camel_type_init_done = TRUE; 525 } 518 526 519 527 if (type == 0) trunk/libtinymail-camel/tny-msg-header.c
r135 r138 27 27 #include "tny-msg-header-priv.h" 28 28 29 #include <tny-camel-shared.h> 30 29 31 #include <camel/camel-folder.h> 30 32 #include <camel/camel.h> … … 189 191 camel_internet_address_add (target, name, email); 190 192 } else { 191 camel_internet_address_add (target, NULL, tok); 193 194 char *name = (char*)tok; 195 char *lname = name; 196 197 lname += (strlen (name)-1); 198 199 if (*name == ' ') 200 *name++; 201 202 if (*lname == ' ') 203 *lname-- = '\0'; 204 205 camel_internet_address_add (target, NULL, name); 192 206 } 193 207 } … … 277 291 { 278 292 TnyMsgHeader *me = TNY_MSG_HEADER (self); 293 294 CamelInternetAddress *addr = camel_internet_address_new (); 295 camel_object_unref (CAMEL_OBJECT (addr)); 279 296 280 297 prepare_for_write (me); … … 417 434 TnyMsgHeader *me = TNY_MSG_HEADER (self); 418 435 419 load_msg_header (me); 420 421 /* TODO: write case */ 422 423 return camel_message_info_subject (me->message_info); 436 if (me->uid) 437 { 438 load_msg_header (me); 439 440 return camel_message_info_subject (me->message_info); 441 442 } else if (me->mime_message) 443 { 444 return camel_mime_message_get_subject (me->mime_message); 445 } else 446 return NULL; 424 447 } 425 448 … … 553 576 klass->get_cc_func = tny_msg_header_get_cc; 554 577 klass->get_bcc_func = tny_msg_header_get_bcc; 555 556 578 klass->get_replyto_func = tny_msg_header_get_replyto; 557 558 klass->get_uid_func = tny_msg_header_get_uid; 579 klass->get_uid_func = tny_msg_header_get_uid; 580 559 581 klass->set_uid_func = tny_msg_header_set_uid; 560 582 … … 594 616 { 595 617 static GType type = 0; 618 619 if (!camel_type_init_done) 620 { 621 camel_type_init (); 622 camel_type_init_done = TRUE; 623 } 596 624 597 625 if (type == 0) trunk/libtinymail-camel/tny-msg-mime-part.c
r108 r138 28 28 #include <camel/camel-data-wrapper.h> 29 29 30 #include <tny-camel-shared.h> 31 30 32 static GObjectClass *parent_class = NULL; 31 33 … … 277 279 { 278 280 static GType type = 0; 281 282 if (!camel_type_init_done) 283 { 284 camel_type_init (); 285 camel_type_init_done = TRUE; 286 } 279 287 280 288 if (type == 0) trunk/libtinymail-camel/tny-msg.c
r108 r138 28 28 #include <camel/camel-stream-buffer.h> 29 29 30 #include <tny-camel-shared.h> 31 30 32 static GObjectClass *parent_class = NULL; 31 33 … … 267 269 { 268 270 static GType type = 0; 271 272 if (!camel_type_init_done) 273 { 274 camel_type_init (); 275 camel_type_init_done = TRUE; 276 } 269 277 270 278 if (type == 0) trunk/libtinymail-camel/tny-session-camel.c
r109 r138 37 37 #include <tny-account.h> 38 38 #include "tny-account-priv.h" 39 40 #include <tny-camel-shared.h> 41 42 gboolean camel_type_init_done = FALSE; 39 43 40 44 static CamelSessionClass *ms_parent_class; … … 452 456 static CamelType tny_session_camel_type = CAMEL_INVALID_TYPE; 453 457 458 if (!camel_type_init_done) 459 { 460 camel_type_init (); 461 camel_type_init_done = TRUE; 462 } 463 454 464 if (tny_session_camel_type == CAMEL_INVALID_TYPE) { 455 465 ms_parent_class = (CamelSessionClass *)camel_session_get_type(); trunk/libtinymail-camel/tny-stream-camel.c
r109 r138 35 35 36 36 #include <tny-session-camel.h> 37 38 #include <tny-camel-shared.h> 37 39 38 40 static GObjectClass *parent_class = NULL; … … 231 233 static GType type = 0; 232 234 235 if (!camel_type_init_done) 236 { 237 camel_type_init (); 238 camel_type_init_done = TRUE; 239 } 240 233 241 if (type == 0) 234 242 { trunk/libtinymail-test/tny-msg-header-iface-test.c
r135 r138 17 17 */ 18 18 19 #include <string.h> 20 19 21 #include <tny-msg-header-iface-test.h> 20 22 … … 24 26 static TnyMsgHeaderIface *iface = NULL; 25 27 26 void28 static void 27 29 tny_msg_header_iface_test_setup (void) 28 30 { 29 g_print ("setup\n");30 31 iface = TNY_MSG_HEADER_IFACE (tny_msg_header_new ()); 31 32 … … 33 34 } 34 35 35 void36 static void 36 37 tny_msg_header_iface_test_teardown (void) 37 38 { … … 44 45 tny_msg_header_iface_test_set_from (void) 45 46 { 46 const gchar *str_in = " 1st test string", *str_out;47 const gchar *str_in = "Me myself and I <me.myself@and.i.com>", *str_out; 47 48 48 49 tny_msg_header_iface_set_from (iface, str_in); 49 50 str_out = tny_msg_header_iface_get_from (iface); 50 51 51 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set from! ");52 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set from!\n"); 52 53 53 54 return; 54 55 } 55 56 56 void57 static void 57 58 tny_msg_header_iface_test_set_to (void) 58 59 { 59 const gchar *str_in = "1st test string", *str_out; 60 61 tny_msg_header_iface_set_to (iface, str_in); 60 gchar *str_in = g_strdup ("Myself <this@is.me>, You Do Die Daa <you.doe.die@daa.com>; patrick@test.com"); 61 const gchar *str_out; 62 int i=0; 63 64 tny_msg_header_iface_set_to (iface, (const gchar*)str_in); 62 65 str_out = tny_msg_header_iface_get_to (iface); 63 66 64 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set to!"); 67 /* The implementation will always return a comma separated list 68 * but should also accept ; separated lists. Even mixed (both 69 * characters have the same meaning). */ 70 71 for (i=0; i < strlen(str_in); i++) 72 if (str_in[i] == ';') 73 str_in[i] = ','; 74 75 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set to!\n"); 76 77 g_free (str_in); 65 78 66 79 return; 67 80 } 68 81 69 void82 static void 70 83 tny_msg_header_iface_test_set_cc (void) 71 84 { 72 const gchar *str_in = " 1st test string", *str_out;85 const gchar *str_in = "First user <first@user.be>, Second user <second@user.com>", *str_out; 73 86 74 87 tny_msg_header_iface_set_cc (iface, str_in); 75 88 str_out = tny_msg_header_iface_get_cc (iface); 76 89 77 g_ print("CC test: %s,%s\n", str_in, str_out);90 g_message ("CC test: %s,%s\n", str_in, str_out); 78 91 79 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set cc!"); 92 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set cc!\n"); 93 80 94 81 95 return; 82 96 } 83 97 84 void98 static void 85 99 tny_msg_header_iface_test_set_bcc (void) 86 100 { 87 const gchar *str_in = " 1st test string", *str_out;101 const gchar *str_in = "The Invisible man <the.invisible@man.com>, mark@here.there.com", *str_out; 88 102 89 103 tny_msg_header_iface_set_bcc (iface, str_in); 90 104 str_out = tny_msg_header_iface_get_bcc (iface); 91 105 92 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set bcc!"); 106 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set bcc!\n"); 107 108 return; 109 } 110 111 static void 112 tny_msg_header_iface_test_set_subject (void) 113 { 114 const gchar *str_in = "I'm the nice subject", *str_out; 115 116 tny_msg_header_iface_set_subject (iface, str_in); 117 str_out = tny_msg_header_iface_get_subject (iface); 118 119 gunit_fail_unless(!strcmp (str_in, str_out), "Unable to set subject!\n"); 120 } 121 122 static void 123 tny_msg_header_iface_test_set_replyto (void) 124 { 125 126 GUNIT_WARNING ("TODO"); 93 127 94 128 return; … … 131 165 tny_msg_header_iface_test_teardown)); 132 166 167 168 gunit_test_suite_add_test_case(suite, 169 gunit_test_case_new_with_funcs("tny_msg_header_iface_test_set_replyto", 170 tny_msg_header_iface_test_setup, 171 tny_msg_header_iface_test_set_replyto, 172 tny_msg_header_iface_test_teardown)); 173 174 gunit_test_suite_add_test_case(suite, 175 gunit_test_case_new_with_funcs("tny_msg_header_iface_test_set_subject", 176 tny_msg_header_iface_test_setup, 177 tny_msg_header_iface_test_set_subject, 178 tny_msg_header_iface_test_teardown)); 179 133 180 return suite; 134 181 } trunk/libtinymail-test/tny-msg-header-iface-test.h
r128 r138 24 24 #include <tny-msg-header-iface.h> 25 25 26 /* Setup & Teardown */27 void tny_msg_header_iface_test_setup (void);28 void tny_msg_header_iface_test_teardown (void);29 30 /* Test cases */31 void tny_msg_header_iface_test_set_bcc (void); /* Test case 01 */32 void tny_msg_header_iface_test_set_cc (void); /* Test case 02 */33 void tny_msg_header_iface_test_set_to (void); /* Test case 03 */34 void tny_msg_header_iface_test_set_from (void); /* Test case 04 */35 36 26 /* Test suite */ 37 27 GUnitTestSuite *create_tny_msg_header_iface_suite (void); 38 28 39 40 29 #endif trunk/libtinymail/tny-msg-mime-part-iface.c
r109 r138 124 124 * 125 125 * Inefficiently get a stream from a message part. The entire data of the 126 * the part will be kept in memory until the stream i nunreferenced.126 * the part will be kept in memory until the stream is unreferenced. 127 127 * 128 128 * Return value: An in-memory stream trunk/tinymail/tny-main.c
r124 r138 52 52 window = GTK_WINDOW (tny_summary_window_new ()); 53 53 54 TnyMsgHeaderIface *iface = tny_msg_header_new (); 55 tny_msg_header_iface_set_subject (iface, "test"); 56 g_print ("%s\n", tny_msg_header_iface_get_subject (iface)); 57 54 58 gtk_widget_show (GTK_WIDGET (window)); 55 59
