comparison 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
comparison
equal deleted inserted replaced
18285:51ebbe199514 18292:9db52d9b8436
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * 19 *
20 */ 20 */
21 #include "internal.h" 21 #include "internal.h"
22 #include "core.h"
22 #include "debug.h" 23 #include "debug.h"
23 #include "prefs.h" 24 #include "prefs.h"
24 #include "util.h" 25 #include "util.h"
25 26
26 #include "buddy.h" 27 #include "buddy.h"
248 char *os = NULL; 249 char *os = NULL;
249 250
250 type = xmlnode_get_attrib(packet, "type"); 251 type = xmlnode_get_attrib(packet, "type");
251 252
252 if(type && !strcmp(type, "get")) { 253 if(type && !strcmp(type, "get")) {
254 GHashTable *ui_info;
255 const char *ui_name = NULL, *ui_version = NULL;
253 256
254 if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { 257 if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) {
255 struct utsname osinfo; 258 struct utsname osinfo;
256 259
257 uname(&osinfo); 260 uname(&osinfo);
266 xmlnode_set_attrib(iq->node, "to", from); 269 xmlnode_set_attrib(iq->node, "to", from);
267 jabber_iq_set_id(iq, id); 270 jabber_iq_set_id(iq, id);
268 271
269 query = xmlnode_get_child(iq->node, "query"); 272 query = xmlnode_get_child(iq->node, "query");
270 273
271 /* TODO: ask the core for the version of libpurple and the name and version of the UI */ 274 ui_info = purple_core_get_ui_info();
272 xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); 275
273 xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); 276 if(NULL != ui_info) {
277 ui_name = g_hash_table_lookup(ui_info, "name");
278 ui_version = g_hash_table_lookup(ui_info, "version");
279 }
280
281 if(NULL != ui_name && NULL != ui_version) {
282 char *name_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_name);
283 xmlnode_insert_data(xmlnode_new_child(query, "name"), name_complete, -1);
284 xmlnode_insert_data(xmlnode_new_child(query, "version"), ui_version, -1);
285 g_free(name_complete);
286 } else {
287 xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1);
288 xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1);
289 }
290
274 if(os) { 291 if(os) {
275 xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); 292 xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1);
276 g_free(os); 293 g_free(os);
277 } 294 }
278 295