diff options
Diffstat (limited to 'OpenSim/Addons/OfflineIM/Service')
-rw-r--r-- | OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs index 6731923..690c955 100644 --- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs +++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -91,7 +91,7 @@ namespace OpenSim.OfflineIM | |||
91 | { | 91 | { |
92 | reason = string.Empty; | 92 | reason = string.Empty; |
93 | 93 | ||
94 | // TODO Check limits | 94 | // Check limits |
95 | UUID principalID = new UUID(im.toAgentID); | 95 | UUID principalID = new UUID(im.toAgentID); |
96 | long count = m_Database.GetCount("PrincipalID", principalID.ToString()); | 96 | long count = m_Database.GetCount("PrincipalID", principalID.ToString()); |
97 | if (count >= MAX_IM) | 97 | if (count >= MAX_IM) |
@@ -100,7 +100,7 @@ namespace OpenSim.OfflineIM | |||
100 | return false; | 100 | return false; |
101 | } | 101 | } |
102 | 102 | ||
103 | string imXml = string.Empty; | 103 | string imXml; |
104 | using (MemoryStream mstream = new MemoryStream()) | 104 | using (MemoryStream mstream = new MemoryStream()) |
105 | { | 105 | { |
106 | XmlWriterSettings settings = new XmlWriterSettings(); | 106 | XmlWriterSettings settings = new XmlWriterSettings(); |
@@ -110,22 +110,26 @@ namespace OpenSim.OfflineIM | |||
110 | { | 110 | { |
111 | m_serializer.Serialize(writer, im); | 111 | m_serializer.Serialize(writer, im); |
112 | writer.Flush(); | 112 | writer.Flush(); |
113 | |||
114 | mstream.Position = 0; | ||
115 | using (StreamReader sreader = new StreamReader(mstream)) | ||
116 | { | ||
117 | imXml = sreader.ReadToEnd(); | ||
118 | } | ||
119 | } | 113 | } |
114 | |||
115 | imXml = Util.UTF8.GetString(mstream.ToArray()); | ||
120 | } | 116 | } |
121 | 117 | ||
122 | OfflineIMData data = new OfflineIMData(); | 118 | OfflineIMData data = new OfflineIMData(); |
123 | data.PrincipalID = principalID; | 119 | data.PrincipalID = principalID; |
120 | data.FromID = new UUID(im.fromAgentID); | ||
124 | data.Data = new Dictionary<string, string>(); | 121 | data.Data = new Dictionary<string, string>(); |
125 | data.Data["Message"] = imXml; | 122 | data.Data["Message"] = imXml; |
126 | 123 | ||
127 | return m_Database.Store(data); | 124 | return m_Database.Store(data); |
128 | 125 | ||
129 | } | 126 | } |
127 | |||
128 | public void DeleteMessages(UUID userID) | ||
129 | { | ||
130 | m_Database.Delete("PrincipalID", userID.ToString()); | ||
131 | m_Database.Delete("FromID", userID.ToString()); | ||
132 | } | ||
133 | |||
130 | } | 134 | } |
131 | } | 135 | } |