-
Notifications
You must be signed in to change notification settings - Fork 2
/
XMPPMessageStanzaFactory.m
47 lines (43 loc) · 1.29 KB
/
XMPPMessageStanzaFactory.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
//
// MessageStanzaFactory.m
// Jabber
//
// Created by David Chisnall on 24/05/2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "XMPPMessageStanzaFactory.h"
#import <EtoileXML/ETXMLString.h>
#import <EtoileXML/ETXMLXHTML-IMParser.h>
#import "XMPPError.h"
#ifdef WITH_XMPP_OBJECTSTORE
#import "XMPPObjectStore.h"
#endif
#import "XMPPMessage.h"
static XMPPMessageStanzaFactory * sharedInstance;
@implementation XMPPMessageStanzaFactory
+ (void) initialize
{
sharedInstance = [[XMPPMessageStanzaFactory alloc] init];
//Insert default handlers here:
[sharedInstance addHandler:[ETXMLString class] forTag:@"body"];
[sharedInstance addHandler:[ETXMLString class] forTag:@"subject"];
[sharedInstance addHandler:[XMPPTimestamp class] withValue:@"timestamp" forTag:@"x" inNamespace:@"jabber:x:delay"];
[sharedInstance addHandler:[XMPPError class] forTag:@"error"];
#ifndef WITHOUT_XHTML_IM
[sharedInstance addHandler:[ETXMLXHTML_IMParser class] forTag:@"html"];
#endif
#ifdef WITH_XMPP_OBJECTSTORE
[sharedInstance addHandler: [XMPPObjectStore class]
forTag: @"coreobject"
inNamespace: @"http://www.etoileos.com/CoreObject"];
#endif
}
+ (id) sharedStazaFactory
{
return sharedInstance;
}
- (id) parser
{
return [[XMPPMessage alloc] init];
}
@end