|
@@ -83,7 +83,6 @@ void spawnbot(const char *nick)
|
|
|
free(run);
|
|
free(run);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef LEAF
|
|
|
|
|
/* spawn and kill bots accordingly
|
|
/* spawn and kill bots accordingly
|
|
|
* bots prefixxed with '/' will be killed auto if running.
|
|
* 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 */
|
|
* 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;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
|
|
|
#ifndef CYGWIN_HACKS
|
|
#ifndef CYGWIN_HACKS
|
|
|
static uid_t save_euid, save_egid;
|
|
static uid_t save_euid, save_egid;
|
|
@@ -283,18 +281,11 @@ init_conf()
|
|
|
#else /* !CYGWIN_HACKS */
|
|
#else /* !CYGWIN_HACKS */
|
|
|
conf.binpath = strdup(dirname(binname));
|
|
conf.binpath = strdup(dirname(binname));
|
|
|
#endif /* CYGWIN_HACKS */
|
|
#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.portmin = 0;
|
|
|
conf.portmax = 0;
|
|
conf.portmax = 0;
|
|
|
conf.pscloak = 0;
|
|
conf.pscloak = 0;
|
|
@@ -350,9 +341,6 @@ checkpid(char *nick, conf_bot *bot)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
-static
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
void
|
|
void
|
|
|
conf_addbot(char *nick, char *ip, char *host, char *ip6)
|
|
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->next->next = NULL;
|
|
|
bot->pid_file = NULL;
|
|
bot->pid_file = NULL;
|
|
|
bot->nick = strdup(nick);
|
|
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.ip = NULL;
|
|
|
bot->net.host = NULL;
|
|
bot->net.host = NULL;
|
|
|
bot->net.ip6 = NULL;
|
|
bot->net.ip6 = NULL;
|
|
@@ -413,6 +391,15 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
|
|
|
p++;
|
|
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
|
|
void
|
|
@@ -444,7 +431,6 @@ free_bot(char *botn)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef LEAF
|
|
|
|
|
int
|
|
int
|
|
|
conf_delbot(char *botn)
|
|
conf_delbot(char *botn)
|
|
|
{
|
|
{
|
|
@@ -460,7 +446,6 @@ conf_delbot(char *botn)
|
|
|
}
|
|
}
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
|
|
|
void
|
|
void
|
|
|
free_conf_bots(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->u = src->u ? src->u : NULL;
|
|
|
dest->pid = src->pid;
|
|
dest->pid = src->pid;
|
|
|
dest->hub = src->hub;
|
|
dest->hub = src->hub;
|
|
|
-#ifdef LEAF
|
|
|
|
|
dest->localhub = src->localhub;
|
|
dest->localhub = src->localhub;
|
|
|
-#endif /* LEAF */
|
|
|
|
|
dest->next = NULL;
|
|
dest->next = NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|