lib: add a User object

This commit is contained in:
Hylke Bons 2011-07-23 22:33:15 +01:00
parent 1eece7806e
commit 253111e901
2 changed files with 15 additions and 5 deletions

View file

@ -76,10 +76,18 @@ namespace SparkleLib {
public class SparkleNote { public class SparkleNote {
public string UserName; public SparkleUser User;
public string UserEmail;
public DateTime Timestamp; public DateTime Timestamp;
public string Body; public string Body;
} }
public class SparkleUser {
public string Name;
public string Email;
public string PublicKey;
}
} }

View file

@ -365,8 +365,10 @@ namespace SparkleLib {
if (match_notes.Success) { if (match_notes.Success) {
SparkleNote note = new SparkleNote () { SparkleNote note = new SparkleNote () {
UserName = match_notes.Groups [1].Value, User = new SparkleUser () {
UserEmail = match_notes.Groups [2].Value, 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)), Timestamp = new DateTime (1970, 1, 1).AddSeconds (int.Parse (match_notes.Groups [3].Value)),
Body = match_notes.Groups [4].Value Body = match_notes.Groups [4].Value
}; };
@ -448,7 +450,7 @@ namespace SparkleLib {
bool note_added = false; bool note_added = false;
foreach (string added in change_set.Added) { foreach (string added in change_set.Added) {
if (added.StartsWith (".notes")) { if (added.Contains (".notes")) {
if (NewNote != null) if (NewNote != null)
NewNote (change_set.UserName, change_set.UserEmail); NewNote (change_set.UserName, change_set.UserEmail);