28 using System.Collections.Generic;
30 using System.Reflection;
31 using System.Threading;
33 using OpenSim.Framework;
34 using OpenSim.Framework.Console;
35 using OpenSim.Framework.Monitoring;
36 using OpenSim.Region.ClientStack.LindenUDP;
37 using OpenSim.Region.Framework;
38 using OpenSim.Region.Framework.Interfaces;
39 using OpenSim.Region.Framework.Scenes;
40 using OpenSim.Services.Interfaces;
41 using OpenSim.Services.Connectors.Hypergrid;
44 using OpenMetaverse.Packets;
53 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"BasicSearchModule")]
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 protected List<Scene> m_Scenes =
new List<Scene>();
63 #region ISharedRegionModule
67 string umanmod = config.Configs[
"Modules"].GetString(
"SearchModule", Name);
71 m_log.DebugFormat(
"[BASIC SEARCH MODULE]: {0} is enabled", Name);
75 public bool IsSharedModule
80 public virtual string Name
82 get {
return "BasicSearchModule"; }
85 public Type ReplaceableInterface
96 scene.EventManager.OnMakeRootAgent +=
new Action<ScenePresence>(EventManager_OnMakeRootAgent);
97 scene.EventManager.OnMakeChildAgent +=
new EventManager.OnMakeChildAgentDelegate(EventManager_OnMakeChildAgent);
105 m_Scenes.Remove(scene);
107 scene.EventManager.OnMakeRootAgent -=
new Action<ScenePresence>(EventManager_OnMakeRootAgent);
108 scene.EventManager.OnMakeChildAgent -=
new EventManager.OnMakeChildAgentDelegate(EventManager_OnMakeChildAgent);
117 if (m_GroupsService == null)
122 if (m_GroupsService == null)
123 m_log.Warn(
"[BASIC SEARCH MODULE]: Could not get IGroupsModule");
136 #endregion ISharedRegionModule
139 #region Event Handlers
143 sp.ControllingClient.OnDirFindQuery += OnDirFindQuery;
148 sp.ControllingClient.OnDirFindQuery -= OnDirFindQuery;
151 void OnDirFindQuery(
IClientAPI remoteClient, UUID queryID,
string queryText, uint queryFlags,
int queryStart)
153 queryText = queryText.Trim();
157 if (
string.IsNullOrEmpty(queryText))
160 List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, queryText);
166 d.agentID = acc.PrincipalID;
167 d.firstName = acc.FirstName;
168 d.lastName = acc.LastName;
175 remoteClient.SendDirPeopleReply(queryID, hits);
179 if (m_GroupsService == null)
181 m_log.Warn(
"[BASIC SEARCH MODULE]: Groups service is not available. Unable to search groups.");
182 remoteClient.SendAlertMessage(
"Groups search is not enabled");
186 if (
string.IsNullOrEmpty(queryText))
190 remoteClient.SendDirGroupsReply(queryID, m_GroupsService.FindGroups(remoteClient, queryText).ToArray());
195 #endregion Event Handlers
void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void RegionLoaded(Scene s)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
Interactive OpenSim region server
void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
OpenMetaverse.DirectoryManager.DirFindFlags DirFindFlags
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
OpenMetaverse.DirectoryManager.DirFindFlags DirFindFlags