diff options
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r-- | plugins/itip-formatter/ChangeLog | 21 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 5 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-view.c | 44 |
3 files changed, 57 insertions, 13 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index 4fc1bddaa4..b30fd70aaa 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,24 @@ +2008-10-01 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #519491 + + * itip-view.c: (ensure_utf8), (itip_view_set_organizer), + (itip_view_set_organizer_sentby), (itip_view_set_attendee), + (itip_view_set_attendee_sentby), (itip_view_set_proxy), + (itip_view_set_delegator), (itip_view_set_summary), + (itip_view_set_location), (itip_view_set_status), + (itip_view_set_comment), (itip_view_set_description), + (itip_view_add_upper_info_item), (itip_view_add_lower_info_item): + Convert texts to valid UTF-8 texts before passing them to Gtk+ + functions which requires that. + +2008-09-24 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #313225 + + * itip-formatter.c: (format_itip): Set the user flag '$has_cal' + on the message when formatting a calendar attachment. + 2008-08-27 Sankar P <psankar@novell.com> License Changes diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 3e200ac873..e37c0d162a 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -2243,6 +2243,11 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str); + /* mark message as containing calendar, thus it will show the icon in message list now on */ + if (target->format->uid && target->format->folder && + !camel_folder_get_message_user_flag (target->format->folder, target->format->uid, "$has_cal")) + camel_folder_set_message_user_flag (target->format->folder, target->format->uid, "$has_cal", TRUE); + puri = (struct _itip_puri *)em_format_add_puri(target->format, sizeof(struct _itip_puri), classid, target->part, itip_attachment_frame); pobj = em_format_html_add_pobject ((EMFormatHTML *) target->format, sizeof (EMFormatHTMLPObject), classid, target->part, format_itip_object); diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index e42b338e0f..1e5e41195c 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -1194,6 +1194,24 @@ itip_view_get_item_type (ItipView *view) return priv->type; } +/* ensures the returned text will be valid UTF-8 text, thus gtk functions expecting + only valid UTF-8 texts will not crash. Returned pointer should be freed with g_free. */ +static gchar * +ensure_utf8 (const char *text) +{ + gchar *res = g_strdup (text), *p; + + if (!text) + return res; + + p = res; + while (!g_utf8_validate (p, -1, (const gchar **) &p)) { + /* make all invalid characters appear as question marks */ + *p = '?'; + } + + return res; +} void itip_view_set_organizer (ItipView *view, const char *organizer) @@ -1208,7 +1226,7 @@ itip_view_set_organizer (ItipView *view, const char *organizer) if (priv->organizer) g_free (priv->organizer); - priv->organizer = g_strdup (organizer); + priv->organizer = ensure_utf8 (organizer); set_sender_text (view); } @@ -1239,7 +1257,7 @@ itip_view_set_organizer_sentby (ItipView *view, const char *sentby) if (priv->organizer_sentby) g_free (priv->organizer_sentby); - priv->organizer_sentby = g_strdup (sentby); + priv->organizer_sentby = ensure_utf8 (sentby); set_sender_text (view); } @@ -1270,7 +1288,7 @@ itip_view_set_attendee (ItipView *view, const char *attendee) if (priv->attendee) g_free (priv->attendee); - priv->attendee = g_strdup (attendee); + priv->attendee = ensure_utf8 (attendee); set_sender_text (view); } @@ -1301,7 +1319,7 @@ itip_view_set_attendee_sentby (ItipView *view, const char *sentby) if (priv->attendee_sentby) g_free (priv->attendee_sentby); - priv->attendee_sentby = g_strdup (sentby); + priv->attendee_sentby = ensure_utf8 (sentby); set_sender_text (view); } @@ -1332,7 +1350,7 @@ itip_view_set_proxy (ItipView *view, const char *proxy) if (priv->proxy) g_free (priv->proxy); - priv->proxy = g_strdup (proxy); + priv->proxy = ensure_utf8 (proxy); set_sender_text (view); } @@ -1363,7 +1381,7 @@ itip_view_set_delegator (ItipView *view, const char *delegator) if (priv->delegator) g_free (priv->delegator); - priv->delegator = g_strdup (delegator); + priv->delegator = ensure_utf8 (delegator); set_sender_text (view); } @@ -1394,7 +1412,7 @@ itip_view_set_summary (ItipView *view, const char *summary) if (priv->summary) g_free (priv->summary); - priv->summary = summary ? g_strstrip (g_strdup (summary)) : NULL; + priv->summary = summary ? g_strstrip (ensure_utf8 (summary)) : NULL; set_summary_text (view); } @@ -1425,7 +1443,7 @@ itip_view_set_location (ItipView *view, const char *location) if (priv->location) g_free (priv->location); - priv->location = location ? g_strstrip (g_strdup (location)) : NULL; + priv->location = location ? g_strstrip (ensure_utf8 (location)) : NULL; set_location_text (view); } @@ -1456,7 +1474,7 @@ itip_view_set_status (ItipView *view, const char *status) if (priv->status) g_free (priv->status); - priv->status = status ? g_strstrip (g_strdup (status)) : NULL; + priv->status = status ? g_strstrip (ensure_utf8 (status)) : NULL; set_status_text (view); } @@ -1487,7 +1505,7 @@ itip_view_set_comment (ItipView *view, const char *comment) if (priv->comment) g_free (priv->comment); - priv->comment = comment ? g_strstrip (g_strdup (comment)) : NULL; + priv->comment = comment ? g_strstrip (ensure_utf8 (comment)) : NULL; set_comment_text (view); } @@ -1519,7 +1537,7 @@ itip_view_set_description (ItipView *view, const char *description) if (priv->description) g_free (priv->description); - priv->description = description ? g_strstrip (g_strdup (description)) : NULL; + priv->description = description ? g_strstrip (ensure_utf8 (description)) : NULL; set_description_text (view); } @@ -1624,7 +1642,7 @@ itip_view_add_upper_info_item (ItipView *view, ItipViewInfoItemType type, const item = g_new0 (ItipViewInfoItem, 1); item->type = type; - item->message = g_strdup (message); + item->message = ensure_utf8 (message); item->id = priv->next_info_item_id++; priv->upper_info_items = g_slist_append (priv->upper_info_items, item); @@ -1719,7 +1737,7 @@ itip_view_add_lower_info_item (ItipView *view, ItipViewInfoItemType type, const item = g_new0 (ItipViewInfoItem, 1); item->type = type; - item->message = g_strdup (message); + item->message = ensure_utf8 (message); item->id = priv->next_info_item_id++; priv->lower_info_items = g_slist_append (priv->lower_info_items, item); |