Change -[XMPPMessage addBody:] to -[XMPPMessage setBody:].

This commit is contained in:
Jonathan Schleifer 2012-02-03 09:05:51 +01:00
parent 3d5d7564a7
commit d6c5f1d91e
2 changed files with 14 additions and 7 deletions

View file

@ -94,9 +94,9 @@
ID: (OFString*)ID; ID: (OFString*)ID;
/** /**
* Adds a body element to the XMPPMessage * Sets the body element of the XMPPMessage.
* *
* \param body The text content of the body element * \param body The text content of the body element or nil to remove the body
*/ */
- (void)addBody: (OFString*)body; - (void)setBody: (OFString*)body;
@end @end

View file

@ -77,10 +77,17 @@
ID: ID_]; ID: ID_];
} }
- (void)addBody: (OFString*)body - (void)setBody: (OFString*)body
{ {
[self addChild: [OFXMLElement elementWithName: @"body" OFXMLElement *oldBody = [self elementForName: @"body"
namespace: XMPP_NS_CLIENT namespace: XMPP_NS_CLIENT];
stringValue: body]];
if (oldBody != nil)
[self removeChild: oldBody];
if (body != nil)
[self addChild: [OFXMLElement elementWithName: @"body"
namespace: XMPP_NS_CLIENT
stringValue: body]];
} }
@end @end