aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-09 12:10:54 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-09 12:10:54 +0800
commit936f363f4fb199da202d9c3e07a68ee369536fb4 (patch)
tree732de024a37bf8c053f1e005bd5693bf38cd7e80 /composer
parent91a2ff89c4ffe82aa07be175fb623b329d3d6a61 (diff)
downloadgsoc2013-evolution-936f363f4fb199da202d9c3e07a68ee369536fb4.tar.gz
gsoc2013-evolution-936f363f4fb199da202d9c3e07a68ee369536fb4.tar.zst
gsoc2013-evolution-936f363f4fb199da202d9c3e07a68ee369536fb4.zip
Originally was corba_recipientlist_to_glist. (impl_Composer_set_headers):
2001-09-08 Jon Trowbridge <trow@ximian.com> * evolution-composer.c (corba_recipientlist_to_destv): Originally was corba_recipientlist_to_glist. (impl_Composer_set_headers): Use corba_recipientlist_to_destv, new destination-based api. * e-msg-composer.c (build_message): Get rid of that 'sending' stuff. That was a bad idea. (e_msg_composer_new_with_message): Apply the revised api and work with vectors of destinations rather than just lists. (e_msg_composer_get_recipients): Added. Returns the full set of recipient destinations in a vector. * e-msg-composer-hdrs.c: Removed free_destv function. We use e_destination_freev instead. (e_msg_composer_hdrs_get_to): Changed to return a vector of EDestinations. This function now works. (e_msg_composer_hdrs_get_cc): Ditto. (e_msg_composer_hdrs_get_bcc): Ditto. (e_msg_composer_hdrs_get_recipients): Added. Returns a vector of EDestinations that is the union of the to, cc and bcc lines. (e_msg_composer_hdrs_set_to): Changed to take a vector of EDestinations, rather than a GList. (e_msg_composer_hdrs_set_cc): Ditto. (e_msg_composer_hdrs_set_bcc): Ditto. (e_msg_composer_hdrs_to_message): Use our new, improved API, rather than a bunch of poking around in BonoboPropertyBags, etc. svn path=/trunk/; revision=12711
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog29
-rw-r--r--composer/e-msg-composer-hdrs.c197
-rw-r--r--composer/e-msg-composer-hdrs.h20
-rw-r--r--composer/e-msg-composer.c99
-rw-r--r--composer/e-msg-composer.h11
-rw-r--r--composer/evolution-composer.c57
6 files changed, 239 insertions, 174 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index ebc10d7f6f..840d286115 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,32 @@
+2001-09-08 Jon Trowbridge <trow@ximian.com>
+
+ * evolution-composer.c (corba_recipientlist_to_destv): Originally
+ was corba_recipientlist_to_glist.
+ (impl_Composer_set_headers): Use corba_recipientlist_to_destv, new
+ destination-based api.
+
+ * e-msg-composer.c (build_message): Get rid of that 'sending'
+ stuff. That was a bad idea.
+ (e_msg_composer_new_with_message): Apply the revised api and work
+ with vectors of destinations rather than just lists.
+ (e_msg_composer_get_recipients): Added. Returns the full set of
+ recipient destinations in a vector.
+
+ * e-msg-composer-hdrs.c: Removed free_destv function. We use
+ e_destination_freev instead.
+ (e_msg_composer_hdrs_get_to): Changed to return a vector of
+ EDestinations. This function now works.
+ (e_msg_composer_hdrs_get_cc): Ditto.
+ (e_msg_composer_hdrs_get_bcc): Ditto.
+ (e_msg_composer_hdrs_get_recipients): Added. Returns a vector of
+ EDestinations that is the union of the to, cc and bcc lines.
+ (e_msg_composer_hdrs_set_to): Changed to take a vector of
+ EDestinations, rather than a GList.
+ (e_msg_composer_hdrs_set_cc): Ditto.
+ (e_msg_composer_hdrs_set_bcc): Ditto.
+ (e_msg_composer_hdrs_to_message): Use our new, improved API, rather
+ than a bunch of poking around in BonoboPropertyBags, etc.
+
2001-09-07 Dan Winship <danw@ximian.com>
* e-msg-composer-hdrs.c (set_recipients_from_destv): Remove some
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index b542304717..231c036e90 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -44,7 +44,6 @@
#include <gal/widgets/e-unicode.h>
#include <camel/camel.h>
-#include <e-destination.h>
#include "e-msg-composer-hdrs.h"
#include "mail/mail-config.h"
#include "addressbook/backend/ebook/e-book-util.h"
@@ -677,7 +676,7 @@ set_recipients_from_destv (CamelMimeMessage *msg,
seen_hidden_list = TRUE;
}
- camel_address_unformat (CAMEL_ADDRESS (target),text_addr);
+ camel_address_unformat (CAMEL_ADDRESS (target), text_addr);
}
}
}
@@ -711,29 +710,12 @@ set_recipients_from_destv (CamelMimeMessage *msg,
camel_object_unref (CAMEL_OBJECT (bcc_addr));
}
-static void
-free_destv (EDestination **destv, gboolean should_we_touch)
-{
- gint i;
-
- if (destv) {
- for (i = 0; destv[i] != NULL; ++i) {
- if (should_we_touch)
- e_destination_touch (destv[i]);
- gtk_object_unref (GTK_OBJECT (destv[i]));
- }
- g_free (destv);
- }
-}
-
void
e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg,
- gboolean sending)
+ CamelMimeMessage *msg)
{
CamelInternetAddress *addr;
gchar *subject;
- gchar *str = NULL;
EDestination **to_destv, **cc_destv, **bcc_destv;
g_return_if_fail (hdrs != NULL);
@@ -755,53 +737,20 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
camel_object_unref (CAMEL_OBJECT (addr));
}
- /* Get string of destinations from each entry. */
-
- bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", &str, NULL);
- g_message ("to str: %s", str);
- to_destv = e_destination_importv (str);
- g_free (str);
-
- bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", &str, NULL);
- g_message ("cc str: %s", str);
- cc_destv = e_destination_importv (str);
- g_free (str);
-
- bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", &str, NULL);
- g_message ("bcc str: %s", str);
- bcc_destv = e_destination_importv (str);
- g_free (str);
+ to_destv = e_msg_composer_hdrs_get_to (hdrs);
+ cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
+ bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
/* Attach destinations to the message. */
set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv);
- /* Only touch the destinations (boosting the use score) if we are sending */
- free_destv (to_destv, sending);
- free_destv (cc_destv, sending);
- free_destv (bcc_destv, sending);
+ e_destination_freev (to_destv);
+ e_destination_freev (cc_destv);
+ e_destination_freev (bcc_destv);
}
-static void
-set_entry (BonoboWidget *bonobo_widget,
- const GList *list)
-{
- GString *string;
- const GList *p;
-
- string = g_string_new ("");
- for (p = list; p != NULL; p = p->next) {
- if (string->str[0] != '\0')
- g_string_append (string, ", ");
- g_string_append (string, p->data);
- }
-
- bonobo_widget_set_property (BONOBO_WIDGET (bonobo_widget), "text", string->str, NULL);
-
- g_string_free (string, TRUE);
-}
-
/* FIXME: yea, this could be better... but it's doubtful it'll be used much */
void
@@ -853,35 +802,40 @@ e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
"text", reply_to, NULL);
}
-/* FIXME: these shouldn't take GLists, they should take CamelInternetAddress's */
void
e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- const GList *to_list)
+ EDestination **to_destv)
{
- g_return_if_fail (hdrs != NULL);
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- set_entry (BONOBO_WIDGET (hdrs->priv->to.entry), to_list);
+
+ str = e_destination_exportv (to_destv);
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", str, NULL);
+ g_free (str);
}
void
e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- const GList *cc_list)
+ EDestination **cc_destv)
{
- g_return_if_fail (hdrs != NULL);
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- set_entry (BONOBO_WIDGET (hdrs->priv->cc.entry), cc_list);
+ str = e_destination_exportv (cc_destv);
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", str, NULL);
+ g_free (str);
}
void
e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- const GList *bcc_list)
+ EDestination **bcc_destv)
{
- g_return_if_fail (hdrs != NULL);
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- set_entry (BONOBO_WIDGET (hdrs->priv->bcc.entry), bcc_list);
+
+ str = e_destination_exportv (bcc_destv);
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", str, NULL);
+ g_free (str);
}
void
@@ -948,40 +902,103 @@ e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs)
return addr;
}
-/* FIXME this is currently unused and broken. */
-GList *
+EDestination **
e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
{
- g_return_val_if_fail (hdrs != NULL, NULL);
+ gchar *str = NULL;
+ EDestination **destv = NULL;
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", &str, NULL);
+
+ if (str != NULL) {
+ destv = e_destination_importv (str);
+ g_free (str);
+ }
- g_assert_not_reached ();
-
- return NULL;
+ return destv;
}
-/* FIXME this is currently unused and broken. */
-GList *
+EDestination **
e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs)
{
- g_return_val_if_fail (hdrs != NULL, NULL);
+ gchar *str = NULL;
+ EDestination **destv = NULL;
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- g_assert_not_reached ();
-
- return NULL;
+
+ bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", &str, NULL);
+
+ if (str != NULL) {
+ destv = e_destination_importv (str);
+ g_free (str);
+ }
+
+ return destv;
}
-/* FIXME this is currently unused and broken. */
-GList *
+EDestination **
e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs)
{
- g_return_val_if_fail (hdrs != NULL, NULL);
+ gchar *str = NULL;
+ EDestination **destv = NULL;
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", &str, NULL);
+
+ if (str != NULL) {
+ destv = e_destination_importv (str);
+ g_free (str);
+ }
+
+ return destv;
+}
+
+EDestination **
+e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs)
+{
+ EDestination **to_destv;
+ EDestination **cc_destv;
+ EDestination **bcc_destv;
+ EDestination **recip_destv;
+ gint i, j, N;
- g_assert_not_reached ();
-
- return NULL;
+ g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ to_destv = e_msg_composer_hdrs_get_to (hdrs);
+ cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
+ bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
+
+ N = 0;
+
+ for (i = 0; to_destv && to_destv[i] != NULL; ++i, ++N);
+ for (i = 0; cc_destv && cc_destv[i] != NULL; ++i, ++N);
+ for (i = 0; bcc_destv && bcc_destv[i] != NULL; ++i, ++N);
+
+ if (N == 0)
+ return NULL;
+
+ recip_destv = g_new (EDestination *, N+1);
+
+ j = 0;
+
+ for (i = 0; to_destv && to_destv[i] != NULL; ++i, ++j)
+ recip_destv[j] = to_destv[i];
+ for (i = 0; cc_destv && cc_destv[i] != NULL; ++i, ++j)
+ recip_destv[j] = cc_destv[i];
+ for (i = 0; bcc_destv && bcc_destv[i] != NULL; ++i, ++j)
+ recip_destv[j] = bcc_destv[i];
+
+ g_assert (j == N);
+ recip_destv[j] = NULL;
+
+ g_free (to_destv);
+ g_free (cc_destv);
+ g_free (bcc_destv);
+
+ return recip_destv;
}
char *
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index b3a968920b..15ad478497 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -26,6 +26,7 @@
#include <gtk/gtktable.h>
#include <camel/camel-mime-message.h>
+#include <addressbook/backend/ebook/e-destination.h>
#include <mail/mail-config.h>
#ifdef __cplusplus
@@ -79,28 +80,29 @@ GtkType e_msg_composer_hdrs_get_type (void);
GtkWidget *e_msg_composer_hdrs_new (gint visible_flags);
void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg,
- gboolean sending);
+ CamelMimeMessage *msg);
void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
const char *account_name);
void e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
const char *reply_to);
void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- const GList *to_list);
+ EDestination **to_destv);
void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- const GList *cc_list);
+ EDestination **cc_destv);
void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- const GList *bcc_list);
+ EDestination **bcc_destv);
void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
const char *subject);
CamelInternetAddress *e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs);
CamelInternetAddress *e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
-char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
+
+EDestination **e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
+EDestination **e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
+EDestination **e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
+EDestination **e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs);
+char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index dbb06de932..200205a1ad 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -120,7 +120,6 @@ static GnomeAppClass *parent_class = NULL;
/* local prototypes */
static GList *add_recipients (GList *list, const char *recips, gboolean decode);
-static void free_recipients (GList *list);
static void handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth);
static void message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream);
@@ -289,7 +288,7 @@ add_inlined_images (EMsgComposer *composer, CamelMultipart *multipart)
* composed in `composer'.
*/
static CamelMimeMessage *
-build_message (EMsgComposer *composer, gboolean sending)
+build_message (EMsgComposer *composer)
{
EMsgComposerAttachmentBar *attachment_bar =
E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar);
@@ -310,7 +309,7 @@ build_message (EMsgComposer *composer, gboolean sending)
return NULL;
new = camel_mime_message_new ();
- e_msg_composer_hdrs_to_message (hdrs, new, sending);
+ e_msg_composer_hdrs_to_message (hdrs, new);
for (i = 0; i < composer->extra_hdr_names->len; i++) {
camel_medium_add_header (CAMEL_MEDIUM (new),
composer->extra_hdr_names->pdata[i],
@@ -2588,6 +2587,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
{
const CamelInternetAddress *to, *cc, *bcc;
GList *To = NULL, *Cc = NULL, *Bcc = NULL;
+ EDestination **Tov, **Ccv, **Bccv;
const char *format, *subject, *account_name;
CamelContentType *content_type;
struct _header_raw *headers;
@@ -2611,27 +2611,44 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
const char *name, *addr;
if (camel_internet_address_get (to, i, &name, &addr)) {
- To = g_list_append (To, camel_internet_address_format_address (name, addr));
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+ To = g_list_append (To, dest);
}
}
+ Tov = e_destination_list_to_vector (To);
+ g_list_free (To);
len = CAMEL_ADDRESS (cc)->addresses->len;
for (i = 0; i < len; i++) {
const char *name, *addr;
if (camel_internet_address_get (cc, i, &name, &addr)) {
- Cc = g_list_append (Cc, camel_internet_address_format_address (name, addr));
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+ Cc = g_list_append (Cc, dest);
}
}
+ Ccv = e_destination_list_to_vector (Cc);
+ g_list_free (Cc);
len = CAMEL_ADDRESS (bcc)->addresses->len;
for (i = 0; i < len; i++) {
const char *name, *addr;
if (camel_internet_address_get (bcc, i, &name, &addr)) {
- Bcc = g_list_append (Bcc, camel_internet_address_format_address (name, addr));
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+ Bcc = g_list_append (Bcc, dest);
}
}
+
+ Bccv = e_destination_list_to_vector (Bcc);
+ g_list_free (Bcc);
+
/* Restore the Account preference */
account_name = camel_medium_get_header (CAMEL_MEDIUM (msg), "X-Evolution-Account");
@@ -2641,11 +2658,11 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
camel_medium_remove_header (CAMEL_MEDIUM (msg), "X-Evolution-Account");
}
- e_msg_composer_set_headers (new, account_name, To, Cc, Bcc, subject);
+ e_msg_composer_set_headers (new, account_name, Tov, Ccv, Bccv, subject);
- free_recipients (To);
- free_recipients (Cc);
- free_recipients (Bcc);
+ e_destination_freev (Tov);
+ e_destination_freev (Ccv);
+ e_destination_freev (Bccv);
/* Restore the format editing preference */
format = camel_medium_get_header (CAMEL_MEDIUM (msg), "X-Evolution-Format");
@@ -2752,26 +2769,17 @@ add_recipients (GList *list, const char *recips, gboolean decode)
for (i = 0; i < num; i++) {
if (camel_internet_address_get (cia, i, &name, &addr)) {
- char *str;
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
- str = camel_internet_address_format_address (name, addr);
- list = g_list_append (list, str);
+ list = g_list_append (list, dest);
}
}
return list;
}
-static void
-free_recipients (GList *list)
-{
- GList *l;
-
- for (l = list; l; l = l->next)
- g_free (l->data);
- g_list_free (list);
-}
-
/**
* e_msg_composer_new_from_url:
* @url: a mailto URL
@@ -2785,6 +2793,7 @@ e_msg_composer_new_from_url (const char *url)
EMsgComposer *composer;
EMsgComposerHdrs *hdrs;
GList *to = NULL, *cc = NULL, *bcc = NULL;
+ EDestination **tov, **ccv, **bccv;
char *subject = NULL, *body = NULL;
const char *p, *header;
int len, clen;
@@ -2844,13 +2853,24 @@ e_msg_composer_new_from_url (const char *url)
}
}
+ tov = e_destination_list_to_vector (to);
+ ccv = e_destination_list_to_vector (cc);
+ bccv = e_destination_list_to_vector (bcc);
+
+ g_list_free (to);
+ g_list_free (cc);
+ g_list_free (bcc);
+
hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
- e_msg_composer_hdrs_set_to (hdrs, to);
- free_recipients (to);
- e_msg_composer_hdrs_set_cc (hdrs, cc);
- free_recipients (cc);
- e_msg_composer_hdrs_set_bcc (hdrs, bcc);
- free_recipients (bcc);
+
+ e_msg_composer_hdrs_set_to (hdrs, tov);
+ e_msg_composer_hdrs_set_cc (hdrs, ccv);
+ e_msg_composer_hdrs_set_bcc (hdrs, bccv);
+
+ e_destination_freev (tov);
+ e_destination_freev (ccv);
+ e_destination_freev (bccv);
+
if (subject) {
e_msg_composer_hdrs_set_subject (hdrs, subject);
g_free (subject);
@@ -2898,9 +2918,9 @@ e_msg_composer_show_attachments (EMsgComposer *composer,
void
e_msg_composer_set_headers (EMsgComposer *composer,
const char *from,
- const GList *to,
- const GList *cc,
- const GList *bcc,
+ EDestination **to,
+ EDestination **cc,
+ EDestination **bcc,
const char *subject)
{
EMsgComposerHdrs *hdrs;
@@ -2986,12 +3006,11 @@ e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment)
* Return value: A pointer to the new CamelMimeMessage object
**/
CamelMimeMessage *
-e_msg_composer_get_message (EMsgComposer *composer, gboolean sending)
+e_msg_composer_get_message (EMsgComposer *composer)
{
- g_return_val_if_fail (composer != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
- return build_message (composer, sending);
+ return build_message (composer);
}
CamelMimeMessage *
@@ -3017,7 +3036,7 @@ e_msg_composer_get_message_draft (EMsgComposer *composer)
old_smime_encrypt = composer->smime_encrypt;
composer->smime_encrypt = FALSE;
- msg = e_msg_composer_get_message (composer, FALSE);
+ msg = e_msg_composer_get_message (composer);
composer->send_html = old_send_html;
composer->pgp_sign = old_pgp_sign;
@@ -3420,6 +3439,14 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
e_msg_composer_get_visible_flags (composer));
}
+EDestination **
+e_msg_composer_get_recipients (EMsgComposer *composer)
+{
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
+
+ return composer->hdrs ? e_msg_composer_hdrs_get_recipients (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL;
+}
+
/**
* e_msg_composer_get_view_cc:
* @composer: A message composer widget
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index c76d54450b..e661909662 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -113,9 +113,9 @@ void e_msg_composer_show_attachments (EMsgComposer *compose
gboolean show);
void e_msg_composer_set_headers (EMsgComposer *composer,
const char *from,
- const GList *to,
- const GList *cc,
- const GList *bcc,
+ EDestination **to,
+ EDestination **cc,
+ EDestination **bcc,
const char *subject);
void e_msg_composer_set_body_text (EMsgComposer *composer,
const char *text);
@@ -124,8 +124,7 @@ void e_msg_composer_add_header (EMsgComposer *compose
const char *value);
void e_msg_composer_attach (EMsgComposer *composer,
CamelMimePart *attachment);
-CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer,
- gboolean sending);
+CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer);
void e_msg_composer_show_sig_file (EMsgComposer *composer);
gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
@@ -146,6 +145,8 @@ gboolean e_msg_composer_get_view_cc (EMsgComposer *compose
void e_msg_composer_set_view_cc (EMsgComposer *composer,
gboolean view_cc);
+EDestination **e_msg_composer_get_recipients (EMsgComposer *composer);
+
const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index 6dfddf1202..6a24186fa2 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -44,40 +44,30 @@ static void (*postpone_cb) (EMsgComposer *, gpointer);
static POA_GNOME_Evolution_Composer__vepv Composer_vepv;
-static GList *
-corba_recipientlist_to_glist (const GNOME_Evolution_Composer_RecipientList *cl)
+static EDestination **
+corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl)
{
GNOME_Evolution_Composer_Recipient *recip;
- GList *gl = NULL;
- char *str;
+ EDestination **destv;
int i;
- for (i = cl->_length - 1; i >= 0; i--) {
- recip = &(cl->_buffer[i]);
+ if (cl->_length == 0)
+ return NULL;
- /* Let's copy this code into yet another place! */
- if (*recip->name) {
- str = camel_internet_address_format_address (recip->name, recip->address);
- } else
- str = g_strdup (recip->address);
-
- gl = g_list_prepend (gl, str);
- }
+ destv = g_new (EDestination *, cl->_length+1);
- return gl;
-}
+ for (i = 0; i < cl->_length; ++i) {
+ recip = &(cl->_buffer[i]);
-static void
-free_recipient_glist (GList *gl)
-{
- GList *tmp;
+ destv[i] = e_destination_new ();
- while (gl) {
- tmp = gl->next;
- g_free (gl->data);
- g_list_free_1 (gl);
- gl = tmp;
+ if (*recip->name)
+ e_destination_set_name (destv[i], recip->name);
+ e_destination_set_email (destv[i], recip->address);
+
}
+
+ return destv;
}
static void
@@ -90,21 +80,20 @@ impl_Composer_set_headers (PortableServer_Servant servant,
{
BonoboObject *bonobo_object;
EvolutionComposer *composer;
- GList *gto, *gcc, *gbcc;
+ EDestination **tov, **ccv, **bccv;
bonobo_object = bonobo_object_from_servant (servant);
composer = EVOLUTION_COMPOSER (bonobo_object);
- gto = corba_recipientlist_to_glist (to);
- gcc = corba_recipientlist_to_glist (cc);
- gbcc = corba_recipientlist_to_glist (bcc);
+ tov = corba_recipientlist_to_destv (to);
+ ccv = corba_recipientlist_to_destv (cc);
+ bccv = corba_recipientlist_to_destv (bcc);
- e_msg_composer_set_headers (composer->composer, NULL, gto, gcc, gbcc,
- subject);
+ e_msg_composer_set_headers (composer->composer, NULL, tov, ccv, bccv, subject);
- free_recipient_glist (gto);
- free_recipient_glist (gcc);
- free_recipient_glist (gbcc);
+ e_destination_freev (tov);
+ e_destination_freev (ccv);
+ e_destination_freev (bccv);
}
static void