pidgin: cd201a23: Ignore buddies with invalid emails in th...

qulogic at pidgin.im qulogic at pidgin.im
Thu Aug 6 01:30:37 EDT 2009


-----------------------------------------------------------------
Revision: cd201a23c1b0c9571298b531f87dde3a7c373576
Ancestor: 66c2e7329145cfc8eb6bb71d6f9cc4684c979812
Author: qulogic at pidgin.im
Date: 2009-08-06T05:25:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cd201a23c1b0c9571298b531f87dde3a7c373576

Modified files:
        libpurple/protocols/msn/contact.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c	2415c3c78be3fa2d14ed69e0a523082510217e39
+++ libpurple/protocols/msn/contact.c	202b59014d8af79c0b156eba1e6553396e95d080
@@ -351,14 +351,24 @@ msn_parse_each_member(MsnSession *sessio
 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 @@ msn_parse_addressbook_contacts(MsnSessio
 		if (passport == NULL)
 			continue;
 
+		if (!purple_email_is_valid(passport))
+			continue;
+
 		if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
 			Name = xmlnode_get_data(displayName);
 		else


More information about the Commits mailing list