ObjXMPP  Diff

Differences From Artifact [328a61beaa]:

To Artifact [e5a3313b65]:


18
19
20
21
22
23
24

25
26
27
28
29
30
31
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32







+







 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

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

@implementation XMPPStanza
@synthesize from;
@synthesize to;
@synthesize type;
@synthesize ID;

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







-
-
-
-
+

+
-
+

+
-
+








-
+



















-
+

-
+





-
+


-
+

-
+





-
+




-
+








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

	@try {
		OFXMLAttribute *attr;
		OFXMLElement *el;

		for (attr in elem.attributes) {
		for (OFXMLAttribute *attr in elem.attributes) {
			if ([attr.name isEqual: @"from"])
				[self setFrom: [XMPPJID JIDWithString:
				[self setFrom: [attr stringValue]];
				    [attr stringValue]]];
			else if ([attr.name isEqual: @"to"])
				[self setTo: [XMPPJID JIDWithString:
				[self setTo: [attr stringValue]];
				    [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 (el in elem.children)
		for (OFXMLElement *el in elem.children)
			[self addChild: el];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

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

	[super dealloc];
}

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

	[self removeAttributeForName: @"from"];
	[self addAttributeWithName: @"from"
		       stringValue: from_];
		       stringValue: from_.fullJID];
}

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

	[self removeAttributeForName: @"to"];
	[self addAttributeWithName: @"to"
		       stringValue: to];
		       stringValue: to_.fullJID];
}

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

	[self removeAttributeForName: @"type"];
	[self addAttributeWithName: @"type"
		       stringValue: type];
}