Index: trunk/tools/wmib/Config.cs |
— | — | @@ -77,17 +77,17 @@ |
78 | 78 | return; |
79 | 79 | } |
80 | 80 | conf = File.ReadAllText(conf_file); |
81 | | - if (config.parseConfig(conf, "keysdb") != "") |
| 81 | + if (parseConfig(conf, "keysdb") != "") |
82 | 82 | { |
83 | | - keydb = (config.parseConfig(conf, "keysdb")); |
| 83 | + keydb = (parseConfig(conf, "keysdb")); |
84 | 84 | } |
85 | | - if (config.parseConfig(conf, "logged") != "") |
| 85 | + if (parseConfig(conf, "logged") != "") |
86 | 86 | { |
87 | | - logged = bool.Parse(config.parseConfig(conf, "logged")); |
| 87 | + logged = bool.Parse(parseConfig(conf, "logged")); |
88 | 88 | } |
89 | | - if (config.parseConfig(conf, "infodb") != "") |
| 89 | + if (parseConfig(conf, "infodb") != "") |
90 | 90 | { |
91 | | - info = bool.Parse(config.parseConfig(conf, "infodb")); |
| 91 | + info = bool.Parse(parseConfig(conf, "infodb")); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | AddConfig("network", network); |
149 | 149 | AddConfig("debug", debugchan); |
150 | 150 | AddConfig("nick", login); |
151 | | - text = text + "\nchannels="; |
| 151 | + text += text + "\nchannels="; |
152 | 152 | foreach (channel current in channels) |
153 | 153 | { |
154 | 154 | text = text + current.name + ",\n"; |
— | — | @@ -210,12 +210,12 @@ |
211 | 211 | /// <summary> |
212 | 212 | /// Network |
213 | 213 | /// </summary> |
214 | | - /// |
| 214 | + |
215 | 215 | public static string network = "irc.freenode.net"; |
216 | 216 | /// <summary> |
217 | 217 | /// Nick name |
218 | 218 | /// </summary> |
219 | | - /// |
| 219 | + |
220 | 220 | public static string username = "wm-bot"; |
221 | 221 | |
222 | 222 | public static string debugchan = null; |
Index: trunk/tools/wmib/Program.cs |
— | — | @@ -18,14 +18,14 @@ |
19 | 19 | |
20 | 20 | namespace wmib |
21 | 21 | { |
22 | | - class Program |
| 22 | + internal class Program |
23 | 23 | { |
24 | | - public static bool Log(string msg ) |
| 24 | + public static bool Log(string msg) |
25 | 25 | { |
26 | 26 | Console.WriteLine("LOG: " + msg); |
27 | 27 | return false; |
28 | 28 | } |
29 | | - static void Main(string[] args) |
| 29 | + private static void Main(string[] args) |
30 | 30 | { |
31 | 31 | Log("Connecting"); |
32 | 32 | config.Load(); |
Index: trunk/tools/wmib/Core.cs |
— | — | @@ -42,8 +42,8 @@ |
43 | 43 | private static System.Net.Sockets.NetworkStream data; |
44 | 44 | public static Thread dumphtmt; |
45 | 45 | public static Thread check_thread; |
46 | | - public static System.IO.StreamReader rd; |
47 | | - private static System.IO.StreamWriter wd; |
| 46 | + public static StreamReader rd; |
| 47 | + private static StreamWriter wd; |
48 | 48 | private static List<user> User = new List<user>(); |
49 | 49 | |
50 | 50 | public class messages |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | } |
142 | 142 | public int IsMatch() |
143 | 143 | { |
144 | | - Thread quick = new Thread(new ThreadStart(Run)); |
| 144 | + Thread quick = new Thread(Run); |
145 | 145 | searching = true; |
146 | 146 | quick.Start(); |
147 | 147 | int check = 0; |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | string users_ok = ""; |
360 | 360 | foreach (user b in Users) |
361 | 361 | { |
362 | | - users_ok = users_ok + " " + b.name + ","; |
| 362 | + users_ok += " " + b.name + ","; |
363 | 363 | } |
364 | 364 | Message("I trust: " + users_ok, _Channel); |
365 | 365 | } |
— | — | @@ -615,11 +615,17 @@ |
616 | 616 | string log; |
617 | 617 | if (!noac) |
618 | 618 | { |
619 | | - log = "[" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "] * " + user + " " + message + "\n"; |
| 619 | + log = "[" + timedateToString(DateTime.Now.Hour) + ":" + |
| 620 | + timedateToString(DateTime.Now.Minute) + ":" + |
| 621 | + timedateToString(DateTime.Now.Second) + "] * " + |
| 622 | + user + " " + message + "\n"; |
620 | 623 | } |
621 | 624 | else |
622 | 625 | { |
623 | | - log = "[" + timedateToString(DateTime.Now.Hour) + ":" + timedateToString(DateTime.Now.Minute) + ":" + timedateToString(DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; |
| 626 | + log = "[" + timedateToString(DateTime.Now.Hour) + ":" |
| 627 | + + timedateToString(DateTime.Now.Minute) + ":" + |
| 628 | + timedateToString(DateTime.Now.Second) + "] " + "<" + |
| 629 | + user + ">\t " + message + "\n"; |
624 | 630 | } |
625 | 631 | File.AppendAllText(channel.log + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".txt", log); |
626 | 632 | } |
— | — | @@ -648,7 +654,8 @@ |
649 | 655 | |
650 | 656 | public static bool validFile(string name) |
651 | 657 | { |
652 | | - return !(name.Contains(" ") || name.Contains("?") || name.Contains("|") || name.Contains("/") || name.Contains("\\") || name.Contains(">") || name.Contains("<") || name.Contains("*")); |
| 658 | + return !(name.Contains(" ") || name.Contains("?") || name.Contains("|") || name.Contains("/") |
| 659 | + || name.Contains("\\") || name.Contains(">") || name.Contains("<") || name.Contains("*")); |
653 | 660 | } |
654 | 661 | |
655 | 662 | /// <summary> |
— | — | @@ -690,13 +697,11 @@ |
691 | 698 | Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + host); |
692 | 699 | return; |
693 | 700 | } |
694 | | - else |
695 | | - { |
696 | | - Message("Invalid name", chan.name); |
697 | | - return; |
698 | | - } |
| 701 | + Message("Invalid name", chan.name); |
| 702 | + return; |
699 | 703 | } |
700 | 704 | Message(messages.PermissionDenied, chan.name); |
| 705 | + return; |
701 | 706 | } |
702 | 707 | } |
703 | 708 | catch (Exception b) |
— | — | @@ -738,11 +743,8 @@ |
739 | 744 | config.Save(); |
740 | 745 | return; |
741 | 746 | } |
742 | | - else |
743 | | - { |
744 | | - Message(messages.PermissionDenied, chan.name); |
745 | | - return; |
746 | | - } |
| 747 | + Message(messages.PermissionDenied, chan.name); |
| 748 | + return; |
747 | 749 | } |
748 | 750 | if (message == "@part") |
749 | 751 | { |
— | — | @@ -783,11 +785,8 @@ |
784 | 786 | Message("Channel config was reloaded", chan.name); |
785 | 787 | return; |
786 | 788 | } |
787 | | - else |
788 | | - { |
789 | | - Message(messages.PermissionDenied, chan.name); |
790 | | - return; |
791 | | - } |
| 789 | + Message(messages.PermissionDenied, chan.name); |
| 790 | + return; |
792 | 791 | } |
793 | 792 | if (message == "@refresh") |
794 | 793 | { |
— | — | @@ -801,11 +800,8 @@ |
802 | 801 | Message("Message queue was reloaded", chan.name); |
803 | 802 | return; |
804 | 803 | } |
805 | | - else |
806 | | - { |
807 | | - Message(messages.PermissionDenied, chan.name); |
808 | | - return; |
809 | | - } |
| 804 | + Message(messages.PermissionDenied, chan.name); |
| 805 | + return; |
810 | 806 | } |
811 | 807 | if (message == "@logon") |
812 | 808 | { |
— | — | @@ -825,11 +821,8 @@ |
826 | 822 | return; |
827 | 823 | } |
828 | 824 | } |
829 | | - else |
830 | | - { |
831 | | - SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
832 | | - return; |
833 | | - } |
| 825 | + SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
| 826 | + return; |
834 | 827 | } |
835 | 828 | if (message == "@whoami") |
836 | 829 | { |
— | — | @@ -839,11 +832,8 @@ |
840 | 833 | Message("You are unknown to me :)", chan.name); |
841 | 834 | return; |
842 | 835 | } |
843 | | - else |
844 | | - { |
845 | | - Message("You are " + current.level + " identified by name " + current.name, chan.name); |
846 | | - return; |
847 | | - } |
| 836 | + Message("You are " + current.level + " identified by name " + current.name, chan.name); |
| 837 | + return; |
848 | 838 | } |
849 | 839 | |
850 | 840 | if (message == "@logoff") |
— | — | @@ -864,11 +854,8 @@ |
865 | 855 | return; |
866 | 856 | } |
867 | 857 | } |
868 | | - else |
869 | | - { |
870 | | - SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
871 | | - return; |
872 | | - } |
| 858 | + SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
| 859 | + return; |
873 | 860 | } |
874 | 861 | if (message == "@channellist") |
875 | 862 | { |
— | — | @@ -898,11 +885,8 @@ |
899 | 886 | return; |
900 | 887 | } |
901 | 888 | } |
902 | | - else |
903 | | - { |
904 | | - SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
905 | | - return; |
906 | | - } |
| 889 | + SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
| 890 | + return; |
907 | 891 | } |
908 | 892 | if (message == "@infobot-on") |
909 | 893 | { |
— | — | @@ -913,20 +897,14 @@ |
914 | 898 | Message("Infobot was already enabled :O", chan.name); |
915 | 899 | return; |
916 | 900 | } |
917 | | - else |
918 | | - { |
919 | | - chan.info = true; |
920 | | - config.Save(); |
921 | | - chan.SaveConfig(); |
922 | | - Message("Infobot enabled", chan.name); |
923 | | - return; |
924 | | - } |
925 | | - } |
926 | | - else |
927 | | - { |
928 | | - SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
| 901 | + chan.info = true; |
| 902 | + config.Save(); |
| 903 | + chan.SaveConfig(); |
| 904 | + Message("Infobot enabled", chan.name); |
929 | 905 | return; |
930 | 906 | } |
| 907 | + SlowQueue.DeliverMessage(messages.PermissionDenied, chan.name); |
| 908 | + return; |
931 | 909 | } |
932 | 910 | if (message == "@commands") |
933 | 911 | { |
— | — | @@ -983,7 +961,7 @@ |
984 | 962 | wd.WriteLine("USER " + config.name + " 8 * :" + config.name); |
985 | 963 | wd.WriteLine("NICK " + config.username); |
986 | 964 | Authenticate(); |
987 | | - _Queue = new Thread(new ThreadStart(SlowQueue.Run)); |
| 965 | + _Queue = new Thread(SlowQueue.Run); |
988 | 966 | foreach (config.channel ch in config.channels) |
989 | 967 | { |
990 | 968 | Thread.Sleep(2000); |
— | — | @@ -1006,10 +984,10 @@ |
1007 | 985 | rd = new System.IO.StreamReader(data, System.Text.Encoding.UTF8); |
1008 | 986 | wd = new System.IO.StreamWriter(data); |
1009 | 987 | |
1010 | | - _Queue = new Thread(new ThreadStart(SlowQueue.Run)); |
1011 | | - dumphtmt = new Thread(new ThreadStart(HtmlDump.Start)); |
| 988 | + _Queue = new Thread(SlowQueue.Run); |
| 989 | + dumphtmt = new Thread(HtmlDump.Start); |
1012 | 990 | dumphtmt.Start(); |
1013 | | - check_thread = new Thread(new ThreadStart(Ping)); |
| 991 | + check_thread = new Thread(Ping); |
1014 | 992 | check_thread.Start(); |
1015 | 993 | |
1016 | 994 | wd.WriteLine("USER " + config.name + " 8 * :" + config.name); |
Index: trunk/tools/wmib/DumpHtm.cs |
— | — | @@ -105,15 +105,14 @@ |
106 | 106 | { |
107 | 107 | try |
108 | 108 | { |
109 | | - string text; |
110 | | - text = CreateHeader(); |
| 109 | + string text = CreateHeader(); |
111 | 110 | text = text + "<table border=1 width=100%>\n<tr><td width=10%>Key</td><td>Value</td></tr>\n"; |
112 | 111 | Channel.Keys.locked = true; |
113 | 112 | if (Channel.Keys.text.Count > 0) |
114 | 113 | { |
115 | 114 | foreach (dictionary.item Key in Channel.Keys.text) |
116 | 115 | { |
117 | | - text = text + AddLine(Key.key, Key.text); |
| 116 | + text += AddLine(Key.key, Key.text); |
118 | 117 | } |
119 | 118 | } |
120 | 119 | Channel.Keys.locked = false; |