diff options
author | Dr Scofield | 2009-02-10 13:10:57 +0000 |
---|---|---|
committer | Dr Scofield | 2009-02-10 13:10:57 +0000 |
commit | 180be7de07014aa33bc6066f12a0819b731c1c9d (patch) | |
tree | 3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs | |
parent | Stopgap measure: To use gridlaunch, or GUI, start opensim with (diff) | |
download | opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.zip opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2 opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz |
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what
has happened is that OpenSim.Region.Environment.Modules has been split
in two:
- OpenSim.Region.CoreModules: all those modules that are either
directly or indirectly referenced from other OpenSim packages, or
that provide functionality that the OpenSim developer community
considers core functionality:
CoreModules/Agent/AssetTransaction
CoreModules/Agent/Capabilities
CoreModules/Agent/TextureDownload
CoreModules/Agent/TextureSender
CoreModules/Agent/TextureSender/Tests
CoreModules/Agent/Xfer
CoreModules/Avatar/AvatarFactory
CoreModules/Avatar/Chat/ChatModule
CoreModules/Avatar/Combat
CoreModules/Avatar/Currency/SampleMoney
CoreModules/Avatar/Dialog
CoreModules/Avatar/Friends
CoreModules/Avatar/Gestures
CoreModules/Avatar/Groups
CoreModules/Avatar/InstantMessage
CoreModules/Avatar/Inventory
CoreModules/Avatar/Inventory/Archiver
CoreModules/Avatar/Inventory/Transfer
CoreModules/Avatar/Lure
CoreModules/Avatar/ObjectCaps
CoreModules/Avatar/Profiles
CoreModules/Communications/Local
CoreModules/Communications/REST
CoreModules/Framework/EventQueue
CoreModules/Framework/InterfaceCommander
CoreModules/Hypergrid
CoreModules/InterGrid
CoreModules/Scripting/DynamicTexture
CoreModules/Scripting/EMailModules
CoreModules/Scripting/HttpRequest
CoreModules/Scripting/LoadImageURL
CoreModules/Scripting/VectorRender
CoreModules/Scripting/WorldComm
CoreModules/Scripting/XMLRPC
CoreModules/World/Archiver
CoreModules/World/Archiver/Tests
CoreModules/World/Estate
CoreModules/World/Land
CoreModules/World/Permissions
CoreModules/World/Serialiser
CoreModules/World/Sound
CoreModules/World/Sun
CoreModules/World/Terrain
CoreModules/World/Terrain/DefaultEffects
CoreModules/World/Terrain/DefaultEffects/bin
CoreModules/World/Terrain/DefaultEffects/bin/Debug
CoreModules/World/Terrain/Effects
CoreModules/World/Terrain/FileLoaders
CoreModules/World/Terrain/FloodBrushes
CoreModules/World/Terrain/PaintBrushes
CoreModules/World/Terrain/Tests
CoreModules/World/Vegetation
CoreModules/World/Wind
CoreModules/World/WorldMap
- OpenSim.Region.OptionalModules: all those modules that are not core
modules:
OptionalModules/Avatar/Chat/IRC-stuff
OptionalModules/Avatar/Concierge
OptionalModules/Avatar/Voice/AsterixVoice
OptionalModules/Avatar/Voice/SIPVoice
OptionalModules/ContentManagementSystem
OptionalModules/Grid/Interregion
OptionalModules/Python
OptionalModules/SvnSerialiser
OptionalModules/World/NPC
OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs deleted file mode 100644 index 3a1b282..0000000 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Net; | ||
32 | using System.Threading; | ||
33 | using OpenMetaverse; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Client; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | |||
42 | namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | ||
43 | { | ||
44 | public class InstantMessageModule : IRegionModule | ||
45 | { | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | /// <value> | ||
49 | /// Is this module enabled? | ||
50 | /// </value> | ||
51 | private bool m_enabled = false; | ||
52 | |||
53 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
54 | |||
55 | #region IRegionModule Members | ||
56 | |||
57 | private IMessageTransferModule m_TransferModule = null; | ||
58 | |||
59 | public void Initialise(Scene scene, IConfigSource config) | ||
60 | { | ||
61 | if (config.Configs["Messaging"] != null) | ||
62 | { | ||
63 | if (config.Configs["Messaging"].GetString( | ||
64 | "InstantMessageModule", "InstantMessageModule") != | ||
65 | "InstantMessageModule") | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | m_enabled = true; | ||
70 | |||
71 | lock (m_scenes) | ||
72 | { | ||
73 | if (!m_scenes.Contains(scene)) | ||
74 | { | ||
75 | m_scenes.Add(scene); | ||
76 | scene.EventManager.OnClientConnect += OnClientConnect; | ||
77 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | |||
82 | void OnClientConnect(IClientCore client) | ||
83 | { | ||
84 | IClientIM clientIM; | ||
85 | if (client.TryGet(out clientIM)) | ||
86 | { | ||
87 | clientIM.OnInstantMessage += OnInstantMessage; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void PostInitialise() | ||
92 | { | ||
93 | if (!m_enabled) | ||
94 | return; | ||
95 | |||
96 | m_TransferModule = | ||
97 | m_scenes[0].RequestModuleInterface<IMessageTransferModule>(); | ||
98 | |||
99 | if (m_TransferModule == null) | ||
100 | m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ | ||
101 | "IM will not work!"); | ||
102 | } | ||
103 | |||
104 | public void Close() | ||
105 | { | ||
106 | } | ||
107 | |||
108 | public string Name | ||
109 | { | ||
110 | get { return "InstantMessageModule"; } | ||
111 | } | ||
112 | |||
113 | public bool IsSharedModule | ||
114 | { | ||
115 | get { return true; } | ||
116 | } | ||
117 | |||
118 | #endregion | ||
119 | |||
120 | public void OnInstantMessage(IClientAPI client, GridInstantMessage im) | ||
121 | { | ||
122 | byte dialog = im.dialog; | ||
123 | |||
124 | if ( dialog != (byte)InstantMessageDialog.MessageFromAgent | ||
125 | && dialog != (byte)InstantMessageDialog.StartTyping | ||
126 | && dialog != (byte)InstantMessageDialog.StopTyping) | ||
127 | { | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | if (m_TransferModule != null) | ||
132 | { | ||
133 | m_TransferModule.SendInstantMessage(im, | ||
134 | delegate(bool success) | ||
135 | { | ||
136 | if (dialog == (uint)InstantMessageDialog.StartTyping || | ||
137 | dialog == (uint)InstantMessageDialog.StopTyping) | ||
138 | { | ||
139 | return; | ||
140 | } | ||
141 | |||
142 | if ((client != null) && !success) | ||
143 | { | ||
144 | client.SendInstantMessage(new UUID(im.toAgentID), | ||
145 | "Unable to send instant message. "+ | ||
146 | "User is not logged in.", | ||
147 | new UUID(im.fromAgentID), "System", | ||
148 | (byte)InstantMessageDialog.BusyAutoResponse, | ||
149 | (uint)Util.UnixTimeSinceEpoch()); | ||
150 | } | ||
151 | } | ||
152 | ); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | /// <summary> | ||
157 | /// | ||
158 | /// </summary> | ||
159 | /// <param name="msg"></param> | ||
160 | private void OnGridInstantMessage(GridInstantMessage msg) | ||
161 | { | ||
162 | // Just call the Text IM handler above | ||
163 | // This event won't be raised unless we have that agent, | ||
164 | // so we can depend on the above not trying to send | ||
165 | // via grid again | ||
166 | // | ||
167 | OnInstantMessage(null, msg); | ||
168 | } | ||
169 | } | ||
170 | } | ||