ADDED Makefile Index: Makefile ================================================================== --- /dev/null +++ Makefile @@ -0,0 +1,4 @@ +all: tests + +tests: test.m XMPPConnection.m XMPPStanza.m + objfw-compile -o $@ $^ -lidn -Wall -Werror Index: XMPPConnection.m ================================================================== --- XMPPConnection.m +++ XMPPConnection.m @@ -1,5 +1,7 @@ +#include +#include #import "XMPPConnection.h" #import "XMPPStanza.h" #define NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind" #define NS_CLIENT @"jabber:client" @@ -40,10 +42,31 @@ [parser release]; [elementBuilder release]; [super dealloc]; } + +- (void)setUsername: (OFString*)username_ +{ + OFString *old = username; + char *node; + + Stringprep_rc rc; + if ((rc = stringprep_profile([username_ cString], &node, "Nodeprep", 0)) + != STRINGPREP_OK) { + of_log(@"Nodeprep failed: %s", stringprep_strerror(rc)); + assert(0); + } + + @try { + username = [[OFString alloc] initWithCString: node]; + } @finally { + free(node); + } + + [old release]; +} - (void)_startStream { [sock writeFormat: @"\n" @"