Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -417,25 +417,18 @@ if ([delegate respondsToSelector: @selector(connection:didReceiveIQ:)]) handled = [delegate connection: self didReceiveIQ: iq]; if (!handled) { - OFString *from = [iq attributeForName: @"from"].stringValue; - OFString *to = [iq attributeForName: @"to"].stringValue; + XMPPJID *from = iq.from; + XMPPJID *to = iq.to; OFXMLElement *error; [iq setType: @"error"]; - [iq removeAttributeForName: @"from"]; - [iq removeAttributeForName: @"to"]; - - if (from != nil) - [iq addAttributeWithName: @"to" - stringValue: from]; - if (to != nil) - [iq addAttributeWithName: @"from" - stringValue: to]; + iq.to = from; + iq.from = to; error = [OFXMLElement elementWithName: @"error"]; [error addAttributeWithName: @"type" stringValue: @"cancel"]; [error addChild: