<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -407,6 +407,12 @@ enum XMPPClientFlags
 {
 	if(jid == nil) return;
 	
+	if([[myJID bare] isEqualToString:[jid bare]])
+	{
+		// No, you don't need to add yourself
+		return;
+	}
+	
 	// Add the buddy to our roster
 	NSXMLElement *item = [NSXMLElement elementWithName:@&quot;item&quot;];
 	[item addAttributeWithName:@&quot;jid&quot; stringValue:[jid bare]];
@@ -436,6 +442,12 @@ enum XMPPClientFlags
 {
 	if(jid == nil) return;
 	
+	if([[myJID bare] isEqualToString:[jid bare]])
+	{
+		// No, you shouldn't remove yourself
+		return;
+	}
+	
 	// Remove the buddy from our roster
 	// Unsubscribe from presence
 	// And revoke contact's subscription to our presence
@@ -794,7 +806,11 @@ enum XMPPClientFlags
 {
 	if([iq isRosterQuery])
 	{
-		NSXMLElement *query = [iq elementForName:@&quot;query&quot;];
+		// Note: Some jabber servers send an iq element with a xmlns.
+		// Because of the bug in Apple's NSXML (documented in our elementForName method),
+		// it is important we specify the xmlns for the query.
+		
+		NSXMLElement *query = [iq elementForName:@&quot;query&quot; xmlns:@&quot;jabber:iq:roster&quot;];
 		NSArray *items = [query elementsForName:@&quot;item&quot;];
 		
 		int i;</diff>
      <filename>XMPPClient.m</filename>
    </modified>
    <modified>
      <diff>@@ -24,13 +24,16 @@
 	if([[subscription stringValue] isEqualToString:@&quot;none&quot;])
 	{
 		NSXMLNode *ask = [item attributeForName:@&quot;ask&quot;];
-		if([[ask stringValue] isEqualToString:@&quot;subscribe&quot;]) {
+		if([[ask stringValue] isEqualToString:@&quot;subscribe&quot;])
+		{
 			return YES;
 		}
-		else {
+		else
+		{
 			return NO;
 		}
 	}
+	
 	return YES;
 }
 
@@ -40,8 +43,14 @@
 **/
 - (BOOL)isRosterQuery
 {
-	NSXMLElement *query = [self elementForName:@&quot;query&quot;];
-	return [[query xmlns] isEqualToString:@&quot;jabber:iq:roster&quot;];
+	// Note: Some jabber servers send an iq element with a xmlns.
+	// Because of the bug in Apple's NSXML (documented in our elementForName method),
+	// it is important we specify the xmlns for the query.
+	
+	NSXMLElement *query = [self elementForName:@&quot;query&quot; xmlns:@&quot;jabber:iq:roster&quot;];
+	
+	return (query != nil);
+
 }
 
 @end</diff>
      <filename>XMPPIQ.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3f3be60d0369da9a15a6554c1675eb9f22777057</id>
    </parent>
  </parents>
  <author>
    <name>deusty</name>
    <email>deusty@69bd8580-3047-0410-960a-a116b6c96ec9</email>
  </author>
  <url>http://github.com/tinycode/xmppframework/commit/35d9d828263400a61b80b2dc6e02c909edf1a6b7</url>
  <id>35d9d828263400a61b80b2dc6e02c909edf1a6b7</id>
  <committed-date>2009-04-20T19:37:06-07:00</committed-date>
  <authored-date>2009-04-20T19:37:06-07:00</authored-date>
  <message>Workaround for bug related to jabber servers that send an xmlns in their iq elements and a bug in Apple's NSXML

git-svn-id: http://xmppframework.googlecode.com/svn/trunk@82 69bd8580-3047-0410-960a-a116b6c96ec9</message>
  <tree>4a98656fbe305f4964acd855370e140b6328ec45</tree>
  <committer>
    <name>deusty</name>
    <email>deusty@69bd8580-3047-0410-960a-a116b6c96ec9</email>
  </committer>
</commit>
