aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/InstantMessage
diff options
context:
space:
mode:
authorJeff Ames2008-05-01 14:31:30 +0000
committerJeff Ames2008-05-01 14:31:30 +0000
commitd51ce47b2d7635b17f3dd429158e8f59b78b83aa (patch)
treed3595bd5194199184059aa398b91a51dc6c799cf /OpenSim/Region/Environment/Modules/Avatar/InstantMessage
parent* Looks like I had the bamboo build right in the first place - it was just th... (diff)
downloadopensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.zip
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.gz
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.bz2
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.xz
Update svn properties. Minor formatting cleanup.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/InstantMessage')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs314
1 files changed, 157 insertions, 157 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
index cb58b4c..26586a5 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -1,158 +1,158 @@
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
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using Nini.Config; 30using Nini.Config;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34 34
35namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage 35namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
36{ 36{
37 public class InstantMessageModule : IRegionModule 37 public class InstantMessageModule : IRegionModule
38 { 38 {
39 private readonly List<Scene> m_scenes = new List<Scene>(); 39 private readonly List<Scene> m_scenes = new List<Scene>();
40 40
41 #region IRegionModule Members 41 #region IRegionModule Members
42 42
43 public void Initialise(Scene scene, IConfigSource config) 43 public void Initialise(Scene scene, IConfigSource config)
44 { 44 {
45 lock (m_scenes) 45 lock (m_scenes)
46 { 46 {
47 if (m_scenes.Count == 0) 47 if (m_scenes.Count == 0)
48 { 48 {
49 //scene.AddXmlRPCHandler("avatar_location_update", processPresenceUpdate); 49 //scene.AddXmlRPCHandler("avatar_location_update", processPresenceUpdate);
50 } 50 }
51 51
52 if (!m_scenes.Contains(scene)) 52 if (!m_scenes.Contains(scene))
53 { 53 {
54 m_scenes.Add(scene); 54 m_scenes.Add(scene);
55 scene.EventManager.OnNewClient += OnNewClient; 55 scene.EventManager.OnNewClient += OnNewClient;
56 scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage; 56 scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage;
57 } 57 }
58 } 58 }
59 } 59 }
60 60
61 public void PostInitialise() 61 public void PostInitialise()
62 { 62 {
63 } 63 }
64 64
65 public void Close() 65 public void Close()
66 { 66 {
67 } 67 }
68 68
69 public string Name 69 public string Name
70 { 70 {
71 get { return "InstantMessageModule"; } 71 get { return "InstantMessageModule"; }
72 } 72 }
73 73
74 public bool IsSharedModule 74 public bool IsSharedModule
75 { 75 {
76 get { return true; } 76 get { return true; }
77 } 77 }
78 78
79 #endregion 79 #endregion
80 80
81 private void OnNewClient(IClientAPI client) 81 private void OnNewClient(IClientAPI client)
82 { 82 {
83 client.OnInstantMessage += OnInstantMessage; 83 client.OnInstantMessage += OnInstantMessage;
84 } 84 }
85 85
86 private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID, 86 private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
87 LLUUID fromAgentSession, LLUUID toAgentID, 87 LLUUID fromAgentSession, LLUUID toAgentID,
88 LLUUID imSessionID, uint timestamp, string fromAgentName, 88 LLUUID imSessionID, uint timestamp, string fromAgentName,
89 string message, byte dialog, bool fromGroup, byte offline, 89 string message, byte dialog, bool fromGroup, byte offline,
90 uint ParentEstateID, LLVector3 Position, LLUUID RegionID, 90 uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
91 byte[] binaryBucket) 91 byte[] binaryBucket)
92 { 92 {
93 bool dialogHandledElsewhere 93 bool dialogHandledElsewhere
94 = ((dialog == 38) || (dialog == 39) || (dialog == 40) 94 = ((dialog == 38) || (dialog == 39) || (dialog == 40)
95 || dialog == (byte) InstantMessageDialog.InventoryOffered 95 || dialog == (byte) InstantMessageDialog.InventoryOffered
96 || dialog == (byte) InstantMessageDialog.InventoryAccepted 96 || dialog == (byte) InstantMessageDialog.InventoryAccepted
97 || dialog == (byte) InstantMessageDialog.InventoryDeclined); 97 || dialog == (byte) InstantMessageDialog.InventoryDeclined);
98 98
99 // IM dialogs need to be pre-processed and have their sessionID filled by the server 99 // IM dialogs need to be pre-processed and have their sessionID filled by the server
100 // so the sim can match the transaction on the return packet. 100 // so the sim can match the transaction on the return packet.
101 101
102 // Don't send a Friend Dialog IM with a LLUUID.Zero session. 102 // Don't send a Friend Dialog IM with a LLUUID.Zero session.
103 if (!(dialogHandledElsewhere && imSessionID == LLUUID.Zero)) 103 if (!(dialogHandledElsewhere && imSessionID == LLUUID.Zero))
104 { 104 {
105 // Try root avatar only first 105 // Try root avatar only first
106 foreach (Scene scene in m_scenes) 106 foreach (Scene scene in m_scenes)
107 { 107 {
108 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) 108 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence)
109 { 109 {
110 // Local message 110 // Local message
111 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 111 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
112 if (!user.IsChildAgent) 112 if (!user.IsChildAgent)
113 { 113 {
114 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 114 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
115 toAgentID, imSessionID, fromAgentName, dialog, 115 toAgentID, imSessionID, fromAgentName, dialog,
116 timestamp); 116 timestamp);
117 // Message sent 117 // Message sent
118 return; 118 return;
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 // try child avatar second 123 // try child avatar second
124 foreach (Scene scene in m_scenes) 124 foreach (Scene scene in m_scenes)
125 { 125 {
126 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) 126 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence)
127 { 127 {
128 // Local message 128 // Local message
129 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 129 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
130 130
131 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 131 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
132 toAgentID, imSessionID, fromAgentName, dialog, 132 toAgentID, imSessionID, fromAgentName, dialog,
133 timestamp); 133 timestamp);
134 // Message sent 134 // Message sent
135 return; 135 return;
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 140
141 // Still here, try send via Grid 141 // Still here, try send via Grid
142 // TODO 142 // TODO
143 } 143 }
144 144
145 // Trusty OSG1 called method. This method also gets called from the FriendsModule 145 // Trusty OSG1 called method. This method also gets called from the FriendsModule
146 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. 146 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend.
147 147
148 private void OnGridInstantMessage(GridInstantMessage msg) 148 private void OnGridInstantMessage(GridInstantMessage msg)
149 { 149 {
150 // Trigger the above event handler 150 // Trigger the above event handler
151 OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession), 151 OnInstantMessage(null, new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession),
152 new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName, 152 new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
153 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID, 153 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
154 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), 154 new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
155 msg.binaryBucket); 155 msg.binaryBucket);
156 } 156 }
157 } 157 }
158} \ No newline at end of file 158} \ No newline at end of file