From 253111e901c14133a5ff4168f148da5daa8f5da5 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 23 Jul 2011 22:33:15 +0100 Subject: [PATCH] lib: add a User object --- SparkleLib/SparkleChangeSet.cs | 12 ++++++++++-- SparkleLib/SparkleRepoBase.cs | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/SparkleLib/SparkleChangeSet.cs b/SparkleLib/SparkleChangeSet.cs index 3961c39c..f0cfdd03 100644 --- a/SparkleLib/SparkleChangeSet.cs +++ b/SparkleLib/SparkleChangeSet.cs @@ -76,10 +76,18 @@ namespace SparkleLib { public class SparkleNote { - public string UserName; - public string UserEmail; + public SparkleUser User; public DateTime Timestamp; public string Body; } + + + public class SparkleUser { + + public string Name; + public string Email; + + public string PublicKey; + } } diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 9229e669..cdb03ba5 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -365,8 +365,10 @@ namespace SparkleLib { if (match_notes.Success) { SparkleNote note = new SparkleNote () { - UserName = match_notes.Groups [1].Value, - UserEmail = match_notes.Groups [2].Value, + User = new SparkleUser () { + Name = match_notes.Groups [1].Value, + Email = match_notes.Groups [2].Value + }, Timestamp = new DateTime (1970, 1, 1).AddSeconds (int.Parse (match_notes.Groups [3].Value)), Body = match_notes.Groups [4].Value }; @@ -448,7 +450,7 @@ namespace SparkleLib { bool note_added = false; foreach (string added in change_set.Added) { - if (added.StartsWith (".notes")) { + if (added.Contains (".notes")) { if (NewNote != null) NewNote (change_set.UserName, change_set.UserEmail);