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
@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
{
	return [[[self alloc] initWithName: name] autorelease];
}

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

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

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type_
	      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];
}

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

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

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

	@try {
		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 (ID_ != nil)
			[self setID: ID_];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







|


|



|


|



|
|


|
|







|

|




|
|

|
|



|
|

|

|


|
|
|

|



|
|








|
|

|
|







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
{
	return [[[self alloc] initWithName: name
				      type: type] autorelease];
}

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

+ stanzaWithName: (OFString*)name
	    type: (OFString*)type
	      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];
}

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

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

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

	@try {
		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 (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
	}

	return self;
}

- (void)dealloc
{
	[from release];
	[to release];
	[type release];
	[ID release];

	[super dealloc];
}

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

	[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;
	type = [type_ copy];
	[old release];

	[self removeAttributeForName: @"type"];

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

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

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

	[self removeAttributeForName: @"id"];

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

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

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

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

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

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







|
|
|
|




|

|
|




|

|




|


|

|
|




|

|




|


|

|
|




|






|


|

|
|




|

|




|


|

|
|





|



|




|


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];

	[super dealloc];
}

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

	[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;
	_type = [type copy];
	[old release];

	[self removeAttributeForName: @"type"];

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

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

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

	[self removeAttributeForName: @"id"];

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

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

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

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

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

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