/cpw/tomkiewicz/gg11: c6bd55f526f9: Gadu-Gadu: code polishing fo...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Fri Sep 14 16:04:25 EDT 2012
Changeset: c6bd55f526f9ee3c40355405f5b168c223e17f4e
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2012-09-14 22:04 +0200
Branch: default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/c6bd55f526f9
Description:
Gadu-Gadu: code polishing for messages
diffstat:
libpurple/protocols/gg/html.c | 2 ++
libpurple/protocols/gg/html.h | 1 +
libpurple/protocols/gg/message-prpl.c | 20 +++++++++++++-------
3 files changed, 16 insertions(+), 7 deletions(-)
diffs (88 lines):
diff --git a/libpurple/protocols/gg/html.c b/libpurple/protocols/gg/html.c
--- a/libpurple/protocols/gg/html.c
+++ b/libpurple/protocols/gg/html.c
@@ -138,6 +138,8 @@ ggp_html_tag ggp_html_parse_tag(const gc
return GGP_HTML_TAG_DIV;
if (0 == strcmp(tag_str, "br"))
return GGP_HTML_TAG_BR;
+ if (0 == strcmp(tag_str, "a"))
+ return GGP_HTML_TAG_A;
if (0 == strcmp(tag_str, "b"))
return GGP_HTML_TAG_B;
if (0 == strcmp(tag_str, "i"))
diff --git a/libpurple/protocols/gg/html.h b/libpurple/protocols/gg/html.h
--- a/libpurple/protocols/gg/html.h
+++ b/libpurple/protocols/gg/html.h
@@ -8,6 +8,7 @@ typedef enum
GGP_HTML_TAG_UNKNOWN,
GGP_HTML_TAG_IGNORED,
GGP_HTML_TAG_EOM,
+ GGP_HTML_TAG_A,
GGP_HTML_TAG_B,
GGP_HTML_TAG_I,
GGP_HTML_TAG_U,
diff --git a/libpurple/protocols/gg/message-prpl.c b/libpurple/protocols/gg/message-prpl.c
--- a/libpurple/protocols/gg/message-prpl.c
+++ b/libpurple/protocols/gg/message-prpl.c
@@ -143,7 +143,8 @@ void ggp_message_got(PurpleConnection *g
ggp_message_got_data_free(msg);
}
-void ggp_message_got_multilogon(PurpleConnection *gc, const struct gg_event_msg *ev)
+void ggp_message_got_multilogon(PurpleConnection *gc,
+ const struct gg_event_msg *ev)
{
ggp_message_got_data *msg = g_new(ggp_message_got_data, 1);
ggp_message_format_from_gg(msg, ev->xhtml_message);
@@ -220,7 +221,9 @@ static gchar * ggp_message_format_to_gg(
gboolean font_changed = FALSE;
gboolean in_any_tag = FALSE;
- purple_debug_info("gg", "ggp formatting text: [%s]\n", text);
+ /* TODO: verbose
+ * purple_debug_info("gg", "ggp formatting text: [%s]\n", text);
+ */
/* default font */
font_base = ggp_font_new();
@@ -412,7 +415,8 @@ static gchar * ggp_message_format_to_gg(
g_hash_table_destroy(attribs);
}
- else if ((tag == GGP_HTML_TAG_SPAN || tag == GGP_HTML_TAG_DIV) && !tag_close)
+ else if ((tag == GGP_HTML_TAG_SPAN || tag == GGP_HTML_TAG_DIV)
+ && !tag_close)
{
GHashTable *attribs, *styles = NULL;
gchar *style = NULL;
@@ -450,8 +454,8 @@ static gchar * ggp_message_format_to_gg(
g_hash_table_destroy(styles);
g_hash_table_destroy(attribs);
}
- else if ((tag == GGP_HTML_TAG_FONT || tag == GGP_HTML_TAG_SPAN ||
- tag == GGP_HTML_TAG_DIV) && tag_close)
+ else if ((tag == GGP_HTML_TAG_FONT || tag == GGP_HTML_TAG_SPAN
+ || tag == GGP_HTML_TAG_DIV) && tag_close)
{
font_changed = TRUE;
@@ -475,7 +479,7 @@ static gchar * ggp_message_format_to_gg(
pending_objects = g_list_prepend(pending_objects,
g_strdup("<br><span>---</span><br>"));
}
- else if (tag == GGP_HTML_TAG_EOM)
+ else if (tag == GGP_HTML_TAG_A || tag == GGP_HTML_TAG_EOM)
{
/* do nothing */
}
@@ -514,7 +518,9 @@ static gchar * ggp_message_format_to_gg(
text_new = ggp_strjoin_list("", rt);
g_list_free_full(rt, g_free);
- purple_debug_info("gg", "ggp reformatted text: [%s]\n", text_new);
+ /* TODO: verbose
+ * purple_debug_info("gg", "reformatted text: [%s]\n", text_new);
+ */
return text_new;
}
More information about the Commits
mailing list