2005-12-14 18:13:05 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace TechBot.Library
|
|
|
|
{
|
2007-12-10 19:08:13 +00:00
|
|
|
public abstract class BugCommand : Command//, ICommand
|
2005-12-14 18:13:05 +00:00
|
|
|
{
|
2007-12-10 19:08:13 +00:00
|
|
|
public BugCommand(TechBotService techBot) : base (techBot)
|
2005-12-14 18:13:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-12-10 19:08:13 +00:00
|
|
|
public override void Handle(MessageContext context,
|
|
|
|
string commandName,
|
|
|
|
string parameters)
|
|
|
|
{
|
|
|
|
string bugText = parameters;
|
|
|
|
if (bugText.Equals(String.Empty))
|
|
|
|
{
|
|
|
|
TechBot.ServiceOutput.WriteLine(context,
|
|
|
|
"Please provide a valid bug number.");
|
|
|
|
return;
|
|
|
|
}
|
2005-12-14 18:13:05 +00:00
|
|
|
|
2007-12-10 19:08:13 +00:00
|
|
|
NumberParser np = new NumberParser();
|
|
|
|
long bug = np.Parse(bugText);
|
|
|
|
if (np.Error)
|
|
|
|
{
|
|
|
|
TechBot.ServiceOutput.WriteLine(context,
|
|
|
|
String.Format("{0} is not a valid bug number.",
|
|
|
|
bugText));
|
|
|
|
return;
|
|
|
|
}
|
2005-12-14 18:13:05 +00:00
|
|
|
|
2007-12-10 19:08:13 +00:00
|
|
|
/*
|
|
|
|
string bugUrl = this.RosBugUrl;
|
|
|
|
|
|
|
|
if (context is ChannelMessageContext)
|
|
|
|
{
|
|
|
|
ChannelMessageContext channelContext = context as ChannelMessageContext;
|
|
|
|
if (channelContext.Channel.Name == "winehackers")
|
|
|
|
bugUrl = this.WineBugUrl;
|
|
|
|
else if (channelContext.Channel.Name == "samba-technical")
|
|
|
|
bugUrl = this.SambaBugUrl;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
TechBot.ServiceOutput.WriteLine(context, String.Format(BugUrl, bug));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract string BugUrl { get; }
|
2005-12-14 18:13:05 +00:00
|
|
|
}
|
|
|
|
}
|