ObjXMPP  Diff

Differences From Artifact [62c85c1076]:

To Artifact [26c7c49d18]:


26
27
28
29
30
31
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
#endif

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

@implementation XMPPStanza



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

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

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

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

+ (instancetype)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"])







>
>
>
|




|
|





|
|





|
|
|






|




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|
|






|
|






|
|
|







26
27
28
29
30
31
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
#endif

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

@implementation XMPPStanza
@synthesize from = _from, to = _to, type = _type, ID = _ID;
@synthesize language = _language;

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

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

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

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

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

- initWithName: (OFString *)name
     namespace: (nullable OFString *)namespace
   stringValue: (nullable OFString *)stringValue
{
	OF_INVALID_INIT_METHOD
}

- initWithXMLString: (OFString *)string
{
	OF_INVALID_INIT_METHOD
}

- initWithFile: (OFString *)path
{
	OF_INVALID_INIT_METHOD
}

- 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"])
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
		[self release];
		@throw e;
	}

	return self;
}

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

	@try {
		OFXMLAttribute *attribute;

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







|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
		[self release];
		@throw e;
	}

	return self;
}

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

	@try {
		OFXMLAttribute *attribute;

		if ((attribute = [element attributeForName: @"from"]))
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
	[_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







|












<
<
<
<
<
|












<
<
<
<
<
|












<
<
<
<
<
|












<
<
<
<
<
|














<
<
<
<
<

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
	[_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]];
}






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

	[self removeAttributeForName: @"to"];

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






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

	[self removeAttributeForName: @"type"];

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






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

	[self removeAttributeForName: @"id"];

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






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





@end