From f3109b1c7a72d41824da6f6fe4c14d9ad448a719 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sat, 19 Feb 2011 17:38:25 +0100 Subject: [PATCH] Make XMPPJID conform to OFCopying. --- src/XMPPJID.h | 2 +- src/XMPPJID.m | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/XMPPJID.h b/src/XMPPJID.h index ea80782..ccfdc1f 100644 --- a/src/XMPPJID.h +++ b/src/XMPPJID.h @@ -26,7 +26,7 @@ /** * \brief A class for easy handling of JIDs. */ -@interface XMPPJID: OFObject +@interface XMPPJID: OFObject { /// The JID's localpart OFString *node; diff --git a/src/XMPPJID.m b/src/XMPPJID.m index 580916b..65fd60d 100644 --- a/src/XMPPJID.m +++ b/src/XMPPJID.m @@ -68,6 +68,22 @@ return self; } +- copy +{ + XMPPJID *new = [[XMPPJID alloc] init]; + + @try { + new->node = [node copy]; + new->domain = [domain copy]; + new->resource = [resource copy]; + } @catch (id e) { + [new release]; + @throw e; + } + + return new; +} + - (void)setNode: (OFString*)node_ { OFString *old = node;