Changeset 1384
- Timestamp:
- 01/10/07 03:15:04
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c (modified) (7 diffs)
- trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c (modified) (2 diffs)
- trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-pop-folder.c (modified) (4 diffs)
- trunk/libtinymail-camel/tny-camel-pop-store-account.c (modified) (7 diffs)
- trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1382 r1384 3 3 * Added some extra TnyFolderType's for use in tinymail clients 4 4 5 6 5 2007-01-09 Philip Van Hoof <pvanhoof@gnome.org> 6 7 * Temporary POP implementation (CamelFolderSummary support) 8 9 2007-01-09 Philip Van Hoof <pvanhoof@gnome.org> 7 10 8 11 * Implemented a very memory efficient message fetching mechanism in trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c
r1366 r1384 124 124 { 125 125 CamelFolder *folder; 126 CamelPOP3Store *p3store = (CamelPOP3Store*) parent; 127 gchar *summary_file; 126 128 127 129 d(printf("opening pop3 INBOX folder\n")); … … 130 132 camel_folder_construct (folder, parent, "inbox", "inbox"); 131 133 134 summary_file = g_strdup_printf ("%s/summary.mmap", p3store->root); 135 folder->summary = camel_folder_summary_new (folder); 136 camel_folder_summary_set_build_content (folder->summary, TRUE); 137 camel_folder_summary_set_filename (folder->summary, summary_file); 138 139 if (camel_folder_summary_load (folder->summary) == -1) { 140 camel_folder_summary_clear (folder->summary); 141 camel_folder_summary_touch (folder->summary); 142 camel_folder_summary_save (folder->summary); 143 camel_folder_summary_load (folder->summary); 144 } 145 g_free (summary_file); 146 147 132 148 /* mt-ok, since we dont have the folder-lock for new() */ 133 149 camel_folder_refresh_info (folder, ex);/* mt-ok */ … … 136 152 folder = NULL; 137 153 } 138 154 155 if (!folder->summary) { 156 camel_object_unref (CAMEL_OBJECT (folder)); 157 camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, 158 _("Could not load summary for INBOX")); 159 return NULL; 160 } 161 162 folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY; 163 139 164 return folder; 140 165 } … … 272 297 camel_pop3_engine_command_free(pop3_store->engine, pcl); 273 298 299 for (i=0;i<pop3_folder->uids->len;i++) 300 { 301 CamelPOP3FolderInfo *fi = pop3_folder->uids->pdata[i]; 302 303 /* TNY TODO: only get the HEAD if the service is capable of that */ 304 pop3_get_message (folder, fi->uid, FALSE, NULL); 305 } 306 274 307 if (pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL) { 275 308 camel_pop3_engine_command_free(pop3_store->engine, pcu); … … 277 310 for (i=0;i<pop3_folder->uids->len;i++) { 278 311 CamelPOP3FolderInfo *fi = pop3_folder->uids->pdata[i]; 312 279 313 if (fi->cmd) { 280 314 camel_pop3_engine_command_free(pop3_store->engine, fi->cmd); … … 466 500 int i, last; 467 501 CamelStream *stream = NULL; 502 CamelFolderSummary *summary = folder->summary; 503 CamelMessageInfoBase *mi; 468 504 469 505 /* TNY TODO: Implement partial message retrieval if full==TRUE */ … … 585 621 message = NULL; 586 622 } 623 624 mi = (CamelMessageInfoBase *) camel_folder_summary_info_new_from_message (summary, message); 625 626 mi->flags |= CAMEL_MESSAGE_INFO_UID_NEEDS_FREE; 627 mi->uid = g_strdup (fi->uid); 628 629 camel_folder_summary_add (summary, (CamelMessageInfo *)mi); 630 587 631 done: 588 632 camel_object_unref((CamelObject *)stream); trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c
r1027 r1384 133 133 if (pop3_store->cache) 134 134 camel_object_unref((CamelObject *)pop3_store->cache); 135 if (pop3_store->root) 136 g_free (pop3_store->root); 135 137 } 136 138 … … 568 570 569 571 root = camel_session_get_storage_path (session, service, ex); 572 store->root = root; 570 573 if (root) { 571 574 store->cache = camel_data_cache_new(root, 0, ex); 572 g_free(root);575 /*g_free(root);*/ 573 576 if (store->cache) { 574 577 /* Default cache expiry - 1 week or not visited in a day */ trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h
r1014 r1384 52 52 53 53 guint delete_after; 54 gchar *root; 55 54 56 } CamelPOP3Store; 55 57 trunk/libtinymail-camel/tny-camel-pop-folder.c
r1383 r1384 50 50 static GObjectClass *parent_class = NULL; 51 51 52 52 #if 0 53 53 static void 54 54 tny_camel_pop_folder_refresh_impl (TnyFolder *self, GError **err, CamelOperationStatusFunc status_func) … … 188 188 } 189 189 190 190 191 static void 191 192 tny_camel_pop_folder_refresh (TnyFolder *self, GError **err) … … 433 434 return; 434 435 } 436 #endif 435 437 436 438 /** … … 465 467 object_class = (GObjectClass*) class; 466 468 469 /* 467 470 TNY_CAMEL_FOLDER_CLASS (class)->refresh_async_func = tny_camel_pop_folder_refresh_async; 468 TNY_CAMEL_FOLDER_CLASS (class)->refresh_func = tny_camel_pop_folder_refresh; 471 TNY_CAMEL_FOLDER_CLASS (class)->refresh_func = tny_camel_pop_folder_refresh; 472 */ 469 473 470 474 object_class->finalize = tny_camel_pop_folder_finalize; trunk/libtinymail-camel/tny-camel-pop-store-account.c
r1383 r1384 59 59 static GObjectClass *parent_class = NULL; 60 60 61 #if 0 61 62 static TnyFolder* 62 63 create_maildir (TnyCamelAccount *self, TnyCamelAccountPriv *apriv, const gchar *name, const gchar *url_string) … … 123 124 return NULL; 124 125 } 125 126 126 127 127 static void … … 150 150 } 151 151 152 #endif 153 152 154 static const gchar* 153 155 tny_camel_pop_store_account_get_url_string (TnyAccount *self) … … 172 174 tny_camel_pop_store_account_get_folders (TnyFolderStore *self, TnyList *list, TnyFolderStoreQuery *query, GError **err) 173 175 { 174 TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 175 176 g_assert (list != NULL); 176 177 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 178 TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self); 179 CamelException ex = CAMEL_EXCEPTION_INITIALISER; 180 CamelStore *store; 181 TnyCamelFolder *folder; 182 177 183 g_assert (TNY_IS_LIST (list)); 178 184 185 store = camel_session_get_store ((CamelSession*) apriv->session, 186 apriv->url_string, &ex); 187 188 if (camel_exception_is_set (&ex)) 189 { 190 g_set_error (err, TNY_FOLDER_STORE_ERROR, 191 TNY_FOLDER_STORE_ERROR_GET_FOLDERS, 192 camel_exception_get_description (&ex)); 193 camel_exception_clear (&ex); 194 195 if (store && CAMEL_IS_OBJECT (store)) 196 camel_object_unref (CAMEL_OBJECT (store)); 197 198 return; 199 } 200 201 g_assert (CAMEL_IS_STORE (store)); 202 203 folder = TNY_CAMEL_FOLDER (tny_camel_pop_folder_new ()); 204 205 _tny_camel_folder_set_id (folder, "INBOX"); 206 /* _tny_camel_folder_set_unread_count (folder, iter->unread); 207 _tny_camel_folder_set_all_count (folder, iter->total); */ 208 _tny_camel_folder_set_name (folder, "Inbox"); 209 priv->managed_folders = g_list_prepend (priv->managed_folders, folder); 210 _tny_camel_folder_set_account (folder, TNY_ACCOUNT (self)); 211 tny_list_prepend (list, G_OBJECT (folder)); 212 213 g_object_unref (G_OBJECT (folder)); 214 215 return; 216 217 218 #if 0 179 219 if (!priv->inbox) 180 220 tny_camel_pop_store_account_reconnect (TNY_CAMEL_ACCOUNT (self)); … … 206 246 207 247 return; 208 } 209 248 249 250 #endif 251 252 } 253 254 #if 0 210 255 static void 211 256 tny_camel_pop_store_account_get_folders_async (TnyFolderStore *self, TnyList *list, TnyGetFoldersCallback callback, TnyFolderStoreQuery *query, gpointer user_data) … … 235 280 } 236 281 282 #endif 237 283 238 284 … … 290 336 object_class = (GObjectClass*) class; 291 337 338 #if 0 292 339 TNY_CAMEL_ACCOUNT_CLASS (class)->reconnect_func = tny_camel_pop_store_account_reconnect; 340 #endif 341 293 342 TNY_CAMEL_ACCOUNT_CLASS (class)->get_url_string_func = tny_camel_pop_store_account_get_url_string; 294 343 TNY_CAMEL_ACCOUNT_CLASS (class)->set_url_string_func = tny_camel_pop_store_account_set_url_string; 295 344 TNY_CAMEL_ACCOUNT_CLASS (class)->add_option_func = tny_camel_pop_store_account_add_option; 296 345 #if 0 297 346 TNY_CAMEL_STORE_ACCOUNT_CLASS (class)->get_folders_async_func = tny_camel_pop_store_account_get_folders_async; 347 #endif 348 298 349 TNY_CAMEL_STORE_ACCOUNT_CLASS (class)->get_folders_func = tny_camel_pop_store_account_get_folders; 299 350 TNY_CAMEL_STORE_ACCOUNT_CLASS (class)->remove_folder_func = tny_camel_pop_store_account_remove_folder; trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c
r1383 r1384 400 400 account = TNY_ACCOUNT (tny_camel_pop_store_account_new ()); 401 401 else /* Unknown, create a generic one? */ 402 account = TNY_ACCOUNT (tny_camel_store_account_new ());402 account = TNY_ACCOUNT (tny_camel_store_account_new ()); 403 403 } 404 404
