aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-string-parser.c16
-rw-r--r--libempathy-gtk/empathy-string-parser.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c
index 1240edd50..1f9f5f2ab 100644
--- a/libempathy-gtk/empathy-string-parser.c
+++ b/libempathy-gtk/empathy-string-parser.c
@@ -191,3 +191,19 @@ empathy_string_replace_escaped (const gchar *text,
g_free (escaped);
}
+gchar *
+empathy_add_link_markup (const gchar *text)
+{
+ static EmpathyStringParser parsers[] = {
+ {empathy_string_match_link, empathy_string_replace_link},
+ {empathy_string_match_all, empathy_string_replace_escaped},
+ {NULL, NULL}
+ };
+ GString *string;
+
+ string = g_string_sized_new (strlen (text));
+ empathy_string_parser_substr (text, -1, parsers, string);
+
+ return g_string_free (string, FALSE);
+}
+
diff --git a/libempathy-gtk/empathy-string-parser.h b/libempathy-gtk/empathy-string-parser.h
index db646d60b..aec741add 100644
--- a/libempathy-gtk/empathy-string-parser.h
+++ b/libempathy-gtk/empathy-string-parser.h
@@ -82,6 +82,9 @@ empathy_string_replace_escaped (const gchar *text,
gpointer match_data,
gpointer user_data);
+gchar *
+empathy_add_link_markup (const gchar *text);
+
G_END_DECLS
#endif /* __EMPATHY_STRING_PARSER_H__ */