Make reconnecting possible.

This commit is contained in:
Florian Zeitz 2012-11-08 21:42:10 +01:00
parent 1445c7654c
commit 6331f5695f

View file

@ -69,7 +69,6 @@
self = [super init];
@try {
sock = [[OFTCPSocket alloc] init];
port = 5222;
encrypted = NO;
streamOpen = NO;
@ -257,6 +256,12 @@
XMPPSRVLookup *SRVLookup = nil;
OFEnumerator *enumerator;
if (sock != nil)
@throw [OFAlreadyConnectedException
exceptionWithClass: [self class]];
sock = [[OFTCPSocket alloc] init];
if (server)
[sock connectToHost: [self XMPP_IDNAToASCII: server]
port: port];
@ -635,10 +640,23 @@
- (void)close
{
if (streamOpen) {
if (streamOpen)
[sock writeString: @"</stream:stream>"];
streamOpen = NO;
}
[oldParser release];
oldParser = nil;
[oldElementBuilder release];
oldElementBuilder = nil;
[authModule release];
authModule = nil;
[sock release];
sock = nil;
[JID release];
JID = nil;
streamOpen = needsSession = encrypted = NO;
supportsRosterVersioning = supportsStreamManagement = NO;
lastID = 0;
}
- (void)XMPP_handleStanza: (OFXMLElement*)element