Parcourir la source

Slight optimizations

Bryan Drewery il y a 10 ans
Parent
commit
9c91f62434
4 fichiers modifiés avec 16 ajouts et 16 suppressions
  1. 1 1
      src/botcmd.cc
  2. 2 2
      src/cmds.cc
  3. 1 1
      src/mod/share.mod/share.cc
  4. 12 12
      src/mod/transfer.mod/transfer.cc

+ 1 - 1
src/botcmd.cc

@@ -865,7 +865,7 @@ static void bot_reject(int idx, char *par)
       /* Kick someone here! */
 
       for (i = 0; i < dcc_total; i++) {
-        if (dcc[i].type && dcc[i].simul == -1 && !strcasecmp(who, dcc[i].nick) && (dcc[i].type->flags & DCT_CHAT)) {
+        if (dcc[i].type && dcc[i].simul == -1 && (dcc[i].type->flags & DCT_CHAT) && !strcasecmp(who, dcc[i].nick)) {
           u = get_user_by_handle(userlist, from);
           if (u) {
             if (!whois_access(u, dcc[idx].user)) {

+ 2 - 2
src/cmds.cc

@@ -1051,7 +1051,7 @@ static void cmd_boot(int idx, char *par)
     return;
   }
   for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && dcc[i].simul == -1 && !strcasecmp(dcc[i].nick, who) && (dcc[i].type->flags & DCT_CANBOOT)) {
+    if (dcc[i].type && dcc[i].simul == -1 && (dcc[i].type->flags & DCT_CANBOOT) && !strcasecmp(dcc[i].nick, who)) {
       if (!whois_access(dcc[idx].user, dcc[i].user)) {
         dprintf(idx, "Sorry, you cannot boot %s.\n", dcc[i].nick);
         return;
@@ -2168,7 +2168,7 @@ static void cmd_simul(int idx, char *par)
   bool ok = 0;
 
   for (int i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && !strcasecmp(nick, dcc[i].nick) && !ok && (dcc[i].type->flags & DCT_SIMUL)) {
+    if (dcc[i].type && (dcc[i].type->flags & DCT_SIMUL) && !ok && !strcasecmp(nick, dcc[i].nick)) {
       putlog(LOG_CMDS, "*", "#%s# simul %s %s", dcc[idx].nick, nick, par);
       if (dcc[i].type && dcc[i].type->activity) {
 	dcc[i].type->activity(i, par, strlen(par));

+ 1 - 1
src/mod/share.mod/share.cc

@@ -1308,7 +1308,7 @@ finish_share(int idx)
   int i, j = -1;
 
   for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type && !strcasecmp(dcc[i].nick, dcc[idx].host) && (dcc[i].type->flags & DCT_BOT)) {
+    if (dcc[i].type && (dcc[i].type->flags & DCT_BOT) && !strcasecmp(dcc[i].nick, dcc[idx].host)) {
       j = i;
       break;
     }

+ 12 - 12
src/mod/transfer.mod/transfer.cc

@@ -115,7 +115,7 @@ void eof_dcc_fork_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[idx].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
 	break;
       }
@@ -129,7 +129,7 @@ void eof_dcc_fork_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[idx].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
 	break;
       }
@@ -169,7 +169,7 @@ static void eof_dcc_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++) {
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[idx].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }
@@ -201,7 +201,7 @@ static void eof_dcc_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[idx].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }
@@ -357,7 +357,7 @@ void dcc_get(int idx, char *buf, int len)
       int x, y = -1;
 
       for (x = 0; x < dcc_total; x++)
-	if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+        if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	  y = x;
           break;
         }
@@ -372,7 +372,7 @@ void dcc_get(int idx, char *buf, int len)
       int x, y = -1;
 
       for (x = 0; x < dcc_total; x++)
-	if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+        if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	  y = x;
           break;
         }
@@ -405,7 +405,7 @@ void eof_dcc_get(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }
@@ -429,7 +429,7 @@ void eof_dcc_get(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }
@@ -516,7 +516,7 @@ static void transfer_get_timeout(int i)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[i].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[i].host))) {
 	y = x;
         break;
       }
@@ -546,7 +546,7 @@ static void transfer_get_timeout(int i)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && (!strcasecmp(dcc[x].nick, dcc[i].host)) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[i].host))) {
 	y = x;
         break;
       }
@@ -583,7 +583,7 @@ void tout_dcc_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }
@@ -597,7 +597,7 @@ void tout_dcc_send(int idx)
     int x, y = -1;
 
     for (x = 0; x < dcc_total; x++)
-      if (dcc[x].type && !strcasecmp(dcc[x].nick, dcc[idx].host) && (dcc[x].type->flags & DCT_BOT)) {
+      if (dcc[x].type && (dcc[x].type->flags & DCT_BOT) && (!strcasecmp(dcc[x].nick, dcc[idx].host))) {
 	y = x;
         break;
       }