ObjXMPP  Diff

Differences From Artifact [20dba48ed9]:

To Artifact [6749e640ea]:


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	      ID: (OFString*)ID_
{
	return [[[self alloc] initWithName: name
				      type: type_
					ID: ID_] autorelease];
}

+ stanzaWithElement: (OFXMLElement*)elem
{
	return [[[self alloc] initWithElement: elem] autorelease];
}

- initWithName: (OFString*)name_
{
	return [self initWithName: name_
			     type: nil
			       ID: nil];







|

|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	      ID: (OFString*)ID_
{
	return [[[self alloc] initWithName: name
				      type: type_
					ID: ID_] autorelease];
}

+ stanzaWithElement: (OFXMLElement*)element
{
	return [[[self alloc] initWithElement: element] autorelease];
}

- initWithName: (OFString*)name_
{
	return [self initWithName: name_
			     type: nil
			       ID: nil];
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
153
		[self release];
		@throw e;
	}

	return self;
}

- initWithElement: (OFXMLElement*)elem
{
	self = [super initWithName: [elem name]
			 namespace: [elem namespace]];

	@try {
		OFEnumerator *enumerator;
		OFXMLAttribute *attr;
		OFXMLElement *el;

		enumerator = [[elem attributes] objectEnumerator];
		while ((attr = [enumerator nextObject]) != nil) {
			if ([[attr name] isEqual: @"from"])
				[self setFrom: [XMPPJID JIDWithString:
				    [attr stringValue]]];
			else if ([[attr name] isEqual: @"to"])
				[self setTo: [XMPPJID JIDWithString:
				    [attr stringValue]]];
			else if ([[attr name] isEqual: @"type"])
				[self setType: [attr stringValue]];
			else if ([[attr name] isEqual: @"id"])
				[self setID: [attr stringValue]];
			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;
}







|

|
<


<
|
<

<
<
|
|
<
<
|
|
|
|
<
|
<
<
|
|
<
<
|

<
>
|
<







107
108
109
110
111
112
113
114
115
116

117
118

119

120


121
122


123
124
125
126

127


128
129


130
131

132
133

134
135
136
137
138
139
140
		[self release];
		@throw e;
	}

	return self;
}

- initWithElement: (OFXMLElement*)element
{
	self = [super initWithElement: element];


	@try {

		OFXMLAttribute *attribute;




		if ((attribute = [element attributeForName: @"from"]))
			[self setFrom:


			    [XMPPJID JIDWithString: [attribute stringValue]]];

		if ((attribute = [element attributeForName: @"to"]))
			[self setTo:

			    [XMPPJID JIDWithString: [attribute stringValue]]];



		if ((attribute = [element attributeForName: @"type"]))


			[self setType: [attribute stringValue]];


		if ((attribute = [element attributeForName: @"id"]))
			[self setID: [attribute stringValue]];

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

	return self;
}