--- a/TODO Thu Apr 02 02:56:31 2009 +0300
+++ b/TODO Thu Apr 02 02:59:52 2009 +0300
@@ -1,6 +1,8 @@
sock:
* async SSL handshake
* sock_openssl, or improve sock_gnutls
+ * client certs for sock_ssl_connect
+ * server cert validation for sock_ssl_connect
* tests...
irc_queue:
@@ -13,11 +15,6 @@
config:
* An even more advanced structured value parser that can then handle config values for more things like the command line --options
-modules:
- * proper unload support, there needs to be some kind of completion notification thing that can then destroy the module
- once it's completely unloaded - maybe some kind of module-resource-reference-counting thing, which will eventually
- be needed anyways?
-
irc_log:
* recode to valid UTF8
--- a/src/lua_objs.c Thu Apr 02 02:56:31 2009 +0300
+++ b/src/lua_objs.c Thu Apr 02 02:59:52 2009 +0300
@@ -510,6 +510,21 @@
char *path;
};
+static int lua_modules__gc (lua_State *L)
+{
+ struct lua_modules *lua_modules = lua_obj_get_obj(L, __func__, "spbot.modules");
+
+ // remove the modules path if it was set by us
+ if (lua_modules->path && modules_path(lua_modules->modules, NULL) == lua_modules->path)
+ modules_path(lua_modules->modules, "");
+
+ // release any strdup'd path
+ free(lua_modules->path);
+
+ // ok
+ return 0;
+}
+
static int lua_modules_path (lua_State *L)
{
struct lua_modules *lua_modules = lua_obj_get_obj(L, __func__, "spbot.modules");
@@ -577,6 +592,7 @@
}
static const struct luaL_Reg lua_modules_methods[] = {
+ { "__gc", &lua_modules__gc },
{ "path", &lua_modules_path },
{ "load", &lua_modules_load },
{ "module", &lua_modules_module },