Changeset 1349
- Timestamp:
- 12/26/06 12:11:38
- Files:
-
- trunk/libtinymail-camel/tny-camel-msg.c (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-send-queue.c (modified) (7 diffs)
- trunk/libtinymail/tny-send-queue.c (modified) (1 diff)
- trunk/libtinymail/tny-send-queue.h (modified) (2 diffs)
- trunk/tests/functional/msg-sender.c (modified) (1 diff)
- trunk/tests/shared/account-store.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/tny-camel-msg.c
r1347 r1349 154 154 CamelMimeMessage *msg; 155 155 TnyCamelMsgPriv *priv = TNY_CAMEL_MSG_GET_PRIVATE (self); 156 CamelInternetAddress *from, *recipients, *replyto;157 const gchar *str; 156 /* CamelInternetAddress *from, *recipients, *replyto; 157 const gchar *str; */ 158 158 159 159 g_assert (TNY_IS_CAMEL_HEADER (header)); … … 171 171 TnyCamelMimePartPriv *ppriv = TNY_CAMEL_MIME_PART_GET_PRIVATE (self); 172 172 g_mutex_lock (ppriv->part_lock); 173 if (ppriv->part) 173 if (ppriv->part) 174 { 175 /* TODO: copy old part over? */ 174 176 camel_object_unref (CAMEL_OBJECT (ppriv->part)); 177 } 175 178 /* Add a reference? */ 176 179 ppriv->part = (CamelMimePart *) ((WriteInfo*)((TnyCamelHeader *)header)->info)->msg; trunk/libtinymail-camel/tny-camel-send-queue.c
r1315 r1349 57 57 g_mutex_lock (priv->todo_lock); 58 58 { 59 GError *terror = NULL; 59 60 sentbox = tny_send_queue_get_sentbox (self); 60 61 outbox = tny_send_queue_get_outbox (self); 61 /* TODO handle and report errors here */ 62 tny_folder_get_headers (outbox, list, TRUE, NULL); 62 tny_folder_get_headers (outbox, list, TRUE, &terror); 63 if (terror != NULL) 64 { 65 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 66 0, NULL, terror, i, priv->total); 67 g_object_unref (G_OBJECT (list)); 68 goto errorhandler; 69 } 70 63 71 length = tny_list_get_length (list); 64 72 priv->total = length; … … 75 83 g_mutex_lock (priv->todo_lock); 76 84 { 85 GError *ferror = NULL; 77 86 TnyIterator *hdriter; 78 87 TnyList *headers = tny_simple_list_new (); 79 /* TODO handle and report errors here */ 80 tny_folder_get_headers (outbox, headers, TRUE, NULL); 88 89 tny_folder_get_headers (outbox, headers, TRUE, &ferror); 90 91 if (ferror != NULL) 92 { 93 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 94 0, msg, ferror, i, priv->total); 95 g_object_unref (G_OBJECT (headers)); 96 goto errorhandler; 97 } 98 81 99 length = tny_list_get_length (headers); 82 100 83 101 priv->total = length; 102 84 103 if (length <= 0) 85 104 { … … 90 109 hdriter = tny_list_create_iterator (headers); 91 110 header = (TnyHeader *) tny_iterator_get_current (hdriter); 111 92 112 g_object_unref (G_OBJECT (hdriter)); 93 113 g_object_unref (G_OBJECT (headers)); … … 95 115 g_mutex_unlock (priv->todo_lock); 96 116 117 97 118 if (header && TNY_IS_HEADER (header)) 98 119 { … … 101 122 102 123 tny_list_prepend (hassent, G_OBJECT (header)); 103 /* TODO handle and report errors here */104 124 msg = tny_folder_get_msg (outbox, header, &err); 105 106 107 /* TODO handle and report errors here */108 125 g_object_unref (G_OBJECT (header)); 109 126 110 if (err == NULL) 111 tny_transport_account_send (priv->trans_account, msg, NULL); 112 else 113 g_print ("error: %s\n", err->message); 127 if (err == NULL) 128 { 129 tny_transport_account_send (priv->trans_account, msg, &err); 130 if (err != NULL) 131 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 132 0, msg, err, i, priv->total); 133 } else 134 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 135 0, msg, err, i, priv->total); 114 136 115 137 g_mutex_lock (priv->todo_lock); 116 138 { 117 /* TODO handle and report errors here */ 118 tny_folder_transfer_msgs (outbox, hassent, sentbox, TRUE, NULL); 119 priv->total--; 139 if (err == NULL) 140 { 141 GError *newerr = NULL; 142 tny_folder_transfer_msgs (outbox, hassent, sentbox, TRUE, &newerr); 143 if (newerr != NULL) 144 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 145 0, msg, newerr, i, priv->total); 146 147 priv->total--; 148 } 120 149 } 121 150 g_mutex_unlock (priv->todo_lock); … … 123 152 g_object_unref (G_OBJECT (hassent)); 124 153 125 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_MSG_SENT], 126 0, msg, i, priv->total); 154 if (err == NULL) 155 g_signal_emit (self, tny_send_queue_signals [TNY_SEND_QUEUE_MSG_SENT], 156 0, msg, i, priv->total); 127 157 128 158 i++; … … 137 167 } 138 168 } 169 170 errorhandler: 139 171 140 172 g_object_unref (G_OBJECT (sentbox)); trunk/libtinymail/tny-send-queue.c
r1228 r1349 110 110 G_TYPE_NONE, 3, TNY_TYPE_MSG, G_TYPE_UINT, G_TYPE_UINT); 111 111 112 /** 113 * TnySendQueue::error-happened 114 * @self: the object on which the signal is emitted 115 * @arg1: The message that was supposed to be sent or NULL 116 * @arg2: a GError containing the error that happened 117 * @arg3: The current nth number of the message that was supposed to be sent 118 * @arg4: The total amount of messages currently being processed 119 * 120 * API WARNING: This API might change 121 * 122 * Emitted when a message didn't get sent because of an error 123 **/ 124 tny_send_queue_signals[TNY_SEND_QUEUE_ERROR_HAPPENED] = 125 g_signal_new ("error_happened", 126 TNY_TYPE_SEND_QUEUE, 127 G_SIGNAL_RUN_FIRST, 128 G_STRUCT_OFFSET (TnySendQueueIface, error_happened), 129 NULL, NULL, 130 g_cclosure_marshal_VOID__POINTER, 131 G_TYPE_NONE, 3, TNY_TYPE_MSG, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT); 132 112 133 initialized = TRUE; 113 134 } trunk/libtinymail/tny-send-queue.h
r1228 r1349 42 42 { 43 43 TNY_SEND_QUEUE_MSG_SENT, 44 TNY_SEND_QUEUE_ERROR_HAPPENED, 44 45 TNY_SEND_QUEUE_LAST_SIGNAL 45 46 }; … … 54 55 /* Signals */ 55 56 void (*msg_sent) (TnySendQueue *self, TnyMsg *msg, guint nth, guint total); 57 void (*error_happened) (TnySendQueue *self, TnyMsg *msg, guint nth, guint total); 56 58 57 59 /* methods */ trunk/tests/functional/msg-sender.c
r1347 r1349 83 83 84 84 tny_stream_write (stream, TEST_STRING, strlen (TEST_STRING)); 85 tny_stream_reset (stream); 85 86 86 87 tny_mime_part_construct_from_stream (TNY_MIME_PART (retval), stream, "text/plain"); trunk/tests/shared/account-store.c
r1347 r1349 108 108 if (types == TNY_ACCOUNT_STORE_STORE_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 109 109 { 110 account = tny_camel_store_account_new ();110 account = TNY_ACCOUNT (tny_camel_store_account_new ()); 111 111 112 112 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); … … 115 115 116 116 tny_account_set_proto (account, "imap"); 117 tny_account_set_name (account, " unit test account");117 tny_account_set_name (account, "IMAP unit test account"); 118 118 tny_account_set_user (account, "tinymailunittest"); 119 119 tny_account_set_hostname (account, "mail.tinymail.org"); … … 128 128 if (types == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS || types == TNY_ACCOUNT_STORE_BOTH) 129 129 { 130 account = tny_camel_transport_account_new ();130 account = TNY_ACCOUNT (tny_camel_transport_account_new ()); 131 131 132 132 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), me->session); … … 134 134 tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 135 135 136 tny_account_set_proto (account, "s mtp");137 tny_account_set_name (account, " unit test account");136 tny_account_set_proto (account, "something"); 137 tny_account_set_name (account, "SMTP unit test account"); 138 138 tny_account_set_id (account, "unique_smtp"); 139 139 tny_account_set_url_string (account, "smtp://tinymailunittest;auth=PLAIN@mail.tinymail.org/;use_ssl=always");
