diff pidgin/gtkblist.c @ 22762:dd8cdf1d8b19

Fine tune the edit-settings dialog (e.g., mark fields as masked or required as appropriate), and avoid storing a NULL value in the hash-table.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 29 Apr 2008 18:57:10 +0000
parents cf88a302fa88
children cc8903c59d6b
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Tue Apr 29 18:56:04 2008 +0000
+++ b/pidgin/gtkblist.c	Tue Apr 29 18:57:10 2008 +0000
@@ -632,7 +632,11 @@
 			else
 				val = g_strdup(purple_request_field_string_get_value(field));
 
-			g_hash_table_replace(purple_chat_get_components(chat), g_strdup(id), val);  /* val should not be free'd */
+			if (!val) {
+				g_hash_table_remove(purple_chat_get_components(chat), id);
+			} else {
+				g_hash_table_replace(purple_chat_get_components(chat), g_strdup(id), val);  /* val should not be free'd */
+			}
 		}
 	}
 }
@@ -663,8 +667,13 @@
 		} else {
 			field = purple_request_field_string_new(pce->identifier, pce->label,
 					g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier), FALSE);
+			if (pce->secret)
+				purple_request_field_string_set_masked(field, TRUE);
 		}
 
+		if (pce->required)
+			purple_request_field_set_required(field, TRUE);
+
 		purple_request_field_group_add_field(group, field);
 		g_free(pce);
 	}