Different output for !bug command on the other channels. (#winehackers, #samba-technical)
authorMaarten Bosma <maarten@bosma.de>
Thu, 5 Jan 2006 21:46:24 +0000 (21:46 +0000)
committerMaarten Bosma <maarten@bosma.de>
Thu, 5 Jan 2006 21:46:24 +0000 (21:46 +0000)
svn path=/trunk/; revision=20590

irc/TechBot/TechBot.Console/App.config
irc/TechBot/TechBot.Console/Main.cs
irc/TechBot/TechBot.Library/BugCommand.cs
irc/TechBot/TechBot.Library/IrcService.cs
irc/TechBot/TechBot.Library/TechBotService.cs
irc/TechBot/TechBot/App.config
irc/TechBot/TechBot/ServiceThread.cs

index 310f6ee..397d4b0 100644 (file)
@@ -12,7 +12,9 @@
                <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />\r
                <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />\r
                <add key="WmXml" value="C:\IRC\TechBot\wm.xml" />\r
                <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />\r
                <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />\r
                <add key="WmXml" value="C:\IRC\TechBot\wm.xml" />\r
-               <add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />\r
-               <add key="BugUrl" value="www.reactos.org/bugzilla/show_bug.cgi?id={0}" />\r
+               <add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />\r
+               <add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />\r
+               <add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />\r
+               <add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />\r
        </appSettings>\r
 </configuration>\r
        </appSettings>\r
 </configuration>\r
index 323f234..8a29172 100644 (file)
@@ -182,6 +182,32 @@ namespace TechBot.Console
                        }\r
                }\r
 \r
                        }\r
                }\r
 \r
+               private static string WineBugUrl\r
+               {\r
+                       get\r
+                       {\r
+                               string optionName = "WineBugUrl";\r
+                               string s = ConfigurationSettings.AppSettings[optionName];\r
+                               VerifyRequiredOption(optionName,\r
+                                                    s);\r
+                               return s;\r
+                       }\r
+               }\r
+\r
+\r
+               private static string SambaBugUrl\r
+               {\r
+                       get\r
+                       {\r
+                               string optionName = "SambaBugUrl";\r
+                               string s = ConfigurationSettings.AppSettings[optionName];\r
+                               VerifyRequiredOption(optionName,\r
+                                                    s);\r
+                               return s;\r
+                       }\r
+               }\r
+\r
+\r
                private static void RunIrcService()\r
                {\r
                        IrcService ircService = new IrcService(IRCServerHostName,\r
                private static void RunIrcService()\r
                {\r
                        IrcService ircService = new IrcService(IRCServerHostName,\r
@@ -196,7 +222,9 @@ namespace TechBot.Console
                                                               HresultXml,\r
                                                               WmXml,\r
                                                               SvnCommand,\r
                                                               HresultXml,\r
                                                               WmXml,\r
                                                               SvnCommand,\r
-                                                              BugUrl);\r
+                                                              BugUrl,\r
+                                                              WineBugUrl,\r
+                                                              SambaBugUrl);\r
                        ircService.Run();\r
                }\r
                \r
                        ircService.Run();\r
                }\r
                \r
@@ -217,7 +245,9 @@ namespace TechBot.Console
                                                                    HresultXml,\r
                                                                    WmXml,\r
                                                                    SvnCommand,\r
                                                                    HresultXml,\r
                                                                    WmXml,\r
                                                                    SvnCommand,\r
-                                                                   BugUrl);\r
+                                                                   BugUrl,\r
+                                                                   WineBugUrl,\r
+                                                                   SambaBugUrl);\r
                        service.Run();\r
                        while (true)\r
                        {\r
                        service.Run();\r
                        while (true)\r
                        {\r
index 955abe7..afba680 100644 (file)
@@ -5,13 +5,19 @@ namespace TechBot.Library
        public class BugCommand : BaseCommand, ICommand\r
        {\r
                private IServiceOutput serviceOutput;\r
        public class BugCommand : BaseCommand, ICommand\r
        {\r
                private IServiceOutput serviceOutput;\r
-               private string bugUrl;\r
+               private string RosBugUrl;\r
+               private string WineBugUrl;\r
+               private string SambaBugUrl;\r
 \r
                public BugCommand(IServiceOutput serviceOutput,\r
 \r
                public BugCommand(IServiceOutput serviceOutput,\r
-                                 string bugUrl)\r
+                                 string RosBugUrl,\r
+                                 string WineBugUrl,\r
+                                 string SambaBugUrl)\r
                {\r
                        this.serviceOutput = serviceOutput;\r
                {\r
                        this.serviceOutput = serviceOutput;\r
-                       this.bugUrl = bugUrl;\r
+                       this.RosBugUrl = RosBugUrl;\r
+                       this.WineBugUrl = WineBugUrl;\r
+                       this.SambaBugUrl = SambaBugUrl;\r
                }\r
                \r
                public bool CanHandle(string commandName)\r
                }\r
                \r
                public bool CanHandle(string commandName)\r
@@ -41,7 +47,18 @@ namespace TechBot.Library
                                                                      bugText));\r
                                return;\r
                        }\r
                                                                      bugText));\r
                                return;\r
                        }\r
+                       \r
+                       string bugUrl = this.RosBugUrl;\r
 \r
 \r
+                       if (context is ChannelMessageContext)\r
+                       {\r
+                               ChannelMessageContext channelContext = context as ChannelMessageContext;\r
+                               if (channelContext.Channel.Name == "winehackers")\r
+                                       bugUrl = this.WineBugUrl;\r
+                               else if (channelContext.Channel.Name == "samba-technical")\r
+                                       bugUrl = this.SambaBugUrl;\r
+                       }\r
+                       \r
                        serviceOutput.WriteLine(context,\r
                                                String.Format(bugUrl, bug));\r
                }\r
                        serviceOutput.WriteLine(context,\r
                                                String.Format(bugUrl, bug));\r
                }\r
index 2bc382c..2e7229f 100644 (file)
@@ -19,7 +19,7 @@ namespace TechBot.Library
                private string hresultXml;\r
                private string wmXml;\r
                private string svnCommand;\r
                private string hresultXml;\r
                private string wmXml;\r
                private string svnCommand;\r
-               private string bugUrl;\r
+               private string bugUrl, WineBugUrl, SambaBugUrl;\r
                private IrcClient client;\r
                private ArrayList channels = new ArrayList(); /* IrcChannel */\r
                private TechBotService service;\r
                private IrcClient client;\r
                private ArrayList channels = new ArrayList(); /* IrcChannel */\r
                private TechBotService service;\r
@@ -37,7 +37,9 @@ namespace TechBot.Library
                                  string hresultXml,\r
                                  string wmXml,\r
                                  string svnCommand,\r
                                  string hresultXml,\r
                                  string wmXml,\r
                                  string svnCommand,\r
-                                 string bugUrl)\r
+                                 string BugUrl,\r
+                                 string WineBugUrl,\r
+                                 string SambaBugUrl)\r
                {\r
                        this.hostname = hostname;\r
                        this.port = port;\r
                {\r
                        this.hostname = hostname;\r
                        this.port = port;\r
@@ -54,7 +56,9 @@ namespace TechBot.Library
                        this.hresultXml = hresultXml;\r
                        this.wmXml = wmXml;\r
                        this.svnCommand = svnCommand;\r
                        this.hresultXml = hresultXml;\r
                        this.wmXml = wmXml;\r
                        this.svnCommand = svnCommand;\r
-                       this.bugUrl = bugUrl;\r
+                       this.bugUrl = BugUrl;\r
+                       this.WineBugUrl = WineBugUrl;\r
+                       this.SambaBugUrl = SambaBugUrl;\r
                }\r
 \r
                public void Run()\r
                }\r
 \r
                public void Run()\r
@@ -67,7 +71,9 @@ namespace TechBot.Library
                                                     hresultXml,\r
                                                     wmXml,\r
                                                     svnCommand,\r
                                                     hresultXml,\r
                                                     wmXml,\r
                                                     svnCommand,\r
-                                                    bugUrl);\r
+                                                    bugUrl,\r
+                                                    WineBugUrl,\r
+                                                    SambaBugUrl);\r
                        service.Run();\r
 \r
                        client = new IrcClient();\r
                        service.Run();\r
 \r
                        client = new IrcClient();\r
index 1b7f95d..1efb858 100644 (file)
@@ -17,7 +17,7 @@ namespace TechBot.Library
                private string hresultXml;\r
                private string wmXml;\r
                private string svnCommand;\r
                private string hresultXml;\r
                private string wmXml;\r
                private string svnCommand;\r
-               private string bugUrl;\r
+               private string bugUrl, WineBugUrl, SambaBugUrl;\r
                private ArrayList commands = new ArrayList();\r
                \r
                public TechBotService(IServiceOutput serviceOutput,\r
                private ArrayList commands = new ArrayList();\r
                \r
                public TechBotService(IServiceOutput serviceOutput,\r
@@ -28,7 +28,9 @@ namespace TechBot.Library
                                      string hresultXml,\r
                                      string wmXml,\r
                                      string svnCommand,\r
                                      string hresultXml,\r
                                      string wmXml,\r
                                      string svnCommand,\r
-                                     string bugUrl)\r
+                                     string bugUrl,\r
+                                     string WineBugUrl,\r
+                                     string SambaBugUrl)\r
                {\r
                        this.serviceOutput = serviceOutput;\r
                        this.chmPath = chmPath;\r
                {\r
                        this.serviceOutput = serviceOutput;\r
                        this.chmPath = chmPath;\r
@@ -39,6 +41,8 @@ namespace TechBot.Library
                        this.wmXml = wmXml;\r
                        this.svnCommand = svnCommand;\r
                        this.bugUrl = bugUrl;\r
                        this.wmXml = wmXml;\r
                        this.svnCommand = svnCommand;\r
                        this.bugUrl = bugUrl;\r
+                       this.WineBugUrl = WineBugUrl;\r
+                       this.SambaBugUrl = SambaBugUrl;\r
                }\r
                \r
                public void Run()\r
                }\r
                \r
                public void Run()\r
@@ -63,7 +67,9 @@ namespace TechBot.Library
                        commands.Add(new SvnCommand(serviceOutput,\r
                                                    svnCommand));\r
                        commands.Add(new BugCommand(serviceOutput,\r
                        commands.Add(new SvnCommand(serviceOutput,\r
                                                    svnCommand));\r
                        commands.Add(new BugCommand(serviceOutput,\r
-                                                   bugUrl));\r
+                                                   bugUrl,\r
+                                                   WineBugUrl,\r
+                                                   SambaBugUrl));\r
                }\r
                \r
                public void InjectMessage(MessageContext context,\r
                }\r
                \r
                public void InjectMessage(MessageContext context,\r
index 2a40c92..397d4b0 100644 (file)
@@ -13,6 +13,8 @@
                <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />\r
                <add key="WmXml" value="C:\IRC\TechBot\wm.xml" />\r
                <add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />\r
                <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />\r
                <add key="WmXml" value="C:\IRC\TechBot\wm.xml" />\r
                <add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />\r
-               <add key="BugUrl" value="www.reactos.org/bugzilla/show_bug.cgi?id={0}" />\r
+               <add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />\r
+               <add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />\r
+               <add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />\r
        </appSettings>\r
 </configuration>\r
        </appSettings>\r
 </configuration>\r
index f2595c9..48b30d2 100644 (file)
@@ -19,7 +19,7 @@ namespace TechBot
                private string WmXml;\r
                private string WinerrorXml;\r
                private string SvnCommand;\r
                private string WmXml;\r
                private string WinerrorXml;\r
                private string SvnCommand;\r
-               private string BugUrl;\r
+               private string BugUrl, WineBugUrl, SambaBugUrl;\r
                private EventLog eventLog;\r
                \r
                public ServiceThread(EventLog eventLog)\r
                private EventLog eventLog;\r
                \r
                public ServiceThread(EventLog eventLog)\r
@@ -42,6 +42,8 @@ namespace TechBot
                        WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];\r
                        SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];\r
                        BugUrl = ConfigurationSettings.AppSettings["BugUrl"];\r
                        WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];\r
                        SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];\r
                        BugUrl = ConfigurationSettings.AppSettings["BugUrl"];\r
+                       WineBugUrl = ConfigurationSettings.AppSettings["WineBugUrl"];\r
+                       SambaBugUrl = ConfigurationSettings.AppSettings["SambaBugUrl"];\r
                }\r
                \r
                public void Run()\r
                }\r
                \r
                public void Run()\r
@@ -61,7 +63,9 @@ namespace TechBot
                                                               HresultXml,\r
                                                               WmXml,\r
                                                               SvnCommand,\r
                                                               HresultXml,\r
                                                               WmXml,\r
                                                               SvnCommand,\r
-                                                              BugUrl);\r
+                                                              BugUrl,\r
+                                                              WineBugUrl,\r
+                                                              SambaBugUrl);\r
                        ircService.Run();\r
                }\r
                \r
                        ircService.Run();\r
                }\r
                \r