-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathXMPPStreamFeatures.m
62 lines (54 loc) · 1.87 KB
/
XMPPStreamFeatures.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
61
62
//
// XMPPStreamFeatures.m
// Jabber
//
// Created by David Chisnall on 05/06/2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "XMPPStreamFeatures.h"
#import <EtoileXML/ETXMLString.h>
#import <EtoileFoundation/EtoileFoundation.h>
@implementation XMPPStreamFeatures
- (id) initWithXMLParser: (ETXMLParser*)aParser
key: (id)aKey
{
self = [super initWithXMLParser: aParser
key: aKey];
if (nil == self)
{
return nil;
}
features = [[NSMutableDictionary alloc] init];
[features setObject:[NSMutableArray array] forKey:@"mechanisms"];
#ifndef DNDEBUG
ETLog(@"Key is %@", aKey);
#endif
value = features;
return self;
}
- (void)startElement:(NSString *)aName
attributes:(NSDictionary*)attributes;
{
if([aName isEqualToString:@"stream:features"] || [aName isEqualToString:@"mechanisms"])
{
depth++;
}
else if([aName isEqualToString:@"mechanism"])
{
[[[ETXMLString alloc] initWithXMLParser:parser
key:@"mechanism"] startElement:aName
attributes:attributes];
}
else
{
[features setObject:[attributes objectForKey:@"xmlns"] forKey:aName];
[[[ETXMLNullHandler alloc] initWithXMLParser:parser
key:nil] startElement:aName
attributes:attributes];
}
}
- (void) addmechanism:(NSString*)aMechanism
{
[[features objectForKey:@"mechanisms"] addObject:aMechanism];
}
@end