aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-02-25 03:07:46 +0000
committerMelanie2010-02-25 03:07:46 +0000
commite776bf93169c0231dcdaf4e197ae61ec656e00e1 (patch)
tree3fe464b14c36265e8b79b7cc0523774200ca4bfa
parentAdd the stream handler/listener and requisite methods to the friends module (diff)
downloadopensim-SC-e776bf93169c0231dcdaf4e197ae61ec656e00e1.zip
opensim-SC-e776bf93169c0231dcdaf4e197ae61ec656e00e1.tar.gz
opensim-SC-e776bf93169c0231dcdaf4e197ae61ec656e00e1.tar.bz2
opensim-SC-e776bf93169c0231dcdaf4e197ae61ec656e00e1.tar.xz
Grab the presence module and load the friends connector into the friends module
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index fe027c6..6134416 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -52,6 +52,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
52 52
53 protected int m_Port = 0; 53 protected int m_Port = 0;
54 54
55 protected List<Scene> m_Scenes = new List<Scene>();
56
57 protected IPresenceService m_PresenceService = null;
58 protected IFriendsService m_FriendsService = null;
59
60 protected IPresenceService PresenceService
61 {
62 get
63 {
64 if (m_PresenceService == null)
65 {
66 if (m_Scenes.Count > 0)
67 m_PresenceService = m_Scenes[0].RequestModuleInterface<IPresenceService>();
68 }
69
70 return m_PresenceService;
71 }
72 }
73
55 public FriendsModule() 74 public FriendsModule()
56 : base("POST", "/friends") 75 : base("POST", "/friends")
57 { 76 {
@@ -63,6 +82,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
63 if (friendsConfig != null) 82 if (friendsConfig != null)
64 { 83 {
65 m_Port = friendsConfig.GetInt("Port", m_Port); 84 m_Port = friendsConfig.GetInt("Port", m_Port);
85
86 string connector = friendsConfig.GetString("Connector", String.Empty);
87 Object[] args = new Object[] { config };
88
89 m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(connector, args);
90 }
91
92 if (m_FriendsService == null)
93 {
94 m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue");
95 throw new Exception("Connector load error");
66 } 96 }
67 97
68 IHttpServer server = MainServer.GetHttpServer((uint)m_Port); 98 IHttpServer server = MainServer.GetHttpServer((uint)m_Port);
@@ -81,6 +111,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
81 111
82 public void AddRegion(Scene scene) 112 public void AddRegion(Scene scene)
83 { 113 {
114 m_Scenes.Add(scene);
115 scene.RegisterModuleInterface<IFriendsModule>(this);
84 } 116 }
85 117
86 public void RegionLoaded(Scene scene) 118 public void RegionLoaded(Scene scene)
@@ -89,6 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
89 121
90 public void RemoveRegion(Scene scene) 122 public void RemoveRegion(Scene scene)
91 { 123 {
124 m_Scenes.Remove(scene);
92 } 125 }
93 126
94 public override byte[] Handle(string path, Stream requestData, 127 public override byte[] Handle(string path, Stream requestData,