Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jabber.c @ 27135:f5369bdd0285
propagate from branch 'im.pidgin.pidgin' (head 6fb44be5a32516ac1d940330c4f7b8d530208a16)
to branch 'im.pidgin.cpw.malu.client_type' (head d22d5bca23b57e3cc71ec9b4d23bf4ff4cb44fc6)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 06 Jun 2009 06:21:39 +0000 |
parents | 335d737c396e 68d6c6517ef8 |
children | dd7e7071d46d |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Sat Jun 06 04:02:28 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Jun 06 06:21:39 2009 +0000 @@ -23,6 +23,7 @@ #include "account.h" #include "accountopt.h" #include "blist.h" +#include "core.h" #include "cmds.h" #include "connection.h" #include "conversation.h" @@ -1906,7 +1907,7 @@ JabberStream *js; JabberBuddy *jb = NULL; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); - + if(!gc) return NULL; @@ -1919,6 +1920,28 @@ !(jb->subscription & JABBER_SUB_TO))) return "not-authorized"; } + + if (jb) { + JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); + if (jbr) { + const gchar *client_type = + jabber_resource_get_identity_category_type(jbr, "client"); + + if (client_type) { + if (strcmp(client_type, "phone") == 0) { + return "mobile"; + } else if (strcmp(client_type, "web") == 0) { + return "external"; + } else if (strcmp(client_type, "handheld") == 0) { + return "hiptop"; + } else if (strcmp(client_type, "bot") == 0) { + return "bot"; + } + /* the default value "pc" falls through and has no emblem */ + } + } + } + return NULL; } @@ -3396,9 +3419,24 @@ void jabber_init_plugin(PurplePlugin *plugin) { + GHashTable *ui_info = purple_core_get_ui_info(); + const gchar *ui_type = g_hash_table_lookup(ui_info, "client_type"); + const gchar *type = "pc"; /* default client type, if unknown or + unspecified */ + + if (ui_type) { + if (strcmp(ui_type, "pc") == 0 || + strcmp(ui_type, "console") == 0 || + strcmp(ui_type, "phone") == 0 || + strcmp(ui_type, "handheld") == 0 || + strcmp(ui_type, "web") == 0 || + strcmp(ui_type, "bot") == 0) { + type = ui_type; + } + } jabber_plugin = plugin; - jabber_add_identity("client", "pc", NULL, PACKAGE); + jabber_add_identity("client", type, NULL, PACKAGE); /* initialize jabber_features list */ jabber_add_feature("jabber:iq:last", 0);