r108675 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108674‎ | r108675 | r108676 >
Date:20:25, 11 January 2012
Author:petrb
Status:deferred
Tags:
Comment:
fixed output and improved html format for links
Modified paths:
  • /trunk/tools/wmib/DumpHtm.cs (modified) (history)
  • /trunk/tools/wmib/RClogs.cs (modified) (history)

Diff [purge]

Index: trunk/tools/wmib/DumpHtm.cs
@@ -96,6 +96,28 @@
9797 }
9898
9999 /// <summary>
 100+ /// Insert another table row
 101+ /// </summary>
 102+ /// <param name="name"></param>
 103+ /// <param name="value"></param>
 104+ /// <returns></returns>
 105+ public string AddLink(string name, string value)
 106+ {
 107+ return "<tr><td>" + Encode(name) + "</td><td><a href=\"#" + Encode(value) +"\">" + Encode(value) + "</a></td></tr>\n";
 108+ }
 109+
 110+ /// <summary>
 111+ /// Insert another table row
 112+ /// </summary>
 113+ /// <param name="name"></param>
 114+ /// <param name="value"></param>
 115+ /// <returns></returns>
 116+ public string AddKey(string name, string value)
 117+ {
 118+ return "<tr id=\"" + Encode(name) + "\"><td>" + Encode(name) + "</td><td>" + Encode(value) + "</td></tr>\n";
 119+ }
 120+
 121+ /// <summary>
100122 /// Generate a dump file
101123 /// </summary>
102124 public void Make()
@@ -104,20 +126,20 @@
105127 {
106128 string text = CreateHeader();
107129 text = text + "<h4>Infobot</h4>\n";
108 - text = text + "<table border=1 width=100%>\n<tr><td width=10%>Key</td><td>Value</td></tr>\n";
 130+ text = text + "<table border=1 width=100%>\n<tr><th width=10%>Key</th><th>Value</th></tr>\n";
109131 Channel.Keys.locked = true;
110132 if (Channel.Keys.text.Count > 0)
111133 {
112134 foreach (dictionary.item Key in Channel.Keys.text)
113135 {
114 - text += AddLine(Key.key, Key.text);
 136+ text += AddKey(Key.key, Key.text);
115137 }
116138 }
117139 text = text + "</table>\n";
118140 text = text + "<h4>Aliases</h4>\n<table border=1 width=100%>\n";
119141 foreach (dictionary.staticalias data in Channel.Keys.Alias)
120142 {
121 - text += AddLine(data.Name, data.Key);
 143+ text += AddLink(data.Name, data.Key);
122144 }
123145 text = text + "</table>\n";
124146 Channel.Keys.locked = false;
Index: trunk/tools/wmib/RClogs.cs
@@ -222,7 +222,7 @@
223223 }
224224 catch (Exception)
225225 {
226 -
 226+ Console.WriteLine("error in Connect() fc");
227227 }
228228 }
229229
@@ -364,39 +364,36 @@
365365 }
366366 }
367367 }
368 - wikiinfo.Add(new wiki("#cs.wikinews", "https://cs.wikipedia.org/w/index.php", "cs_wikinews"));
369 - wikiinfo.Add(new wiki("#en.wikinews", "https://en.wikipedia.org/w/index.php", "en_wikinews"));
370 - wikiinfo.Add(new wiki("#de.wikinews", "https://de.wikipedia.org/w/index.php", "de_wikinews"));
371 - wikiinfo.Add(new wiki("#fr.wikinews", "https://fr.wikipedia.org/w/index.php", "fr_wikinews"));
372 - wikiinfo.Add(new wiki("#pt.wikinews", "https://pt.wikipedia.org/w/index.php", "pt_wikinews"));
373 - wikiinfo.Add(new wiki("#zh.wikinews", "https://fr.wikipedia.org/w/index.php", "zh_wikinews"));
374 - wikiinfo.Add(new wiki("#es.wikinews", "https://fr.wikipedia.org/w/index.php", "es_wikinews"));
375 - wikiinfo.Add(new wiki("#ru.wikinews", "https://fr.wikipedia.org/w/index.php", "ru_wikinews"));
376 - wikiinfo.Add(new wiki("#it.wikinews", "https://fr.wikipedia.org/w/index.php", "it_wikinews"));
377 - wikiinfo.Add(new wiki("#nl.wikinews", "https://fr.wikipedia.org/w/index.php", "nl_wikinews"));
378 - wikiinfo.Add(new wiki("#ja.wikinews", "https://fr.wikipedia.org/w/index.php", "ja_wikinews"));
 368+ wikiinfo.Add(new wiki("#cs.wikinews", "https://cs.wikinews.org/w/index.php", "cs_wikinews"));
 369+ wikiinfo.Add(new wiki("#en.wikinews", "https://en.wikinews.org/w/index.php", "en_wikinews"));
 370+ wikiinfo.Add(new wiki("#de.wikinews", "https://de.wikinews.org/w/index.php", "de_wikinews"));
 371+ wikiinfo.Add(new wiki("#fr.wikinews", "https://fr.wikinews.org/w/index.php", "fr_wikinews"));
 372+ wikiinfo.Add(new wiki("#pt.wikinews", "https://pt.wikinews.org/w/index.php", "pt_wikinews"));
 373+ wikiinfo.Add(new wiki("#zh.wikinews", "https://zh.wikinews.org/w/index.php", "zh_wikinews"));
 374+ wikiinfo.Add(new wiki("#es.wikinews", "https://es.wikinews.org/w/index.php", "es_wikinews"));
 375+ wikiinfo.Add(new wiki("#ru.wikinews", "https://ru.wikinews.org/w/index.php", "ru_wikinews"));
 376+ wikiinfo.Add(new wiki("#it.wikinews", "https://it.wikinews.org/w/index.php", "it_wikinews"));
 377+ wikiinfo.Add(new wiki("#nl.wikinews", "https://nl.wikinews.org/w/index.php", "nl_wikinews"));
 378+ wikiinfo.Add(new wiki("#ja.wikinews", "https://ja.wikinews.org/w/index.php", "ja_wikinews"));
379379 wikiinfo.Add(new wiki("#en.wiktionary", "https://en.wiktionary.org/w/index.php", "en_wiktionary"));
380 - wikiinfo.Add(new wiki("#cs.wiktionary", "https://cs.wikipedia.org/w/index.php", "cs_wiktionary"));
381 - wikiinfo.Add(new wiki("#de.wiktionary", "https://de.wikipedia.org/w/index.php", "de_wiktionary"));
382 - wikiinfo.Add(new wiki("#fr.wiktionary", "https://fr.wikipedia.org/w/index.php", "fr_wiktionary"));
383 - wikiinfo.Add(new wiki("#pt.wiktionary", "https://pt.wikipedia.org/w/index.php", "pt_wiktionary"));
384 - wikiinfo.Add(new wiki("#zh.wiktionary", "https://fr.wikipedia.org/w/index.php", "zh_wiktionary"));
385 - wikiinfo.Add(new wiki("#es.wiktionary", "https://fr.wikipedia.org/w/index.php", "es_wiktionary"));
386 - wikiinfo.Add(new wiki("#ru.wiktionary", "https://fr.wikipedia.org/w/index.php", "ru_wiktionary"));
387 - wikiinfo.Add(new wiki("#it.wiktionary", "https://fr.wikipedia.org/w/index.php", "it_wiktionary"));
388 - wikiinfo.Add(new wiki("#nl.wiktionary", "https://fr.wikipedia.org/w/index.php", "nl_wiktionary"));
389 - wikiinfo.Add(new wiki("#ja.wiktionary", "https://fr.wikipedia.org/w/index.php", "ja_wiktionary"));
 380+ wikiinfo.Add(new wiki("#cs.wiktionary", "https://cs.wiktionary.org/w/index.php", "cs_wiktionary"));
 381+ wikiinfo.Add(new wiki("#de.wiktionary", "https://de.wiktionary.org/w/index.php", "de_wiktionary"));
 382+ wikiinfo.Add(new wiki("#fr.wiktionary", "https://fr.wiktionary.org/w/index.php", "fr_wiktionary"));
 383+ wikiinfo.Add(new wiki("#pt.wiktionary", "https://pt.wiktionary.org/w/index.php", "pt_wiktionary"));
 384+ wikiinfo.Add(new wiki("#es.wiktionary", "https://es.wiktionary.org/w/index.php", "es_wiktionary"));
 385+ wikiinfo.Add(new wiki("#ru.wiktionary", "https://ru.wiktionary.org/w/index.php", "ru_wiktionary"));
 386+ wikiinfo.Add(new wiki("#it.wiktionary", "https://it.wiktionary.org/w/index.php", "it_wiktionary"));
 387+ wikiinfo.Add(new wiki("#nl.wiktionary", "https://nl.wiktionary.org/w/index.php", "nl_wiktionary"));
 388+ wikiinfo.Add(new wiki("#ja.wiktionary", "https://ja.wiktionary.org/w/index.php", "ja_wiktionary"));
390389 wikiinfo.Add(new wiki("#cs.wikipedia", "https://cs.wikipedia.org/w/index.php", "cs_wikipedia"));
391390 wikiinfo.Add(new wiki("#en.wikipedia", "https://en.wikipedia.org/w/index.php", "en_wikipedia"));
392391 wikiinfo.Add(new wiki("#de.wikipedia", "https://de.wikipedia.org/w/index.php", "de_wikipedia"));
393392 wikiinfo.Add(new wiki("#fr.wikipedia", "https://fr.wikipedia.org/w/index.php", "fr_wikipedia"));
394393 wikiinfo.Add(new wiki("#pt.wikipedia", "https://pt.wikipedia.org/w/index.php", "pt_wikipedia"));
395 - wikiinfo.Add(new wiki("#zh.wikipedia", "https://fr.wikipedia.org/w/index.php", "zh_wikipedia"));
396 - wikiinfo.Add(new wiki("#es.wikipedia", "https://fr.wikipedia.org/w/index.php", "es_wikipedia"));
397 - wikiinfo.Add(new wiki("#ru.wikipedia", "https://fr.wikipedia.org/w/index.php", "ru_wikipedia"));
398 - wikiinfo.Add(new wiki("#it.wikipedia", "https://fr.wikipedia.org/w/index.php", "it_wikipedia"));
399 - wikiinfo.Add(new wiki("#nl.wikipedia", "https://fr.wikipedia.org/w/index.php", "nl_wikipedia"));
400 - wikiinfo.Add(new wiki("#ja.wikipedia", "https://fr.wikipedia.org/w/index.php", "ja_wikipedia"));
 394+ wikiinfo.Add(new wiki("#zh.wikipedia", "https://zh.wikipedia.org/w/index.php", "zh_wikipedia"));
 395+ wikiinfo.Add(new wiki("#es.wikipedia", "https://es.wikipedia.org/w/index.php", "es_wikipedia"));
 396+ wikiinfo.Add(new wiki("#ru.wikipedia", "https://ru.wikipedia.org/w/index.php", "ru_wikipedia"));
 397+ wikiinfo.Add(new wiki("#ja.wikipedia", "https://ja.wikipedia.org/w/index.php", "ja_wikipedia"));
401398 wikiinfo.Add(new wiki("#mediawiki.wikipedia", "https://www.mediawiki.org/w/index.php", "mediawiki"));
402399 wikiinfo.Add(new wiki("#test.wikipedia", "https://test.wikipedia.org/w/index.php", "test_wikipedia"));
403400 return 0;
@@ -426,6 +423,14 @@
427424 break;
428425 }
429426 }
 427+ if (Page.Contains("*"))
 428+ {
 429+ if (!Page.EndsWith("*") || Page.Replace("*", "") == "")
 430+ {
 431+ irc.SlowQueue.DeliverMessage("Invalid string, you can't use a wildcard like this", channel.name);
 432+ return true;
 433+ }
 434+ }
430435 if (pages.Contains(currpage))
431436 {
432437 irc.SlowQueue.DeliverMessage("There is already this string in a list of watched items",
@@ -493,12 +498,26 @@
494499 {
495500 foreach (IWatch w in curr.pages)
496501 {
497 - if (w.Channel == _channel && page == w.Page)
 502+ if (w.Channel == _channel)
498503 {
499 - irc.SlowQueue.DeliverMessage(
500 - "Change on 12" + w.URL.name + " a page " + page +
501 - " was modified," + " changed by " + username +
502 - " link " + w.URL.url + "?diff=" + link + " edit summary: " + summary, curr.channel.name);
 504+ if (page == w.Page)
 505+ {
 506+ irc.SlowQueue.DeliverMessage(
 507+ "Change on 12" + w.URL.name + " a page " + page +
 508+ " was modified," + " changed by " + username +
 509+ " link " + w.URL.url + "?diff=" + link + " edit summary: " + summary, curr.channel.name);
 510+ }
 511+ else
 512+ if (w.Page.EndsWith("*"))
 513+ {
 514+ if (page.StartsWith(w.Page.Replace("*", "")))
 515+ {
 516+ irc.SlowQueue.DeliverMessage(
 517+ "Change on 12" + w.URL.name + " a page " + page +
 518+ " was modified," + " changed by " + username +
 519+ " link " + w.URL.url + "?diff=" + link + " edit summary: " + summary, curr.channel.name);
 520+ }
 521+ }
503522 }
504523 }
505524 }

Status & tagging log