diff options
-rw-r--r-- | composer/ChangeLog | 7 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 4 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 2 | ||||
-rw-r--r-- | plugins/attachment-reminder/ChangeLog | 8 | ||||
-rw-r--r-- | plugins/attachment-reminder/attachment-reminder.c | 25 |
5 files changed, 36 insertions, 10 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index e902007906..523164bdbc 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,10 @@ +2008-01-25 Johnny Jacob <jjohnny@novell.com> + + ** Fixes bug #503327 & #503678 + + * e-msg-composer.c (e_msg_composer_get_raw_message_text): Return + GByteArray instead of gchar* + 2008-01-24 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #509124 diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f0bb36633f..56035b1aea 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -6262,7 +6262,7 @@ e_msg_composer_unset_autosaved (EMsgComposer *composer) * * Returns the text/plain of the message from composer **/ -const gchar * +GByteArray * e_msg_composer_get_raw_message_text (EMsgComposer *composer) { GByteArray *data = NULL; @@ -6271,7 +6271,7 @@ e_msg_composer_get_raw_message_text (EMsgComposer *composer) data = get_text (p->persist_stream_interface, "text/plain"); if (data) - return (const gchar *)data->data; + return data; return NULL; } diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 19e84170e4..a6c8e719fc 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -192,7 +192,7 @@ EMsgComposerHdrs* e_msg_composer_get_hdrs (EMsgComposer *composer); void e_msg_composer_set_saved (EMsgComposer *composer); void e_msg_composer_set_send_options (EMsgComposer *composer, gboolean send_enable); -const gchar * e_msg_composer_get_raw_message_text (EMsgComposer *composer); +GByteArray * e_msg_composer_get_raw_message_text (EMsgComposer *composer); struct _EAttachmentBar* e_msg_composer_get_attachment_bar (EMsgComposer *composer); diff --git a/plugins/attachment-reminder/ChangeLog b/plugins/attachment-reminder/ChangeLog index 8f56be90f9..a8cdf93a9f 100644 --- a/plugins/attachment-reminder/ChangeLog +++ b/plugins/attachment-reminder/ChangeLog @@ -1,3 +1,11 @@ +2008-01-24 Johnny Jacob <jjohnny@novell.com> + + ** Fixes bug #503327 & #503678 + + * attachment-reminder.c (strip_text_msg): Memory leak Fix. + (org_gnome_evolution_attachment_reminder): Free GByteArray. + NULL terminate string. + 2008-01-14 Kjartan Maraas <kmaraas@gnome.org> * apps-evolution-attachment-reminder.schemas.in: Add diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 6bbf4d0e00..b50fc5b9dc 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -94,7 +94,9 @@ void org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t) { GConfClient *gconf; - char *rawstr = NULL, *filtered_str = NULL; + GByteArray *raw_msg_barray; + + gchar *filtered_str = NULL; gconf = gconf_client_get_default (); if (!gconf_client_get_bool (gconf, GCONF_KEY_ATTACHMENT_REMINDER, NULL)){ @@ -103,11 +105,15 @@ org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t) } else g_object_unref (gconf); - rawstr = g_strdup (e_msg_composer_get_raw_message_text (t->composer)); + raw_msg_barray = e_msg_composer_get_raw_message_text (t->composer); + + if (!raw_msg_barray) + return; - filtered_str = strip_text_msg (rawstr); + raw_msg_barray = g_byte_array_append (raw_msg_barray, (const guint8 *)"", 1); - g_free (rawstr); + filtered_str = strip_text_msg (raw_msg_barray->data); + g_byte_array_free (raw_msg_barray, TRUE); /* Set presend_check_status for the composer*/ if (check_for_attachment_clues (filtered_str) && !check_for_attachment (t->composer)) @@ -136,6 +142,7 @@ check_for_attachment_clues (gchar *msg) gconf = gconf_client_get_default (); + /* Get the list from gconf */ clue_list = gconf_client_get_list ( gconf, GCONF_KEY_ATTACH_REMINDER_CLUES, GCONF_VALUE_STRING, NULL ); @@ -176,12 +183,13 @@ strip_text_msg (gchar *msg) { gchar **lines = g_strsplit ( msg, "\n", -1); gchar *stripped_msg = g_strdup (" "); - guint i=0; + gchar *temp; while (lines [i]){ if (lines [i] != NULL && !g_str_has_prefix (g_strstrip(lines[i]), ">")){ - gchar *temp = stripped_msg; + temp = stripped_msg; + stripped_msg = g_strconcat (" ", stripped_msg, lines[i], NULL); g_free (temp); @@ -191,7 +199,10 @@ strip_text_msg (gchar *msg) g_strfreev (lines); - return g_utf8_strdown (stripped_msg, -1); + temp = g_utf8_strdown (stripped_msg, -1); + g_free (stripped_msg); + + return temp; } static void |