diff options
author | Eion Robb <eion@robbmob.com> | 2009-12-10 22:05:01 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2009-12-10 22:05:01 +0300 |
commit | cf8e37d050b2fc918f68c8a6d0c46d7e1a471d6c (patch) | |
tree | 14fe1b858ac3b9a257aa6de28a202e914dddf079 | |
parent | bdb87854fef7b75dfd22caa9c6abb4c3cf6f6fdf (diff) |
First attempt at turning the silly XML blob in chats into useful info
-rw-r--r-- | skype_events.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/skype_events.c b/skype_events.c index 5bf8394..921c452 100644 --- a/skype_events.c +++ b/skype_events.c @@ -1025,6 +1025,7 @@ handle_complete_message(int messagenumber) SkypeMessage *skypemessage = NULL; SkypeChat *chat = NULL; gchar *body_html = NULL; + xmlnode *xmlblob; int i; if (messages_table == NULL) @@ -1068,6 +1069,35 @@ handle_complete_message(int messagenumber) //fallthrough intentional case SKYPE_MESSAGE_OTHER: //'other' type of message is generally an auth request + //Check that it's not an xml blob + if (!skypemessage->body) + return FALSE; + xmlblob = xmlnode_from_str(skypemessage->body, -1); + if (xmlblob) + { + if (g_str_equal(xmlblob->name, "partlist")) + { + for(xmlnode *nodi = xmlnode_get_child(xmlblob, "part"); + nodi; + nodi = xmlnode_get_next_twin(nodi)) + { + if (g_str_equal(xmlnode_get_attrib(nodi, "identity"), skype_get_account_username(skypemessage->account))) + { + nodi = xmlnode_get_child(nodi, "duration"); + body_html = xmlnode_get_data(nodi); + if (body_html) + { + g_free(skypemessage->body); + skypemessage->body = g_strdup_printf(_("Call ended after %s seconds"), body_html); + g_free(body_html); + skypemessage->type = SKYPE_MESSAGE_TEXT; + } + break; + } + } + } + xmlnode_free(xmlblob); + } case SKYPE_MESSAGE_TEXT: if (!skypemessage->body || !skypemessage->from_handle || !skypemessage->timestamp) return FALSE; |