ObjXMPP  Diff

Differences From Artifact [20dba48ed9]:

To Artifact [6749e640ea]:


50
51
52
53
54
55
56
57

58
59

60
61
62
63
64
65
66
50
51
52
53
54
55
56

57
58

59
60
61
62
63
64
65
66







-
+

-
+







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

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

- initWithName: (OFString*)name_
{
	return [self initWithName: name_
			     type: nil
			       ID: nil];
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
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







-
+

-
+
-


-
-
+
-

-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
-
-
+
-
-
-
-
+
+
-
-
-
+

-
-
+
+
-







		[self release];
		@throw e;
	}

	return self;
}

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

	@try {
		OFEnumerator *enumerator;
		OFXMLAttribute *attr;
		OFXMLAttribute *attribute;
		OFXMLElement *el;

		enumerator = [[elem attributes] objectEnumerator];
		while ((attr = [enumerator nextObject]) != nil) {
			if ([[attr name] isEqual: @"from"])
				[self setFrom: [XMPPJID JIDWithString:
		if ((attribute = [element attributeForName: @"from"]))
			[self setFrom:
				    [attr stringValue]]];
			else if ([[attr name] isEqual: @"to"])
				[self setTo: [XMPPJID JIDWithString:
				    [attr stringValue]]];
			else if ([[attr name] isEqual: @"type"])
				[self setType: [attr stringValue]];
			    [XMPPJID JIDWithString: [attribute stringValue]]];

		if ((attribute = [element attributeForName: @"to"]))
			[self setTo:
			else if ([[attr name] isEqual: @"id"])
				[self setID: [attr stringValue]];
			    [XMPPJID JIDWithString: [attribute stringValue]]];
			else
				[self addAttribute: attr];
		}


		if ((attribute = [element attributeForName: @"type"]))
		enumerator = [[elem children] objectEnumerator];
		while ((el = [enumerator nextObject]) != nil)
			[self addChild: el];
			[self setType: [attribute stringValue]];

		[self setDefaultNamespace: XMPP_NS_CLIENT];
		[self setPrefix: @"stream"
		if ((attribute = [element attributeForName: @"id"]))
			[self setID: [attribute stringValue]];
		   forNamespace: XMPP_NS_STREAM];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}