changeset 14136:6666ce3176b9

[gaim-migrate @ 16778] Thanks to Josh Blanton for this fix to MSN signon with non-glibc printf. This is a complete hack, but it's no worse than what is there now. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 16 Aug 2006 02:44:21 +0000
parents 38270d4e29c6
children 7a763d1d1df6
files src/protocols/msn/nexus.c
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/nexus.c	Wed Aug 16 02:37:49 2006 +0000
+++ b/src/protocols/msn/nexus.c	Wed Aug 16 02:44:21 2006 +0000
@@ -293,6 +293,15 @@
 
 }
 
+/* this guards against missing hash entries */
+char *
+nexus_challenge_data_lookup(GHashTable *challenge_data, const char *key)
+{
+  char *entry;
+
+  return (entry = (char *)g_hash_table_lookup(challenge_data, key)) ?
+    entry : "(null)";
+}
 
 void
 login_connect_cb(gpointer data, GaimSslConnection *gsc,
@@ -336,16 +345,16 @@
 		"Host: %s\r\n"
 		"Connection: Keep-Alive\r\n"
 		"Cache-Control: no-cache\r\n",
-		(char *)g_hash_table_lookup(nexus->challenge_data, "lc"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "id"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "tw"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "fs"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "ru"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "lc"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "id"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "tw"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "fs"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "ru"),
 		ctint,
-		(char *)g_hash_table_lookup(nexus->challenge_data, "kpp"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "kv"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "ver"),
-		(char *)g_hash_table_lookup(nexus->challenge_data, "tpf"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "kpp"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "kv"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "ver"),
+		nexus_challenge_data_lookup(nexus->challenge_data, "tpf"),
 		nexus->login_host);
 
 	buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail);