events: listener: code cleanup
This commit is contained in:
parent
26a99679a7
commit
26dfba06e3
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
@ -24,6 +25,7 @@ namespace SparkleLib {
|
||||||
public string Type;
|
public string Type;
|
||||||
public string Message;
|
public string Message;
|
||||||
|
|
||||||
|
|
||||||
public SparkleEventArgs (string type)
|
public SparkleEventArgs (string type)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
|
@ -34,17 +36,19 @@ namespace SparkleLib {
|
||||||
// Arguments for the NewCommit event
|
// Arguments for the NewCommit event
|
||||||
public class NewCommitArgs : EventArgs {
|
public class NewCommitArgs : EventArgs {
|
||||||
|
|
||||||
public string Author;
|
public string UserName;
|
||||||
public string Email;
|
public string UserEmail;
|
||||||
public string Message;
|
public string Message;
|
||||||
public string RepositoryPath;
|
public string LocalPath;
|
||||||
|
|
||||||
public NewCommitArgs (string author, string email, string message, string repository_path)
|
|
||||||
|
public NewCommitArgs (string user_name, string user_email,
|
||||||
|
string message, string local_path)
|
||||||
{
|
{
|
||||||
Author = author;
|
UserName = user_name;
|
||||||
Email = email;
|
UserEmail = user_email;
|
||||||
Message = message;
|
Message = message;
|
||||||
RepositoryPath = repository_path;
|
LocalPath = local_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace SparkleLib {
|
||||||
// listens for change notifications
|
// listens for change notifications
|
||||||
public class SparkleListener {
|
public class SparkleListener {
|
||||||
|
|
||||||
private Thread Thread;
|
private Thread thread;
|
||||||
|
|
||||||
// FIXME: The IrcClient is a public property because
|
// FIXME: The IrcClient is a public property because
|
||||||
// extending it causes crashes
|
// extending it causes crashes
|
||||||
|
@ -48,7 +48,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
|
|
||||||
public SparkleListener (string server, string folder_name,
|
public SparkleListener (string server, string folder_name,
|
||||||
string user_email, NotificationServerType type)
|
string user_email, NotificationServerType type)
|
||||||
{
|
{
|
||||||
if (type == NotificationServerType.Own) {
|
if (type == NotificationServerType.Own) {
|
||||||
Server = server;
|
Server = server;
|
||||||
|
@ -79,7 +79,7 @@ namespace SparkleLib {
|
||||||
// Starts a new thread and listens to the channel
|
// Starts a new thread and listens to the channel
|
||||||
public void Listen ()
|
public void Listen ()
|
||||||
{
|
{
|
||||||
Thread = new Thread (
|
this.thread = new Thread (
|
||||||
new ThreadStart (delegate {
|
new ThreadStart (delegate {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace SparkleLib {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
Thread.Start ();
|
this.thread.Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ namespace SparkleLib {
|
||||||
// Frees all resources for this Listener
|
// Frees all resources for this Listener
|
||||||
public void Dispose ()
|
public void Dispose ()
|
||||||
{
|
{
|
||||||
Thread.Abort ();
|
this.thread.Abort ();
|
||||||
Thread.Join ();
|
this.thread.Join ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue