diff options
author | Mike Mazur | 2009-02-24 23:40:08 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-24 23:40:08 +0000 |
commit | d81fb565c1f48b013d107651c3bf383bd59e4daa (patch) | |
tree | 78b90903c6ee6dbce33f28b352d64e3b82fe3768 /OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs | |
parent | Close-to-final tweaking with appearance. This time sending *everything*. Addr... (diff) | |
download | opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.zip opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.gz opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.bz2 opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.xz |
Setting svn:eol-style=native on new files.
Diffstat (limited to 'OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs')
-rw-r--r-- | OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs | 270 |
1 files changed, 135 insertions, 135 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs index 5d13c1b..67d630e 100644 --- a/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs +++ b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs | |||
@@ -1,135 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.Net; | 29 | using System.Net; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nwc.XmlRpc; | 32 | using Nwc.XmlRpc; |
33 | using OpenSim.Data; | 33 | using OpenSim.Data; |
34 | 34 | ||
35 | namespace OpenSim.Grid.MessagingServer.Modules | 35 | namespace OpenSim.Grid.MessagingServer.Modules |
36 | { | 36 | { |
37 | public delegate RegionProfileData GetRegionData(ulong region_handle); | 37 | public delegate RegionProfileData GetRegionData(ulong region_handle); |
38 | public delegate void Done(PresenceInformer obj); | 38 | public delegate void Done(PresenceInformer obj); |
39 | 39 | ||
40 | 40 | ||
41 | public class PresenceInformer | 41 | public class PresenceInformer |
42 | { | 42 | { |
43 | public event GetRegionData OnGetRegionData; | 43 | public event GetRegionData OnGetRegionData; |
44 | public event Done OnDone; | 44 | public event Done OnDone; |
45 | 45 | ||
46 | private GetRegionData handlerGetRegionData = null; | 46 | private GetRegionData handlerGetRegionData = null; |
47 | private Done handlerDone = null; | 47 | private Done handlerDone = null; |
48 | 48 | ||
49 | public UserPresenceData presence1 = null; | 49 | public UserPresenceData presence1 = null; |
50 | public UserPresenceData presence2 = null; | 50 | public UserPresenceData presence2 = null; |
51 | public string gridserverurl, gridserversendkey, gridserverrecvkey; | 51 | public string gridserverurl, gridserversendkey, gridserverrecvkey; |
52 | public bool lookupRegion = true; | 52 | public bool lookupRegion = true; |
53 | //public methodGroup | 53 | //public methodGroup |
54 | 54 | ||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | public PresenceInformer() | 57 | public PresenceInformer() |
58 | { | 58 | { |
59 | 59 | ||
60 | } | 60 | } |
61 | public void go(object o) | 61 | public void go(object o) |
62 | { | 62 | { |
63 | if (presence1 != null && presence2 != null) | 63 | if (presence1 != null && presence2 != null) |
64 | { | 64 | { |
65 | SendRegionPresenceUpdate(presence1, presence2); | 65 | SendRegionPresenceUpdate(presence1, presence2); |
66 | } | 66 | } |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Informs a region about an Agent | 71 | /// Informs a region about an Agent |
72 | /// </summary> | 72 | /// </summary> |
73 | /// <param name="TalkingAbout">User to talk about</param> | 73 | /// <param name="TalkingAbout">User to talk about</param> |
74 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> | 74 | /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> |
75 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) | 75 | public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) |
76 | { | 76 | { |
77 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' | 77 | // TODO: Fill in pertenant Presence Data from 'TalkingAbout' |
78 | RegionProfileData whichRegion = new RegionProfileData(); | 78 | RegionProfileData whichRegion = new RegionProfileData(); |
79 | if (lookupRegion) | 79 | if (lookupRegion) |
80 | { | 80 | { |
81 | handlerGetRegionData = OnGetRegionData; | 81 | handlerGetRegionData = OnGetRegionData; |
82 | if (handlerGetRegionData != null) | 82 | if (handlerGetRegionData != null) |
83 | { | 83 | { |
84 | whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); | 84 | whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); |
85 | } | 85 | } |
86 | //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); | 86 | //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); |
87 | 87 | ||
88 | //whichRegion = rp; | 88 | //whichRegion = rp; |
89 | } | 89 | } |
90 | else | 90 | else |
91 | { | 91 | { |
92 | whichRegion = UserToUpdate.regionData; | 92 | whichRegion = UserToUpdate.regionData; |
93 | } | 93 | } |
94 | //whichRegion.httpServerURI | 94 | //whichRegion.httpServerURI |
95 | 95 | ||
96 | if (whichRegion != null) | 96 | if (whichRegion != null) |
97 | { | 97 | { |
98 | Hashtable PresenceParams = new Hashtable(); | 98 | Hashtable PresenceParams = new Hashtable(); |
99 | PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); | 99 | PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); |
100 | PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); | 100 | PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); |
101 | if (TalkingAbout.OnlineYN) | 101 | if (TalkingAbout.OnlineYN) |
102 | PresenceParams.Add("status","TRUE"); | 102 | PresenceParams.Add("status","TRUE"); |
103 | else | 103 | else |
104 | PresenceParams.Add("status","FALSE"); | 104 | PresenceParams.Add("status","FALSE"); |
105 | 105 | ||
106 | ArrayList SendParams = new ArrayList(); | 106 | ArrayList SendParams = new ArrayList(); |
107 | SendParams.Add(PresenceParams); | 107 | SendParams.Add(PresenceParams); |
108 | 108 | ||
109 | m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); | 109 | m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); |
110 | // Send | 110 | // Send |
111 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); | 111 | XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); |
112 | try | 112 | try |
113 | { | 113 | { |
114 | // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); | 114 | // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); |
115 | RegionReq.Send(whichRegion.httpServerURI, 6000); | 115 | RegionReq.Send(whichRegion.httpServerURI, 6000); |
116 | } | 116 | } |
117 | catch (WebException) | 117 | catch (WebException) |
118 | { | 118 | { |
119 | 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); | 119 | 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); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); | 124 | m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); |
125 | 125 | ||
126 | } | 126 | } |
127 | 127 | ||
128 | handlerDone = OnDone; | 128 | handlerDone = OnDone; |
129 | if (handlerDone != null) | 129 | if (handlerDone != null) |
130 | { | 130 | { |
131 | handlerDone(this); | 131 | handlerDone(this); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |