Skip to content

Commit 45fac8d

Browse files
committed
Fixed typo.
1 parent a625095 commit 45fac8d

File tree

6 files changed

+211
-1
lines changed

6 files changed

+211
-1
lines changed

Core/StreamManagement.cs

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.Xml;
3+
4+
namespace Sharp.Xmpp.Core
5+
{
6+
/// <summary>
7+
/// An acknowledgement answer - <a xmlns='urn:xmpp:sm:3' h='1'/>
8+
/// </summary>
9+
public class A1
10+
{
11+
private const string @namespace = "urn:xmpp:sm:3";
12+
13+
/// <summary>
14+
/// The XmlElement containing the actual data.
15+
/// </summary>
16+
protected XmlElement element;
17+
18+
public A1()
19+
{
20+
element = Xml.Element(RootElementName, @namespace);
21+
}
22+
23+
public A1(XmlElement element)
24+
{
25+
this.element = element;
26+
}
27+
28+
/// <summary>
29+
/// The sequence Id of the element.
30+
/// </summary>
31+
/// <value>The sequence.</value>
32+
public Int64 Sequence
33+
{
34+
get
35+
{
36+
var h = element.GetAttribute("h");
37+
if (Int64.TryParse(h, out long v))
38+
return v;
39+
else
40+
return 0;
41+
}
42+
}
43+
44+
/// <summary>
45+
/// The tag name of the stanza's root element
46+
/// Allows the element tag name to be overridden.
47+
/// </summary>
48+
protected virtual string RootElementName
49+
{
50+
get { return GetType().Name.ToLowerInvariant(); }
51+
}
52+
53+
/// <summary>
54+
/// Returns a textual representation of this instance of the class.
55+
/// </summary>
56+
/// <returns>A textual representation of this instance.</returns>
57+
public override string ToString()
58+
{
59+
return element.ToXmlString();
60+
}
61+
}
62+
63+
/// <summary>
64+
/// An acknowledgement request - <r xmlns='urn:xmpp:sm:3'/>
65+
/// </summary>
66+
public class R1
67+
{
68+
private const string @namespace = "urn:xmpp:sm:3";
69+
70+
/// <summary>
71+
/// The XmlElement containing the actual data.
72+
/// </summary>
73+
protected XmlElement element;
74+
75+
public R1()
76+
{
77+
element = Xml.Element(RootElementName, @namespace);
78+
}
79+
80+
public R1(XmlElement element)
81+
{
82+
this.element = element;
83+
}
84+
85+
/// <summary>
86+
/// The tag name of the stanza's root element
87+
/// Allows the element tag name to be overridden.
88+
/// </summary>
89+
protected virtual string RootElementName
90+
{
91+
get { return GetType().Name.ToLowerInvariant(); }
92+
}
93+
94+
/// <summary>
95+
/// Returns a textual representation of this instance of the class.
96+
/// </summary>
97+
/// <returns>A textual representation of this instance.</returns>
98+
public override string ToString()
99+
{
100+
return element.ToXmlString();
101+
}
102+
}
103+
}

Core/StreamManagementEventArgs.cs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
3+
namespace Sharp.Xmpp.Core
4+
{
5+
/// <summary>
6+
/// Provides data for the Presence event.
7+
/// </summary>
8+
public class PresenceEventArgs : EventArgs
9+
{
10+
/// <summary>
11+
/// The Presence stanza.
12+
/// </summary>
13+
public Presence Stanza
14+
{
15+
get;
16+
private set;
17+
}
18+
19+
/// <summary>
20+
/// Initializes a new instance of the PresenceEventArgs class.
21+
/// </summary>
22+
/// <param name="stanza">The Presence stanza on whose behalf the event is
23+
/// raised.</param>
24+
/// <exception cref="ArgumentNullException">The stanza parameter is
25+
/// null.</exception>
26+
public PresenceEventArgs(Presence stanza)
27+
{
28+
stanza.ThrowIfNull("stanza");
29+
Stanza = stanza;
30+
}
31+
}
32+
}

SharpXmppTest/Program.cs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace SharpXmppTest
4+
{
5+
class MainClass
6+
{
7+
public static void Main(string[] args)
8+
{
9+
Console.WriteLine("Hello World!");
10+
}
11+
}
12+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("SharpXmppTest")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("")]
12+
[assembly: AssemblyCopyright("${AuthorCopyright}")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]

SharpXmppTest/SharpXmppTest.csproj

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{170B8AF1-5FA4-4925-8BC1-519CF5D5AB11}</ProjectGuid>
7+
<OutputType>Exe</OutputType>
8+
<RootNamespace>SharpXmppTest</RootNamespace>
9+
<AssemblyName>SharpXmppTest</AssemblyName>
10+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13+
<DebugSymbols>true</DebugSymbols>
14+
<DebugType>full</DebugType>
15+
<Optimize>false</Optimize>
16+
<OutputPath>bin\Debug</OutputPath>
17+
<DefineConstants>DEBUG;</DefineConstants>
18+
<ErrorReport>prompt</ErrorReport>
19+
<WarningLevel>4</WarningLevel>
20+
<ExternalConsole>true</ExternalConsole>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+
<Optimize>true</Optimize>
24+
<OutputPath>bin\Release</OutputPath>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
<ExternalConsole>true</ExternalConsole>
28+
</PropertyGroup>
29+
<ItemGroup>
30+
<Reference Include="System" />
31+
</ItemGroup>
32+
<ItemGroup>
33+
<Compile Include="Program.cs" />
34+
<Compile Include="Properties\AssemblyInfo.cs" />
35+
</ItemGroup>
36+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
37+
</Project>

Xml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static string ToXmlString(this XmlElement e, bool xmlDeclaration = false,
8888
// a prefix, i.e. stream:stream (What it does is probably correct, but just
8989
// not what we need for XMPP).
9090
StringBuilder b = new StringBuilder("<" + e.Name);
91-
if (!String.IsNullOrEmpty(e.NamespaceURI)))
91+
if (!String.IsNullOrEmpty(e.NamespaceURI))
9292
b.Append(" xmlns='" + e.NamespaceURI + "'");
9393
foreach (XmlAttribute a in e.Attributes)
9494
{

0 commit comments

Comments
 (0)