comparison libpurple/protocols/jabber/jabber.c @ 28729:ed88200c79ee

A leak fix in the candidate list, and some code simplification.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 10 Oct 2009 19:44:44 +0000
parents c7aaad89a2f8
children bd8a1dad7f1c 4a0d69b9d8a8 44e949b676f0
comparison
equal deleted inserted replaced
28725:401a00227615 28729:ed88200c79ee
1077 jabber_iq_send(iq); 1077 jabber_iq_send(iq);
1078 g_free(cbdata); 1078 g_free(cbdata);
1079 return; 1079 return;
1080 } 1080 }
1081 } else { 1081 } else {
1082 const char *ids[] = {"username", "password", "name", "email", "nick", "first",
1083 "last", "address", "city", "state", "zip", "phone", "url", "date",
1084 NULL};
1082 const char *value = purple_request_field_string_get_value(field); 1085 const char *value = purple_request_field_string_get_value(field);
1083 1086 int i;
1084 if(!strcmp(id, "username")) { 1087 for (i = 0; ids[i]; i++) {
1085 y = xmlnode_new_child(query, "username"); 1088 if (!strcmp(id, ids[i]))
1086 } else if(!strcmp(id, "password")) { 1089 break;
1087 y = xmlnode_new_child(query, "password"); 1090 }
1088 } else if(!strcmp(id, "name")) { 1091
1089 y = xmlnode_new_child(query, "name"); 1092 if (!ids[i])
1090 } else if(!strcmp(id, "email")) {
1091 y = xmlnode_new_child(query, "email");
1092 } else if(!strcmp(id, "nick")) {
1093 y = xmlnode_new_child(query, "nick");
1094 } else if(!strcmp(id, "first")) {
1095 y = xmlnode_new_child(query, "first");
1096 } else if(!strcmp(id, "last")) {
1097 y = xmlnode_new_child(query, "last");
1098 } else if(!strcmp(id, "address")) {
1099 y = xmlnode_new_child(query, "address");
1100 } else if(!strcmp(id, "city")) {
1101 y = xmlnode_new_child(query, "city");
1102 } else if(!strcmp(id, "state")) {
1103 y = xmlnode_new_child(query, "state");
1104 } else if(!strcmp(id, "zip")) {
1105 y = xmlnode_new_child(query, "zip");
1106 } else if(!strcmp(id, "phone")) {
1107 y = xmlnode_new_child(query, "phone");
1108 } else if(!strcmp(id, "url")) {
1109 y = xmlnode_new_child(query, "url");
1110 } else if(!strcmp(id, "date")) {
1111 y = xmlnode_new_child(query, "date");
1112 } else {
1113 continue; 1093 continue;
1114 } 1094 y = xmlnode_new_child(query, ids[i]);
1115 xmlnode_insert_data(y, value, -1); 1095 xmlnode_insert_data(y, value, -1);
1116 if(cbdata->js->registration && !strcmp(id, "username")) { 1096 if(cbdata->js->registration && !strcmp(id, "username")) {
1117 g_free(cbdata->js->user->node); 1097 g_free(cbdata->js->user->node);
1118 cbdata->js->user->node = g_strdup(value); 1098 cbdata->js->user->node = g_strdup(value);
1119 } 1099 }