Explorar o código

* Expire more than 1 remote idx at a time, safe to do so now
* Expire remote simul idxs when a matching nick parts the partyline (Fixes a .su/.botcmd/.quit bug)


svn: 2042

Bryan Drewery %!s(int64=21) %!d(string=hai) anos
pai
achega
6863736ae1
Modificáronse 3 ficheiros con 18 adicións e 8 borrados
  1. 14 0
      src/botcmd.c
  2. 4 7
      src/cmds.c
  3. 0 1
      src/main.c

+ 14 - 0
src/botcmd.c

@@ -1027,6 +1027,20 @@ static void bot_part(int idx, char *par)
     botnet_send_part_party(idx, partyidx, par, silent);
     botnet_send_part_party(idx, partyidx, par, silent);
     remparty(bot, sock);
     remparty(bot, sock);
   }
   }
+
+  /* check if we have a remote idx for them */
+  int i = 0;
+
+  for (i = 0; i < dcc_total; i++) {
+    if (dcc[i].type && dcc[i].simul >= 0 && !egg_strcasecmp(dcc[i].nick, nick)) {
+        dcc[idx].simul = -1;
+// FIXME: THIS NEEDS TO BE UPDATED FOR CLASS
+//        if (dcc[idx].irc)
+//          auth[dcc[idx].auth].idx = -1;
+        lostdcc(idx);
+    }
+  }
+
 }
 }
 
 
 /* away <bot> <sock> <message>
 /* away <bot> <sock> <message>

+ 4 - 7
src/cmds.c

@@ -3036,10 +3036,8 @@ static void cmd_su(int idx, char *par)
 	 */
 	 */
 	if (dcc[idx].u.chat->away != NULL)
 	if (dcc[idx].u.chat->away != NULL)
 	  free(dcc[idx].u.chat->away);
 	  free(dcc[idx].u.chat->away);
-        dcc[idx].u.chat->away = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-        dcc[idx].u.chat->su_nick = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
+        dcc[idx].u.chat->away = strdup(dcc[idx].nick);
+        dcc[idx].u.chat->su_nick = strdup(dcc[idx].nick);
 	dcc[idx].user = u;
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
 	strcpy(dcc[idx].nick, par);
 	/* Display password prompt and turn off echo (send IAC WILL ECHO). */
 	/* Display password prompt and turn off echo (send IAC WILL ECHO). */
@@ -3047,7 +3045,7 @@ static void cmd_su(int idx, char *par)
 		(dcc[idx].status & STAT_TELNET) ? TLN_IAC_C TLN_WILL_C
 		(dcc[idx].status & STAT_TELNET) ? TLN_IAC_C TLN_WILL_C
 	       					  TLN_ECHO_C : "");
 	       					  TLN_ECHO_C : "");
 	dcc[idx].type = &DCC_CHAT_PASS;
 	dcc[idx].type = &DCC_CHAT_PASS;
-      } else if (atr & USER_OWNER) {
+      } else if (atr & USER_ADMIN) {
 	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
 	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
 	  botnet_send_part_idx(idx, "");
 	  botnet_send_part_idx(idx, "");
 	chanout_but(-1, dcc[idx].u.chat->channel,
 	chanout_but(-1, dcc[idx].u.chat->channel,
@@ -3055,8 +3053,7 @@ static void cmd_su(int idx, char *par)
 	dprintf(idx, "Setting your username to %s.\n", par);
 	dprintf(idx, "Setting your username to %s.\n", par);
 	if (atr & USER_MASTER)
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
 	  dcc[idx].u.chat->con_flags = conmask;
-        dcc[idx].u.chat->su_nick = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
+        dcc[idx].u.chat->su_nick = strdup(dcc[idx].nick);
 	dcc[idx].user = u;
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
 	strcpy(dcc[idx].nick, par);
 	dcc_chatter(idx);
 	dcc_chatter(idx);

+ 0 - 1
src/main.c

@@ -200,7 +200,6 @@ static void expire_simuls() {
 //        if (dcc[idx].irc)
 //        if (dcc[idx].irc)
 //          auth[dcc[idx].auth].idx = -1;
 //          auth[dcc[idx].auth].idx = -1;
         lostdcc(idx);
         lostdcc(idx);
-        return;		/* only safe to do one at a time */
       }
       }
     }
     }
   }
   }