@@ -326,10 +326,20 @@ - (OFTCPSocket*)socket { return [[sock retain] autorelease]; } + +- (BOOL)encryptionRequired +{ + return encryptionRequired; +} + +- (void)setEncryptionRequired: (BOOL)required +{ + encryptionRequired = required; +} - (BOOL)encrypted { return encrypted; } @@ -709,10 +719,14 @@ [OFXMLElement elementWithName: @"starttls" namespace: XMPP_NS_STARTTLS]]; return; } + if (encryptionRequired && !encrypted) + /* TODO: Find/create an exception to throw here */ + @throw [OFException newWithClass: isa]; + if (mechs != nil) { OFEnumerator *enumerator; OFXMLElement *mech; enumerator = [[mechs children] objectEnumerator];