From fb9e85df5787450d4c9032b9c05a78390b2b3a0d Mon Sep 17 00:00:00 2001 From: Michael Giagnocavo Date: Thu, 4 Sep 2008 23:28:10 +0000 Subject: [PATCH] Allow class name only function resolution in mod_mono because some people were too lazy to fully qualify git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9456 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_mono_managed/Loader.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mod/languages/mod_mono_managed/Loader.cs b/src/mod/languages/mod_mono_managed/Loader.cs index ce5f515ee8..a8d254ffe6 100644 --- a/src/mod/languages/mod_mono_managed/Loader.cs +++ b/src/mod/languages/mod_mono_managed/Loader.cs @@ -42,6 +42,8 @@ namespace FreeSWITCH { // Stores a list of the loaded function types so we can instantiate them as needed static readonly Dictionary functions = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + // Only class name. Last in wins. + static readonly Dictionary shortFunctions = new Dictionary(StringComparer.InvariantCultureIgnoreCase); #region Load/Unload @@ -86,6 +88,7 @@ namespace FreeSWITCH if (shouldLoad) { Log.WriteLine(LogLevel.Notice, "Function {0} loaded.", t.FullName); functions.Add(t.FullName, t); + shortFunctions[t.Name] = t; } else { Log.WriteLine(LogLevel.Notice, "Function {0} requested not to be loaded.", t.FullName); @@ -137,8 +140,10 @@ namespace FreeSWITCH { Type t; if (!functions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) { - Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName); - return null; + if (!shortFunctions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) { + Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName); + return null; + } } return t; }