ObjXMPP  Check-in [efd0127bff]

Overview
Comment:Set the default namespace and prefixes when creating a new XMPPStanza.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: efd0127bff10a7d42425efe3fa3e9c3ec864cd9f49fb733a60f3b5aef44959a4
User & Date: js on 2011-03-30 18:35:02
Other Links: manifest | tags
Context
2011-03-31
12:25
Adjust to newest ObjFW and greatly improve XML handling. check-in: 423434d147 user: js tags: trunk
2011-03-30
18:35
Set the default namespace and prefixes when creating a new XMPPStanza. check-in: efd0127bff user: js tags: trunk
18:12
Use OpenSSL to generate the nonce. check-in: 2adf07b564 user: js tags: trunk
Changes

Modified src/XMPPStanza.m from [3e896b294c] to [20dba48ed9].

17
18
19
20
21
22
23

24
25
26
27
28
29
30
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */


#import "XMPPStanza.h"
#import "XMPPJID.h"

@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
{
	return [[[self alloc] initWithName: name] autorelease];







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "XMPPConnection.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"

@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
{
	return [[[self alloc] initWithName: name] autorelease];
89
90
91
92
93
94
95
96


97
98
99
100
101
102
103

	@try {
		if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
		    ![name_ isEqual: @"presence"])
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		[self setDefaultNamespace: @"jabber:client"];



		if (type_ != nil)
			[self setType: type_];

		if (ID_ != nil)
			[self setID: ID_];
	} @catch (id e) {







|
>
>







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

	@try {
		if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
		    ![name_ isEqual: @"presence"])
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		[self setDefaultNamespace: XMPP_NS_CLIENT];
		[self setPrefix: @"stream"
		   forNamespace: XMPP_NS_STREAM];

		if (type_ != nil)
			[self setType: type_];

		if (ID_ != nil)
			[self setID: ID_];
	} @catch (id e) {
133
134
135
136
137
138
139




140
141
142
143
144
145
146
			else
				[self addAttribute: attr];
		}

		enumerator = [[elem children] objectEnumerator];
		while ((el = [enumerator nextObject]) != nil)
			[self addChild: el];




	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







>
>
>
>







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
			else
				[self addAttribute: attr];
		}

		enumerator = [[elem children] objectEnumerator];
		while ((el = [enumerator nextObject]) != nil)
			[self addChild: el];

		[self setDefaultNamespace: XMPP_NS_CLIENT];
		[self setPrefix: @"stream"
		   forNamespace: XMPP_NS_STREAM];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}