aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog3
-rw-r--r--mail/component-factory.c50
-rw-r--r--mail/mail-callbacks.c4
3 files changed, 38 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 798526d67a..ecf10efbca 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,8 @@
2001-06-18 Jeffrey Stedfast <fejj@ximian.com>
+ * component-factory.c (destination_folder_handle_drop): Use a nice
+ switch statement and use the new enum values.
+
* mail-callbacks.c (list_add_addresses): Now takes a hash table of
already-used-recipients so that we don't get duplicates.
(mail_generate_reply): Pass in a rcpt_hash argument to
diff --git a/mail/component-factory.c b/mail/component-factory.c
index fc9c3649e7..303b29f443 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -66,14 +66,28 @@ char *evolution_dir;
static BonoboGenericFactory *component_factory = NULL;
static GHashTable *storages_hash;
+enum {
+ ACCEPTED_DND_TYPE_MESSAGE_RFC822,
+ ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE,
+};
+
static char *accepted_dnd_types[] = {
"message/rfc822", /* if we drag from nautilus or something... */
"x-evolution-message", /* if we drag from an evolution message list... */
NULL
};
+enum {
+ EXPORTED_DND_TYPE_TEXT_PLAIN,
+};
+
+static char *exported_dnd_types[] = {
+ "text/plain", /* we have to export to nautilus as text/plain or a uri-list */
+ NULL
+};
+
static const EvolutionShellComponentFolderType folder_types[] = {
- { "mail", "evolution-inbox.png", accepted_dnd_types, NULL },
+ { "mail", "evolution-inbox.png", accepted_dnd_types, exported_dnd_types },
{ "mailstorage", "evolution-inbox.png", NULL, NULL },
{ "vtrash", "evolution-trash.png", NULL, NULL },
{ NULL, NULL, NULL, NULL }
@@ -256,6 +270,7 @@ get_dnd_selection (EvolutionShellComponent *shell_component,
void *closure)
{
g_print ("should get dnd selection for %s\n", physical_uri);
+
return NULL;
}
@@ -320,20 +335,21 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
const GNOME_Evolution_ShellComponentDnd_Data *data,
gpointer user_data)
{
+ char *url, *name, *in, *inptr, *inend;
gboolean retval = FALSE;
+ CamelFolder *source;
+ CamelStream *stream;
+ GPtrArray *uids;
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
return FALSE; /* we can't create links */
g_print ("in destination_folder_handle_drop (%s)\n", physical_uri);
- if (data->format == 0) {
- /* message/rfc822 */
- CamelFolder *folder;
- CamelStream *stream;
-
- folder = mail_tool_uri_to_folder (physical_uri, NULL);
- if (!folder)
+ switch (data->format) {
+ case ACCEPTED_DND_TYPE_MESSAGE_RFC822:
+ source = mail_tool_uri_to_folder (physical_uri, NULL);
+ if (!source)
return FALSE;
/* write the message(s) out to a CamelStream so we can use it */
@@ -341,14 +357,11 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
camel_stream_write (stream, data->bytes._buffer, data->bytes._length);
camel_stream_reset (stream);
- retval = message_rfc822_dnd (folder, stream);
+ retval = message_rfc822_dnd (source, stream);
camel_object_unref (CAMEL_OBJECT (stream));
- } else {
- /* x-evolution-message */
- char *url, *name, *in, *inptr, *inend;
- CamelFolder *source;
- GPtrArray *uids;
-
+ camel_object_unref (CAMEL_OBJECT (source));
+ break;
+ case ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE:
/* format: "url folder_name uid1\0uid2\0uid3\0...\0uidn" */
in = data->bytes._buffer;
@@ -384,10 +397,13 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
mail_do_transfer_messages (source, uids,
action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
physical_uri);
+
+ camel_object_unref (CAMEL_OBJECT (source));
+ break;
+ default:
+ break;
}
- camel_object_unref (CAMEL_OBJECT (folder));
-
return retval;
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 0e3faa0711..0bfd8b7305 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -504,7 +504,7 @@ list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *
}
if (notme && !g_hash_table_lookup (rcpt_hash, addr)) {
- g_hash_table_insert (rcpt_hash, g_strdup (addr), GINT_TO_POINTER (1));
+ g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1));
list = g_list_append (list, full);
} else
g_free (full);
@@ -658,7 +658,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
/* Get the Reply-To address so we can ignore references to it in the Cc: list */
camel_internet_address_get (reply_to, 0, NULL, &reply_addr);
- g_hash_table_insert (rcpt_hash, reply_addr, GINT_TO_POINTER (1));
+ g_hash_table_insert (rcpt_hash, (char *) reply_addr, GINT_TO_POINTER (1));
to = g_list_append (to, camel_address_format (CAMEL_ADDRESS (reply_to)));
}