Mercurial > pidgin
diff libpurple/protocols/jabber/iq.c @ 18292:9db52d9b8436
core support for UI info...now to do the UI piece
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 02 Jul 2007 03:26:08 +0000 |
parents | c5c265dff90c |
children | c58b83d2b188 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/iq.c Mon Jun 25 17:44:40 2007 +0000 +++ b/libpurple/protocols/jabber/iq.c Mon Jul 02 03:26:08 2007 +0000 @@ -19,6 +19,7 @@ * */ #include "internal.h" +#include "core.h" #include "debug.h" #include "prefs.h" #include "util.h" @@ -250,6 +251,8 @@ type = xmlnode_get_attrib(packet, "type"); if(type && !strcmp(type, "get")) { + GHashTable *ui_info; + const char *ui_name = NULL, *ui_version = NULL; if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { struct utsname osinfo; @@ -268,9 +271,23 @@ query = xmlnode_get_child(iq->node, "query"); - /* TODO: ask the core for the version of libpurple and the name and version of the UI */ - xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); + ui_info = purple_core_get_ui_info(); + + if(NULL != ui_info) { + ui_name = g_hash_table_lookup(ui_info, "name"); + ui_version = g_hash_table_lookup(ui_info, "version"); + } + + if(NULL != ui_name && NULL != ui_version) { + char *name_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_name); + xmlnode_insert_data(xmlnode_new_child(query, "name"), name_complete, -1); + xmlnode_insert_data(xmlnode_new_child(query, "version"), ui_version, -1); + g_free(name_complete); + } else { + xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); + xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); + } + if(os) { xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); g_free(os);