commit
c2a9c53ac8
|
@ -24,7 +24,7 @@ namespace ChatSharp.Handlers
|
|||
}
|
||||
// TODO: Consider doing this differently
|
||||
// TODO: Allow users to specify other things to handle
|
||||
if (value != null)
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
switch (key.ToUpper())
|
||||
{
|
||||
|
|
|
@ -52,7 +52,8 @@ namespace ChatSharp
|
|||
foreach (string rawTag in rawTags.Split(';'))
|
||||
{
|
||||
var replacedTag = rawTag.Replace(@"\:", ";");
|
||||
KeyValuePair<string, string> tag = new KeyValuePair<string, string>(replacedTag, string.Empty);
|
||||
// The spec declares `@a=` as a tag with an empty value, while `@b;` as a tag with a null value
|
||||
KeyValuePair<string, string> tag = new KeyValuePair<string, string>(replacedTag, null);
|
||||
|
||||
if (replacedTag.Contains("="))
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ChatSharp
|
|||
if (!compatibility)
|
||||
{
|
||||
DateTime parsedDate;
|
||||
if (!DateTime.TryParseExact(date, @"yyyy-MM-dd\THH:mm:ss.fff\Z", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out parsedDate))
|
||||
if (!DateTime.TryParse(date, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out parsedDate))
|
||||
throw new ArgumentException("The date string was provided in an invalid format.", date);
|
||||
|
||||
Date = parsedDate;
|
||||
|
|
|
@ -82,6 +82,18 @@ namespace ChatSharp.Tests
|
|||
CollectionAssert.AreEqual(fromMessage.Tags, compareTags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void NewValidMessage_TagsNoValue()
|
||||
{
|
||||
IrcMessage fromMessage = new IrcMessage("@a=;b :nick!ident@host.com PRIVMSG me :Hello");
|
||||
KeyValuePair<string, string>[] compareTags = new KeyValuePair<string, string>[]
|
||||
{
|
||||
new KeyValuePair<string, string>("a", ""),
|
||||
new KeyValuePair<string, string>("b", null),
|
||||
};
|
||||
CollectionAssert.AreEqual(fromMessage.Tags, compareTags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Timestamp_CompareISOString()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue