]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Allow class name only function resolution in mod_mono because some people were too...
authorMichael Giagnocavo <mgg@giagnocavo.net>
Thu, 4 Sep 2008 23:28:10 +0000 (23:28 +0000)
committerMichael Giagnocavo <mgg@giagnocavo.net>
Thu, 4 Sep 2008 23:28:10 +0000 (23:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9456 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_mono_managed/Loader.cs

index ce5f515ee8b562dc9bd7c5a23de52843c5db00db..a8d254ffe65021cd181d256525ea289802a91dfd 100644 (file)
@@ -42,6 +42,8 @@ namespace FreeSWITCH
     {\r
         // Stores a list of the loaded function types so we can instantiate them as needed\r
         static readonly Dictionary<string, Type> functions = new Dictionary<string, Type>(StringComparer.InvariantCultureIgnoreCase);\r
+        // Only class name. Last in wins.\r
+        static readonly Dictionary<string, Type> shortFunctions = new Dictionary<string, Type>(StringComparer.InvariantCultureIgnoreCase);\r
 \r
         #region Load/Unload\r
 \r
@@ -86,6 +88,7 @@ namespace FreeSWITCH
                     if (shouldLoad) {\r
                         Log.WriteLine(LogLevel.Notice, "Function {0} loaded.", t.FullName);\r
                         functions.Add(t.FullName, t);\r
+                        shortFunctions[t.Name] = t;\r
                     }\r
                     else {\r
                         Log.WriteLine(LogLevel.Notice, "Function {0} requested not to be loaded.", t.FullName);\r
@@ -137,8 +140,10 @@ namespace FreeSWITCH
         {\r
             Type t;\r
             if (!functions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) {\r
-                Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName);\r
-                return null;\r
+                if (!shortFunctions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) {\r
+                    Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName);\r
+                    return null;\r
+                }\r
             }\r
             return t;\r
         }\r