Bryan Drewery 21 лет назад
Родитель
Сommit
e3c19df9ec
2 измененных файлов с 14 добавлено и 37 удалено
  1. 14 31
      src/conf.c
  2. 0 6
      src/conf.h

+ 14 - 31
src/conf.c

@@ -83,7 +83,6 @@ void spawnbot(const char *nick)
   free(run);
 }
 
-#ifdef LEAF
 /* spawn and kill bots accordingly
  * bots prefixxed with '/' will be killed auto if running.
  * if (updating) then we were called with -L and -P, we need to restart all running bots except our parent and localhub */
@@ -136,7 +135,6 @@ killbot(char *botnick, int signal)
   }
   return -1;
 }
-#endif /* LEAF */
 
 #ifndef CYGWIN_HACKS
 static uid_t save_euid, save_egid;
@@ -283,18 +281,11 @@ init_conf()
 #else /* !CYGWIN_HACKS */
   conf.binpath = strdup(dirname(binname));
 #endif /* CYGWIN_HACKS */
-//#ifdef LEAF
-//  conf.binname = strdup(STR(".sshrc"));
-//#endif /* LEAF */
-//#ifdef HUB
-//  {
-    char *p = NULL;
-
-    p = strrchr(binname, '/');
-    p++;
-    conf.binname = strdup(p);
-//  }
-//#endif /* HUB */
+  char *p = strrchr(binname, '/');
+
+  p++;
+  conf.binname = strdup(p);
+
   conf.portmin = 0;
   conf.portmax = 0;
   conf.pscloak = 0;
@@ -350,9 +341,6 @@ checkpid(char *nick, conf_bot *bot)
   return 0;
 }
 
-#ifdef HUB
-static
-#endif                          /* HUB */
 void
 conf_addbot(char *nick, char *ip, char *host, char *ip6)
 {
@@ -364,16 +352,6 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
   bot->next->next = NULL;
   bot->pid_file = NULL;
   bot->nick = strdup(nick);
-#ifdef LEAF
-  if (bot == conf.bots) {
-    bot->localhub = 1;          /* first bot */
-    conf.localhub = strdup(nick ? nick : origbotname);
-    /* perhaps they did -B localhub-bot ? */
-    if (origbotname[0] && !strcmp(origbotname, bot->nick))
-      localhub = 1;
-  }
-#endif /* LEAF */
-
   bot->net.ip = NULL;
   bot->net.host = NULL;
   bot->net.ip6 = NULL;
@@ -413,6 +391,15 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
         p++;
     }
   }
+
+  if (!bot->hub && bot == conf.bots) {
+    bot->localhub = 1;          /* first bot */
+    conf.localhub = strdup(nick ? nick : origbotname);
+    /* perhaps they did -B localhub-bot ? */
+    if (origbotname[0] && !strcmp(origbotname, bot->nick))
+      localhub = 1;
+  }
+
 }
 
 void
@@ -444,7 +431,6 @@ free_bot(char *botn)
   }
 }
 
-#ifdef LEAF
 int
 conf_delbot(char *botn)
 {
@@ -460,7 +446,6 @@ conf_delbot(char *botn)
   }
   return 1;
 }
-#endif /* LEAF */
 
 void
 free_conf_bots(void)
@@ -788,9 +773,7 @@ conf_bot_dup(conf_bot * dest, conf_bot * src)
   dest->u = src->u ? src->u : NULL;
   dest->pid = src->pid;
   dest->hub = src->hub;
-#ifdef LEAF
   dest->localhub = src->localhub;
-#endif /* LEAF */
   dest->next = NULL;
 }
 

+ 0 - 6
src/conf.h

@@ -20,9 +20,7 @@ typedef struct conf_bot_b {
   struct userrec *u;	/* our own user record */
   struct conf_net_b net;
   pid_t pid;              /* contains the PID for the bot (read for the pidfile) */
-#ifdef LEAF
   int localhub;         /* bot is localhub */
-#endif /* LEAF */
   char *nick;
   char *pid_file;       /* path and filename of the .pid file */
   bool hub;		/* should bot behave as a hub? */
@@ -56,15 +54,11 @@ enum {
 
 
 void spawnbot(const char *);
-#ifdef LEAF
 void spawnbots();
 int killbot(char *, int);
-#endif /* LEAF */
 void confedit() __attribute__((noreturn));
-#ifdef LEAF
 void conf_addbot(char *, char *, char *, char *);
 int conf_delbot(char *);
-#endif /* LEAF */
 pid_t checkpid(char *, conf_bot *);
 void init_conf();
 void free_conf_bots();