diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | 60 |
2 files changed, 51 insertions, 27 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index f67bb0b..d8d6219 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -167,6 +167,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | 169 | ||
170 | HandleUndeliveredMessage(im, result); | ||
171 | |||
172 | return; | ||
173 | } | ||
174 | |||
175 | private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | ||
176 | { | ||
170 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; | 177 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; |
171 | 178 | ||
172 | // If this event has handlers, then the IM will be considered | 179 | // If this event has handlers, then the IM will be considered |
@@ -181,7 +188,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
181 | 188 | ||
182 | //m_log.DebugFormat("[INSTANT MESSAGE]: Undeliverable"); | 189 | //m_log.DebugFormat("[INSTANT MESSAGE]: Undeliverable"); |
183 | result(false); | 190 | result(false); |
184 | return; | ||
185 | } | 191 | } |
186 | 192 | ||
187 | /// <summary> | 193 | /// <summary> |
@@ -487,14 +493,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
487 | if (upd.Handle == prevRegionHandle) | 493 | if (upd.Handle == prevRegionHandle) |
488 | { | 494 | { |
489 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 495 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); |
490 | result(false); | 496 | HandleUndeliveredMessage(im, result); |
491 | return; | 497 | return; |
492 | } | 498 | } |
493 | } | 499 | } |
494 | else | 500 | else |
495 | { | 501 | { |
496 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 502 | m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); |
497 | result(false); | 503 | HandleUndeliveredMessage(im, result); |
498 | return; | 504 | return; |
499 | } | 505 | } |
500 | } | 506 | } |
@@ -544,18 +550,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
544 | else | 550 | else |
545 | { | 551 | { |
546 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle); | 552 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle); |
547 | result(false); | 553 | HandleUndeliveredMessage(im, result); |
548 | } | 554 | } |
549 | } | 555 | } |
550 | else | 556 | else |
551 | { | 557 | { |
552 | result(false); | 558 | HandleUndeliveredMessage(im, result); |
553 | } | 559 | } |
554 | } | 560 | } |
555 | else | 561 | else |
556 | { | 562 | { |
557 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find user {0}", toAgentID); | 563 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find user {0}", toAgentID); |
558 | result(false); | 564 | HandleUndeliveredMessage(im, result); |
559 | } | 565 | } |
560 | } | 566 | } |
561 | 567 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index d09c669..77bc9d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -55,18 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
55 | 55 | ||
56 | lock (m_SceneList) | 56 | lock (m_SceneList) |
57 | { | 57 | { |
58 | if (m_SceneList.Count == 0) | ||
59 | { | ||
60 | IMessageTransferModule trans = scene.RequestModuleInterface<IMessageTransferModule>(); | ||
61 | if (trans == null) | ||
62 | { | ||
63 | enabled = false; | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | trans.OnUndeliveredMessage += UndeliveredMessage; | ||
68 | } | ||
69 | |||
70 | if (!m_SceneList.Contains(scene)) | 58 | if (!m_SceneList.Contains(scene)) |
71 | m_SceneList.Add(scene); | 59 | m_SceneList.Add(scene); |
72 | 60 | ||
@@ -76,6 +64,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
76 | 64 | ||
77 | public void PostInitialise() | 65 | public void PostInitialise() |
78 | { | 66 | { |
67 | if (m_SceneList.Count == 0) | ||
68 | return; | ||
69 | |||
70 | IMessageTransferModule trans = m_SceneList[0].RequestModuleInterface<IMessageTransferModule>(); | ||
71 | if (trans == null) | ||
72 | { | ||
73 | enabled = false; | ||
74 | |||
75 | lock (m_SceneList) | ||
76 | { | ||
77 | foreach (Scene s in m_SceneList) | ||
78 | s.EventManager.OnNewClient -= OnNewClient; | ||
79 | |||
80 | m_SceneList.Clear(); | ||
81 | } | ||
82 | |||
83 | return; | ||
84 | } | ||
85 | |||
86 | trans.OnUndeliveredMessage += UndeliveredMessage; | ||
87 | |||
88 | m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); | ||
79 | } | 89 | } |
80 | 90 | ||
81 | public string Name | 91 | public string Name |
@@ -115,16 +125,24 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
115 | 125 | ||
116 | private void UndeliveredMessage(GridInstantMessage im) | 126 | private void UndeliveredMessage(GridInstantMessage im) |
117 | { | 127 | { |
118 | IClientAPI client = FindClient(new UUID(im.toAgentID)); | 128 | if (im.offline != 0) |
119 | if (client == null) | 129 | { |
120 | return; | 130 | // TODO: Actually save it |
131 | |||
132 | if(im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | ||
133 | { | ||
134 | IClientAPI client = FindClient(new UUID(im.fromAgentID)); | ||
135 | if (client == null) | ||
136 | return; | ||
121 | 137 | ||
122 | client.SendInstantMessage(new UUID(im.toAgentID), | 138 | client.SendInstantMessage(new UUID(im.fromAgentID), |
123 | "User is not logged in. "+ | 139 | "User is not logged in. "+ |
124 | "Message saved.", | 140 | "Message saved.", |
125 | new UUID(im.fromAgentID), "System", | 141 | new UUID(im.toAgentID), "System", |
126 | (byte)InstantMessageDialog.BusyAutoResponse, | 142 | (byte)InstantMessageDialog.BusyAutoResponse, |
127 | (uint)Util.UnixTimeSinceEpoch()); | 143 | (uint)Util.UnixTimeSinceEpoch()); |
144 | } | ||
145 | } | ||
128 | } | 146 | } |
129 | } | 147 | } |
130 | } | 148 | } |