r106540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106539‎ | r106540 | r106541 >
Date:00:44, 18 December 2011
Author:reedy
Status:deferred
Tags:
Comment:
De-indent more code

Fix if (!(keyv == ""))
Modified paths:
  • /trunk/tools/wmib/Core.cs (modified) (history)

Diff [purge]

Index: trunk/tools/wmib/Core.cs
@@ -346,7 +346,7 @@
347347 /// <summary>
348348 /// Locked
349349 /// </summary>
350 - public bool locked = false;
 350+ public bool locked;
351351
352352 public class item
353353 {
@@ -558,7 +558,7 @@
559559 Message("It would be cool to give me also a name of key", Channel);
560560 return true;
561561 }
562 - this.aliasKey(name.Substring(name.IndexOf(" alias") + 7), parm[0], "");
 562+ aliasKey(name.Substring(name.IndexOf(" alias") + 7), parm[0], "");
563563 }
564564 else
565565 {
@@ -583,10 +583,7 @@
584584 }
585585 return false;
586586 }
587 - else
588 - {
589 - Message("You are not autorized to perform this, sorry", Channel);
590 - }
 587+ Message("You are not autorized to perform this, sorry", Channel);
591588 return false;
592589 }
593590 if (parm[1] == "del")
@@ -613,7 +610,7 @@
614611 string[] p = name.Split(' ');
615612 int parameters = p.Length;
616613 string keyv = getValue(p[0]);
617 - if (!(keyv == ""))
 614+ if (keyv != "")
618615 {
619616 if (parameters > 1)
620617 {
@@ -1116,7 +1113,7 @@
11171114 config.channel Chan = getChannel(channel);
11181115 Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + host);
11191116 }
1120 - catch (Exception b)
 1117+ catch (Exception)
11211118 {
11221119
11231120 }
@@ -1212,11 +1209,8 @@
12131210 config.Save();
12141211 return;
12151212 }
1216 - else
1217 - {
1218 - Message(messages.PermissionDenied, chan.name);
1219 - return;
1220 - }
 1213+ Message(messages.PermissionDenied, chan.name);
 1214+ return;
12211215 }
12221216 if (message == "@whoami")
12231217 {
@@ -1389,10 +1383,8 @@
13901384 }
13911385 }
13921386 wd.Flush();
1393 - string text = "";
13941387 string nick = "";
13951388 string host = "";
1396 - string message = "";
13971389 string channel = "";
13981390 char delimiter = (char) 001;
13991391
@@ -1402,16 +1394,12 @@
14031395 {
14041396 while (!rd.EndOfStream)
14051397 {
1406 - text = rd.ReadLine();
 1398+ string text = rd.ReadLine();
14071399 if (text.StartsWith(":"))
14081400 {
14091401 string check = text.Substring(text.IndexOf(" "));
1410 - if (check.StartsWith(" 005"))
 1402+ if (!check.StartsWith(" 005"))
14111403 {
1412 -
1413 - }
1414 - else
1415 - {
14161404 if (text.Contains("PRIVMSG"))
14171405 {
14181406 string info = text.Substring(1, text.IndexOf(" :", 1) - 1);
@@ -1426,6 +1414,7 @@
14271415 }
14281416 info_host = info.Substring(info.IndexOf("PRIVMSG "));
14291417
 1418+ string message;
14301419 if (info_host.Contains("#"))
14311420 {
14321421 channel = info_host.Substring(info_host.IndexOf("#"));
@@ -1440,41 +1429,38 @@
14411430 getMessage(channel, nick, host, message);
14421431 continue;
14431432 }
1444 - else
 1433+ message = text.Substring(text.IndexOf("PRIVMSG"));
 1434+ message = message.Substring(message.IndexOf(":"));
 1435+ // private message
 1436+ if (message.StartsWith(":" + delimiter.ToString() + "FINGER"))
14451437 {
1446 - message = text.Substring(text.IndexOf("PRIVMSG"));
1447 - message = message.Substring(message.IndexOf(":"));
1448 - // private message
1449 - if (message.StartsWith(":" + delimiter.ToString() + "FINGER"))
1450 - {
1451 - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "FINGER" +
1452 - " I am a bot don't finger me");
1453 - wd.Flush();
1454 - continue;
1455 - }
1456 - if (message.StartsWith(":" + delimiter.ToString() + "TIME"))
1457 - {
1458 - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "TIME " +
1459 - DateTime.Now.ToString());
1460 - wd.Flush();
1461 - continue;
1462 - }
1463 - if (message.StartsWith(":" + delimiter.ToString() + "PING"))
1464 - {
1465 - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "PING" +
1466 - message.Substring(
1467 - message.IndexOf(delimiter.ToString() + "PING") + 5));
1468 - wd.Flush();
1469 - continue;
1470 - }
1471 - if (message.StartsWith(":" + delimiter.ToString() + "VERSION"))
1472 - {
1473 - wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "VERSION " +
1474 - config.version);
1475 - wd.Flush();
1476 - continue;
1477 - }
 1438+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "FINGER" +
 1439+ " I am a bot don't finger me");
 1440+ wd.Flush();
 1441+ continue;
14781442 }
 1443+ if (message.StartsWith(":" + delimiter.ToString() + "TIME"))
 1444+ {
 1445+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "TIME " +
 1446+ DateTime.Now.ToString());
 1447+ wd.Flush();
 1448+ continue;
 1449+ }
 1450+ if (message.StartsWith(":" + delimiter.ToString() + "PING"))
 1451+ {
 1452+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "PING" +
 1453+ message.Substring(
 1454+ message.IndexOf(delimiter.ToString() + "PING") + 5));
 1455+ wd.Flush();
 1456+ continue;
 1457+ }
 1458+ if (message.StartsWith(":" + delimiter.ToString() + "VERSION"))
 1459+ {
 1460+ wd.WriteLine("NOTICE " + nick + " :" + delimiter.ToString() + "VERSION " +
 1461+ config.version);
 1462+ wd.Flush();
 1463+ continue;
 1464+ }
14791465 }
14801466 if (text.Contains("PING "))
14811467 {

Status & tagging log