Browse Source

In the offline message table, store the sender.

This data is useful for preventing abuse (e.g., someone who sends too many messages), or for deleting message if their sender has been deleted.
Oren Hurvitz 11 years ago
parent
commit
46c2791fe2

+ 1 - 2
OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs

@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) Contributors, http://opensimulator.org/
  * Copyright (c) Contributors, http://opensimulator.org/
  * See CONTRIBUTORS.TXT for a full list of copyright holders.
  * See CONTRIBUTORS.TXT for a full list of copyright holders.
  *
  *
@@ -96,7 +96,6 @@ namespace OpenSim.OfflineIM
                 string method = request["METHOD"].ToString();
                 string method = request["METHOD"].ToString();
                 request.Remove("METHOD");
                 request.Remove("METHOD");
 
 
-                m_log.DebugFormat("[OfflineIM.V2.Handler]: {0}", method);
                 switch (method)
                 switch (method)
                 {
                 {
                     case "GET":
                     case "GET":

+ 2 - 1
OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs

@@ -91,7 +91,7 @@ namespace OpenSim.OfflineIM
         {
         {
             reason = string.Empty;
             reason = string.Empty;
             
             
-            // TODO Check limits
+            // Check limits
             UUID principalID = new UUID(im.toAgentID);
             UUID principalID = new UUID(im.toAgentID);
             long count = m_Database.GetCount("PrincipalID", principalID.ToString());
             long count = m_Database.GetCount("PrincipalID", principalID.ToString());
             if (count >= MAX_IM)
             if (count >= MAX_IM)
@@ -117,6 +117,7 @@ namespace OpenSim.OfflineIM
 
 
             OfflineIMData data = new OfflineIMData();
             OfflineIMData data = new OfflineIMData();
             data.PrincipalID = principalID;
             data.PrincipalID = principalID;
+            data.FromID = new UUID(im.fromAgentID);
             data.Data = new Dictionary<string, string>();
             data.Data = new Dictionary<string, string>();
             data.Data["Message"] = imXml;
             data.Data["Message"] = imXml;
 
 

+ 2 - 1
OpenSim/Data/IOfflineIMData.cs

@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) Contributors, http://opensimulator.org/
  * Copyright (c) Contributors, http://opensimulator.org/
  * See CONTRIBUTORS.TXT for a full list of copyright holders.
  * See CONTRIBUTORS.TXT for a full list of copyright holders.
  *
  *
@@ -34,6 +34,7 @@ namespace OpenSim.Data
     public class OfflineIMData
     public class OfflineIMData
     {
     {
         public UUID PrincipalID;
         public UUID PrincipalID;
+        public UUID FromID;
         public Dictionary<string, string> Data;
         public Dictionary<string, string> Data;
     }
     }
 
 

+ 11 - 1
OpenSim/Data/MySQL/Resources/IM_Store.migrations

@@ -21,4 +21,14 @@ INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
 DROP TABLE `diva_im_offline`;
 DROP TABLE `diva_im_offline`;
 DELETE FROM `migrations` WHERE name='diva_im_Store';
 DELETE FROM `migrations` WHERE name='diva_im_Store';
 
 
-COMMIT;
+COMMIT;
+
+:VERSION 3         # -------------------------- 
+
+BEGIN;
+
+ALTER TABLE `im_offline`
+  ADD `FromID` char(36) NOT NULL default '' AFTER `PrincipalID`,
+  ADD KEY `FromID` (`FromID`);
+
+COMMIT;