ObjXMPP  Diff

Differences From Artifact [1421b4edb3]:

To Artifact [3a525ca278]:


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
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
			       ID: ID_];
}

- initWithName: (OFString*)name_
	  type: (OFString*)type_
	    ID: (OFString*)ID_
{
	if (!([name_ isEqual: @"iq"] ||
	      [name_ isEqual: @"message"] ||
	      [name_ isEqual: @"presence"]))
		of_log(@"Invalid stanza name!");

	self = [super initWithName: name_];


	[self setDefaultNamespace: @"jabber:client"];

	if (type_)
		[self setType: type_];

	if (ID_)
		[self setID: ID_];





	return self;
}

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


	OFXMLAttribute *attr;


	for (attr in elem.attributes) {
		if ([attr.name isEqual: @"from"]) {
			[self setFrom: [attr stringValue]];
		} else if ([attr.name isEqual: @"to"]) {
			[self setTo: [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];
		}
	}

	OFXMLElement *el;

	for (el in elem.children) {
		[self addChild: el];



	}

	return self;
}

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

	[super dealloc];
}

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


	[self addAttributeWithName: @"from" stringValue: from_];

}

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


	[self addAttributeWithName: @"to" stringValue: to];

}

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


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

}

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


	[self addAttributeWithName: @"id"
		       stringValue: ID];
}
@end







|
|
|



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








>
|
>

|
|
|
|
|
|
|
|
|
|
|

|
<
<
<
|
|
>
>
>




















>
>
|
>







>
>
|
>







>
>
|
>







>
>




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
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
			       ID: ID_];
}

- initWithName: (OFString*)name_
	  type: (OFString*)type_
	    ID: (OFString*)ID_
{
	if (![name_ isEqual: @"iq"] &&
	    ![name_ isEqual: @"message"] &&
	    ![name_ isEqual: @"presence"])
		of_log(@"Invalid stanza name!");

	self = [super initWithName: name_];

	@try {
		[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 {
		OFXMLAttribute *attr;
		OFXMLElement *el;

		for (attr in elem.attributes) {
			if ([attr.name isEqual: @"from"])
				[self setFrom: [attr stringValue]];
			else if ([attr.name isEqual: @"to"])
				[self setTo: [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)
			[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_
{
	OFString* old = from;
	from = [from_ copy];
	[old release];

	/* FIXME: Remove old attribute! */
	[self addAttributeWithName: @"from"
		       stringValue: from_];
}

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

	/* FIXME: Remove old attribute! */
	[self addAttributeWithName: @"to"
		       stringValue: to];
}

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

	/* FIXME: Remove old attribute! */
	[self addAttributeWithName: @"type"
		       stringValue: type];
}

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

	/* FIXME: Remove old attribute! */
	[self addAttributeWithName: @"id"
		       stringValue: ID];
}
@end