-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathXMPPError.m
60 lines (56 loc) · 1.18 KB
/
XMPPError.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// XMPPError.m
// Jabber
//
// Created by David Chisnall on 26/08/2007.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
#import "XMPPError.h"
#import <EtoileXML/ETXMLString.h>
#import <EtoileFoundation/EtoileFoundation.h>
@implementation XMPPError
/*
<error code='404' type='wait'>
<recipient-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>error message</text>
</error>
*/
- (void)startElement:(NSString *)aName
attributes:(NSDictionary*)attributes
{
if([aName isEqualToString:@"error"])
{
depth++;
code = [[attributes objectForKey:@"code"] intValue];
type = [attributes objectForKey:@"type"];
}
else if([aName isEqualToString:@"text"])
{
[[[ETXMLString alloc] initWithXMLParser:parser
key:@"text"] startElement:aName
attributes:attributes];
}
else
{
[[[ETXMLNullHandler alloc] initWithXMLParser:parser
key:nil] startElement:aName
attributes:attributes];
}
}
- (void) addtext:(NSString*)aString
{
message = aString;
}
- (NSString*) errorMessage
{
return message;
}
- (int) errorCode
{
return code;
}
- (NSString*) errorType
{
return type;
}
@end