aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/MessagingServer/PresenceInformer.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-06-02 16:16:07 +0000
committerTeravus Ovares2008-06-02 16:16:07 +0000
commit3991908db5b50e764112d30e5750447db67795b5 (patch)
treebc5c47d6c26b87dd04c550ed24d5597e686e7663 /OpenSim/Grid/MessagingServer/PresenceInformer.cs
parentFixed half completed comment in OpenSim.ini.example. (diff)
downloadopensim-SC_OLD-3991908db5b50e764112d30e5750447db67795b5.zip
opensim-SC_OLD-3991908db5b50e764112d30e5750447db67795b5.tar.gz
opensim-SC_OLD-3991908db5b50e764112d30e5750447db67795b5.tar.bz2
opensim-SC_OLD-3991908db5b50e764112d30e5750447db67795b5.tar.xz
* This update enables grid wide presence updates.
* You'll need to start-up the MessageingServer and set it up. It sets up like any of the other grid servers. * All user presence data is kept in memory for speed, while the agent is online. That means if you shutdown the messaging server or the messaging server crashes, it forgets who's online/offline. * Occasionally the region-cache will get stale if regions move around a lot. if it gets stale, run clear-cache on the messaging server console to clear the region cache.
Diffstat (limited to 'OpenSim/Grid/MessagingServer/PresenceInformer.cs')
-rw-r--r--OpenSim/Grid/MessagingServer/PresenceInformer.cs81
1 files changed, 73 insertions, 8 deletions
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
index 59d0e13..050d88a 100644
--- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs
+++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
@@ -27,16 +27,31 @@
27 27
28using System.Collections; 28using System.Collections;
29using System.Reflection; 29using System.Reflection;
30using System.Net;
30using log4net; 31using log4net;
31using Nwc.XmlRpc; 32using Nwc.XmlRpc;
32using OpenSim.Data; 33using OpenSim.Data;
33 34
34namespace OpenSim.Grid.MessagingServer 35namespace OpenSim.Grid.MessagingServer
35{ 36{
37 public delegate RegionProfileData GetRegionData(ulong region_handle);
38 public delegate void Done(PresenceInformer obj);
39
40
36 public class PresenceInformer 41 public class PresenceInformer
37 { 42 {
43 public event GetRegionData OnGetRegionData;
44 public event Done OnDone;
45
46 private GetRegionData handlerGetRegionData = null;
47 private Done handlerDone = null;
48
38 public UserPresenceData presence1 = null; 49 public UserPresenceData presence1 = null;
39 public UserPresenceData presence2 = null; 50 public UserPresenceData presence2 = null;
51 public string gridserverurl, gridserversendkey, gridserverrecvkey;
52 public bool lookupRegion = true;
53 //public methodGroup
54
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 56
42 public PresenceInformer() 57 public PresenceInformer()
@@ -60,18 +75,68 @@ namespace OpenSim.Grid.MessagingServer
60 public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) 75 public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate)
61 { 76 {
62 // TODO: Fill in pertenant Presence Data from 'TalkingAbout' 77 // TODO: Fill in pertenant Presence Data from 'TalkingAbout'
78 RegionProfileData whichRegion = new RegionProfileData();
79 if (lookupRegion)
80 {
81 handlerGetRegionData = OnGetRegionData;
82 if (handlerGetRegionData != null)
83 {
84 whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle);
85 }
86 //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey);
63 87
64 RegionProfileData whichRegion = UserToUpdate.regionData; 88 //whichRegion = rp;
89 }
90 else
91 {
92 whichRegion = UserToUpdate.regionData;
93 }
65 //whichRegion.httpServerURI 94 //whichRegion.httpServerURI
66 95
67 Hashtable PresenceParams = new Hashtable(); 96 if (whichRegion != null)
68 ArrayList SendParams = new ArrayList(); 97 {
69 SendParams.Add(PresenceParams); 98
99
100 Hashtable PresenceParams = new Hashtable();
101 PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString());
102 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString());
103 if (TalkingAbout.OnlineYN)
104 PresenceParams.Add("status","TRUE");
105 else
106 PresenceParams.Add("status","FALSE");
107
108
109
110
111 ArrayList SendParams = new ArrayList();
112 SendParams.Add(PresenceParams);
113
114
115 m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI);
116 // Send
117 XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams);
118 try
119 {
120
121 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
122 }
123 catch (WebException)
124 {
125 m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname);
126 }
127 }
128 else
129 {
130 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping");
131
132 }
133
134 handlerDone = OnDone;
135 if (handlerDone != null)
136 {
137 handlerDone(this);
138 }
70 139
71 m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI);
72 // Send
73 XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams);
74 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
75 } 140 }
76 } 141 }
77} 142}