Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/notification.c @ 31124:c1e44e9a1110
Support sending different client types in PrivateEndpointData.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 15 Dec 2009 04:32:49 +0000 |
parents | dd430f788bdc |
children | 4c8bd8efacb8 |
comparison
equal
deleted
inserted
replaced
31123:dd430f788bdc | 31124:c1e44e9a1110 |
---|---|
20 * You should have received a copy of the GNU General Public License | 20 * You should have received a copy of the GNU General Public License |
21 * along with this program; if not, write to the Free Software | 21 * along with this program; if not, write to the Free Software |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
23 */ | 23 */ |
24 #include "msn.h" | 24 #include "msn.h" |
25 #include "core.h" | |
25 #include "notification.h" | 26 #include "notification.h" |
26 #include "contact.h" | 27 #include "contact.h" |
27 #include "state.h" | 28 #include "state.h" |
28 #include "error.h" | 29 #include "error.h" |
29 #include "msnutils.h" | 30 #include "msnutils.h" |
1845 { | 1846 { |
1846 xmlnode *private; | 1847 xmlnode *private; |
1847 const char *name; | 1848 const char *name; |
1848 xmlnode *epname; | 1849 xmlnode *epname; |
1849 xmlnode *idle; | 1850 xmlnode *idle; |
1851 GHashTable *ui_info; | |
1852 const gchar *ui_type; | |
1850 xmlnode *client_type; | 1853 xmlnode *client_type; |
1851 xmlnode *state; | 1854 xmlnode *state; |
1852 char *payload; | 1855 char *payload; |
1853 int length; | 1856 int length; |
1854 | 1857 |
1859 xmlnode_insert_data(epname, name, -1); | 1862 xmlnode_insert_data(epname, name, -1); |
1860 | 1863 |
1861 idle = xmlnode_new_child(private, "Idle"); | 1864 idle = xmlnode_new_child(private, "Idle"); |
1862 xmlnode_insert_data(idle, "false", -1); | 1865 xmlnode_insert_data(idle, "false", -1); |
1863 | 1866 |
1864 /* TODO: support different client types */ | |
1865 /* ClientType info (from amsn guys): | 1867 /* ClientType info (from amsn guys): |
1866 0: None | 1868 0: None |
1867 1: Computer | 1869 1: Computer |
1868 2: Website | 1870 2: Website |
1869 3: Mobile / none | 1871 3: Mobile / none |
1870 4: Xbox / phone /mobile | 1872 4: Xbox / phone /mobile |
1871 9: MsnGroup | 1873 9: MsnGroup |
1872 32: Email member, currently Yahoo! | 1874 32: Email member, currently Yahoo! |
1873 */ | 1875 */ |
1874 client_type = xmlnode_new_child(private, "ClientType"); | 1876 client_type = xmlnode_new_child(private, "ClientType"); |
1875 xmlnode_insert_data(client_type, "1", -1); | 1877 ui_info = purple_core_get_ui_info(); |
1878 ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; | |
1879 if (ui_type) { | |
1880 if (strcmp(ui_type, "pc") == 0) | |
1881 xmlnode_insert_data(client_type, "1", -1); | |
1882 else if (strcmp(ui_type, "web") == 0) | |
1883 xmlnode_insert_data(client_type, "2", -1); | |
1884 else if (strcmp(ui_type, "phone") == 0) | |
1885 xmlnode_insert_data(client_type, "3", -1); | |
1886 else if (strcmp(ui_type, "handheld") == 0) | |
1887 xmlnode_insert_data(client_type, "3", -1); | |
1888 else | |
1889 xmlnode_insert_data(client_type, "1", -1); | |
1890 } | |
1891 else | |
1892 xmlnode_insert_data(client_type, "1", -1); | |
1876 | 1893 |
1877 state = xmlnode_new_child(private, "State"); | 1894 state = xmlnode_new_child(private, "State"); |
1878 xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1); | 1895 xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1); |
1879 | 1896 |
1880 payload = xmlnode_to_str(private, &length); | 1897 payload = xmlnode_to_str(private, &length); |