aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/ChangeLog15
-rw-r--r--composer/e-msg-composer.c22
-rw-r--r--composer/evolution-composer.c4
3 files changed, 28 insertions, 13 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index e094cfc06a..a06f0fc027 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,18 @@
+2004-02-02 Not Zed <NotZed@Ximian.com>
+
+ * evolution-composer.c (impl_Composer_set_body): use
+ g_ascii_strcasecmp rather than strcasecmp.
+
+ ** See bug #53506, again.
+
+ * e-msg-composer.c (set_editor_text): Add an argument to make
+ adding the signature optional. Also fix a memleak with the sig
+ content.
+ (e_msg_composer_new_with_type, e_msg_composer_flush_pending_body)
+ (handle_mailto, e_msg_composer_set_body_text)
+ (e_msg_composer_set_body): Fixed callers for above change
+ appropriately.
+
2004-01-29 Not Zed <NotZed@Ximian.com>
* e-msg-composer.c (e_msg_composer_new_with_type): reverted
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 487d8c608e..d6ea5bebdf 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1077,14 +1077,15 @@ get_signature_html (EMsgComposer *composer)
}
static void
-set_editor_text (EMsgComposer *composer, const char *text)
+set_editor_text(EMsgComposer *composer, const char *text, int setsig)
{
Bonobo_PersistStream persist;
BonoboStream *stream;
BonoboWidget *editor;
CORBA_Environment ev;
Bonobo_Unknown object;
- char *sig, *mem = NULL, *content;
+ char *sig, *mem = NULL;
+ const char *content;
size_t len;
g_return_if_fail (composer->persist_stream_interface != CORBA_OBJECT_NIL);
@@ -1096,13 +1097,14 @@ set_editor_text (EMsgComposer *composer, const char *text)
CORBA_exception_init (&ev);
/* This copying bullshit is because the bonobo stream interface is just painful */
- sig = get_signature_html(composer);
len = strlen(text);
- if (sig) {
+ if (setsig
+ && (sig = get_signature_html(composer))) {
len += strlen(sig);
content = mem = g_malloc(len+1);
memcpy(mem, text, strlen(text));
strcpy(mem + strlen(text), sig);
+ g_free(sig);
} else {
content = text;
}
@@ -3276,7 +3278,7 @@ e_msg_composer_new_with_type (int type)
if (new) {
e_msg_composer_set_send_html (new, send_html);
set_editor_signature (new);
- set_editor_text (new, "");
+ set_editor_text (new, "", TRUE);
}
return new;
@@ -3331,7 +3333,7 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply)
body = g_object_get_data ((GObject *) composer, "body:text");
if (body) {
if (apply)
- set_editor_text (composer, body);
+ set_editor_text (composer, body, FALSE);
g_object_set_data ((GObject *) composer, "body:text", NULL);
g_free (body);
@@ -4106,7 +4108,7 @@ handle_mailto (EMsgComposer *composer, const char *mailto)
char *htmlbody;
htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
- set_editor_text (composer, htmlbody);
+ set_editor_text (composer, htmlbody, FALSE);
g_free (htmlbody);
}
}
@@ -4199,7 +4201,7 @@ e_msg_composer_set_body_text (EMsgComposer *composer, const char *text)
{
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- set_editor_text (composer, text);
+ set_editor_text (composer, text, TRUE);
}
/**
@@ -4217,9 +4219,7 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body,
{
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- set_editor_text (composer, _("<b>(The composer contains a non-text "
- "message body, which cannot be "
- "edited.)<b>"));
+ set_editor_text (composer, _("<b>(The composer contains a non-text message body, which cannot be edited.)<b>"), FALSE);
e_msg_composer_set_send_html (composer, FALSE);
disable_editor (composer);
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index 31da13c342..c028781de8 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -156,12 +156,12 @@ impl_Composer_set_body (PortableServer_Servant servant,
bonobo_object = bonobo_object_from_servant (servant);
composer = EVOLUTION_COMPOSER (bonobo_object);
- if (!strcasecmp (mime_type, "text/plain")) {
+ if (!g_ascii_strcasecmp (mime_type, "text/plain")) {
char *htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
e_msg_composer_set_body_text (composer->composer, htmlbody);
g_free (htmlbody);
- } else if (!strcasecmp (mime_type, "text/html"))
+ } else if (!g_ascii_strcasecmp (mime_type, "text/html"))
e_msg_composer_set_body_text (composer->composer, body);
else
e_msg_composer_set_body (composer->composer, body, mime_type);