ObjXMPP  Check-in [c9c5afc2e7]

Overview
Comment:Add XMPPRosterItem class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c9c5afc2e7ff7c5e7137ae1a28c73bf637265944e0ac29ddb96b64f6bcb54977
User & Date: js on 2011-03-27 23:47:48
Other Links: manifest | tags
Context
2011-03-27
23:55
Add autorelease pools. check-in: 69621da29a user: js tags: trunk
23:47
Add XMPPRosterItem class. check-in: c9c5afc2e7 user: js tags: trunk
21:50
Don't synthesize the getter when the setter isn't synthesized. check-in: 6b038b0cf6 user: js tags: trunk
Changes

Modified ObjXMPP.xcodeproj/project.pbxproj from [1e7813da0b] to [f446e9346b].

29
30
31
32
33
34
35


36
37
38
39
40
41
42
		4BC559F91337AC0900E345C7 /* XMPPPLAINAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559E71337AC0900E345C7 /* XMPPPLAINAuth.m */; };
		4BC559FA1337AC0900E345C7 /* XMPPPresence.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559E81337AC0900E345C7 /* XMPPPresence.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC559FB1337AC0900E345C7 /* XMPPPresence.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559E91337AC0900E345C7 /* XMPPPresence.m */; };
		4BC559FC1337AC0900E345C7 /* XMPPSCRAMAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC55A001337AC1800E345C7 /* XMPPSCRAMAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */; };
		4BC55A011337AC1800E345C7 /* XMPPStanza.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559FE1337AC1800E345C7 /* XMPPStanza.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC55A021337AC1800E345C7 /* XMPPStanza.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559FF1337AC1800E345C7 /* XMPPStanza.m */; };


/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
		4B1295DE1337BD2D00154B25 /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = /usr/share/man/man1/;







>
>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
		4BC559F91337AC0900E345C7 /* XMPPPLAINAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559E71337AC0900E345C7 /* XMPPPLAINAuth.m */; };
		4BC559FA1337AC0900E345C7 /* XMPPPresence.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559E81337AC0900E345C7 /* XMPPPresence.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC559FB1337AC0900E345C7 /* XMPPPresence.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559E91337AC0900E345C7 /* XMPPPresence.m */; };
		4BC559FC1337AC0900E345C7 /* XMPPSCRAMAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC55A001337AC1800E345C7 /* XMPPSCRAMAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */; };
		4BC55A011337AC1800E345C7 /* XMPPStanza.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC559FE1337AC1800E345C7 /* XMPPStanza.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC55A021337AC1800E345C7 /* XMPPStanza.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC559FF1337AC1800E345C7 /* XMPPStanza.m */; };
		4BD9BF59134003F700DAB43A /* XMPPRosterItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD9BF57134003F700DAB43A /* XMPPRosterItem.h */; };
		4BD9BF5A134003F700DAB43A /* XMPPRosterItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD9BF58134003F700DAB43A /* XMPPRosterItem.m */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
		4B1295DE1337BD2D00154B25 /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = /usr/share/man/man1/;
71
72
73
74
75
76
77


78
79
80
81
82
83
84
		4BC559E81337AC0900E345C7 /* XMPPPresence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPPresence.h; path = src/XMPPPresence.h; sourceTree = SOURCE_ROOT; };
		4BC559E91337AC0900E345C7 /* XMPPPresence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPPresence.m; path = src/XMPPPresence.m; sourceTree = SOURCE_ROOT; };
		4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPSCRAMAuth.h; path = src/XMPPSCRAMAuth.h; sourceTree = SOURCE_ROOT; };
		4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPSCRAMAuth.m; path = src/XMPPSCRAMAuth.m; sourceTree = SOURCE_ROOT; };
		4BC559FE1337AC1800E345C7 /* XMPPStanza.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPStanza.h; path = src/XMPPStanza.h; sourceTree = SOURCE_ROOT; };
		4BC559FF1337AC1800E345C7 /* XMPPStanza.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPStanza.m; path = src/XMPPStanza.m; sourceTree = SOURCE_ROOT; };
		4BC55A051337ADA800E345C7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };


/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		4B1295DD1337BD2D00154B25 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (







>
>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
		4BC559E81337AC0900E345C7 /* XMPPPresence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPPresence.h; path = src/XMPPPresence.h; sourceTree = SOURCE_ROOT; };
		4BC559E91337AC0900E345C7 /* XMPPPresence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPPresence.m; path = src/XMPPPresence.m; sourceTree = SOURCE_ROOT; };
		4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPSCRAMAuth.h; path = src/XMPPSCRAMAuth.h; sourceTree = SOURCE_ROOT; };
		4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPSCRAMAuth.m; path = src/XMPPSCRAMAuth.m; sourceTree = SOURCE_ROOT; };
		4BC559FE1337AC1800E345C7 /* XMPPStanza.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPStanza.h; path = src/XMPPStanza.h; sourceTree = SOURCE_ROOT; };
		4BC559FF1337AC1800E345C7 /* XMPPStanza.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPStanza.m; path = src/XMPPStanza.m; sourceTree = SOURCE_ROOT; };
		4BC55A051337ADA800E345C7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
		4BD9BF57134003F700DAB43A /* XMPPRosterItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMPPRosterItem.h; path = src/XMPPRosterItem.h; sourceTree = SOURCE_ROOT; };
		4BD9BF58134003F700DAB43A /* XMPPRosterItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMPPRosterItem.m; path = src/XMPPRosterItem.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		4B1295DD1337BD2D00154B25 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
151
152
153
154
155
156
157


158
159
160
161
162
163
164
				4BC559E31337AC0900E345C7 /* XMPPJID.m */,
				4BC559E41337AC0900E345C7 /* XMPPMessage.h */,
				4BC559E51337AC0900E345C7 /* XMPPMessage.m */,
				4BC559E61337AC0900E345C7 /* XMPPPLAINAuth.h */,
				4BC559E71337AC0900E345C7 /* XMPPPLAINAuth.m */,
				4BC559E81337AC0900E345C7 /* XMPPPresence.h */,
				4BC559E91337AC0900E345C7 /* XMPPPresence.m */,


				4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */,
				4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */,
				4BC559FE1337AC1800E345C7 /* XMPPStanza.h */,
				4BC559FF1337AC1800E345C7 /* XMPPStanza.m */,
				4BC559D91337AC0900E345C7 /* arc4random_uniform.m */,
			);
			path = ObjXMPP;







>
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
				4BC559E31337AC0900E345C7 /* XMPPJID.m */,
				4BC559E41337AC0900E345C7 /* XMPPMessage.h */,
				4BC559E51337AC0900E345C7 /* XMPPMessage.m */,
				4BC559E61337AC0900E345C7 /* XMPPPLAINAuth.h */,
				4BC559E71337AC0900E345C7 /* XMPPPLAINAuth.m */,
				4BC559E81337AC0900E345C7 /* XMPPPresence.h */,
				4BC559E91337AC0900E345C7 /* XMPPPresence.m */,
				4BD9BF57134003F700DAB43A /* XMPPRosterItem.h */,
				4BD9BF58134003F700DAB43A /* XMPPRosterItem.m */,
				4BC559EA1337AC0900E345C7 /* XMPPSCRAMAuth.h */,
				4BC559FD1337AC1800E345C7 /* XMPPSCRAMAuth.m */,
				4BC559FE1337AC1800E345C7 /* XMPPStanza.h */,
				4BC559FF1337AC1800E345C7 /* XMPPStanza.m */,
				4BC559D91337AC0900E345C7 /* arc4random_uniform.m */,
			);
			path = ObjXMPP;
185
186
187
188
189
190
191

192
193
194
195
196
197
198
				4BC559F21337AC0900E345C7 /* XMPPIQ.h in Headers */,
				4BC559F41337AC0900E345C7 /* XMPPJID.h in Headers */,
				4BC559F61337AC0900E345C7 /* XMPPMessage.h in Headers */,
				4BC559F81337AC0900E345C7 /* XMPPPLAINAuth.h in Headers */,
				4BC559FA1337AC0900E345C7 /* XMPPPresence.h in Headers */,
				4BC559FC1337AC0900E345C7 /* XMPPSCRAMAuth.h in Headers */,
				4BC55A011337AC1800E345C7 /* XMPPStanza.h in Headers */,

			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
		4B1295DF1337BD2D00154B25 /* ObjXMPPTests */ = {







>







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
				4BC559F21337AC0900E345C7 /* XMPPIQ.h in Headers */,
				4BC559F41337AC0900E345C7 /* XMPPJID.h in Headers */,
				4BC559F61337AC0900E345C7 /* XMPPMessage.h in Headers */,
				4BC559F81337AC0900E345C7 /* XMPPPLAINAuth.h in Headers */,
				4BC559FA1337AC0900E345C7 /* XMPPPresence.h in Headers */,
				4BC559FC1337AC0900E345C7 /* XMPPSCRAMAuth.h in Headers */,
				4BC55A011337AC1800E345C7 /* XMPPStanza.h in Headers */,
				4BD9BF59134003F700DAB43A /* XMPPRosterItem.h in Headers */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
		4B1295DF1337BD2D00154B25 /* ObjXMPPTests */ = {
283
284
285
286
287
288
289

290
291
292
293
294
295
296
				4BC559F31337AC0900E345C7 /* XMPPIQ.m in Sources */,
				4BC559F51337AC0900E345C7 /* XMPPJID.m in Sources */,
				4BC559F71337AC0900E345C7 /* XMPPMessage.m in Sources */,
				4BC559F91337AC0900E345C7 /* XMPPPLAINAuth.m in Sources */,
				4BC559FB1337AC0900E345C7 /* XMPPPresence.m in Sources */,
				4BC55A001337AC1800E345C7 /* XMPPSCRAMAuth.m in Sources */,
				4BC55A021337AC1800E345C7 /* XMPPStanza.m in Sources */,

			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
		4B1295EA1337BD2D00154B25 /* Debug */ = {







>







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
				4BC559F31337AC0900E345C7 /* XMPPIQ.m in Sources */,
				4BC559F51337AC0900E345C7 /* XMPPJID.m in Sources */,
				4BC559F71337AC0900E345C7 /* XMPPMessage.m in Sources */,
				4BC559F91337AC0900E345C7 /* XMPPPLAINAuth.m in Sources */,
				4BC559FB1337AC0900E345C7 /* XMPPPresence.m in Sources */,
				4BC55A001337AC1800E345C7 /* XMPPSCRAMAuth.m in Sources */,
				4BC55A021337AC1800E345C7 /* XMPPStanza.m in Sources */,
				4BD9BF5A134003F700DAB43A /* XMPPRosterItem.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
		4B1295EA1337BD2D00154B25 /* Debug */ = {

Modified src/XMPPConnection.m from [be8ca31728] to [3fbb4082fa].

32
33
34
35
36
37
38

39
40
41
42
43
44
45
#import "XMPPSCRAMAuth.h"
#import "XMPPPLAINAuth.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"

#import "XMPPExceptions.h"

#define NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind"
#define NS_CLIENT @"jabber:client"
#define NS_ROSTER @"jabber:iq:roster"
#define NS_SASL @"urn:ietf:params:xml:ns:xmpp-sasl"
#define NS_STARTTLS @"urn:ietf:params:xml:ns:xmpp-tls"







>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import "XMPPSCRAMAuth.h"
#import "XMPPPLAINAuth.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRosterItem.h"
#import "XMPPExceptions.h"

#define NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind"
#define NS_CLIENT @"jabber:client"
#define NS_ROSTER @"jabber:iq:roster"
#define NS_SASL @"urn:ietf:params:xml:ns:xmpp-sasl"
#define NS_STARTTLS @"urn:ietf:params:xml:ns:xmpp-tls"
627
628
629
630
631
632
633

634
635
636
637
638
639


640
641



642
643
644

645
646
647
648
649
650
651
652
653
654
655


656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
	rosterElem = iq.children.firstObject;

	if (![rosterElem.name isEqual: @"query"] ||
	    ![rosterElem.namespace isEqual: NS_ROSTER])
		assert(0);

	for (OFXMLElement *elem in rosterElem.children) {

		OFArray *groups;

		if (![elem.name isEqual: @"item"] ||
		    ![elem.ns isEqual: NS_ROSTER])
			continue;



		groups = [elem elementsForName: @"group"
				     namespace: NS_ROSTER];




		for (OFXMLElement *groupElem in groups) {
			OFString *group = groupElem.stringValue;

			OFMutableArray *rosterGroup =
			    [roster objectForKey: group];

			if (rosterGroup == nil) {
				rosterGroup = [OFMutableArray array];
				[roster setObject: rosterGroup
					   forKey: group];
			}

			[rosterGroup addObject: elem];
		}



		if (groups.count == 0) {
			OFMutableArray *rosterGroup =
			    [roster objectForKey: @""];

			if (rosterGroup == nil) {
				rosterGroup = [OFMutableArray array];
				[roster setObject: rosterGroup
					   forKey: @""];
			}

			[rosterGroup addObject: elem];
		}
	}

	if ([delegate respondsToSelector:
	    @selector(connectionDidReceiveRoster:)])
		[delegate connectionDidReceiveRoster: self];

	[rosterID release];
	rosterID = nil;
}
@end







>
|





>
>
|
|
>
>
>

|
|
>

|




|


|

>
>











|











628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
	rosterElem = iq.children.firstObject;

	if (![rosterElem.name isEqual: @"query"] ||
	    ![rosterElem.namespace isEqual: NS_ROSTER])
		assert(0);

	for (OFXMLElement *elem in rosterElem.children) {
		XMPPRosterItem *rosterItem;
		OFMutableArray *groups = [OFMutableArray array];

		if (![elem.name isEqual: @"item"] ||
		    ![elem.ns isEqual: NS_ROSTER])
			continue;

		rosterItem = [XMPPRosterItem rosterItem];
		rosterItem.JID = [XMPPJID JIDWithString:
		    [rosterElem attributeForName: @"jid"].stringValue];
		rosterItem.name =
		    [rosterElem attributeForName: @"name"].stringValue;
		rosterItem.subscription =
		    [rosterElem attributeForName: @"subscription"].stringValue;

		for (OFXMLElement *groupElem in
		     [elem elementsForName: @"group"
				 namespace: NS_ROSTER]) {
			OFMutableArray *rosterGroup =
			     [roster objectForKey: rosterElem.stringValue];

			if (rosterGroup == nil) {
				rosterGroup = [OFMutableArray array];
				[roster setObject: rosterGroup
					   forKey: rosterElem.stringValue];
			}

			[rosterGroup addObject: rosterItem];
		}

		rosterItem.groups = groups;

		if (groups.count == 0) {
			OFMutableArray *rosterGroup =
			    [roster objectForKey: @""];

			if (rosterGroup == nil) {
				rosterGroup = [OFMutableArray array];
				[roster setObject: rosterGroup
					   forKey: @""];
			}

			[rosterGroup addObject: rosterItem];
		}
	}

	if ([delegate respondsToSelector:
	    @selector(connectionDidReceiveRoster:)])
		[delegate connectionDidReceiveRoster: self];

	[rosterID release];
	rosterID = nil;
}
@end

Modified src/XMPPJID.m from [d4cd01dc5d] to [abcbfecd4e].

35
36
37
38
39
40
41


42
43




44
45
46
47
48
49
50
51
+ JIDWithString: (OFString*)str
{
	return [[[self alloc] initWithString: str] autorelease];
}

- initWithString: (OFString*)str
{


	self = [super init];





	size_t nodesep, resourcesep;
	nodesep = [str indexOfFirstOccurrenceOfString: @"@"];
	resourcesep = [str indexOfFirstOccurrenceOfString: @"/"];

	if (nodesep == SIZE_MAX)
		[self setNode: nil];
	else
		[self setNode: [str substringFromIndex: 0







>
>


>
>
>
>
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
+ JIDWithString: (OFString*)str
{
	return [[[self alloc] initWithString: str] autorelease];
}

- initWithString: (OFString*)str
{
	size_t nodesep, resourcesep;

	self = [super init];

	if (str == nil) {
		[self release];
		return nil;
	}

	nodesep = [str indexOfFirstOccurrenceOfString: @"@"];
	resourcesep = [str indexOfFirstOccurrenceOfString: @"/"];

	if (nodesep == SIZE_MAX)
		[self setNode: nil];
	else
		[self setNode: [str substringFromIndex: 0

Modified src/XMPPStanza.m from [a16d9343e0] to [9926f881b4].

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
	[self removeAttributeForName: @"from"];

	if (from_ != nil)
		[self addAttributeWithName: @"from"
			       stringValue: from_.fullJID];
}

- (OFString*)from
{
	return [[from copy] autorelease];
}

- (void)setTo: (XMPPJID*)to_
{
	XMPPJID *old = to;
	to = [to_ copy];
	[old release];

	[self removeAttributeForName: @"to"];

	if (to_ != nil)
		[self addAttributeWithName: @"to"
			       stringValue: to_.fullJID];
}

- (OFString*)to
{
	return [[to copy] autorelease];
}

- (void)setType: (OFString*)type_
{
	OFString *old = type;







|

















|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
	[self removeAttributeForName: @"from"];

	if (from_ != nil)
		[self addAttributeWithName: @"from"
			       stringValue: from_.fullJID];
}

- (XMPPJID*)from
{
	return [[from copy] autorelease];
}

- (void)setTo: (XMPPJID*)to_
{
	XMPPJID *old = to;
	to = [to_ copy];
	[old release];

	[self removeAttributeForName: @"to"];

	if (to_ != nil)
		[self addAttributeWithName: @"to"
			       stringValue: to_.fullJID];
}

- (XMPPJID*)to
{
	return [[to copy] autorelease];
}

- (void)setType: (OFString*)type_
{
	OFString *old = type;