aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/InstantMessage
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-16 20:32:00 +0000
committerMelanie Thielker2008-11-16 20:32:00 +0000
commit3f818e001d1c308d979758d58a48c3d9a6a846e2 (patch)
tree7a0c2db0fe6edf6d1fe89d0698b8332230fc8059 /OpenSim/Region/Environment/Modules/Avatar/InstantMessage
parentGridIMs don't have a (sending) client, which led to a NRE on access. (diff)
downloadopensim-SC_OLD-3f818e001d1c308d979758d58a48c3d9a6a846e2.zip
opensim-SC_OLD-3f818e001d1c308d979758d58a48c3d9a6a846e2.tar.gz
opensim-SC_OLD-3f818e001d1c308d979758d58a48c3d9a6a846e2.tar.bz2
opensim-SC_OLD-3f818e001d1c308d979758d58a48c3d9a6a846e2.tar.xz
First step tidy-up of IM packing/unpacking/repacking
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/InstantMessage')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs29
1 files changed, 18 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
index 339f1f9..cd8c82c 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -127,12 +127,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
127 return; 127 return;
128 } 128 }
129 129
130 IScene scene = client == null ? null : client.Scene; 130 GridInstantMessage im = new GridInstantMessage(client.Scene,
131 GridInstantMessage im = new GridInstantMessage(scene,
132 fromAgentID, fromAgentName, fromAgentSession, toAgentID, 131 fromAgentID, fromAgentName, fromAgentSession, toAgentID,
133 dialog, fromGroup, message, imSessionID, 132 dialog, fromGroup, message, imSessionID,
134 offline != 0 ? true : false, Position, 133 offline != 0 ? true : false, Position,
135 binaryBucket); 134 binaryBucket);
135
136 ProcessInstantMessage(client, im);
137 }
138
139 private void ProcessInstantMessage(IClientAPI client, GridInstantMessage im)
140 {
141 byte dialog = im.dialog;
142
143 if ( dialog != (byte)InstantMessageDialog.MessageFromAgent
144 && dialog != (byte)InstantMessageDialog.StartTyping
145 && dialog != (byte)InstantMessageDialog.StopTyping)
146 {
147 return;
148 }
136 149
137 if (m_TransferModule != null) 150 if (m_TransferModule != null)
138 { 151 {
@@ -147,10 +160,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
147 160
148 if ((client != null) && !success) 161 if ((client != null) && !success)
149 { 162 {
150 client.SendInstantMessage(toAgentID, 163 client.SendInstantMessage(new UUID(im.toAgentID),
151 "Unable to send instant message. "+ 164 "Unable to send instant message. "+
152 "User is not logged in.", 165 "User is not logged in.",
153 fromAgentID, "System", 166 new UUID(im.fromAgentID), "System",
154 (byte)InstantMessageDialog.BusyAutoResponse, 167 (byte)InstantMessageDialog.BusyAutoResponse,
155 (uint)Util.UnixTimeSinceEpoch()); 168 (uint)Util.UnixTimeSinceEpoch());
156 } 169 }
@@ -170,13 +183,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
170 // so we can depend on the above not trying to send 183 // so we can depend on the above not trying to send
171 // via grid again 184 // via grid again
172 // 185 //
173 OnInstantMessage(null, new UUID(msg.fromAgentID), 186 ProcessInstantMessage(null, msg);
174 new UUID(msg.fromAgentSession),
175 new UUID(msg.toAgentID), new UUID(msg.imSessionID),
176 msg.timestamp, msg.fromAgentName, msg.message,
177 msg.dialog, msg.fromGroup, msg.offline,
178 msg.ParentEstateID, msg.Position,
179 new UUID(msg.RegionID), msg.binaryBucket);
180 } 187 }
181 } 188 }
182} 189}