17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* 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
+ stanzaWithName: (OFString*)name
{
return [[[self alloc] initWithName: name] autorelease];
|
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* 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 "XMPPConnection.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"
@implementation XMPPStanza
+ stanzaWithName: (OFString*)name
{
return [[[self alloc] initWithName: name] autorelease];
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
@try {
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) {
|
|
>
>
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
@try {
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
![name_ isEqual: @"presence"])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
[self setDefaultNamespace: XMPP_NS_CLIENT];
[self setPrefix: @"stream"
forNamespace: XMPP_NS_STREAM];
if (type_ != nil)
[self setType: type_];
if (ID_ != nil)
[self setID: ID_];
} @catch (id e) {
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
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;
}
|
>
>
>
>
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
else
[self addAttribute: attr];
}
enumerator = [[elem children] objectEnumerator];
while ((el = [enumerator nextObject]) != nil)
[self addChild: el];
[self setDefaultNamespace: XMPP_NS_CLIENT];
[self setPrefix: @"stream"
forNamespace: XMPP_NS_STREAM];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|