diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/DOMap.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/DOMap.cs (renamed from OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs) | 95 |
1 files changed, 50 insertions, 45 deletions
diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/DOMap.cs index 1e8c33e..f5b650b 100644 --- a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs +++ b/OpenSim/Framework/DOMap.cs | |||
@@ -25,69 +25,74 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Schema; | ||
28 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.StructuredData; | ||
29 | 38 | ||
30 | namespace OpenSim.Framework.Communications.XMPP | 39 | namespace OpenSim.Framework |
31 | { | 40 | { |
32 | /// <summary> | 41 | /// <summary> |
33 | /// Message types. | 42 | /// This class stores and retrieves dynamic objects. |
34 | /// </summary> | 43 | /// </summary> |
35 | public enum XmppMessageType | 44 | /// <remarks> |
45 | /// Experimental - DO NOT USE. Does not yet have namespace support. | ||
46 | /// </remarks> | ||
47 | public class DOMap | ||
36 | { | 48 | { |
37 | [XmlEnum("chat")] chat, | 49 | private IDictionary<string, object> m_map; |
38 | [XmlEnum("error")] error, | 50 | |
39 | [XmlEnum("groupchat")] groupchat, | 51 | public void Add(string ns, string objName, object dynObj) |
40 | [XmlEnum("headline")] headline, | ||
41 | [XmlEnum("normal")] normal, | ||
42 | } | ||
43 | |||
44 | /// <summary> | ||
45 | /// Message body. | ||
46 | /// </summary> | ||
47 | public class XmppMessageBody | ||
48 | { | ||
49 | [XmlText] | ||
50 | public string Text; | ||
51 | |||
52 | public XmppMessageBody() | ||
53 | { | 52 | { |
54 | } | 53 | DAMap.ValidateNamespace(ns); |
55 | 54 | ||
56 | public XmppMessageBody(string message) | 55 | lock (this) |
57 | { | 56 | { |
58 | Text = message; | 57 | if (m_map == null) |
58 | m_map = new Dictionary<string, object>(); | ||
59 | |||
60 | m_map.Add(objName, dynObj); | ||
61 | } | ||
59 | } | 62 | } |
60 | 63 | ||
61 | new public string ToString() | 64 | public bool ContainsKey(string key) |
62 | { | 65 | { |
63 | return Text; | 66 | return Get(key) != null; |
64 | } | 67 | } |
65 | } | ||
66 | 68 | ||
67 | [XmlRoot("message")] | ||
68 | public class XmppMessageStanza: XmppStanza | ||
69 | { | ||
70 | /// <summary> | 69 | /// <summary> |
71 | /// IQ type: one of set, get, result, error | 70 | /// Get a dynamic object |
72 | /// </summary> | 71 | /// </summary> |
73 | [XmlAttribute("type")] | 72 | /// <remarks> |
74 | public XmppMessageType MessageType; | 73 | /// Not providing an index method so that users can't casually overwrite each other's objects. |
75 | 74 | /// </remarks> | |
76 | // [XmlAttribute("error")] | 75 | /// <param name='key'></param> |
77 | // public XmppError Error; | 76 | public object Get(string key) |
78 | |||
79 | [XmlElement("body")] | ||
80 | public XmppMessageBody Body; | ||
81 | |||
82 | public XmppMessageStanza() : base() | ||
83 | { | 77 | { |
78 | lock (this) | ||
79 | { | ||
80 | if (m_map == null) | ||
81 | return null; | ||
82 | else | ||
83 | return m_map[key]; | ||
84 | } | ||
84 | } | 85 | } |
85 | 86 | ||
86 | public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) : | 87 | public bool Remove(string key) |
87 | base(fromJid, toJid) | ||
88 | { | 88 | { |
89 | MessageType = mType; | 89 | lock (this) |
90 | Body = new XmppMessageBody(message); | 90 | { |
91 | if (m_map == null) | ||
92 | return false; | ||
93 | else | ||
94 | return m_map.Remove(key); | ||
95 | } | ||
91 | } | 96 | } |
92 | } | 97 | } |
93 | } | 98 | } \ No newline at end of file |