-
Notifications
You must be signed in to change notification settings - Fork 2
/
XMPPConnection.h
109 lines (104 loc) · 2.63 KB
/
XMPPConnection.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// XMPPConnection.h
// Jabber
//
// Created by David Chisnall on Sun Apr 18 2004.
// Copyright (c) 2004 David Chisnall. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EtoileFoundation/EtoileFoundation.h>
#import <EtoileXML/ETXMLNullHandler.h>
#import "XMPPDispatcher.h"
#import "XMPPRoster.h"
#import "XMPPPresence.h"
@class ETXMLSocketWriter;
/**
* The XMPPConnection class represents a connection to an XMPP server. It is the
* root parser owner. All XML received from the server is parsed by this class (or
* delegated to others by this class). All sending of XML data goes via this
* class.
*/
@interface XMPPConnection : ETXMLNullHandler <XMPPInfoQueryStanzaHandler>
{
//Socket
ETSocket *socket;
ETXMLSocketWriter *xmlWriter;
NSTimer *keepalive;
unsigned int messageID;
NSString* sessionID;
NSMutableString * unsentBuffer;
NSDictionary * streamFeatures;
//Current account details
NSString * serverHost;
NSString * server;
NSString * user;
NSString * pass;
NSString * res;
//XMPPRoster
XMPPRoster * roster;
XMPPDispatcher * dispatcher;
id account;
Class xmlLog;
//Delegates
id <XMPPPresenceDisplay,NSObject> presenceDisplay;
}
/**
* Initialise the connection for a specified account.
*/
- (id) initWithAccount:(id)anAccount;
/**
* Connect to the specified Jabber server as the specified user, with the given
* password.
*
* This needs changing for cases where the server is not that specified by the
* client's JID.
*/
- (void) connectToJabberServer:(NSString*) jabberServer
withJID:(JID*) aJID
password:(NSString*) password;
/**
* Reconnect after disconnection.
*/
- (void) reconnectToJabberServer;
/**
* Disconnect from the Jabber server.
*/
- (void) disconnect;
/**
* Send the passed XML to the server.
*/
- (void) XMPPSend: (NSString*) buffer;
/**
* Returns a new connection-unique ID to be used with iq set/get stanzas.
*/
- (NSString*) nextMessageID;
/**
* Returns YES if connected to the server.
*/
- (BOOL)isConnected;
/**
* Set the current status.
*/
- (void) setStatus:(unsigned char)aStatus withMessage:(NSString*)aMessage;
/**
* Sets the UI component used to display the presence. This should definitely be
* replaced with a notification based system.
*/
- (void) setPresenceDisplay:(id<XMPPPresenceDisplay,NSObject>)aDisplay;
/**
* Returns the dispatcher associated with the connection.
*/
- (XMPPDispatcher*) dispatcher;
/**
* Returns the server name.
*/
- (NSString*) server;
/**
* Returns the XML writer which can be used to send XML to the stream.
*/
- (ETXMLSocketWriter*)xmlWriter;
/**
* Checks if the connection is died
*/
- (BOOL) isDied;
@end