]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
m_spy no longer implements SPYNAMES, instead it overrides normal NAMES on the event...
[user/henk/code/inspircd.git] / src / modules.cpp
index ef494a7c6f5fcf605091d51d7cad87d3372ce586..8f32e94acc541054fd1b19fb1713c64fcd6daa70 100644 (file)
@@ -109,7 +109,7 @@ std::string Event::GetEventID()
 void           Module::OnUserConnect(User*) { }
 void           Module::OnUserQuit(User*, const std::string&, const std::string&) { }
 void           Module::OnUserDisconnect(User*) { }
-void           Module::OnUserJoin(User*, Channel*, bool&) { }
+void           Module::OnUserJoin(User*, Channel*, bool, bool&) { }
 void           Module::OnPostJoin(User*, Channel*) { }
 void           Module::OnUserPart(User*, Channel*, const std::string&, bool&) { }
 void           Module::OnRehash(User*, const std::string&) { }
@@ -404,13 +404,15 @@ bool ModuleManager::Load(const char* filename)
                newhandle = new ircd_module(Instance, modfile, "init_module");
                newmod = newhandle->CallInit();
 
-               if(newmod)
+               if (newmod)
                {
                        Version v = newmod->GetVersion();
 
                        if (v.API != API_VERSION)
                        {
+                               DetachAll(newmod);
                                delete newmod;
+                               delete newhandle;
                                LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")";
                                Instance->Log(DEFAULT, LastModuleError);
                                return false;
@@ -424,25 +426,42 @@ bool ModuleManager::Load(const char* filename)
                }
                else
                {
+                       delete newhandle;
                        LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem";
                        Instance->Log(DEFAULT, LastModuleError);
                        return false;
                }
        }
+       /** XXX: Is there anything we can do about this mess? -- Brain */
        catch (LoadModuleException& modexcept)
        {
+               DetachAll(newmod);
+               if (newmod)
+                       delete newmod;
+               if (newhandle)
+                       delete newhandle;
                LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason();
                Instance->Log(DEFAULT, LastModuleError);
                return false;
        }
        catch (FindSymbolException& modexcept)
        {
+               DetachAll(newmod);
+               if (newmod)
+                       delete newmod;
+               if (newhandle)
+                       delete newhandle;
                LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason();
                Instance->Log(DEFAULT, LastModuleError);
                return false;
        }
        catch (CoreException& modexcept)
        {
+               DetachAll(newmod);
+               if (newmod)
+                       delete newmod;
+               if (newhandle)
+                       delete newhandle;
                LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();
                Instance->Log(DEFAULT, LastModuleError);
                return false;