summaryrefslogtreecommitdiff
path: root/libempathy-gtk/empathy-theme-adium.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-18 15:57:55 +1000
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-25 11:01:13 +1000
commit72d86515da906e3c867eff6abd309a8a03a38534 (patch)
treea54ffed6bb8dfc06ca8e46c121ac4a6bcc3c8348 /libempathy-gtk/empathy-theme-adium.c
parentfcbb1d6512afb91b318781f70b59901a239402af (diff)
downloadempathy-72d86515da906e3c867eff6abd309a8a03a38534.tar.gz
[theme-adium] wrap the messages in <span id=...> so we can find them again
This will enable our DOM manipulation
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 88672554f..712c2fbc5 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -252,7 +252,8 @@ static EmpathyStringParser string_parsers_with_smiley[] = {
};
static gchar *
-theme_adium_parse_body (const gchar *text)
+theme_adium_parse_body (const gchar *text,
+ const gchar *token)
{
EmpathyStringParser *parsers;
GString *string;
@@ -268,8 +269,19 @@ theme_adium_parse_body (const gchar *text)
* by html tags. Also escape text to make sure html code is
* displayed verbatim. */
string = g_string_sized_new (strlen (text));
+
+ /* wrap this in HTML that allows us to find the message for later
+ * editing */
+ if (!tp_str_empty (token))
+ g_string_append_printf (string,
+ "<span id=\"message-token-%s\">",
+ token);
+
empathy_string_parser_substr (text, -1, parsers, string);
+ if (!tp_str_empty (token))
+ g_string_append (string, "</span>");
+
g_object_unref (gsettings);
return g_string_free (string, FALSE);
@@ -437,7 +449,6 @@ theme_adium_append_message (EmpathyChatView *view,
EmpathyContact *sender;
TpAccount *account;
gchar *body_escaped;
- const gchar *body;
const gchar *name;
const gchar *contact_id;
EmpathyAvatar *avatar;
@@ -465,8 +476,9 @@ theme_adium_append_message (EmpathyChatView *view,
if (service_name == NULL)
service_name = tp_account_get_protocol (account);
timestamp = empathy_message_get_timestamp (msg);
- body = empathy_message_get_body (msg);
- body_escaped = theme_adium_parse_body (body);
+ body_escaped = theme_adium_parse_body (
+ empathy_message_get_body (msg),
+ empathy_message_get_token (msg));
name = empathy_contact_get_alias (sender);
contact_id = empathy_contact_get_id (sender);