changeset 27845:975fc5f64438

Ignore buddies with invalid emails in the membership list or address book, which, to be honest, were probably caused by older versions of Pidgin that were not checking and sending the invalid buddies anyway. Fixes #9505.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 06 Aug 2009 05:25:23 +0000
parents f9cf1e14838b
children 24e5f6357cb5
files libpurple/protocols/msn/contact.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Thu Aug 06 04:59:12 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Aug 06 05:25:23 2009 +0000
@@ -351,14 +351,24 @@
 msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node,
 	MsnListId list)
 {
-	char *passport = xmlnode_get_data(xmlnode_get_child(member, node));
-	char *type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
-	char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
-	MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL);
+	char *passport;
+	char *type;
+	char *member_id;
+	MsnUser *user;
 	xmlnode *annotation;
 	guint nid = MSN_NETWORK_UNKNOWN;
 	char *invite = NULL;
 
+	passport = xmlnode_get_data(xmlnode_get_child(member, node));
+	if (!purple_email_is_valid(passport)) {
+		g_free(passport);
+		return;
+	}
+
+	type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
+	member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
+	user = msn_userlist_find_add_user(session->userlist, passport, NULL);
+
 	for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
 	     annotation;
 	     annotation = xmlnode_get_next_twin(annotation)) {
@@ -746,6 +756,9 @@
 		if (passport == NULL)
 			continue;
 
+		if (!purple_email_is_valid(passport))
+			continue;
+
 		if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
 			Name = xmlnode_get_data(displayName);
 		else