Do Nodeprep on username and add Makefile
This commit is contained in:
parent
4bdf81b429
commit
fb15fbd391
2 changed files with 27 additions and 0 deletions
4
Makefile
Normal file
4
Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
all: tests
|
||||||
|
|
||||||
|
tests: test.m XMPPConnection.m XMPPStanza.m
|
||||||
|
objfw-compile -o $@ $^ -lidn -Wall -Werror
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stringprep.h>
|
||||||
|
#include <assert.h>
|
||||||
#import "XMPPConnection.h"
|
#import "XMPPConnection.h"
|
||||||
#import "XMPPStanza.h"
|
#import "XMPPStanza.h"
|
||||||
|
|
||||||
|
@ -43,6 +45,27 @@
|
||||||
[super dealloc];
|
[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
|
- (void)_startStream
|
||||||
{
|
{
|
||||||
[sock writeFormat: @"<?xml version='1.0'?>\n"
|
[sock writeFormat: @"<?xml version='1.0'?>\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue