ObjXMPP  Diff

Differences From Artifact [fbf43a1a52]:

To Artifact [8ed21f56f2]:


32
33
34
35
36
37
38
39

40
41
42

43
44
45
46

47
48
49

50
51
52
53
54


55
56
57
58


59
60
61
62
63
64
65
66

67
68

69
70
71
72
73
74


75
76
77


78
79
80
81
82


83
84

85
86

87
88
89
90
91



92
93

94
95
96
97
98


99
100
101
102
103
104
105
106
107
108


109
110
111


112
113
114
115
116
117
118
32
33
34
35
36
37
38

39
40
41

42
43
44
45

46
47
48

49
50
51
52


53
54
55
56


57
58
59
60
61
62
63
64
65

66
67

68
69
70
71
72


73
74
75


76
77
78
79
80


81
82
83

84
85

86
87
88



89
90
91
92

93
94
95
96


97
98
99
100
101
102
103
104
105
106


107
108
109


110
111
112
113
114
115
116
117
118







-
+


-
+



-
+


-
+



-
-
+
+


-
-
+
+







-
+

-
+




-
-
+
+

-
-
+
+



-
-
+
+

-
+

-
+


-
-
-
+
+
+

-
+



-
-
+
+








-
-
+
+

-
-
+
+







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

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type_
	    type: (OFString*)type
{
	return [[[self alloc] initWithName: name
				      type: type_] autorelease];
				      type: type] autorelease];
}

+ stanzaWithName: (OFString*)name
	      ID: (OFString*)ID_
	      ID: (OFString*)ID
{
	return [[[self alloc] initWithName: name
					ID: ID_] autorelease];
					ID: ID] autorelease];
}

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type_
	      ID: (OFString*)ID_
	    type: (OFString*)type
	      ID: (OFString*)ID
{
	return [[[self alloc] initWithName: name
				      type: type_
					ID: ID_] autorelease];
				      type: type
					ID: ID] autorelease];
}

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

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

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

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

- initWithName: (OFString*)name_
	  type: (OFString*)type_
	    ID: (OFString*)ID_
- initWithName: (OFString*)name
	  type: (OFString*)type
	    ID: (OFString*)ID
{
	self = [super initWithName: name_
	self = [super initWithName: name
			 namespace: XMPP_NS_CLIENT];

	@try {
		if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
		    ![name_ isEqual: @"presence"])
		if (![name isEqual: @"iq"] && ![name isEqual: @"message"] &&
		    ![name isEqual: @"presence"])
			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

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

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

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

	return self;
}
143
144
145
146
147
148
149
150
151
152
153




154
155
156
157
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
191

192
193
194

195
196
197


198
199
200
201
202

203
204
205
206
207
208
209

210
211
212

213
214
215


216
217
218
219
220

221
222

223
224
225
226
227

228
229
230

231
232
233


234
235
236
237
238
239

240
241
242
243

244
245
246
247
248

249
250
143
144
145
146
147
148
149




150
151
152
153
154
155
156
157

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

191
192
193

194
195


196
197
198
199
200
201

202
203
204
205
206
207
208

209
210
211

212
213


214
215
216
217
218
219

220
221

222
223
224
225
226

227
228
229

230
231


232
233
234
235
236
237
238

239
240
241
242

243
244
245
246
247

248
249
250







-
-
-
-
+
+
+
+




-
+

-
-
+
+




-
+

-
+




-
+


-
+

-
-
+
+




-
+

-
+




-
+


-
+

-
-
+
+




-
+






-
+


-
+

-
-
+
+




-
+

-
+




-
+


-
+

-
-
+
+





-
+



-
+




-
+


	}

	return self;
}

- (void)dealloc
{
	[from release];
	[to release];
	[type release];
	[ID release];
	[_from release];
	[_to release];
	[_type release];
	[_ID release];

	[super dealloc];
}

- (void)setFrom: (XMPPJID*)from_
- (void)setFrom: (XMPPJID*)from
{
	XMPPJID *old = from;
	from = [from_ copy];
	XMPPJID *old = _from;
	_from = [from copy];
	[old release];

	[self removeAttributeForName: @"from"];

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

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

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

	[self removeAttributeForName: @"to"];

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

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

- (void)setType: (OFString*)type_
- (void)setType: (OFString*)type
{
	OFString *old = type;
	type = [type_ copy];
	OFString *old = _type;
	_type = [type copy];
	[old release];

	[self removeAttributeForName: @"type"];

	if (type_ != nil)
	if (type != nil)
		[self addAttributeWithName: @"type"
			       stringValue: type];
}

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

- (void)setID: (OFString*)ID_
- (void)setID: (OFString*)ID
{
	OFString *old = ID;
	ID = [ID_ copy];
	OFString *old = _ID;
	_ID = [ID copy];
	[old release];

	[self removeAttributeForName: @"id"];

	if (ID_ != nil)
	if (ID != nil)
		[self addAttributeWithName: @"id"
			       stringValue: ID_];
			       stringValue: ID];
}

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

- (void)setLanguage: (OFString*)language_
- (void)setLanguage: (OFString*)language
{
	OFString *old = language;
	language = [language_ copy];
	OFString *old = _language;
	_language = [language copy];
	[old release];

	[self removeAttributeForName: @"lang"
			   namespace: @"http://www.w3.org/XML/1998/namespace"];

	if (language_ != nil)
	if (language != nil)
		[self addAttributeWithName: @"lang"
				 namespace: @"http://www.w3.org/XML/1998/"
					    @"namespace"
			       stringValue: language_];
			       stringValue: language];
}

- (OFString*)language
{
	return [[language copy] autorelease];
	return [[_language copy] autorelease];
}
@end