diff options
Diffstat (limited to 'OpenSim/Grid/MessagingServer/PresenceInformer.cs')
-rw-r--r-- | OpenSim/Grid/MessagingServer/PresenceInformer.cs | 81 |
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 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Net; | ||
30 | using log4net; | 31 | using log4net; |
31 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
32 | using OpenSim.Data; | 33 | using OpenSim.Data; |
33 | 34 | ||
34 | namespace OpenSim.Grid.MessagingServer | 35 | namespace 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 | } |