-#ifndef USE_STRINGPREP_ICU
-/****************** libidn ********************/
-
-#include <stringprep.h>
-
-static int stringprep_prep(lua_State *L, const Stringprep_profile *profile)
-{
- size_t len;
- const char *s;
- char string[1024];
- int ret;
- if(!lua_isstring(L, 1)) {
- lua_pushnil(L);
- return 1;
- }
- s = lua_tolstring(L, 1, &len);
- if (len >= 1024) {
- lua_pushnil(L);
- return 1; /* TODO return error message */
- }
- strcpy(string, s);
- ret = stringprep(string, 1024, (Stringprep_profile_flags)0, profile);
- if (ret == STRINGPREP_OK) {
- lua_pushstring(L, string);
- return 1;
- } else {
- lua_pushnil(L);
- return 1; /* TODO return error message */
- }
-}
-
-#define MAKE_PREP_FUNC(myFunc, prep) \
-static int myFunc(lua_State *L) { return stringprep_prep(L, prep); }
-
-MAKE_PREP_FUNC(Lstringprep_nameprep, stringprep_nameprep) /** stringprep.nameprep(s) */
-MAKE_PREP_FUNC(Lstringprep_nodeprep, stringprep_xmpp_nodeprep) /** stringprep.nodeprep(s) */
-MAKE_PREP_FUNC(Lstringprep_resourceprep, stringprep_xmpp_resourceprep) /** stringprep.resourceprep(s) */
-MAKE_PREP_FUNC(Lstringprep_saslprep, stringprep_saslprep) /** stringprep.saslprep(s) */
-
-static const luaL_Reg Reg_stringprep[] =
-{
- { "nameprep", Lstringprep_nameprep },
- { "nodeprep", Lstringprep_nodeprep },
- { "resourceprep", Lstringprep_resourceprep },
- { "saslprep", Lstringprep_saslprep },
- { NULL, NULL }
-};