Просмотр исходного кода

* Fixed hub forgetting it's uplink.
* Cleaned up dc[] union code more


svn: 2381

Bryan Drewery 21 лет назад
Родитель
Сommit
be10ef4019
4 измененных файлов с 10 добавлено и 9 удалено
  1. 1 0
      doc/UPDATES
  2. 8 8
      src/dcc.c
  3. 1 0
      src/dcc.h
  4. 0 1
      src/lang.h

+ 1 - 0
doc/UPDATES

@@ -17,6 +17,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed some similar problems with servers/servers6/nick
 * Fixed a memleak in var_set_mem()
 * Now specifying what was removed from a list with set -listvar.
+* Fixed hub forgetting it's uplink.
 
 1.2.7
 * Forgot 'log_bad = 0;' to fix the '!' showing up for aliases.

+ 8 - 8
src/dcc.c

@@ -251,8 +251,8 @@ bot_version(int idx, char *par)
     vversion = newsplit(&par);
 
   if (conf.bot->hub) {
-    putlog(LOG_BOTS, "*", DCC_LINKED, dcc[idx].nick);
-    chatout("*** Linked to %s\n", dcc[idx].nick);
+    putlog(LOG_BOTS, "*", "Linked to %s.\n, dcc[idx].nick);
+    chatout("*** Linked to %s.\n", dcc[idx].nick);
 
     if (bot_hublevel(dcc[idx].user) < 999) {
       if (!bot_aggressive_to(dcc[idx].user))    //not aggressive, so they are technically my uplink.
@@ -408,7 +408,8 @@ static void
 free_dcc_bot_(int n, void *x)
 {
   if (dcc[n].type == &DCC_BOT) {
-    uplink_idx = -1;
+    if (n == uplink_idx)
+      uplink_idx = -1;
     unvia(n, findbot(dcc[n].nick));
     rembot(dcc[n].nick);
   }
@@ -739,7 +740,7 @@ display_dcc_chat_pass(int idx, char *buf)
 static void
 kill_dcc_general(int idx, void *x)
 {
-  if (!dcc[idx].user->bot) {
+  if (!dcc[idx].bot && x) {
     register struct chat_info *p = (struct chat_info *) x;
 
     if (p) {
@@ -888,7 +889,7 @@ out_dcc_general(int idx, char *buf, void *x)
   }
   if (dcc[idx].status & STAT_TELNET)
     y = add_cr(buf);
-  if (!dcc[idx].user->bot && dcc[idx].status & STAT_PAGE)
+  if (!dcc[idx].bot && dcc[idx].status & STAT_PAGE)
     append_line(idx, y);
   else
     tputs(dcc[idx].sock, y, strlen(y));
@@ -1564,13 +1565,12 @@ static void
 dcc_telnet_id(int idx, char *buf, int atr)
 {
   char *nick = buf;
-  int bot = 0;
 
   strip_telnet(dcc[idx].sock, nick, &atr);
 
   if (nick[0] == '-') {
     nick++;
-    bot = 1;
+    dcc[idx].bot = 1;
   }
 
   nick[HANDLEN] = 0;
@@ -1580,7 +1580,7 @@ dcc_telnet_id(int idx, char *buf, int atr)
   bool ok = 0;
 
   if (dcc[idx].user) {
-    if (!bot && dcc[idx].user->bot) {
+    if (!dcc[idx].bot && dcc[idx].user->bot) {
       putlog(LOG_WARN, "*", "Refused %s (fake bot login for '%s')", dcc[idx].host, nick);
       killsock(dcc[idx].sock);
       lostdcc(idx);

+ 1 - 0
src/dcc.h

@@ -54,6 +54,7 @@ struct dcc_t {
   bool irc;			/* forward the output back to irc? */
   bool hub;			// is this bot a hub?
   bool wrong_pass;		// auth obscure hack
+  bool bot;
 //  int auth;
   bool whowas;
   int dns_id;

+ 0 - 1
src/lang.h

@@ -152,7 +152,6 @@
 /* Stuff from dcc.c
  */
 #define DCC_REJECT		"Rejecting link from %s"
-#define DCC_LINKED		"Linked to %s."
 #define DCC_LINKFAIL		"Failed link to %s."
 #define DCC_BADPASS		"Bad password on connect attempt to %s."
 #define DCC_PASSREQ		"Password required for connection to %s."