r106311 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106310‎ | r106311 | r106312 >
Date:07:59, 15 December 2011
Author:petrb
Status:deferred
Tags:
Comment:
Updated a lot of stuff and merged some parts with previous changes
Modified paths:
  • /trunk/tools/wmib/Program.cs (modified) (history)

Diff [purge]

Index: trunk/tools/wmib/Program.cs
@@ -33,6 +33,63 @@
3434 }
3535 }
3636
 37+ public class HtmlDump
 38+ {
 39+ public config.channel Channel;
 40+ public string dumpname;
 41+ public static void Start()
 42+ {
 43+ while (true)
 44+ {
 45+ foreach (config.channel chan in config.channels)
 46+ {
 47+ HtmlDump dump = new HtmlDump(chan);
 48+ dump.Make();
 49+ }
 50+ System.Threading.Thread.Sleep(3600000);
 51+ }
 52+ }
 53+ public HtmlDump(config.channel channel)
 54+ {
 55+ dumpname = config.DumpDir + "/" + channel.name + ".htm";
 56+ Channel = channel;
 57+ }
 58+ public string CreateFooter()
 59+ {
 60+ return "</body></html>\n";
 61+ }
 62+ public string CreateHeader()
 63+ {
 64+ return "<html><head></head><body>\n";
 65+ }
 66+ public string Encode(string text)
 67+ {
 68+ text = text.Replace("<", "&lt;");
 69+ text = text.Replace(">", "&gt;");
 70+ return text;
 71+ }
 72+ public string AddLine(string name, string value)
 73+ {
 74+ return "<tr><td>" + Encode(name) + "</td><td>" + Encode(value) + "</td></tr>\n";
 75+ }
 76+ public void Make()
 77+ {
 78+ string text;
 79+ text = CreateHeader();
 80+ text = text + "<table border=1 width=100%>\n<tr><td width=10%>Key</td><td>Value</td></tr>\n";
 81+ if (Channel.Keys.text.Count > 0)
 82+ {
 83+ foreach (irc.dictionary.item Key in Channel.Keys.text)
 84+ {
 85+ text = text + AddLine(Key.key, Key.text);
 86+ }
 87+ }
 88+ text = text + "<table>\n";
 89+ text = text + CreateFooter();
 90+ System.IO.File.WriteAllText(dumpname, text);
 91+ }
 92+ }
 93+
3794 public static class config
3895 {
3996 public static string text;
@@ -44,7 +101,9 @@
45102 {
46103 text ="";
47104 AddConfig("username", username);
 105+ AddConfig("password", password);
48106 AddConfig("network", network);
 107+ AddConfig("nick", login);
49108 text = text + "\nchannels=";
50109 foreach (channel current in channels)
51110 {
@@ -58,15 +117,59 @@
59118 public string name;
60119 public bool logged;
61120 public string log;
62 - public irc.dictionary Keys = new irc.dictionary();
63 - public irc.trust Users;
 121+ public irc.dictionary Keys;
 122+ private string conf;
 123+ public irc.IRCTrust Users;
 124+ public string keydb = "";
 125+ private void AddConfig(string a, string b)
 126+ {
 127+ conf = conf + "\n" + a + "=" + b + ";";
 128+ }
 129+ public void LoadConfig()
 130+ {
 131+ string conf_file = name + ".setting";
 132+ if (!System.IO.File.Exists(conf_file))
 133+ {
 134+ System.IO.File.WriteAllText(conf_file, "");
 135+ Program.Log("Creating datafile for channel " + name);
 136+ return;
 137+ }
 138+ conf = System.IO.File.ReadAllText(conf_file);
 139+ if (config.parseConfig(conf, "keysdb") != "")
 140+ {
 141+ keydb = (config.parseConfig(conf, "keysdb"));
 142+ }
 143+ if (config.parseConfig(conf, "logged") != "")
 144+ {
 145+ logged = bool.Parse(config.parseConfig(conf, "logged"));
 146+ }
 147+ }
 148+
 149+ public void SaveConfig()
 150+ {
 151+ conf = "";
 152+ AddConfig("keysdb", keydb);
 153+ AddConfig("logged", logged.ToString());
 154+ System.IO.File.WriteAllText(name + ".setting", conf);
 155+ }
64156 public channel(string Name)
65157 {
 158+ conf = "";
 159+ keydb = Name + ".db";
66160 logged = true;
67 - name = Name;
68 - log = Name + ".txt";
69 - Keys.Load(name);
70 - Users = new irc.trust(name);
 161+ name = Name;
 162+ LoadConfig();
 163+ if (!System.IO.Directory.Exists("log"))
 164+ {
 165+ System.IO.Directory.CreateDirectory("log");
 166+ }
 167+ if (!System.IO.Directory.Exists("log/" + Name))
 168+ {
 169+ System.IO.Directory.CreateDirectory("log/" + Name);
 170+ }
 171+ Keys = new irc.dictionary(keydb, name);
 172+ log = "log/" + Name + "/" + System.DateTime.Now.Year + System.DateTime.Now.Month + System.DateTime.Now.Day +".txt";
 173+ Users = new irc.IRCTrust(name);
71174 }
72175 }
73176
@@ -87,21 +190,36 @@
88191 text = System.IO.File.ReadAllText("wmib");
89192 foreach (string x in parseConfig(text, "channels").Replace("\n", "").Split(','))
90193 {
91 - channels.Add(new channel(x));
 194+ string name=x.Replace(" ", "");
 195+ if (!(name == ""))
 196+ {
 197+ channels.Add(new channel(name));
 198+ }
92199 }
93200 username = parseConfig(text, "username");
94201 network = parseConfig(text, "network");
95 -
 202+ login = parseConfig(text, "nick");
 203+ password = parseConfig(text, "password");
 204+ if (!System.IO.Directory.Exists(config.DumpDir))
 205+ {
 206+ System.IO.Directory.CreateDirectory(config.DumpDir);
 207+ }
96208 }
97209 /// <summary>
98210 /// Network
99211 /// </summary>
100212 public static string network = "irc.freenode.net";
 213+ /// <summary>
 214+ /// Nick name
 215+ /// </summary>
101216 public static string username = "wm-bot";
 217+ public static string login = "";
 218+ public static string password = "";
 219+ public static string DumpDir = "dump";
102220 /// <summary>
103 - ///
 221+ /// Version
104222 /// </summary>
105 - public static string version = "wikimedia bot v. 1.0.1";
 223+ public static string version = "wikimedia bot v. 1.1.4";
106224 public static string separator = "|";
107225 /// <summary>
108226 /// User name
@@ -116,17 +234,18 @@
117235 public static class irc
118236 {
119237 private static System.Net.Sockets.NetworkStream data;
 238+ public static System.Threading.Thread dumphtmt;
 239+ public static System.Threading.Thread check_thread;
120240 public static System.IO.StreamReader rd;
121241 private static System.IO.StreamWriter wd;
122242 private static List<user> User = new List<user>();
123 - public static System.Threading.Thread check_thread;
124243
125244 public static void Ping()
126245 {
127246 while (true)
128247 {
129248 System.Threading.Thread.Sleep(20000);
130 - wd.WriteLine("PING: " + config.network);
 249+ wd.WriteLine("PING :" + config.network);
131250 wd.Flush();
132251 }
133252 }
@@ -136,6 +255,17 @@
137256 return text.Replace(config.separator, "<separator>");
138257 }
139258
 259+ public static bool Authenticate()
 260+ {
 261+ if (config.login != "")
 262+ {
 263+ wd.WriteLine("PRIVMSG nickserv :identify " + config.login + " " + config.password);
 264+ wd.Flush();
 265+ System.Threading.Thread.Sleep(4000);
 266+ }
 267+ return true;
 268+ }
 269+
140270 public static string decode(string text)
141271 {
142272 return text.Replace("<separator>", config.separator);
@@ -152,12 +282,12 @@
153283 public string level;
154284 }
155285
156 - public class trust
 286+ public class IRCTrust
157287 {
158288 private List<user> Users = new List<user>();
159289 public string _Channel;
160290 public string File;
161 - public trust(string channel)
 291+ public IRCTrust(string channel)
162292 {
163293 // Load
164294 File = channel + "_user";
@@ -168,7 +298,7 @@
169299 System.IO.File.WriteAllText(File, "");
170300 }
171301 string[] db = System.IO.File.ReadAllLines(channel + "_user");
172 - this._Channel = channel;
 302+ _Channel = channel;
173303 foreach (string x in db)
174304 {
175305 if (x.Contains(config.separator))
@@ -288,49 +418,26 @@
289419 {
290420 return false;
291421 }
292 -
293 - if (command == "alias_key")
 422+ switch (command)
294423 {
 424+ case "alias_key":
 425+ case "delete_key":
 426+ case "trust":
 427+ case "info":
 428+ case "trustadd":
 429+ case "trustdel":
295430 return matchLevel(1, current.level);
 431+ case "admin":
 432+ case "shutdown":
 433+ return matchLevel(2, current.level);
296434 }
297 - if (command == "new_key")
298 - {
299 - return matchLevel(1, current.level);
300 - }
301 - if (command == "shutdown")
302 - {
303 - return matchLevel(1, current.level);
304 - }
305 - if (command == "delete_key")
306 - {
307 - return matchLevel(1, current.level);
308 - }
309 - if (command == "trust")
310 - {
311 - return matchLevel(1, current.level);
312 - }
313 - if (command == "admin")
314 - {
315 - return matchLevel(2, current.level);
316 - }
317 - if (command == "info")
318 - {
319 - return matchLevel(1, current.level);
320 - }
321 - if (command == "trustadd")
322 - {
323 - return matchLevel(1, current.level);
324 - }
325 - if (command == "trustdel")
326 - {
327 - return matchLevel(1, current.level);
328 - }
329435 return false;
330436 }
331437 }
332438
333439 public class dictionary
334440 {
 441+ public string datafile = "";
335442 public class item
336443 {
337444 public item(string Key, string Text, string User, string Lock = "false")
@@ -358,18 +465,16 @@
359466 public List<item> text = new List<item>();
360467 public List<staticalias> Alias = new List<staticalias>();
361468 public string Channel;
362 - public void Load(string channel)
 469+ public void Load()
363470 {
364 - Channel = channel;
365 - string file = Channel + ".db";
366471 text.Clear();
367 - if (!System.IO.File.Exists(file))
 472+ if (!System.IO.File.Exists(datafile))
368473 {
369474 // Create db
370 - System.IO.File.WriteAllText(file, "");
 475+ System.IO.File.WriteAllText(datafile, "");
371476 }
372477
373 - string[] db = System.IO.File.ReadAllLines(file);
 478+ string[] db = System.IO.File.ReadAllLines(datafile);
374479 foreach (string x in db)
375480 {
376481 if (x.Contains(config.separator))
@@ -390,19 +495,25 @@
391496 }
392497 }
393498
 499+ public dictionary(string database, string channel)
 500+ {
 501+ datafile = database;
 502+ Channel = channel;
 503+ Load();
 504+ }
 505+
394506 public void Save()
395507 {
396508 try
397509 {
398 - string file = Channel + ".db";
399 - System.IO.File.WriteAllText(file, "");
 510+ System.IO.File.WriteAllText(datafile, "");
400511 foreach (staticalias key in Alias)
401512 {
402 - System.IO.File.AppendAllText(file, key.Name + config.separator + key.Key + config.separator + "alias" + "\n");
 513+ System.IO.File.AppendAllText(datafile, key.Name + config.separator + key.Key + config.separator + "alias" + "\n");
403514 }
404515 foreach (item key in text)
405516 {
406 - System.IO.File.AppendAllText(file, key.key + config.separator + key.text + config.separator + "key" + config.separator + key.locked + config.separator + key.user + "\n");
 517+ System.IO.File.AppendAllText(datafile, key.key + config.separator + key.text + config.separator + "key" + config.separator + key.locked + config.separator + key.user + "\n");
407518 }
408519 }
409520 catch (Exception b)
@@ -438,7 +549,13 @@
439550 config.channel _Chan = getChannel(Channel);
440551 if (chan.Users.isApproved(user, host, "info"))
441552 {
442 - setKey(name.Substring(name.IndexOf("is") + 3), parm[0], "");
 553+ if (parm.Length < 3)
 554+ {
 555+ Message("It would be cool to give me also a text of key", Channel);
 556+ return true;
 557+ }
 558+ string key = name.Substring(name.IndexOf(" is") + 4);
 559+ setKey(key, parm[0], "");
443560 }
444561 else
445562 {
@@ -459,6 +576,28 @@
460577 }
461578 return false;
462579 }
 580+ if (parm[1] == "unalias")
 581+ {
 582+ config.channel _Chan = getChannel(Channel);
 583+ if (chan.Users.isApproved(user, host, "info"))
 584+ {
 585+ foreach (staticalias b in Alias)
 586+ {
 587+ if (b.Name == parm[0])
 588+ {
 589+ Alias.Remove(b);
 590+ Message("Alias removed", Channel);
 591+ Save();
 592+ return false;
 593+ }
 594+ }
 595+ }
 596+ else
 597+ {
 598+ Message("You are not autorized to perform this, sorry", Channel);
 599+ }
 600+ return false;
 601+ }
463602 if (parm[1] == "del")
464603 {
465604 if (chan.Users.isApproved(user, host, "info"))
@@ -501,11 +640,12 @@
502641 }
503642 foreach (staticalias b in Alias)
504643 {
505 - if (b.Name == name)
 644+ if (b.Name == p[0])
506645 {
507646 keyv = getValue(b.Key);
508647 if (keyv != "")
509648 {
 649+ keyv = keyv.Replace("$1", p1);
510650 if (User == "")
511651 {
512652 Message(keyv, Channel);
@@ -681,7 +821,7 @@
682822 {
683823 if (!channel.Users.isApproved(user, host, "admin"))
684824 {
685 - Message("Permission denied!", channel.name);
 825+ Message("Permission denied", channel.name);
686826 return 2;
687827 }
688828 }
@@ -702,15 +842,21 @@
703843 if (message.StartsWith("@trustdel"))
704844 {
705845 string[] rights_info = message.Split(' ');
706 - string x = rights_info[1];
707 - if (channel.Users.isApproved(user, host, "trustdel"))
 846+ if (rights_info.Length > 1)
708847 {
709 - channel.Users.delUser(rights_info[1]);
 848+ string x = rights_info[1];
 849+ if (channel.Users.isApproved(user, host, "trustdel"))
 850+ {
 851+ channel.Users.delUser(rights_info[1]);
 852+ return 0;
 853+ }
 854+ else
 855+ {
 856+ Message("You are not autorized to perform this, sorry", channel.name);
 857+ return 0;
 858+ }
710859 }
711 - else
712 - {
713 - Message("You are not autorized to perform this, sorry", channel.name);
714 - }
 860+ Message("Invalid user", channel.name);
715861 }
716862 }
717863 catch (Exception b)
@@ -722,19 +868,27 @@
723869
724870 public static void chanLog(string message, config.channel channel, string user, string host, bool noac = true)
725871 {
726 - if (channel.logged)
 872+ try
727873 {
728 - string log;
729 - if (!noac)
 874+ if (channel.logged)
730875 {
731 - log = "\n" + "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] * " + user + " " + message;
 876+ string log;
 877+ if (!noac)
 878+ {
 879+ log = "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] * " + user + " " + message + "\n";
 880+ }
 881+ else
 882+ {
 883+ log = "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] " + "<" + user + "> " + message + "\n";
 884+ }
 885+ System.IO.File.AppendAllText(channel.log, log);
732886 }
733 - else
734 - {
735 - log = "\n" + "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] " + "<" + user + "> " + message;
736 - }
737 - System.IO.File.AppendAllText(channel.log, log);
738887 }
 888+ catch (Exception er)
 889+ {
 890+ // nothing
 891+ Console.WriteLine(er.Message);
 892+ }
739893 }
740894
741895 public static bool getAction(string message, string Channel, string host, string nick)
@@ -758,6 +912,13 @@
759913 Message("Invalid name", chan.name);
760914 return;
761915 }
 916+ foreach (config.channel cu in config.channels)
 917+ {
 918+ if (channel == cu.name)
 919+ {
 920+ return;
 921+ }
 922+ }
762923 config.channels.Add(new config.channel(channel));
763924 config.Save();
764925 wd.WriteLine("JOIN " + channel);
@@ -796,6 +957,19 @@
797958
798959 public static void admin(config.channel chan, string user, string host, string message)
799960 {
 961+ if (message.StartsWith("@reload"))
 962+ {
 963+ if (chan.Users.isApproved(user, host, "admin"))
 964+ {
 965+ chan.LoadConfig();
 966+ chan.Keys = new dictionary(chan.keydb, chan.name);
 967+ Message("Channel config was reloaded", chan.name);
 968+ }
 969+ else
 970+ {
 971+ Message("Permission denied", chan.name);
 972+ }
 973+ }
800974 if (message.StartsWith("@logon"))
801975 {
802976 if (chan.Users.isApproved(user, host, "admin"))
@@ -808,6 +982,7 @@
809983 {
810984 Message("Channel is now logged", chan.name);
811985 chan.logged = true;
 986+ chan.SaveConfig();
812987 config.Save();
813988 }
814989 }
@@ -822,12 +997,13 @@
823998 {
824999 if (!chan.logged)
8251000 {
826 - Message("Channel is already not logged", chan.name);
 1001+ Message("Channel was already not logged", chan.name);
8271002 }
8281003 else
8291004 {
8301005 chan.logged = false;
8311006 config.Save();
 1007+ chan.SaveConfig();
8321008 Message("Channel is not logged", chan.name);
8331009 }
8341010 }
@@ -836,6 +1012,15 @@
8371013 Message("Permission denied", chan.name);
8381014 }
8391015 }
 1016+ if (message.StartsWith("@channellist"))
 1017+ {
 1018+ string channels = "";
 1019+ foreach (config.channel a in config.channels)
 1020+ {
 1021+ channels = channels + a.name + ", ";
 1022+ }
 1023+ Message("I am now in following channels: " + channels, chan.name);
 1024+ }
8401025 }
8411026
8421027 public static bool getMessage(string channel, string nick, string host, string message)
@@ -872,8 +1057,10 @@
8731058 wd = new System.IO.StreamWriter(data);
8741059 wd.WriteLine("USER " + config.name + " 8 * :" + config.name);
8751060 wd.WriteLine("NICK " + config.username);
 1061+ Authenticate();
8761062 foreach (config.channel ch in config.channels)
8771063 {
 1064+ System.Threading.Thread.Sleep(2000);
8781065 wd.WriteLine("JOIN " + ch.name);
8791066 }
8801067 wd.Flush();
@@ -885,6 +1072,9 @@
8861073 data = new System.Net.Sockets.TcpClient(config.network, 6667).GetStream();
8871074 rd = new System.IO.StreamReader(data, System.Text.Encoding.UTF8);
8881075 wd = new System.IO.StreamWriter(data);
 1076+
 1077+ dumphtmt = new System.Threading.Thread(new System.Threading.ThreadStart(HtmlDump.Start));
 1078+ dumphtmt.Start();
8891079 check_thread = new System.Threading.Thread(new System.Threading.ThreadStart(Ping));
8901080 check_thread.Start();
8911081
@@ -893,9 +1083,15 @@
8941084
8951085 System.Threading.Thread.Sleep(2000);
8961086
 1087+ Authenticate();
 1088+
8971089 foreach (config.channel ch in config.channels)
8981090 {
899 - wd.WriteLine("JOIN " + ch.name);
 1091+ if (ch.name != "")
 1092+ {
 1093+ wd.WriteLine("JOIN " + ch.name);
 1094+ System.Threading.Thread.Sleep(2000);
 1095+ }
9001096 }
9011097 wd.Flush();
9021098 string text = "";
@@ -903,6 +1099,7 @@
9041100 string host = "";
9051101 string message = "";
9061102 string channel = "";
 1103+ char delimiter = (char)001;
9071104
9081105 while (true)
9091106 {
@@ -913,50 +1110,88 @@
9141111 text = rd.ReadLine();
9151112 if (text.StartsWith(":"))
9161113 {
917 - if (text.Contains("PRIVMSG"))
 1114+ string check = text.Substring(text.IndexOf(" "));
 1115+ if (check.StartsWith(" 005"))
9181116 {
919 - string info = text.Substring(1, text.IndexOf(":", 2));
920 - string info_host;
921 - // we got a message here :)
922 - if (text.Contains("!") && text.Contains("@"))
923 - {
924 - nick = info.Substring(0, info.IndexOf("!"));
925 - host = info.Substring(info.IndexOf("@") + 1, info.IndexOf(" ", info.IndexOf("@")) - 1 - info.IndexOf("@"));
926 - }
927 - info_host = info.Substring(info.IndexOf("PRIVMSG "));
9281117
929 - if (info_host.Contains("#"))
 1118+ }
 1119+ else
 1120+ {
 1121+ if (text.Contains("PRIVMSG"))
9301122 {
931 - channel = info_host.Substring(info_host.IndexOf("#"));
932 - channel = channel.Substring(0, channel.IndexOf(" "));
933 - message = text.Replace(info, "");
934 - message = message.Substring(message.IndexOf(":") + 1);
935 - if (message.Contains("ACTION"))
 1123+ string info = text.Substring(1, text.IndexOf(":", 2));
 1124+ string info_host;
 1125+ // we got a message here :)
 1126+ if (text.Contains("!") && text.Contains("@"))
9361127 {
937 - getAction(message.Replace("", "").Replace("ACTION ", ""), channel, host, nick);
 1128+ nick = info.Substring(0, info.IndexOf("!"));
 1129+ host = info.Substring(info.IndexOf("@") + 1, info.IndexOf(" ", info.IndexOf("@")) - 1 - info.IndexOf("@"));
9381130 }
 1131+ info_host = info.Substring(info.IndexOf("PRIVMSG "));
 1132+
 1133+ if (info_host.Contains("#"))
 1134+ {
 1135+ channel = info_host.Substring(info_host.IndexOf("#"));
 1136+ channel = channel.Substring(0, channel.IndexOf(" "));
 1137+ message = text.Replace(info, "");
 1138+ message = message.Substring(message.IndexOf(":") + 1);
 1139+ if (message.Contains(delimiter.ToString() + "ACTION"))
 1140+ {
 1141+ getAction(message.Replace("", "").Replace(delimiter.ToString() +"ACTION ", ""), channel, host, nick);
 1142+ continue;
 1143+ }
 1144+ else
 1145+ {
 1146+ getMessage(channel, nick, host, message);
 1147+ continue;
 1148+ }
 1149+ }
9391150 else
9401151 {
941 - getMessage(channel, nick, host, message);
 1152+ message = text.Substring(text.IndexOf("PRIVMSG"));
 1153+ message = message.Substring(message.IndexOf(":"));
 1154+ // private message
 1155+ if (message.StartsWith(":" + delimiter.ToString() + "FINGER"))
 1156+ {
 1157+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "FINGER" + " I am a bot don't finger me");
 1158+ wd.Flush();
 1159+ continue;
 1160+ }
 1161+ if (message.StartsWith(":" + delimiter.ToString() + "TIME"))
 1162+ {
 1163+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "TIME " + System.DateTime.Now.ToString());
 1164+ wd.Flush();
 1165+ continue;
 1166+ }
 1167+ if (message.StartsWith(":" + delimiter.ToString() + "PING"))
 1168+ {
 1169+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "PING " + message.Substring(message.IndexOf(delimiter.ToString() + "PING" + 6)));
 1170+ wd.Flush();
 1171+ continue;
 1172+ }
 1173+ if (message.StartsWith(":" + delimiter.ToString() + "VERSION"))
 1174+ {
 1175+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "VERSION " + config.version);
 1176+ wd.Flush();
 1177+ continue;
 1178+ }
9421179 }
9431180 }
944 - else
 1181+ if (text.Contains("PING "))
9451182 {
946 - // private message
 1183+ wd.WriteLine("PONG " + text.Substring(text.IndexOf("PING ") + 5));
 1184+ wd.Flush();
9471185 }
9481186 }
949 - if (text.Contains("PING "))
950 - {
951 - wd.WriteLine("PONG " + text.Substring(text.IndexOf("PING ") + 5));
952 - wd.Flush();
953 - }
9541187 }
9551188 System.Threading.Thread.Sleep(50);
9561189 }
 1190+ Program.Log("Reconnecting, end of data stream");
9571191 Reconnect();
9581192 }
9591193 catch (System.IO.IOException xx)
9601194 {
 1195+ Program.Log("Reconnecting, connection failed");
9611196 Reconnect();
9621197 }
9631198 catch (Exception xx)

Status & tagging log