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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
![name_ isEqual: @"presence"])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
[self setDefaultNamespace: @"jabber:client"];
if (type_)
[self setType: type_];
if (ID_)
[self setID: ID_];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithElement: (OFXMLElement*)elem
{
self = [super initWithName: elem.name
namespace: elem.namespace];
@try {
for (OFXMLAttribute *attr in elem.attributes) {
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];
}
for (OFXMLElement *el in elem.children)
[self addChild: el];
} @catch (id e) {
[self release];
@throw e;
}
return self;
|
|
|
|
|
>
|
>
>
>
>
|
|
|
|
|
>
|
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
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
|
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) {
[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];
} @catch (id e) {
[self release];
@throw e;
}
return self;
|
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
|
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];
}
|
|
|
|
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
|
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];
}
|