-
Notifications
You must be signed in to change notification settings - Fork 2
/
XMPPPresenceStanzaFactory.m
42 lines (38 loc) · 1.17 KB
/
XMPPPresenceStanzaFactory.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
//
// XMPPPresenceStanzaFactory.m
// Jabber
//
// Created by David Chisnall on 25/05/2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "XMPPPresenceStanzaFactory.h"
#import "XMPPPresence.h"
#import <EtoileXML/ETXMLString.h>
static XMPPPresenceStanzaFactory * sharedInstance;
@implementation XMPPPresenceStanzaFactory
+ (void) initialize
{
sharedInstance = [[XMPPPresenceStanzaFactory alloc] init];
//Insert default handlers here:
[sharedInstance addHandler:[ETXMLString class] forTag:@"show"];
[sharedInstance addHandler:[ETXMLString class] forTag:@"status"];
[sharedInstance addHandler:[ETXMLString class] forTag:@"nickname"];
[sharedInstance addHandler:[ETXMLString class] forTag:@"priority"];
//Replace the status message with an error message if one exists.
[sharedInstance addHandler:[ETXMLString class] withValue:@"status" forTag:@"error" ];
//vCard updates
[sharedInstance addHandler:NSClassFromString(@"XMPPvCardUpdate")
withValue:@"vCardUpdate"
forTag:@"x"
inNamespace:@"vcard-temp:x:update"];
//TODO: timestamps
}
+ (id) sharedStazaFactory
{
return sharedInstance;
}
- (id) parser
{
return [[XMPPPresence alloc] init];
}
@end