diff options
Diffstat (limited to 'OpenSim/Framework/Communications/XMPP')
7 files changed, 467 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/XMPP/XmppError.cs b/OpenSim/Framework/Communications/XMPP/XmppError.cs new file mode 100644 index 0000000..3d36e9c --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppError.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Xml.Serialization; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.XMPP | ||
31 | { | ||
32 | [XmlRoot("error")] | ||
33 | public class XmppErrorStanza | ||
34 | { | ||
35 | public XmppErrorStanza() | ||
36 | { | ||
37 | } | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs new file mode 100644 index 0000000..12263f4 --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Xml.Serialization; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.XMPP | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// An IQ needs to have one of the follow types set. | ||
34 | /// </summary> | ||
35 | public enum XmppIqType | ||
36 | { | ||
37 | [XmlEnum("set")] set, | ||
38 | [XmlEnum("get")] get, | ||
39 | [XmlEnum("result")] result, | ||
40 | [XmlEnum("error")] error, | ||
41 | } | ||
42 | |||
43 | /// <summary> | ||
44 | /// XmppIqStanza needs to be subclassed as the query content is | ||
45 | /// specific to the query type. | ||
46 | /// </summary> | ||
47 | [XmlRoot("iq")] | ||
48 | public abstract class XmppIqStanza: XmppStanza | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// IQ type: one of set, get, result, error | ||
52 | /// </summary> | ||
53 | [XmlAttribute("type")] | ||
54 | public XmppIqType Type; | ||
55 | |||
56 | public XmppIqStanza(): base() | ||
57 | { | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs new file mode 100644 index 0000000..1e8c33e --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Xml.Serialization; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.XMPP | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// Message types. | ||
34 | /// </summary> | ||
35 | public enum XmppMessageType | ||
36 | { | ||
37 | [XmlEnum("chat")] chat, | ||
38 | [XmlEnum("error")] error, | ||
39 | [XmlEnum("groupchat")] groupchat, | ||
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 | { | ||
54 | } | ||
55 | |||
56 | public XmppMessageBody(string message) | ||
57 | { | ||
58 | Text = message; | ||
59 | } | ||
60 | |||
61 | new public string ToString() | ||
62 | { | ||
63 | return Text; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | [XmlRoot("message")] | ||
68 | public class XmppMessageStanza: XmppStanza | ||
69 | { | ||
70 | /// <summary> | ||
71 | /// IQ type: one of set, get, result, error | ||
72 | /// </summary> | ||
73 | [XmlAttribute("type")] | ||
74 | public XmppMessageType MessageType; | ||
75 | |||
76 | // [XmlAttribute("error")] | ||
77 | // public XmppError Error; | ||
78 | |||
79 | [XmlElement("body")] | ||
80 | public XmppMessageBody Body; | ||
81 | |||
82 | public XmppMessageStanza() : base() | ||
83 | { | ||
84 | } | ||
85 | |||
86 | public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) : | ||
87 | base(fromJid, toJid) | ||
88 | { | ||
89 | MessageType = mType; | ||
90 | Body = new XmppMessageBody(message); | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs new file mode 100644 index 0000000..4d45ac0 --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Xml.Serialization; | ||
29 | |||
30 | namespace OpenSim.Framework.Communications.XMPP | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// Message types. | ||
34 | /// </summary> | ||
35 | public enum XmppPresenceType | ||
36 | { | ||
37 | [XmlEnum("unavailable")] unavailable, | ||
38 | [XmlEnum("subscribe")] subscribe, | ||
39 | [XmlEnum("subscribed")] subscribed, | ||
40 | [XmlEnum("unsubscribe")] unsubscribe, | ||
41 | [XmlEnum("unsubscribed")] unsubscribed, | ||
42 | [XmlEnum("probe")] probe, | ||
43 | [XmlEnum("error")] error, | ||
44 | } | ||
45 | |||
46 | |||
47 | [XmlRoot("message")] | ||
48 | public class XmppPresenceStanza: XmppStanza | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// IQ type: one of set, get, result, error | ||
52 | /// </summary> | ||
53 | [XmlAttribute("type")] | ||
54 | public XmppPresenceType PresenceType; | ||
55 | |||
56 | // [XmlAttribute("error")] | ||
57 | // public XmppError Error; | ||
58 | |||
59 | public XmppPresenceStanza() : base() | ||
60 | { | ||
61 | } | ||
62 | |||
63 | public XmppPresenceStanza(string fromJid, string toJid, XmppPresenceType pType) : | ||
64 | base(fromJid, toJid) | ||
65 | { | ||
66 | PresenceType = pType; | ||
67 | } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs new file mode 100644 index 0000000..e37ef28 --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml; | ||
31 | using System.Xml.Serialization; | ||
32 | |||
33 | namespace OpenSim.Framework.Communications.XMPP | ||
34 | { | ||
35 | public class XmppSerializer | ||
36 | { | ||
37 | // private static readonly ILog _log = | ||
38 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
39 | |||
40 | // need to do it this way, as XmlSerializer(type, extratypes) | ||
41 | // does not work on mono (at least). | ||
42 | private Dictionary<Type, XmlSerializer> _serializerForType = new Dictionary<Type, XmlSerializer>(); | ||
43 | private Dictionary<string, XmlSerializer> _serializerForName = new Dictionary<string, XmlSerializer>(); | ||
44 | private XmlSerializerNamespaces _xmlNs; | ||
45 | private string _defaultNS; | ||
46 | |||
47 | public XmppSerializer(bool server) | ||
48 | { | ||
49 | _xmlNs = new XmlSerializerNamespaces(); | ||
50 | _xmlNs.Add(String.Empty, String.Empty); | ||
51 | if (server) | ||
52 | _defaultNS = "jabber:server"; | ||
53 | else | ||
54 | _defaultNS = "jabber:client"; | ||
55 | |||
56 | // TODO: do this via reflection | ||
57 | _serializerForType[typeof(XmppMessageStanza)] = _serializerForName["message"] = | ||
58 | new XmlSerializer(typeof(XmppMessageStanza), _defaultNS); | ||
59 | } | ||
60 | |||
61 | public void Serialize(XmlWriter xw, object o) | ||
62 | { | ||
63 | if (!_serializerForType.ContainsKey(o.GetType())) | ||
64 | throw new ArgumentException(String.Format("no serializer available for type {0}", o.GetType())); | ||
65 | |||
66 | _serializerForType[o.GetType()].Serialize(xw, o, _xmlNs); | ||
67 | } | ||
68 | |||
69 | public object Deserialize(XmlReader xr) | ||
70 | { | ||
71 | // position on next element | ||
72 | xr.Read(); | ||
73 | if (!_serializerForName.ContainsKey(xr.LocalName)) | ||
74 | throw new ArgumentException(String.Format("no serializer available for name {0}", xr.LocalName)); | ||
75 | |||
76 | return _serializerForName[xr.LocalName].Deserialize(xr); | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs new file mode 100644 index 0000000..5312a31 --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Xml.Serialization; | ||
30 | |||
31 | namespace OpenSim.Framework.Communications.XMPP | ||
32 | { | ||
33 | public abstract class XmppStanza | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// counter used for generating ID | ||
37 | /// </summary> | ||
38 | [XmlIgnore] | ||
39 | private static ulong _ctr = 0; | ||
40 | |||
41 | /// <summary> | ||
42 | /// recipient JID | ||
43 | /// </summary> | ||
44 | [XmlAttribute("to")] | ||
45 | public string ToJid; | ||
46 | |||
47 | /// <summary> | ||
48 | /// sender JID | ||
49 | /// </summary> | ||
50 | [XmlAttribute("from")] | ||
51 | public string FromJid; | ||
52 | |||
53 | /// <summary> | ||
54 | /// unique ID. | ||
55 | /// </summary> | ||
56 | [XmlAttribute("id")] | ||
57 | public string MessageId; | ||
58 | |||
59 | public XmppStanza() | ||
60 | { | ||
61 | } | ||
62 | |||
63 | public XmppStanza(string fromJid, string toJid) | ||
64 | { | ||
65 | ToJid = toJid; | ||
66 | FromJid = fromJid; | ||
67 | MessageId = String.Format("OpenSim_{0}{1}", DateTime.UtcNow.Ticks, _ctr++); | ||
68 | } | ||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs new file mode 100644 index 0000000..415d808 --- /dev/null +++ b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.IO; | ||
29 | using System.Text; | ||
30 | using System.Xml; | ||
31 | using IOStream = System.IO.Stream; | ||
32 | |||
33 | namespace OpenSim.Framework.Communications.XMPP | ||
34 | { | ||
35 | public class XMPPWriter: XmlTextWriter | ||
36 | { | ||
37 | public XMPPWriter(TextWriter textWriter) : base(textWriter) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | public XMPPWriter(IOStream stream) : this(stream, Util.UTF8) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public XMPPWriter(IOStream stream, Encoding enc) : base(stream, enc) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | public override void WriteStartDocument() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public override void WriteStartDocument(bool standalone) | ||
54 | { | ||
55 | } | ||
56 | } | ||
57 | } | ||