Ok you know what, now I have a different problem, I got one of the Add-ins enabled in Windows Live Messenger, problem is it's not sending automated messages like it's supposed to, here is the code:
code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Messenger;
namespace AutoResponder
{
public class AutoResponder : IMessengerAddIn
{
#region Private members
MessengerClient client;
Dictionary<String, DateTime> history;
#endregion
#region IMessengerAddIn Members
public void Initialize(MessengerClient messenger)
{
this.client = messenger;
this.history = new Dictionary<String, DateTime>();
this.client.AddInProperties.FriendlyName =
"Auto-Responder";
this.client.AddInProperties.Creator =
"Keyvan Nayyeri";
this.client.AddInProperties.Description =
"Sends auto-respond texts to senders based on user status";
this.client.AddInProperties.Url =
new Uri("http://nayyeri.net");
this.client.IncomingTextMessage +=
new EventHandler<IncomingTextMessageEventArgs>
(client_IncomingTextMessage);
}
#endregion
#region Private methods
void client_IncomingTextMessage(object sender, IncomingTextMessageEventArgs e)
{
if (ShouldSend(e.UserFrom.UniqueId))
{
String outgoingText = String.Empty;
switch (this.client.LocalUser.Status)
{
case UserStatus.Away:
outgoingText +=
"I'm currently away from my computer and will respond to you later ";
break;
case UserStatus.BeRightBack:
outgoingText +=
"I'll be back very soon. Leave your messages here and I'll answer you when I get back to my computer ";
break;
case UserStatus.Busy:
outgoingText +=
"I'm currently busy or am viewing something in Full Screen mode. I'll respond to you when I get back to my computer ";
break;
case UserStatus.OnThePhone:
outgoingText +=
"I'm on the phone and will respond to you very soon ";
break;
case UserStatus.OutToLunch:
outgoingText +=
"I'm out to lunch. I'll repond to you after that ";
break;
}
if (!String.IsNullOrEmpty(outgoingText))
{
outgoingText = String.Format("Dear {0}, "
+ outgoingText, e.UserFrom.FriendlyName);
if (this.history.ContainsKey(e.UserFrom.UniqueId))
this.history[e.UserFrom.UniqueId] = DateTime.Now;
else
this.history.Add(e.UserFrom.UniqueId, DateTime.Now);
this.client.SendTextMessage(outgoingText, e.UserFrom);
}
}
}
private bool ShouldSend(String UserID)
{
if (this.history.ContainsKey(UserID))
if (DateTime.Now.Subtract(new TimeSpan(0, 5, 0))
< this.history[UserID])
return false;
return true;
}
#endregion
}
}
can anyone with C# knowledge help me on this? and I really don't know programming...