Index: trunk/tools/wmib/DumpHtm.cs |
— | — | @@ -18,10 +18,12 @@ |
19 | 19 | /// Channel name |
20 | 20 | /// </summary> |
21 | 21 | public config.channel Channel; |
| 22 | + |
22 | 23 | /// <summary> |
23 | 24 | /// Dump |
24 | 25 | /// </summary> |
25 | 26 | public string dumpname; |
| 27 | + |
26 | 28 | // This function is called on start of bot |
27 | 29 | public static void Start() |
28 | 30 | { |
— | — | @@ -37,6 +39,7 @@ |
38 | 40 | System.Threading.Thread.Sleep(320000); |
39 | 41 | } |
40 | 42 | } |
| 43 | + |
41 | 44 | /// <summary> |
42 | 45 | /// Constructor |
43 | 46 | /// </summary> |
— | — | @@ -62,7 +65,7 @@ |
63 | 66 | /// <returns></returns> |
64 | 67 | public string CreateHeader() |
65 | 68 | { |
66 | | - return "<html><head><title>"+ Channel.name +"</title></head><body>\n"; |
| 69 | + return "<html><head><title>" + Channel.name + "</title></head><body>\n"; |
67 | 70 | } |
68 | 71 | |
69 | 72 | /// <summary> |
Index: trunk/tools/wmib/Config.cs |
— | — | @@ -23,24 +23,31 @@ |
24 | 24 | /// Channel name |
25 | 25 | /// </summary> |
26 | 26 | public string name; |
| 27 | + |
27 | 28 | public bool logged; |
| 29 | + |
28 | 30 | /// <summary> |
29 | 31 | /// Log |
30 | 32 | /// </summary> |
31 | 33 | public string log; |
| 34 | + |
32 | 35 | public bool info; |
| 36 | + |
33 | 37 | /// <summary> |
34 | 38 | /// Keys |
35 | 39 | /// </summary> |
36 | 40 | public irc.dictionary Keys; |
| 41 | + |
37 | 42 | /// <summary> |
38 | 43 | /// Configuration text |
39 | 44 | /// </summary> |
40 | 45 | private string conf; |
| 46 | + |
41 | 47 | /// <summary> |
42 | 48 | /// Users |
43 | 49 | /// </summary> |
44 | 50 | public irc.IRCTrust Users; |
| 51 | + |
45 | 52 | /// <summary> |
46 | 53 | /// Path of db |
47 | 54 | /// </summary> |
— | — | @@ -61,7 +68,7 @@ |
62 | 69 | /// </summary> |
63 | 70 | public void LoadConfig() |
64 | 71 | { |
65 | | - string conf_file = name + ".setting"; |
| 72 | + string conf_file = name + ".setting"; |
66 | 73 | if (!File.Exists(conf_file)) |
67 | 74 | { |
68 | 75 | File.WriteAllText(conf_file, ""); |
— | — | @@ -174,7 +181,7 @@ |
175 | 182 | text = File.ReadAllText("wmib"); |
176 | 183 | foreach (string x in parseConfig(text, "channels").Replace("\n", "").Split(',')) |
177 | 184 | { |
178 | | - string config =x.Replace(" ", ""); |
| 185 | + string config = x.Replace(" ", ""); |
179 | 186 | if (config != "") |
180 | 187 | { |
181 | 188 | channels.Add(new channel(config)); |
— | — | @@ -197,6 +204,7 @@ |
198 | 205 | /// Network |
199 | 206 | /// </summary> |
200 | 207 | public static string network = "irc.freenode.net"; |
| 208 | + |
201 | 209 | /// <summary> |
202 | 210 | /// Nick name |
203 | 211 | /// </summary> |
Index: trunk/tools/wmib/Program.cs |
— | — | @@ -14,15 +14,15 @@ |
15 | 15 | |
16 | 16 | namespace wmib |
17 | 17 | { |
18 | | - class Program |
| 18 | + internal class Program |
19 | 19 | { |
20 | | - public static bool Log(string msg ) |
| 20 | + public static bool Log(string msg) |
21 | 21 | { |
22 | 22 | Console.WriteLine("LOG: " + msg); |
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | | - static void Main(string[] args) |
| 26 | + private static void Main(string[] args) |
27 | 27 | { |
28 | 28 | Log("Connecting"); |
29 | 29 | config.Load(); |
Index: trunk/tools/wmib/Core.cs |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | namespace wmib |
17 | 17 | { |
18 | 18 | public class misc |
19 | | - { |
| 19 | + { |
20 | 20 | public static bool IsValidRegex(string pattern) |
21 | 21 | { |
22 | 22 | if (pattern == null) return false; |
— | — | @@ -32,6 +32,7 @@ |
33 | 33 | return true; |
34 | 34 | } |
35 | 35 | } |
| 36 | + |
36 | 37 | public class irc |
37 | 38 | { |
38 | 39 | private static System.Net.Sockets.NetworkStream data; |
— | — | @@ -53,10 +54,12 @@ |
54 | 55 | /// Regex |
55 | 56 | /// </summary> |
56 | 57 | public string name; |
| 58 | + |
57 | 59 | /// <summary> |
58 | 60 | /// Level |
59 | 61 | /// </summary> |
60 | 62 | public string level; |
| 63 | + |
61 | 64 | /// <summary> |
62 | 65 | /// Constructor |
63 | 66 | /// </summary> |
— | — | @@ -114,10 +117,12 @@ |
115 | 118 | /// List of all users in a channel |
116 | 119 | /// </summary> |
117 | 120 | private List<user> Users = new List<user>(); |
| 121 | + |
118 | 122 | /// <summary> |
119 | 123 | /// Channel this class belong to |
120 | 124 | /// </summary> |
121 | 125 | public string _Channel; |
| 126 | + |
122 | 127 | /// <summary> |
123 | 128 | /// File where data are stored |
124 | 129 | /// </summary> |
— | — | @@ -333,24 +338,30 @@ |
334 | 339 | /// Data file |
335 | 340 | /// </summary> |
336 | 341 | public string datafile = ""; |
| 342 | + |
337 | 343 | // if we need to update dump |
338 | 344 | public bool update = true; |
| 345 | + |
339 | 346 | /// <summary> |
340 | 347 | /// Locked |
341 | 348 | /// </summary> |
342 | 349 | public bool locked = false; |
| 350 | + |
343 | 351 | public class item |
344 | 352 | { |
345 | 353 | /// <summary> |
346 | 354 | /// Text |
347 | 355 | /// </summary> |
348 | 356 | public string text; |
| 357 | + |
349 | 358 | /// <summary> |
350 | 359 | /// Key |
351 | 360 | /// </summary> |
352 | 361 | public string key; |
| 362 | + |
353 | 363 | public string user; |
354 | 364 | public string locked; |
| 365 | + |
355 | 366 | /// <summary> |
356 | 367 | /// Constructor |
357 | 368 | /// </summary> |
— | — | @@ -366,16 +377,19 @@ |
367 | 378 | user = User; |
368 | 379 | } |
369 | 380 | } |
| 381 | + |
370 | 382 | public class staticalias |
371 | 383 | { |
372 | 384 | /// <summary> |
373 | 385 | /// Name |
374 | 386 | /// </summary> |
375 | 387 | public string Name; |
| 388 | + |
376 | 389 | /// <summary> |
377 | 390 | /// Key |
378 | 391 | /// </summary> |
379 | 392 | public string Key; |
| 393 | + |
380 | 394 | /// <summary> |
381 | 395 | /// Constructor |
382 | 396 | /// </summary> |
— | — | @@ -387,20 +401,25 @@ |
388 | 402 | Key = key; |
389 | 403 | } |
390 | 404 | } |
| 405 | + |
391 | 406 | /// <summary> |
392 | 407 | /// List of all items in class |
393 | 408 | /// </summary> |
394 | 409 | public List<item> text = new List<item>(); |
| 410 | + |
395 | 411 | /// <summary> |
396 | 412 | /// List of all aliases we want to use |
397 | 413 | /// </summary> |
398 | 414 | public List<staticalias> Alias = new List<staticalias>(); |
| 415 | + |
399 | 416 | /// <summary> |
400 | 417 | /// Channel name |
401 | 418 | /// </summary> |
402 | 419 | public string Channel; |
| 420 | + |
403 | 421 | private bool running; |
404 | 422 | private string search_key; |
| 423 | + |
405 | 424 | /// <summary> |
406 | 425 | /// Load it |
407 | 426 | /// </summary> |
— | — | @@ -458,11 +477,14 @@ |
459 | 478 | File.WriteAllText(datafile, ""); |
460 | 479 | foreach (staticalias key in Alias) |
461 | 480 | { |
462 | | - File.AppendAllText(datafile, key.Name + config.separator + key.Key + config.separator + "alias" + "\n"); |
| 481 | + File.AppendAllText(datafile, |
| 482 | + key.Name + config.separator + key.Key + config.separator + "alias" + "\n"); |
463 | 483 | } |
464 | 484 | foreach (item key in text) |
465 | 485 | { |
466 | | - File.AppendAllText(datafile, key.key + config.separator + key.text + config.separator + "key" + config.separator + key.locked + config.separator + key.user + "\n"); |
| 486 | + File.AppendAllText(datafile, |
| 487 | + key.key + config.separator + key.text + config.separator + "key" + |
| 488 | + config.separator + key.locked + config.separator + key.user + "\n"); |
467 | 489 | } |
468 | 490 | } |
469 | 491 | catch (Exception b) |
— | — | @@ -535,7 +557,7 @@ |
536 | 558 | Message("It would be cool to give me also a name of key", Channel); |
537 | 559 | return true; |
538 | 560 | } |
539 | | - this.aliasKey(name.Substring(name.IndexOf(" alias") + 7), parm[0], ""); |
| 561 | + this.aliasKey(name.Substring(name.IndexOf(" alias") + 7), parm[0], ""); |
540 | 562 | } |
541 | 563 | else |
542 | 564 | { |
— | — | @@ -579,7 +601,7 @@ |
580 | 602 | return false; |
581 | 603 | } |
582 | 604 | } |
583 | | - string User =""; |
| 605 | + string User = ""; |
584 | 606 | if (name.Contains("|")) |
585 | 607 | { |
586 | 608 | User = name.Substring(name.IndexOf("|")); |
— | — | @@ -590,26 +612,27 @@ |
591 | 613 | string[] p = name.Split(' '); |
592 | 614 | int parameters = p.Length; |
593 | 615 | string keyv = getValue(p[0]); |
594 | | - if (!(keyv == "")) |
| 616 | + if (!(keyv == "")) |
| 617 | + { |
| 618 | + if (parameters > 1) |
595 | 619 | { |
596 | | - if ( parameters > 1) |
| 620 | + int curr = 1; |
| 621 | + while (parameters > curr) |
597 | 622 | { |
598 | | - int curr = 1; |
599 | | - while ( parameters > curr ) |
600 | | - { |
601 | | - keyv = keyv.Replace("$" + curr.ToString(), p[curr]); |
602 | | - curr++; |
603 | | - } |
| 623 | + keyv = keyv.Replace("$" + curr.ToString(), p[curr]); |
| 624 | + curr++; |
604 | 625 | } |
605 | | - if (User == "") |
606 | | - { |
607 | | - Message(keyv, Channel); |
608 | | - } else |
609 | | - { |
610 | | - Message(User + ": " + keyv, Channel); |
611 | | - } |
612 | | - return true; |
613 | 626 | } |
| 627 | + if (User == "") |
| 628 | + { |
| 629 | + Message(keyv, Channel); |
| 630 | + } |
| 631 | + else |
| 632 | + { |
| 633 | + Message(User + ": " + keyv, Channel); |
| 634 | + } |
| 635 | + return true; |
| 636 | + } |
614 | 637 | foreach (staticalias b in Alias) |
615 | 638 | { |
616 | 639 | if (b.Name == p[0]) |
— | — | @@ -617,10 +640,10 @@ |
618 | 641 | keyv = getValue(b.Key); |
619 | 642 | if (keyv != "") |
620 | 643 | { |
621 | | - if ( parameters > 1) |
| 644 | + if (parameters > 1) |
622 | 645 | { |
623 | 646 | int curr = 1; |
624 | | - while ( parameters > curr ) |
| 647 | + while (parameters > curr) |
625 | 648 | { |
626 | 649 | keyv = keyv.Replace("$" + curr.ToString(), p[curr]); |
627 | 650 | curr++; |
— | — | @@ -643,7 +666,11 @@ |
644 | 667 | |
645 | 668 | private void StartSearch() |
646 | 669 | { |
647 | | - System.Text.RegularExpressions.Regex value = new System.Text.RegularExpressions.Regex(search_key, System.Text.RegularExpressions.RegexOptions.Compiled); |
| 670 | + System.Text.RegularExpressions.Regex value = new System.Text.RegularExpressions.Regex(search_key, |
| 671 | + System.Text. |
| 672 | + RegularExpressions |
| 673 | + .RegexOptions. |
| 674 | + Compiled); |
648 | 675 | string results = ""; |
649 | 676 | foreach (item data in text) |
650 | 677 | { |
— | — | @@ -712,7 +739,7 @@ |
713 | 740 | if (key.Length < 9) |
714 | 741 | { |
715 | 742 | Message("Could you please tell me what I should search for :P", Chan.name); |
716 | | - return; |
| 743 | + return; |
717 | 744 | } |
718 | 745 | key = key.Substring(8); |
719 | 746 | string results = ""; |
— | — | @@ -743,20 +770,20 @@ |
744 | 771 | { |
745 | 772 | while (locked) |
746 | 773 | { |
747 | | - System.Threading.Thread.Sleep(200); |
| 774 | + System.Threading.Thread.Sleep(200); |
748 | 775 | } |
749 | 776 | try |
750 | 777 | { |
751 | | - foreach (item data in text) |
| 778 | + foreach (item data in text) |
| 779 | + { |
| 780 | + if (data.key == key) |
752 | 781 | { |
753 | | - if (data.key == key) |
754 | | - { |
755 | | - Message("Key exist!", Channel); |
756 | | - return; |
757 | | - } |
| 782 | + Message("Key exist!", Channel); |
| 783 | + return; |
758 | 784 | } |
759 | | - text.Add(new item(key, encode(Text), user, "false")); |
760 | | - Message("Key was added!", Channel); |
| 785 | + } |
| 786 | + text.Add(new item(key, encode(Text), user, "false")); |
| 787 | + Message("Key was added!", Channel); |
761 | 788 | Save(); |
762 | 789 | } |
763 | 790 | catch (Exception b) |
— | — | @@ -773,7 +800,7 @@ |
774 | 801 | /// <param name="user">User</param> |
775 | 802 | public void aliasKey(string key, string al, string user) |
776 | 803 | { |
777 | | - foreach(staticalias stakey in this.Alias) |
| 804 | + foreach (staticalias stakey in this.Alias) |
778 | 805 | { |
779 | 806 | if (stakey.Name == al) |
780 | 807 | { |
— | — | @@ -790,7 +817,7 @@ |
791 | 818 | { |
792 | 819 | while (locked) |
793 | 820 | { |
794 | | - System.Threading.Thread.Sleep(200); |
| 821 | + System.Threading.Thread.Sleep(200); |
795 | 822 | } |
796 | 823 | foreach (item keys in text) |
797 | 824 | { |
— | — | @@ -892,7 +919,7 @@ |
893 | 920 | { |
894 | 921 | if (number <= 9 && number >= 0) |
895 | 922 | { |
896 | | - return "0"+number.ToString(); |
| 923 | + return "0" + number.ToString(); |
897 | 924 | } |
898 | 925 | return number.ToString(); |
899 | 926 | } |
— | — | @@ -907,7 +934,7 @@ |
908 | 935 | { |
909 | 936 | config.channel curr = getChannel(channel); |
910 | 937 | wd.WriteLine("PRIVMSG " + channel + " :" + message); |
911 | | - chanLog( message, curr, config.username, "" ); |
| 938 | + chanLog(message, curr, config.username, ""); |
912 | 939 | wd.Flush(); |
913 | 940 | return true; |
914 | 941 | } |
— | — | @@ -931,7 +958,8 @@ |
932 | 959 | { |
933 | 960 | if (rights_info.Length < 3) |
934 | 961 | { |
935 | | - Message("Wrong number of parameters, go fix it - example @trustadd regex (admin|trusted)", channel.name); |
| 962 | + Message("Wrong number of parameters, go fix it - example @trustadd regex (admin|trusted)", |
| 963 | + channel.name); |
936 | 964 | return 0; |
937 | 965 | } |
938 | 966 | if (!(rights_info[2] == "admin" || rights_info[2] == "trusted")) |
— | — | @@ -1005,17 +1033,22 @@ |
1006 | 1034 | string log; |
1007 | 1035 | if (!noac) |
1008 | 1036 | { |
1009 | | - log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + timedateToString(System.DateTime.Now.Minute) + ":" + timedateToString( System.DateTime.Now.Second) + "] * " + user + " " + message + "\n"; |
| 1037 | + log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + |
| 1038 | + timedateToString(System.DateTime.Now.Minute) + ":" + |
| 1039 | + timedateToString(System.DateTime.Now.Second) + "] * " + user + " " + message + "\n"; |
1010 | 1040 | } |
1011 | 1041 | else |
1012 | 1042 | { |
1013 | | - log = "[" + timedateToString( System.DateTime.Now.Hour) + ":" + timedateToString( System.DateTime.Now.Minute ) + ":" + timedateToString( System.DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; |
| 1043 | + log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + |
| 1044 | + timedateToString(System.DateTime.Now.Minute) + ":" + |
| 1045 | + timedateToString(System.DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n"; |
1014 | 1046 | } |
1015 | | - File.AppendAllText(channel.log + System.DateTime.Now.Year + System.DateTime.Now.Month + System.DateTime.Now.Day +".txt", log); |
| 1047 | + File.AppendAllText( |
| 1048 | + channel.log + DateTime.Now.Year + DateTime.Now.Month + System.DateTime.Now.Day + ".txt", log); |
1016 | 1049 | } |
1017 | 1050 | } |
1018 | 1051 | catch (Exception er) |
1019 | | - { |
| 1052 | + { |
1020 | 1053 | // nothing |
1021 | 1054 | Console.WriteLine(er.Message); |
1022 | 1055 | } |
— | — | @@ -1038,7 +1071,9 @@ |
1039 | 1072 | |
1040 | 1073 | public static bool validFile(string name) |
1041 | 1074 | { |
1042 | | - return !(name.Contains(" ") || name.Contains("?") || name.Contains("|") || name.Contains("/") || name.Contains("\\") || name.Contains(">") || name.Contains("<") || name.Contains("*")); |
| 1075 | + return |
| 1076 | + !(name.Contains(" ") || name.Contains("?") || name.Contains("|") || name.Contains("/") || |
| 1077 | + name.Contains("\\") || name.Contains(">") || name.Contains("<") || name.Contains("*")); |
1043 | 1078 | } |
1044 | 1079 | |
1045 | 1080 | /// <summary> |
— | — | @@ -1054,45 +1089,42 @@ |
1055 | 1090 | { |
1056 | 1091 | if (message.StartsWith("@add")) |
1057 | 1092 | { |
1058 | | - if (chan.Users.isApproved(user, host, "admin")) |
| 1093 | + return; |
| 1094 | + } |
| 1095 | + if (!chan.Users.isApproved(user, host, "admin")) |
| 1096 | + { |
| 1097 | + Message(messages.PermissionDenied, chan.name); |
| 1098 | + return; |
| 1099 | + } |
| 1100 | + if (!message.Contains(" ")) |
| 1101 | + { |
| 1102 | + Message("Invalid name", chan.name); |
| 1103 | + return; |
| 1104 | + } |
| 1105 | + string channel = message.Substring(message.IndexOf(" ") + 1); |
| 1106 | + if (!validFile(channel) || (channel.Contains("#") == false)) |
| 1107 | + { |
| 1108 | + Message("Invalid name", chan.name); |
| 1109 | + return; |
| 1110 | + } |
| 1111 | + foreach (config.channel cu in config.channels) |
| 1112 | + { |
| 1113 | + if (channel == cu.name) |
1059 | 1114 | { |
1060 | | - if (message.Contains(" ")) |
1061 | | - { |
1062 | | - string channel = message.Substring(message.IndexOf(" ") + 1); |
1063 | | - if ( !validFile(channel) || (channel.Contains("#") == false)) |
1064 | | - { |
1065 | | - Message("Invalid name", chan.name); |
1066 | | - return; |
1067 | | - } |
1068 | | - foreach (config.channel cu in config.channels) |
1069 | | - { |
1070 | | - if (channel == cu.name) |
1071 | | - { |
1072 | | - return; |
1073 | | - } |
1074 | | - } |
1075 | | - config.channels.Add(new config.channel(channel)); |
1076 | | - config.Save(); |
1077 | | - wd.WriteLine("JOIN " + channel); |
1078 | | - wd.Flush(); |
1079 | | - System.Threading.Thread.Sleep(100); |
1080 | | - config.channel Chan = getChannel(channel); |
1081 | | - Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + host); |
1082 | | - } |
1083 | | - else |
1084 | | - { |
1085 | | - Message("Invalid name", chan.name); |
1086 | | - } |
| 1115 | + return; |
1087 | 1116 | } |
1088 | | - else |
1089 | | - { |
1090 | | - Message(messages.PermissionDenied, chan.name); |
1091 | | - } |
1092 | 1117 | } |
| 1118 | + config.channels.Add(new config.channel(channel)); |
| 1119 | + config.Save(); |
| 1120 | + wd.WriteLine("JOIN " + channel); |
| 1121 | + wd.Flush(); |
| 1122 | + System.Threading.Thread.Sleep(100); |
| 1123 | + config.channel Chan = getChannel(channel); |
| 1124 | + Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + host); |
1093 | 1125 | } |
1094 | 1126 | catch (Exception b) |
1095 | | - { |
1096 | | - |
| 1127 | + { |
| 1128 | + |
1097 | 1129 | } |
1098 | 1130 | } |
1099 | 1131 | |
— | — | @@ -1166,10 +1198,10 @@ |
1167 | 1199 | { |
1168 | 1200 | if (chan.Users.isApproved(user, host, "admin")) |
1169 | 1201 | { |
1170 | | - chan.LoadConfig(); |
1171 | | - chan.Keys = new dictionary(chan.keydb, chan.name); |
1172 | | - Message("Channel config was reloaded", chan.name); |
1173 | | - return; |
| 1202 | + chan.LoadConfig(); |
| 1203 | + chan.Keys = new dictionary(chan.keydb, chan.name); |
| 1204 | + Message("Channel config was reloaded", chan.name); |
| 1205 | + return; |
1174 | 1206 | } |
1175 | 1207 | else |
1176 | 1208 | { |
— | — | @@ -1204,11 +1236,12 @@ |
1205 | 1237 | if (message == "@whoami") |
1206 | 1238 | { |
1207 | 1239 | user current = chan.Users.getUser(user + "!@" + host); |
1208 | | - if(current.level == "null") |
| 1240 | + if (current.level == "null") |
1209 | 1241 | { |
1210 | 1242 | Message("You are unknown to me :)", chan.name); |
1211 | 1243 | return; |
1212 | | - } else |
| 1244 | + } |
| 1245 | + else |
1213 | 1246 | { |
1214 | 1247 | Message("You are " + current.level + " identified by name " + current.name, chan.name); |
1215 | 1248 | return; |
— | — | @@ -1295,7 +1328,9 @@ |
1296 | 1329 | } |
1297 | 1330 | if (message == "@commands") |
1298 | 1331 | { |
1299 | | - Message("Commands: channellist, trusted, trustadd, trustdel, infobot-off, infobot-on, drop, whoami, add, reload, logon, logoff", chan.name); |
| 1332 | + Message( |
| 1333 | + "Commands: channellist, trusted, trustadd, trustdel, infobot-off, infobot-on, drop, whoami, add, reload, logon, logoff", |
| 1334 | + chan.name); |
1300 | 1335 | return; |
1301 | 1336 | } |
1302 | 1337 | } |
— | — | @@ -1392,7 +1427,7 @@ |
1393 | 1428 | string host = ""; |
1394 | 1429 | string message = ""; |
1395 | 1430 | string channel = ""; |
1396 | | - char delimiter = (char)001; |
| 1431 | + char delimiter = (char) 001; |
1397 | 1432 | |
1398 | 1433 | while (true) |
1399 | 1434 | { |
— | — | @@ -1418,7 +1453,9 @@ |
1419 | 1454 | if (text.Contains("!") && text.Contains("@")) |
1420 | 1455 | { |
1421 | 1456 | nick = info.Substring(0, info.IndexOf("!")); |
1422 | | - host = info.Substring(info.IndexOf("@") + 1, info.IndexOf(" ", info.IndexOf("@")) - 1 - info.IndexOf("@")); |
| 1457 | + host = info.Substring(info.IndexOf("@") + 1, |
| 1458 | + info.IndexOf(" ", info.IndexOf("@")) - 1 - |
| 1459 | + info.IndexOf("@")); |
1423 | 1460 | } |
1424 | 1461 | info_host = info.Substring(info.IndexOf("PRIVMSG ")); |
1425 | 1462 | |
— | — | @@ -1429,7 +1466,8 @@ |
1430 | 1467 | message = message.Substring(message.IndexOf(" :") + 2); |
1431 | 1468 | if (message.Contains(delimiter.ToString() + "ACTION")) |
1432 | 1469 | { |
1433 | | - getAction(message.Replace(delimiter.ToString() +"ACTION", ""), channel, host, nick); |
| 1470 | + getAction(message.Replace(delimiter.ToString() + "ACTION", ""), channel, |
| 1471 | + host, nick); |
1434 | 1472 | continue; |
1435 | 1473 | } |
1436 | 1474 | getMessage(channel, nick, host, message); |
— | — | @@ -1442,25 +1480,30 @@ |
1443 | 1481 | // private message |
1444 | 1482 | if (message.StartsWith(":" + delimiter.ToString() + "FINGER")) |
1445 | 1483 | { |
1446 | | - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "FINGER" + " I am a bot don't finger me"); |
| 1484 | + wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "FINGER" + |
| 1485 | + " I am a bot don't finger me"); |
1447 | 1486 | wd.Flush(); |
1448 | 1487 | continue; |
1449 | 1488 | } |
1450 | 1489 | if (message.StartsWith(":" + delimiter.ToString() + "TIME")) |
1451 | 1490 | { |
1452 | | - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "TIME " + System.DateTime.Now.ToString()); |
| 1491 | + wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "TIME " + |
| 1492 | + System.DateTime.Now.ToString()); |
1453 | 1493 | wd.Flush(); |
1454 | 1494 | continue; |
1455 | 1495 | } |
1456 | 1496 | if (message.StartsWith(":" + delimiter.ToString() + "PING")) |
1457 | 1497 | { |
1458 | | - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "PING" + message.Substring(message.IndexOf(delimiter.ToString() + "PING")+5)); |
| 1498 | + wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "PING" + |
| 1499 | + message.Substring( |
| 1500 | + message.IndexOf(delimiter.ToString() + "PING") + 5)); |
1459 | 1501 | wd.Flush(); |
1460 | 1502 | continue; |
1461 | 1503 | } |
1462 | 1504 | if (message.StartsWith(":" + delimiter.ToString() + "VERSION")) |
1463 | 1505 | { |
1464 | | - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "VERSION " + config.version); |
| 1506 | + wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "VERSION " + |
| 1507 | + config.version); |
1465 | 1508 | wd.Flush(); |
1466 | 1509 | continue; |
1467 | 1510 | } |
— | — | @@ -1495,6 +1538,6 @@ |
1496 | 1539 | { |
1497 | 1540 | wd.Flush(); |
1498 | 1541 | return 0; |
1499 | | - } |
| 1542 | + } |
1500 | 1543 | } |
1501 | 1544 | } |