aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-01-09 10:17:39 +0100
committerKim Alvefur <zash@zash.se>2017-01-09 10:17:39 +0100
commitc3d9a2c11d362fcd1677d169af395c1f7bb8d4f1 (patch)
treef74647d6ef7f599b9f5283ae25b85c10ac124a2e
parentea5d14cb81bd618da08e46fc4a314379d8df46ca (diff)
parent9aed5f791f903dd1d5bd997fcb15bcece4c8e9e4 (diff)
downloadprosody-c3d9a2c11d362fcd1677d169af395c1f7bb8d4f1.tar.gz
prosody-c3d9a2c11d362fcd1677d169af395c1f7bb8d4f1.zip
Merge 0.10->trunk
-rw-r--r--plugins/mod_register.lua17
-rw-r--r--tools/erlparse.lua4
-rw-r--r--util-src/crand.c3
-rw-r--r--util-src/encodings.c3
-rw-r--r--util-src/hashes.c3
-rw-r--r--util-src/net.c3
-rw-r--r--util-src/pposix.c3
-rw-r--r--util-src/ringbuffer.c3
-rw-r--r--util-src/signal.c3
-rw-r--r--util-src/table.c3
-rw-r--r--util-src/windows.c3
-rw-r--r--util/dependencies.lua6
12 files changed, 44 insertions, 10 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index c376117f..ee3f88ba 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -41,30 +41,37 @@ local field_map = {
date = { name = "date", type = "text-single", label = "Birth date" };
};
+local title = module:get_option_string("registration_title",
+ "Creating a new account");
+local instructions = module:get_option_string("registration_instructions",
+ "Choose a username and password for use with this service.");
+
local registration_form = dataform_new{
- title = "Creating a new account";
- instructions = "Choose a username and password for use with this service.";
+ title = title;
+ instructions = instructions;
field_map.username;
field_map.password;
};
local registration_query = st.stanza("query", {xmlns = "jabber:iq:register"})
- :tag("instructions"):text("Choose a username and password for use with this service."):up()
+ :tag("instructions"):text(instructions):up()
:tag("username"):up()
:tag("password"):up();
for _, field in ipairs(additional_fields) do
if type(field) == "table" then
registration_form[#registration_form + 1] = field;
- else
+ elseif field_map[field] or field_map[field:sub(1, -2)] then
if field:match("%+$") then
- field = field:sub(1, #field - 1);
+ field = field:sub(1, -2);
field_map[field].required = true;
end
registration_form[#registration_form + 1] = field_map[field];
registration_query:tag(field):up();
+ else
+ module:log("error", "Unknown field %q", field);
end
end
registration_query:add_child(registration_form:form());
diff --git a/tools/erlparse.lua b/tools/erlparse.lua
index 25c38bcf..45bed265 100644
--- a/tools/erlparse.lua
+++ b/tools/erlparse.lua
@@ -189,9 +189,9 @@ local function readFile(filename)
end;
end
-module "erlparse"
+local _M = {};
-function parseFile(file)
+function _M.parseFile(file)
return readFile(file);
end
diff --git a/util-src/crand.c b/util-src/crand.c
index fbdec8f8..177511ce 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -130,6 +130,9 @@ int Lseed(lua_State *L) {
#endif
int luaopen_util_crand(lua_State *L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
lua_pushcfunction(L, Lrandom);
lua_setfield(L, -2, "bytes");
diff --git a/util-src/encodings.c b/util-src/encodings.c
index 35677095..6389b2be 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -524,6 +524,9 @@ static const luaL_Reg Reg_idna[] = {
/***************** end *****************/
LUALIB_API int luaopen_util_encodings(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
#ifdef USE_STRINGPREP_ICU
init_icu();
#endif
diff --git a/util-src/hashes.c b/util-src/hashes.c
index ecab2e32..d6f848c7 100644
--- a/util-src/hashes.c
+++ b/util-src/hashes.c
@@ -212,6 +212,9 @@ static const luaL_Reg Reg[] = {
};
LUALIB_API int luaopen_util_hashes(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
luaL_setfuncs(L, Reg, 0);;
lua_pushliteral(L, "-3.14");
diff --git a/util-src/net.c b/util-src/net.c
index 3ccc7618..18f3d27a 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -125,6 +125,9 @@ static int lc_local_addresses(lua_State* L) {
}
int luaopen_util_net(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
luaL_Reg exports[] = {
{ "local_addresses", lc_local_addresses },
{ NULL, NULL }
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 7037730f..39d8742b 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -779,6 +779,9 @@ int lc_fallocate(lua_State* L) {
/* Register functions */
int luaopen_util_pposix(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
luaL_Reg exports[] = {
{ "abort", lc_abort },
diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c
index f5fa136b..d60a43d9 100644
--- a/util-src/ringbuffer.c
+++ b/util-src/ringbuffer.c
@@ -197,6 +197,9 @@ int rb_gc(lua_State* L) {
}
int luaopen_util_ringbuffer(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
if(luaL_newmetatable(L, "ringbuffer_mt")) {
lua_pushcfunction(L, rb_tostring);
lua_setfield(L, -2, "__tostring");
diff --git a/util-src/signal.c b/util-src/signal.c
index 725555fa..3f29febb 100644
--- a/util-src/signal.c
+++ b/util-src/signal.c
@@ -384,6 +384,9 @@ static const struct luaL_Reg lsignal_lib[] = {
};
int luaopen_util_signal(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
int i = 0;
/* add the library */
diff --git a/util-src/table.c b/util-src/table.c
index 63415541..93acae65 100644
--- a/util-src/table.c
+++ b/util-src/table.c
@@ -21,6 +21,9 @@ static int Lpack(lua_State* L) {
int luaopen_util_table(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
lua_pushcfunction(L, Lcreate_table);
lua_setfield(L, -2, "create");
diff --git a/util-src/windows.c b/util-src/windows.c
index 4fcbf21e..e4457994 100644
--- a/util-src/windows.c
+++ b/util-src/windows.c
@@ -103,6 +103,9 @@ static const luaL_Reg Reg[] = {
};
LUALIB_API int luaopen_util_windows(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
luaL_setfuncs(L, Reg, 0);
lua_pushliteral(L, "-3.14");
diff --git a/util/dependencies.lua b/util/dependencies.lua
index 11cd9486..f213a5da 100644
--- a/util/dependencies.lua
+++ b/util/dependencies.lua
@@ -61,7 +61,7 @@ local function check_dependencies()
if not lxp then
missingdep("luaexpat", {
- ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-expat0";
+ ["Debian/Ubuntu"] = "sudo apt-get install lua-expat";
["luarocks"] = "luarocks install luaexpat";
["Source"] = "http://matthewwild.co.uk/projects/luaexpat/";
});
@@ -72,7 +72,7 @@ local function check_dependencies()
if not socket then
missingdep("luasocket", {
- ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-socket2";
+ ["Debian/Ubuntu"] = "sudo apt-get install lua-socket";
["luarocks"] = "luarocks install luasocket";
["Source"] = "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/";
});
@@ -83,7 +83,7 @@ local function check_dependencies()
if not lfs then
missingdep("luafilesystem", {
["luarocks"] = "luarocks install luafilesystem";
- ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-filesystem0";
+ ["Debian/Ubuntu"] = "sudo apt-get install lua-filesystem";
["Source"] = "http://www.keplerproject.org/luafilesystem/";
});
fatal = true;