Updates for CamelStore changes, small memory leak fixes. (lookup_folder):
* mail-local.c: Updates for CamelStore changes, small memory leak fixes. (lookup_folder): Removed (and moved into the reconfigure code) since this method no longer exists in CamelStore. (do_reconfigure_folder, etc): Update the info in the MailLocalStore after reconfiguring. (mail_local_lookup_folder): Removed * local-config.glade: fix padding of the label_format * message-list.c (ml_tree_value_at): Don't keep message infos reffed across calls, since this can cause badness after a reconfigure. Instead, just strdup the needed values and free those on the next call. * mail-tools.c (mail_tool_get_root_of_store): Unused, remove. (mail_tool_get_inbox): use camel_store_get_inbox. * evolution-outlook-importer.c (load_file_fn): * evolution-mbox-importer.c (load_file_fn): Use mail_tool_get_local_inbox() instead of mail_importer_get_folder() * mail-importer.c (mail_importer_get_folder): Removed svn path=/trunk/; revision=8147
This commit is contained in:
@ -1,3 +1,29 @@
|
||||
2001-02-09 Dan Winship <danw@ximian.com>
|
||||
|
||||
* mail-local.c: Updates for CamelStore changes, small memory leak
|
||||
fixes.
|
||||
(lookup_folder): Removed (and moved into the reconfigure code)
|
||||
since this method no longer exists in CamelStore.
|
||||
(do_reconfigure_folder, etc): Update the info in the
|
||||
MailLocalStore after reconfiguring.
|
||||
(mail_local_lookup_folder): Removed
|
||||
|
||||
* local-config.glade: fix padding of the label_format
|
||||
|
||||
* message-list.c (ml_tree_value_at): Don't keep message infos
|
||||
reffed across calls, since this can cause badness after a
|
||||
reconfigure. Instead, just strdup the needed values and free those
|
||||
on the next call.
|
||||
|
||||
* mail-tools.c (mail_tool_get_root_of_store): Unused, remove.
|
||||
(mail_tool_get_inbox): use camel_store_get_inbox.
|
||||
|
||||
* evolution-outlook-importer.c (load_file_fn):
|
||||
* evolution-mbox-importer.c (load_file_fn): Use
|
||||
mail_tool_get_local_inbox() instead of mail_importer_get_folder()
|
||||
|
||||
* mail-importer.c (mail_importer_get_folder): Removed
|
||||
|
||||
2001-02-08 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-callbacks.c (mail_generate_reply): New location for this
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include <importer/GNOME_Evolution_Importer.h>
|
||||
|
||||
#include "mail-importer.h"
|
||||
#include "mail-tools.h"
|
||||
|
||||
#include <camel/camel.h>
|
||||
|
||||
@ -183,7 +184,7 @@ load_file_fn (EvolutionImporter *eimporter,
|
||||
}
|
||||
|
||||
importer->mstream = NULL;
|
||||
importer->folder = mail_importer_get_folder ("Inbox", NULL);
|
||||
importer->folder = mail_tool_get_local_inbox (NULL);
|
||||
|
||||
if (importer->folder == NULL) {
|
||||
g_print ("Bad folder\n");
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include <importer/GNOME_Evolution_Importer.h>
|
||||
|
||||
#include "mail-importer.h"
|
||||
#include "mail-tools.h"
|
||||
|
||||
#include <camel/camel-exception.h>
|
||||
|
||||
@ -253,7 +254,7 @@ load_file_fn (EvolutionImporter *eimporter,
|
||||
|
||||
importer->mstream = NULL;
|
||||
|
||||
importer->folder = mail_importer_get_folder ("Inbox", NULL);
|
||||
importer->folder = mail_tool_get_local_inbox (NULL);
|
||||
|
||||
if (importer->folder == NULL){
|
||||
g_warning ("Bad folder");
|
||||
|
||||
@ -152,7 +152,7 @@
|
||||
<wrap>False</wrap>
|
||||
<xalign>7.45058e-09</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<xpad>8</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
|
||||
@ -87,42 +87,6 @@ mail_importer_add_line (MailImporter *importer,
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
/**
|
||||
* mail_importer_get_folder:
|
||||
* @name: The folder name.
|
||||
* *opt_ex: A #CamelException, or NULL if you don't care about errors.
|
||||
*
|
||||
* Gets the local folder called @name.
|
||||
*
|
||||
* Returns: A CamelFolder (which needs to be unrefed when you are done with it)
|
||||
* on success, or NULL on fail. A more detailed error is given in @opt_ex, if
|
||||
* @opt_ex is not NULL.
|
||||
*/
|
||||
CamelFolder *
|
||||
mail_importer_get_folder (const char *name,
|
||||
CamelException *opt_ex)
|
||||
{
|
||||
CamelFolder *folder;
|
||||
CamelException *real_ex;
|
||||
char *path, *tmp;
|
||||
|
||||
if (opt_ex != NULL)
|
||||
real_ex = opt_ex;
|
||||
else
|
||||
real_ex = camel_exception_new ();
|
||||
|
||||
g_print ("Evolution_dir: %s\n", evolution_dir);
|
||||
tmp = g_concat_dir_and_file (evolution_dir, "local");
|
||||
path = g_concat_dir_and_file (tmp, name);
|
||||
g_free (tmp);
|
||||
|
||||
folder = mail_local_lookup_folder (path + 1, real_ex);
|
||||
if (opt_ex == NULL)
|
||||
camel_exception_free (real_ex);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* mail_importer_init:
|
||||
*
|
||||
|
||||
@ -40,6 +40,4 @@ void mail_importer_init (void);
|
||||
void mail_importer_add_line (MailImporter *importer,
|
||||
const char *str,
|
||||
gboolean finished);
|
||||
CamelFolder *mail_importer_get_folder (const char *name,
|
||||
CamelException *opt_ex);
|
||||
#endif
|
||||
|
||||
1080
mail/mail-local.c
1080
mail/mail-local.c
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,4 @@ void mail_local_storage_startup (EvolutionShellClient *shellclient,
|
||||
|
||||
void mail_local_reconfigure_folder (FolderBrowser *fb);
|
||||
|
||||
CamelFolder *mail_local_lookup_folder (const char *name,
|
||||
CamelException *ex);
|
||||
#endif
|
||||
|
||||
@ -557,9 +557,14 @@ mail_operations_terminate (void)
|
||||
memset (&clur, 0, sizeof (closure_t));
|
||||
clur.spec = NULL;
|
||||
|
||||
pipe_write (DISPATCH_WRITER, &clur, sizeof (closure_t));
|
||||
/* DISPATCH_WRITER will only have been initialized if any
|
||||
* calls have been made using the old thread system.
|
||||
*/
|
||||
if (DISPATCH_WRITER != -1) {
|
||||
pipe_write (DISPATCH_WRITER, &clur, sizeof (closure_t));
|
||||
|
||||
close (DISPATCH_WRITER);
|
||||
close (DISPATCH_WRITER);
|
||||
}
|
||||
close (MAIN_READER);
|
||||
}
|
||||
|
||||
|
||||
@ -106,14 +106,6 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*camel_service_connect (CAMEL_SERVICE (store), ex);
|
||||
*if (camel_exception_is_set (ex)) {
|
||||
* camel_object_unref (CAMEL_OBJECT (store));
|
||||
* mail_tool_camel_lock_down();
|
||||
* return NULL;
|
||||
*}
|
||||
*/
|
||||
|
||||
folder = camel_store_get_folder (store, name, flags, ex);
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
mail_tool_camel_lock_down();
|
||||
@ -161,8 +153,22 @@ mail_tool_get_local_inbox (CamelException *ex)
|
||||
CamelFolder *
|
||||
mail_tool_get_inbox (const gchar *url, CamelException *ex)
|
||||
{
|
||||
/* FIXME: should be smarter? get_default_folder, etc */
|
||||
return mail_tool_get_folder_from_urlname (url, "inbox", 0, ex);
|
||||
CamelStore *store;
|
||||
CamelFolder *folder;
|
||||
|
||||
mail_tool_camel_lock_up();
|
||||
|
||||
store = camel_session_get_store (session, url, ex);
|
||||
if (!store) {
|
||||
mail_tool_camel_lock_down();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
folder = camel_store_get_inbox (store, ex);
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
mail_tool_camel_lock_down();
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
@ -295,35 +301,6 @@ mail_tool_filter_get_folder_func (CamelFilterDriver *d, const char *uri, void *d
|
||||
return mail_tool_uri_to_folder_noex (uri);
|
||||
}
|
||||
|
||||
CamelFolder *
|
||||
mail_tool_get_root_of_store (const char *source_uri, CamelException *ex)
|
||||
{
|
||||
CamelStore *store;
|
||||
CamelFolder *folder;
|
||||
|
||||
mail_tool_camel_lock_up();
|
||||
|
||||
store = camel_session_get_store (session, source_uri, ex);
|
||||
if (!store) {
|
||||
mail_tool_camel_lock_down ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*camel_service_connect (CAMEL_SERVICE (store), ex);
|
||||
*if (camel_exception_is_set (ex)) {
|
||||
* camel_object_unref (CAMEL_OBJECT (store));
|
||||
* mail_tool_camel_lock_down();
|
||||
* return NULL;
|
||||
*}
|
||||
*/
|
||||
|
||||
folder = camel_store_get_root_folder (store, ex);
|
||||
camel_object_unref (CAMEL_OBJECT (store));
|
||||
mail_tool_camel_lock_down();
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
CamelFolder *
|
||||
mail_tool_uri_to_folder (const char *uri, CamelException *ex)
|
||||
{
|
||||
|
||||
@ -75,10 +75,6 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg);
|
||||
CamelMimePart *
|
||||
mail_tool_make_message_attachment (CamelMimeMessage *message);
|
||||
|
||||
/* Get the root folder of the store specified by @source_uri */
|
||||
CamelFolder *
|
||||
mail_tool_get_root_of_store (const char *source_uri, CamelException *ex);
|
||||
|
||||
/* Parse the ui into a real CamelFolder any way we know how. */
|
||||
CamelFolder *
|
||||
mail_tool_uri_to_folder (const char *uri, CamelException *ex);
|
||||
|
||||
@ -774,8 +774,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
MessageList *message_list = model_data;
|
||||
char *uid;
|
||||
static char *saved;
|
||||
CamelMessageInfo *info;
|
||||
static CamelMessageInfo *msg_info;
|
||||
CamelMessageInfo *msg_info;
|
||||
void *value;
|
||||
|
||||
/* simlated(tm) static dynamic memory (sigh) */
|
||||
if (saved) {
|
||||
@ -795,23 +795,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
}
|
||||
uid = id_uid(uid);
|
||||
|
||||
/* we need ot keep the msg_info ref'd as we return the data, sigh.
|
||||
msg_info = camel_folder_get_message_info (message_list->folder, uid);
|
||||
|
||||
Well, since we have it around, also check to see if its the same
|
||||
one each call, and save the folder lookup */
|
||||
if (msg_info == NULL || strcmp(camel_message_info_uid(msg_info), uid) != 0) {
|
||||
/* FIXME: what if the folder changes? Nothing sets the folder
|
||||
yet, but this probably means we need to cache this inside the ml itself */
|
||||
if (msg_info)
|
||||
camel_folder_free_message_info(message_list->folder, msg_info);
|
||||
|
||||
msg_info = camel_folder_get_message_info (message_list->folder, uid);
|
||||
if (msg_info == NULL) {
|
||||
g_warning("UID for message-list not found in folder: %s", uid);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
switch (col){
|
||||
case COL_MESSAGE_STATUS: {
|
||||
ETreePath *child;
|
||||
@ -826,15 +811,17 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
}
|
||||
|
||||
if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
|
||||
return GINT_TO_POINTER (2);
|
||||
value = GINT_TO_POINTER (2);
|
||||
else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
|
||||
return GINT_TO_POINTER (1);
|
||||
value = GINT_TO_POINTER (1);
|
||||
else
|
||||
return GINT_TO_POINTER (0);
|
||||
value = GINT_TO_POINTER (0);
|
||||
break;
|
||||
}
|
||||
|
||||
case COL_FLAGGED:
|
||||
return (void *)((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0);
|
||||
value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0);
|
||||
break;
|
||||
|
||||
case COL_SCORE:
|
||||
{
|
||||
@ -845,32 +832,44 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
if (tag)
|
||||
score = atoi (tag);
|
||||
|
||||
return GINT_TO_POINTER (score);
|
||||
value = GINT_TO_POINTER (score);
|
||||
break;
|
||||
}
|
||||
|
||||
case COL_ATTACHMENT:
|
||||
return (void *)((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
|
||||
|
||||
value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
|
||||
break;
|
||||
|
||||
case COL_FROM:
|
||||
return (char *)camel_message_info_from(msg_info);
|
||||
saved = g_strdup (camel_message_info_from(msg_info));
|
||||
value = saved;
|
||||
break;
|
||||
|
||||
case COL_SUBJECT:
|
||||
return (char *)camel_message_info_subject(msg_info);
|
||||
saved = g_strdup (camel_message_info_subject(msg_info));
|
||||
value = saved;
|
||||
break;
|
||||
|
||||
case COL_SENT:
|
||||
return GINT_TO_POINTER (msg_info->date_sent);
|
||||
value = GINT_TO_POINTER (msg_info->date_sent);
|
||||
break;
|
||||
|
||||
case COL_RECEIVED:
|
||||
return GINT_TO_POINTER (msg_info->date_received);
|
||||
value = GINT_TO_POINTER (msg_info->date_received);
|
||||
break;
|
||||
|
||||
case COL_TO:
|
||||
return (char *)camel_message_info_to(msg_info);
|
||||
saved = g_strdup (camel_message_info_to(msg_info));
|
||||
value = saved;
|
||||
break;
|
||||
|
||||
case COL_SIZE:
|
||||
return GINT_TO_POINTER (msg_info->size);
|
||||
value = GINT_TO_POINTER (msg_info->size);
|
||||
break;
|
||||
|
||||
case COL_DELETED:
|
||||
return (void *)((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
|
||||
value = GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
|
||||
break;
|
||||
|
||||
case COL_UNREAD: {
|
||||
ETreePath *child;
|
||||
@ -881,7 +880,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
return (void *)subtree_unread(message_list, child);
|
||||
}
|
||||
|
||||
return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
|
||||
value = GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
|
||||
break;
|
||||
}
|
||||
case COL_COLOUR:
|
||||
{
|
||||
@ -889,16 +889,21 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
|
||||
colour = camel_tag_get ((CamelTag **) &msg_info->user_tags,
|
||||
"colour");
|
||||
if (colour)
|
||||
return (void *)colour;
|
||||
else if (msg_info->flags & CAMEL_MESSAGE_FLAGGED)
|
||||
if (colour) {
|
||||
saved = g_strdup (colour);
|
||||
value = saved;
|
||||
} else if (msg_info->flags & CAMEL_MESSAGE_FLAGGED)
|
||||
/* FIXME: extract from the xpm somehow. */
|
||||
return "#A7453E";
|
||||
value = "#A7453E";
|
||||
else
|
||||
return NULL;
|
||||
value = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
camel_folder_free_message_info(message_list->folder, msg_info);
|
||||
return value;
|
||||
|
||||
g_assert_not_reached ();
|
||||
|
||||
fake:
|
||||
@ -940,10 +945,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
if ( (child = e_tree_model_node_get_first_child(etm, path))
|
||||
&& (uid = e_tree_model_node_get_data (etm, child))
|
||||
&& id_is_uid(uid)
|
||||
&& (info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) {
|
||||
&& (msg_info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) {
|
||||
/* well, we could scan more children, build up a (more accurate) list, but this should do ok */
|
||||
saved = g_strdup_printf(_("%s, et al."), camel_message_info_from(info));
|
||||
camel_folder_free_message_info(message_list->folder, info);
|
||||
saved = g_strdup_printf(_("%s, et al."), camel_message_info_from(msg_info));
|
||||
camel_folder_free_message_info(message_list->folder, msg_info);
|
||||
} else {
|
||||
return _("<unknown>");
|
||||
}
|
||||
@ -956,10 +961,10 @@ ml_tree_value_at (ETreeModel *etm, ETreePath *path, int col, void *model_data)
|
||||
if ( (child = e_tree_model_node_get_first_child(etm, path))
|
||||
&& (uid = e_tree_model_node_get_data (etm, child))
|
||||
&& id_is_uid(uid)
|
||||
&& (info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) {
|
||||
&& (msg_info = camel_folder_get_message_info (message_list->folder, id_uid(uid))) ) {
|
||||
/* well, we could scan more children, build up a (more accurate) list, but this should do ok */
|
||||
saved = g_strdup_printf(_("%s, et al."), camel_message_info_to(info));
|
||||
camel_folder_free_message_info(message_list->folder, info);
|
||||
saved = g_strdup_printf(_("%s, et al."), camel_message_info_to(msg_info));
|
||||
camel_folder_free_message_info(message_list->folder, msg_info);
|
||||
} else {
|
||||
return _("<unknown>");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user