aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-01 06:12:04 +0000
committerTeravus Ovares2008-01-01 06:12:04 +0000
commitb4c9b6bd19c0725ae5bf60172db75ebc63ba72c6 (patch)
treed7e9e370371edbcbebb8436791ba8b1cd940ab69 /OpenSim/Region/Environment/Modules/InstantMessageModule.cs
parentMake it possible for new inventory 'libraries' to be added without changing t... (diff)
downloadopensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.zip
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.gz
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.bz2
opensim-SC_OLD-b4c9b6bd19c0725ae5bf60172db75ebc63ba72c6.tar.xz
* You can add and remove a friend in standalone now within the same simulator. It saves.
* You can add and remove a friend in grid mode now within the same simulator. It doesn't save yet. * I got rid of Mr. OpenSim as a friend.. he bothers me /:b...
Diffstat (limited to 'OpenSim/Region/Environment/Modules/InstantMessageModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs45
1 files changed, 35 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 1e1d236..0967b70 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Environment.Modules
52 { 52 {
53 m_scenes.Add(scene); 53 m_scenes.Add(scene);
54 scene.EventManager.OnNewClient += OnNewClient; 54 scene.EventManager.OnNewClient += OnNewClient;
55 scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage;
55 } 56 }
56 } 57 }
57 58
@@ -67,19 +68,29 @@ namespace OpenSim.Region.Environment.Modules
67 uint ParentEstateID, LLVector3 Position, LLUUID RegionID, 68 uint ParentEstateID, LLVector3 Position, LLUUID RegionID,
68 byte[] binaryBucket) 69 byte[] binaryBucket)
69 { 70 {
70 foreach (Scene scene in m_scenes) 71
72 bool FriendDialog = ((dialog == (byte)38) || (dialog == (byte)39) || (dialog == (byte)40));
73
74 // IM dialogs need to be pre-processed and have their sessionID filled by the server
75 // so the sim can match the transaction on the return packet.
76
77 // Don't send a Friend Dialog IM with a LLUUID.Zero session.
78 if (!(FriendDialog && imSessionID == LLUUID.Zero))
71 { 79 {
72 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) 80 foreach (Scene scene in m_scenes)
73 { 81 {
74 // Local message 82 if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence)
75 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
76 if (!user.IsChildAgent)
77 { 83 {
78 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 84 // Local message
79 toAgentID, imSessionID, fromAgentName, dialog, 85 ScenePresence user = (ScenePresence)scene.Entities[toAgentID];
80 timestamp); 86 if (!user.IsChildAgent)
81 // Message sent 87 {
82 return; 88 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
89 toAgentID, imSessionID, fromAgentName, dialog,
90 timestamp);
91 // Message sent
92 return;
93 }
83 } 94 }
84 } 95 }
85 } 96 }
@@ -87,6 +98,20 @@ namespace OpenSim.Region.Environment.Modules
87 // Still here, try send via Grid 98 // Still here, try send via Grid
88 // TODO 99 // TODO
89 } 100 }
101
102 // Trusty OSG1 called method. This method also gets called from the FriendsModule
103 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend.
104
105 private void OnGridInstantMessage(GridInstantMessage msg)
106 {
107 // Trigger the above event handler
108 OnInstantMessage(new LLUUID(msg.fromAgentID), new LLUUID(msg.fromAgentSession),
109 new LLUUID(msg.toAgentID), new LLUUID(msg.imSessionID), msg.timestamp, msg.fromAgentName,
110 msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
111 new LLVector3(msg.Position.x,msg.Position.y,msg.Position.z), new LLUUID(msg.RegionID),
112 msg.binaryBucket);
113
114 }
90 115
91 public void PostInitialise() 116 public void PostInitialise()
92 { 117 {