|
@@ -36,10 +36,8 @@
|
|
|
#include "traffic.h" /* egg_traffic_t */
|
|
#include "traffic.h" /* egg_traffic_t */
|
|
|
#include "core_binds.h"
|
|
#include "core_binds.h"
|
|
|
#include "src/mod/console.mod/console.h"
|
|
#include "src/mod/console.mod/console.h"
|
|
|
-#ifdef LEAF
|
|
|
|
|
#include "src/mod/server.mod/server.h"
|
|
#include "src/mod/server.mod/server.h"
|
|
|
#include "src/mod/irc.mod/irc.h"
|
|
#include "src/mod/irc.mod/irc.h"
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
#include <ctype.h>
|
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
@@ -53,15 +51,12 @@ int cmdi = 0;
|
|
|
|
|
|
|
|
static char *btos(unsigned long);
|
|
static char *btos(unsigned long);
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void tell_who(int idx, int chan)
|
|
static void tell_who(int idx, int chan)
|
|
|
{
|
|
{
|
|
|
int i, k, ok = 0, atr = dcc[idx].user ? dcc[idx].user->flags : 0;
|
|
int i, k, ok = 0, atr = dcc[idx].user ? dcc[idx].user->flags : 0;
|
|
|
size_t nicklen;
|
|
size_t nicklen;
|
|
|
char format[81] = "";
|
|
char format[81] = "";
|
|
|
-#ifdef HUB
|
|
|
|
|
char s[1024] = "";
|
|
char s[1024] = "";
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
if (!chan)
|
|
if (!chan)
|
|
|
dprintf(idx, "%s (* = %s, + = %s, @ = %s)\n", BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
|
|
dprintf(idx, "%s (* = %s, + = %s, @ = %s)\n", BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
|
|
@@ -185,7 +180,6 @@ static void tell_who(int idx, int chan)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_whom(int idx, char *par)
|
|
static void cmd_whom(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -212,7 +206,6 @@ static void cmd_whom(int idx, char *par)
|
|
|
answer_local_whom(idx, chan);
|
|
answer_local_whom(idx, chan);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
/*
|
|
/*
|
|
|
.config
|
|
.config
|
|
|
Usage + available entry list
|
|
Usage + available entry list
|
|
@@ -237,6 +230,7 @@ static void cmd_config(int idx, char *par)
|
|
|
dprintf(idx, "Defined config entry names:\n");
|
|
dprintf(idx, "Defined config entry names:\n");
|
|
|
cnt = 0;
|
|
cnt = 0;
|
|
|
for (i = 0; i < cfg_count; i++) {
|
|
for (i = 0; i < cfg_count; i++) {
|
|
|
|
|
+#ifdef HUB
|
|
|
if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
|
|
if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
|
|
|
if (!cnt) {
|
|
if (!cnt) {
|
|
|
outbuf = (char *) my_realloc(outbuf, 2 + 1);
|
|
outbuf = (char *) my_realloc(outbuf, 2 + 1);
|
|
@@ -250,6 +244,7 @@ static void cmd_config(int idx, char *par)
|
|
|
cnt = 0;
|
|
cnt = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+#endif /* HUB */
|
|
|
}
|
|
}
|
|
|
if (cnt)
|
|
if (cnt)
|
|
|
dprintf(idx, "%s\n", outbuf);
|
|
dprintf(idx, "%s\n", outbuf);
|
|
@@ -261,10 +256,12 @@ static void cmd_config(int idx, char *par)
|
|
|
for (i = 0; !cfgent && (i < cfg_count); i++)
|
|
for (i = 0; !cfgent && (i < cfg_count); i++)
|
|
|
if (!strcmp(cfg[i]->name, name))
|
|
if (!strcmp(cfg[i]->name, name))
|
|
|
cfgent = cfg[i];
|
|
cfgent = cfg[i];
|
|
|
|
|
+#ifdef HUB
|
|
|
if (!cfgent || !cfgent->describe) {
|
|
if (!cfgent || !cfgent->describe) {
|
|
|
dprintf(idx, "No such config entry\n");
|
|
dprintf(idx, "No such config entry\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+#endif /* HUB */
|
|
|
if (!isowner(dcc[idx].nick)) {
|
|
if (!isowner(dcc[idx].nick)) {
|
|
|
int no = 0;
|
|
int no = 0;
|
|
|
if (!egg_strcasecmp(name, "authkey"))
|
|
if (!egg_strcasecmp(name, "authkey"))
|
|
@@ -284,7 +281,9 @@ static void cmd_config(int idx, char *par)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
|
|
|
+#ifdef HUB
|
|
|
cfgent->describe(cfgent, idx);
|
|
cfgent->describe(cfgent, idx);
|
|
|
|
|
+#endif /* HUB */
|
|
|
if (!cfgent->gdata)
|
|
if (!cfgent->gdata)
|
|
|
dprintf(idx, "No current value\n");
|
|
dprintf(idx, "No current value\n");
|
|
|
else {
|
|
else {
|
|
@@ -302,9 +301,7 @@ static void cmd_config(int idx, char *par)
|
|
|
else {
|
|
else {
|
|
|
dprintf(idx, "Now: %s\n", cfgent->gdata);
|
|
dprintf(idx, "Now: %s\n", cfgent->gdata);
|
|
|
}
|
|
}
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_botconfig(int idx, char *par)
|
|
static void cmd_botconfig(int idx, char *par)
|
|
@@ -352,6 +349,7 @@ static void cmd_botconfig(int idx, char *par)
|
|
|
|
|
|
|
|
if (!entry || !entry[0]) {
|
|
if (!entry || !entry[0]) {
|
|
|
for (i = 0; i < cfg_count; i++) {
|
|
for (i = 0; i < cfg_count; i++) {
|
|
|
|
|
+#ifdef HUB
|
|
|
if ((cfg[i]->flags & CFGF_LOCAL) && (cfg[i]->describe)) {
|
|
if ((cfg[i]->flags & CFGF_LOCAL) && (cfg[i]->describe)) {
|
|
|
k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
|
|
k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
|
|
|
while (k && strcmp(k->key, cfg[i]->name))
|
|
while (k && strcmp(k->key, cfg[i]->name))
|
|
@@ -361,14 +359,17 @@ static void cmd_botconfig(int idx, char *par)
|
|
|
else
|
|
else
|
|
|
dprintf(idx, " %s: (not set)\n", cfg[i]->name);
|
|
dprintf(idx, " %s: (not set)\n", cfg[i]->name);
|
|
|
}
|
|
}
|
|
|
|
|
+#endif /* HUB */
|
|
|
}
|
|
}
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
cfgent = NULL;
|
|
cfgent = NULL;
|
|
|
|
|
+#ifdef HUB
|
|
|
for (i = 0; !cfgent && (i < cfg_count); i++)
|
|
for (i = 0; !cfgent && (i < cfg_count); i++)
|
|
|
if (!strcmp(cfg[i]->name, entry) && (cfg[i]->flags & CFGF_LOCAL) && (cfg[i]->describe))
|
|
if (!strcmp(cfg[i]->name, entry) && (cfg[i]->flags & CFGF_LOCAL) && (cfg[i]->describe))
|
|
|
cfgent = cfg[i];
|
|
cfgent = cfg[i];
|
|
|
|
|
+#endif /* HUB */
|
|
|
if (!cfgent) {
|
|
if (!cfgent) {
|
|
|
dprintf(idx, "No such configuration value\n");
|
|
dprintf(idx, "No such configuration value\n");
|
|
|
return;
|
|
return;
|
|
@@ -380,14 +381,14 @@ static void cmd_botconfig(int idx, char *par)
|
|
|
egg_snprintf(tmp, sizeof tmp, "%s %s", cfgent->name, par);
|
|
egg_snprintf(tmp, sizeof tmp, "%s %s", cfgent->name, par);
|
|
|
update_mod(u2->handle, dcc[idx].nick, "botconfig", tmp);
|
|
update_mod(u2->handle, dcc[idx].nick, "botconfig", tmp);
|
|
|
dprintf(idx, "Now: ");
|
|
dprintf(idx, "Now: ");
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+#ifdef HUB
|
|
|
if (cfgent->describe && !described) {
|
|
if (cfgent->describe && !described) {
|
|
|
described++;
|
|
described++;
|
|
|
cfgent->describe(cfgent, idx);
|
|
cfgent->describe(cfgent, idx);
|
|
|
}
|
|
}
|
|
|
|
|
+#endif /* HUB */
|
|
|
}
|
|
}
|
|
|
k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
|
|
k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
|
|
|
while (k && strcmp(k->key, cfgent->name))
|
|
while (k && strcmp(k->key, cfgent->name))
|
|
@@ -466,9 +467,7 @@ static void cmd_cmdpass(int idx, char *par)
|
|
|
else
|
|
else
|
|
|
dprintf(idx, "Set command password for %s to '%s'\n", cmd, pass);
|
|
dprintf(idx, "Set command password for %s to '%s'\n", cmd, pass);
|
|
|
set_cmd_pass(tmp, 1);
|
|
set_cmd_pass(tmp, 1);
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -482,7 +481,6 @@ static void cmd_lagged(int idx, char *par)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_me(int idx, char *par)
|
|
static void cmd_me(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -518,9 +516,8 @@ static void cmd_motd(int idx, char *par)
|
|
|
set_cfg_str(NULL, "motd", s);
|
|
set_cfg_str(NULL, "motd", s);
|
|
|
free(s);
|
|
free(s);
|
|
|
dprintf(idx, "Motd set\n");
|
|
dprintf(idx, "Motd set\n");
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
} else {
|
|
} else {
|
|
|
show_motd(idx);
|
|
show_motd(idx);
|
|
|
}
|
|
}
|
|
@@ -637,9 +634,8 @@ static void cmd_newpass(int idx, char *par)
|
|
|
|
|
|
|
|
set_user(&USERENTRY_PASS, dcc[idx].user, pass);
|
|
set_user(&USERENTRY_PASS, dcc[idx].user, pass);
|
|
|
dprintf(idx, "Changed your password to: %s\n", pass);
|
|
dprintf(idx, "Changed your password to: %s\n", pass);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_secpass(int idx, char *par)
|
|
static void cmd_secpass(int idx, char *par)
|
|
@@ -667,12 +663,10 @@ static void cmd_secpass(int idx, char *par)
|
|
|
pass[MAXPASSLEN] = 0;
|
|
pass[MAXPASSLEN] = 0;
|
|
|
set_user(&USERENTRY_SECPASS, dcc[idx].user, pass);
|
|
set_user(&USERENTRY_SECPASS, dcc[idx].user, pass);
|
|
|
dprintf(idx, "Changed your secpass to: %s\n", pass);
|
|
dprintf(idx, "Changed your secpass to: %s\n", pass);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_bots(int idx, char *par)
|
|
static void cmd_bots(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
char *node = NULL;
|
|
char *node = NULL;
|
|
@@ -695,7 +689,6 @@ static void cmd_bottree(int idx, char *par)
|
|
|
putlog(LOG_CMDS, "*", "#%s# bottree", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# bottree", dcc[idx].nick);
|
|
|
tell_bottree(idx);
|
|
tell_bottree(idx);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
int my_cmp(const mycmds *c1, const mycmds *c2)
|
|
int my_cmp(const mycmds *c1, const mycmds *c2)
|
|
|
{
|
|
{
|
|
@@ -828,7 +821,6 @@ static void cmd_addlog(int idx, char *par)
|
|
|
dprintf(idx, "Placed entry in the log file.\n");
|
|
dprintf(idx, "Placed entry in the log file.\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_who(int idx, char *par)
|
|
static void cmd_who(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
if (par[0]) {
|
|
if (par[0]) {
|
|
@@ -861,7 +853,6 @@ static void cmd_who(int idx, char *par)
|
|
|
tell_who(idx, dcc[idx].u.chat->channel);
|
|
tell_who(idx, dcc[idx].u.chat->channel);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_whois(int idx, char *par)
|
|
static void cmd_whois(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -911,12 +902,10 @@ static void cmd_match(int idx, char *par)
|
|
|
static void cmd_update(int idx, char *par)
|
|
static void cmd_update(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
putlog(LOG_CMDS, "*", "#%s# update %s", dcc[idx].nick, par);
|
|
putlog(LOG_CMDS, "*", "#%s# update %s", dcc[idx].nick, par);
|
|
|
-#ifdef LEAF
|
|
|
|
|
- if (!conf.bot->localhub) {
|
|
|
|
|
|
|
+ if (!conf.bot->hub && !conf.bot->localhub) {
|
|
|
dprintf(idx, "Please use '%s%s%s' for this login/shell.\n", RED(idx), conf.localhub, COLOR_END(idx));
|
|
dprintf(idx, "Please use '%s%s%s' for this login/shell.\n", RED(idx), conf.localhub, COLOR_END(idx));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
if (!par[0])
|
|
if (!par[0])
|
|
|
dprintf(idx, "Usage: update <binname>\n");
|
|
dprintf(idx, "Usage: update <binname>\n");
|
|
|
updatebin(idx, par, 1);
|
|
updatebin(idx, par, 1);
|
|
@@ -1032,10 +1021,10 @@ static void cmd_status(int idx, char *par)
|
|
|
putlog(LOG_CMDS, "*", "#%s# status", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# status", dcc[idx].nick);
|
|
|
tell_verbose_status(idx);
|
|
tell_verbose_status(idx);
|
|
|
}
|
|
}
|
|
|
-#ifdef LEAF
|
|
|
|
|
- server_report(idx, all);
|
|
|
|
|
- irc_report(idx, all);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ server_report(idx, all);
|
|
|
|
|
+ irc_report(idx, all);
|
|
|
|
|
+ }
|
|
|
channels_report(idx, all);
|
|
channels_report(idx, all);
|
|
|
transfer_report(idx, all);
|
|
transfer_report(idx, all);
|
|
|
share_report(idx, all);
|
|
share_report(idx, all);
|
|
@@ -1233,7 +1222,6 @@ static void cmd_date(int idx, char *par)
|
|
|
dprintf(idx, "%s <-- Botnet uses this\n", date);
|
|
dprintf(idx, "%s <-- Botnet uses this\n", date);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_chhandle(int idx, char *par)
|
|
static void cmd_chhandle(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
char hand[HANDLEN + 1] = "", newhand[HANDLEN + 1] = "";
|
|
char hand[HANDLEN + 1] = "", newhand[HANDLEN + 1] = "";
|
|
@@ -1279,12 +1267,9 @@ static void cmd_chhandle(int idx, char *par)
|
|
|
dprintf(idx, "Changed.\n");
|
|
dprintf(idx, "Changed.\n");
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "Failed.\n");
|
|
dprintf(idx, "Failed.\n");
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_handle(int idx, char *par)
|
|
static void cmd_handle(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -1317,13 +1302,11 @@ static void cmd_handle(int idx, char *par)
|
|
|
dprintf(idx, "Okay, changed.\n");
|
|
dprintf(idx, "Okay, changed.\n");
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "Failed.\n");
|
|
dprintf(idx, "Failed.\n");
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_chpass(int idx, char *par)
|
|
static void cmd_chpass(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
@@ -1374,9 +1357,7 @@ static void cmd_chpass(int idx, char *par)
|
|
|
set_user(&USERENTRY_PASS, u, pass);
|
|
set_user(&USERENTRY_PASS, u, pass);
|
|
|
putlog(LOG_CMDS, "*", "#%s# chpass %s [%s]", dcc[idx].nick, handle, randpass ? "random" : "something");
|
|
putlog(LOG_CMDS, "*", "#%s# chpass %s [%s]", dcc[idx].nick, handle, randpass ? "random" : "something");
|
|
|
dprintf(idx, "Password for '%s' changed to: %s\n", handle, pass);
|
|
dprintf(idx, "Password for '%s' changed to: %s\n", handle, pass);
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1429,9 +1410,7 @@ static void cmd_chsecpass(int idx, char *par)
|
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
|
putlog(LOG_CMDS, "*", "#%s# chsecpass %s [%s]", dcc[idx].nick, handle, randpass ? "random" : "something");
|
|
putlog(LOG_CMDS, "*", "#%s# chsecpass %s [%s]", dcc[idx].nick, handle, randpass ? "random" : "something");
|
|
|
dprintf(idx, "Secpass for '%s' changed to: %s\n", handle, pass);
|
|
dprintf(idx, "Secpass for '%s' changed to: %s\n", handle, pass);
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1518,9 +1497,7 @@ static void cmd_hublevel(int idx, char *par)
|
|
|
bi->relay_port = obi->relay_port;
|
|
bi->relay_port = obi->relay_port;
|
|
|
bi->hublevel = atoi(level);
|
|
bi->hublevel = atoi(level);
|
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_uplink(int idx, char *par)
|
|
static void cmd_uplink(int idx, char *par)
|
|
@@ -1559,12 +1536,9 @@ static void cmd_uplink(int idx, char *par)
|
|
|
bi->relay_port = obi->relay_port;
|
|
bi->relay_port = obi->relay_port;
|
|
|
bi->hublevel = obi->hublevel;
|
|
bi->hublevel = obi->hublevel;
|
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
static void cmd_chaddr(int idx, char *par)
|
|
static void cmd_chaddr(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
char *handle = NULL;
|
|
char *handle = NULL;
|
|
@@ -1651,7 +1625,6 @@ static void cmd_chaddr(int idx, char *par)
|
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
set_user(&USERENTRY_BOTADDR, u1, bi);
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_comment(int idx, char *par)
|
|
static void cmd_comment(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -1683,9 +1656,8 @@ static void cmd_comment(int idx, char *par)
|
|
|
dprintf(idx, "Changed comment.\n");
|
|
dprintf(idx, "Changed comment.\n");
|
|
|
update_mod(handle, dcc[idx].nick, "comment", NULL);
|
|
update_mod(handle, dcc[idx].nick, "comment", NULL);
|
|
|
set_user(&USERENTRY_COMMENT, u1, par);
|
|
set_user(&USERENTRY_COMMENT, u1, par);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_randstring(int idx, char *par)
|
|
static void cmd_randstring(int idx, char *par)
|
|
@@ -1740,9 +1712,7 @@ static void cmd_conf(int idx, char *par)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
char *cmd = NULL;
|
|
char *cmd = NULL;
|
|
|
-#ifdef LEAF
|
|
|
|
|
char *listbot = NULL;
|
|
char *listbot = NULL;
|
|
|
-#endif /* LEAF */
|
|
|
|
|
int save = 0;
|
|
int save = 0;
|
|
|
|
|
|
|
|
if (par[0])
|
|
if (par[0])
|
|
@@ -1751,17 +1721,14 @@ static void cmd_conf(int idx, char *par)
|
|
|
/* del/change should restart the specified bot ;) */
|
|
/* del/change should restart the specified bot ;) */
|
|
|
|
|
|
|
|
if (!cmd) {
|
|
if (!cmd) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- dprintf(idx, "Usage: conf <add|del|change|list|set> [options]\n");
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
- dprintf(idx, "Usage: conf <set> [options]\n");
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ dprintf(idx, "Usage: conf <add|del|change|list|set> [options]\n");
|
|
|
|
|
+ else
|
|
|
|
|
+ dprintf(idx, "Usage: conf <set> [options]\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
putlog(LOG_CMDS, "*", "#%s# conf %s %s", dcc[idx].nick, cmd, par[0] ? par : "");
|
|
putlog(LOG_CMDS, "*", "#%s# conf %s %s", dcc[idx].nick, cmd, par[0] ? par : "");
|
|
|
-#ifdef LEAF
|
|
|
|
|
if (!egg_strcasecmp(cmd, "add") || !egg_strcasecmp(cmd, "change")) {
|
|
if (!egg_strcasecmp(cmd, "add") || !egg_strcasecmp(cmd, "change")) {
|
|
|
char *nick = NULL, *host = NULL, *ip = NULL, *ipsix = NULL;
|
|
char *nick = NULL, *host = NULL, *ip = NULL, *ipsix = NULL;
|
|
|
|
|
|
|
@@ -1796,14 +1763,12 @@ static void cmd_conf(int idx, char *par)
|
|
|
|
|
|
|
|
dprintf(idx, "Deleted bot from conf: %s\n", par);
|
|
dprintf(idx, "Deleted bot from conf: %s\n", par);
|
|
|
if ((u = get_user_by_handle(userlist, par))) {
|
|
if ((u = get_user_by_handle(userlist, par))) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- check_this_user(par, 1, NULL);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ check_this_user(par, 1, NULL);
|
|
|
if (deluser(par)) {
|
|
if (deluser(par)) {
|
|
|
dprintf(idx, "Removed bot: %s.\n", par);
|
|
dprintf(idx, "Removed bot: %s.\n", par);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1811,8 +1776,7 @@ static void cmd_conf(int idx, char *par)
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "Error trying to remove bot '%s'\n", par);
|
|
dprintf(idx, "Error trying to remove bot '%s'\n", par);
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
-#if !defined(CYGWIN_HACKS) || defined(HUB)
|
|
|
|
|
|
|
+#ifndef CYGWIN_HACKS
|
|
|
if (!egg_strcasecmp(cmd, "set")) {
|
|
if (!egg_strcasecmp(cmd, "set")) {
|
|
|
char *what = NULL;
|
|
char *what = NULL;
|
|
|
int show = 1, set = 0;
|
|
int show = 1, set = 0;
|
|
@@ -1861,9 +1825,8 @@ static void cmd_conf(int idx, char *par)
|
|
|
if (!what || !egg_strcasecmp(what, "watcher")) dprintf(idx, "%swatcher: %d\n", ss, conf.watcher);
|
|
if (!what || !egg_strcasecmp(what, "watcher")) dprintf(idx, "%swatcher: %d\n", ss, conf.watcher);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* !CYGWIN_HACKS || HUB */
|
|
|
|
|
|
|
+#endif /* !CYGWIN_HACKS */
|
|
|
|
|
|
|
|
-#ifdef LEAF
|
|
|
|
|
if (listbot || !egg_strcasecmp(cmd, "list")) {
|
|
if (listbot || !egg_strcasecmp(cmd, "list")) {
|
|
|
conf_bot *bot = NULL;
|
|
conf_bot *bot = NULL;
|
|
|
unsigned int i = 0;
|
|
unsigned int i = 0;
|
|
@@ -1883,13 +1846,11 @@ static void cmd_conf(int idx, char *par)
|
|
|
}
|
|
}
|
|
|
if (listbot)
|
|
if (listbot)
|
|
|
free(listbot);
|
|
free(listbot);
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
|
|
|
if (save) {
|
|
if (save) {
|
|
|
write_settings(binname, -1);
|
|
write_settings(binname, -1);
|
|
|
-#ifdef LEAF
|
|
|
|
|
- spawnbots(); /* parse conf struct and spawn/kill as needed */
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ spawnbots(); /* parse conf struct and spawn/kill as needed */
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1945,14 +1906,12 @@ static void cmd_restart(int idx, char *par)
|
|
|
restart(idx);
|
|
restart(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_reload(int idx, char *par)
|
|
static void cmd_reload(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
putlog(LOG_CMDS, "*", "#%s# reload", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# reload", dcc[idx].nick);
|
|
|
dprintf(idx, "Reloading user file...\n");
|
|
dprintf(idx, "Reloading user file...\n");
|
|
|
reload();
|
|
reload();
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_die(int idx, char *par)
|
|
static void cmd_die(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -2049,7 +2008,6 @@ static void cmd_simul(int idx, char *par)
|
|
|
dprintf(idx, "No such user on the party line.\n");
|
|
dprintf(idx, "No such user on the party line.\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_link(int idx, char *par)
|
|
static void cmd_link(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
@@ -2074,7 +2032,6 @@ static void cmd_link(int idx, char *par)
|
|
|
botnet_send_link(i, x, s, par);
|
|
botnet_send_link(i, x, s, par);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_unlink(int idx, char *par)
|
|
static void cmd_unlink(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -2118,7 +2075,6 @@ static void cmd_relay(int idx, char *par)
|
|
|
tandem_relay(idx, par, 0);
|
|
tandem_relay(idx, par, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_save(int idx, char *par)
|
|
static void cmd_save(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
char buf[100] = "";
|
|
char buf[100] = "";
|
|
@@ -2145,10 +2101,8 @@ static void cmd_backup(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
putlog(LOG_CMDS, "*", "#%s# backup", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# backup", dcc[idx].nick);
|
|
|
dprintf(idx, "Backing up the channel & user files...\n");
|
|
dprintf(idx, "Backing up the channel & user files...\n");
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
backup_userfile();
|
|
backup_userfile();
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_trace(int idx, char *par)
|
|
static void cmd_trace(int idx, char *par)
|
|
@@ -2176,7 +2130,6 @@ static void cmd_trace(int idx, char *par)
|
|
|
simple_sprintf(y, ":%d", now);
|
|
simple_sprintf(y, ":%d", now);
|
|
|
botnet_send_trace(i, x, par, y);
|
|
botnet_send_trace(i, x, par, y);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
/* After messing with someone's user flags, make sure the dcc-chat flags
|
|
/* After messing with someone's user flags, make sure the dcc-chat flags
|
|
|
* are set correctly.
|
|
* are set correctly.
|
|
@@ -2195,12 +2148,10 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
|
|
|
|
|
|
|
|
for (int i = 0; i < dcc_total; i++) {
|
|
for (int i = 0; i < dcc_total; i++) {
|
|
|
if (dcc[i].type && !dcc[i].simul) {
|
|
if (dcc[i].type && !dcc[i].simul) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- if (dcc[i].type && dcc[i].type == &DCC_CHAT && !ischanhub() && u == conf.bot->u) {
|
|
|
|
|
|
|
+ if (dcc[i].type && dcc[i].type == &DCC_CHAT && !conf.bot->hub && !ischanhub() && u == conf.bot->u) {
|
|
|
dprintf(i, "I am no longer a chathub..\n\n");
|
|
dprintf(i, "I am no longer a chathub..\n\n");
|
|
|
do_boot(i, conf.bot->nick, "I am no longer a chathub.\n\n");
|
|
do_boot(i, conf.bot->nick, "I am no longer a chathub.\n\n");
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
|
|
|
if ((dcc[i].type->flags & DCT_MASTER) && (!egg_strcasecmp(u->handle, dcc[i].nick))) {
|
|
if ((dcc[i].type->flags & DCT_MASTER) && (!egg_strcasecmp(u->handle, dcc[i].nick))) {
|
|
|
stat = dcc[i].status;
|
|
stat = dcc[i].status;
|
|
@@ -2264,10 +2215,8 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
|
|
|
!(u->flags & USER_MASTER))
|
|
!(u->flags & USER_MASTER))
|
|
|
stat |= STAT_PARTY;
|
|
stat |= STAT_PARTY;
|
|
|
if (stat & STAT_CHAT) {
|
|
if (stat & STAT_CHAT) {
|
|
|
-#ifdef HUB
|
|
|
|
|
- if (!(u->flags & USER_HUBA))
|
|
|
|
|
|
|
+ if (conf.bot->hub && !(u->flags & USER_HUBA))
|
|
|
stat &= ~STAT_CHAT;
|
|
stat &= ~STAT_CHAT;
|
|
|
-#endif /* HUB */
|
|
|
|
|
if (ischanhub() && !(u->flags & USER_CHUBA))
|
|
if (ischanhub() && !(u->flags & USER_CHUBA))
|
|
|
stat &= ~STAT_CHAT;
|
|
stat &= ~STAT_CHAT;
|
|
|
}
|
|
}
|
|
@@ -2276,21 +2225,18 @@ int check_dcc_attrs(struct userrec *u, flag_t oatr)
|
|
|
dcc[i].status = stat;
|
|
dcc[i].status = stat;
|
|
|
/* Check if they no longer have access to wherever they are.
|
|
/* Check if they no longer have access to wherever they are.
|
|
|
*/
|
|
*/
|
|
|
-#ifdef HUB
|
|
|
|
|
- if (!(u->flags & (USER_HUBA))) {
|
|
|
|
|
|
|
+ if (conf.bot->hub && !(u->flags & (USER_HUBA))) {
|
|
|
/* no hub access, drop them. */
|
|
/* no hub access, drop them. */
|
|
|
dprintf(i, "-+- POOF! -+-\n");
|
|
dprintf(i, "-+- POOF! -+-\n");
|
|
|
dprintf(i, "You no longer have hub access.\n\n");
|
|
dprintf(i, "You no longer have hub access.\n\n");
|
|
|
do_boot(i, conf.bot->nick, "No hub access.\n\n");
|
|
do_boot(i, conf.bot->nick, "No hub access.\n\n");
|
|
|
}
|
|
}
|
|
|
-#else /* !HUB */
|
|
|
|
|
- if (ischanhub() && !(u->flags & (USER_CHUBA))) {
|
|
|
|
|
|
|
+ if (!conf.bot->hub && ischanhub() && !(u->flags & (USER_CHUBA))) {
|
|
|
/* no chanhub access, drop them. */
|
|
/* no chanhub access, drop them. */
|
|
|
dprintf(i, "-+- POOF! -+-\n");
|
|
dprintf(i, "-+- POOF! -+-\n");
|
|
|
dprintf(i, "You no longer have chathub access.\n\n");
|
|
dprintf(i, "You no longer have chathub access.\n\n");
|
|
|
do_boot(i, conf.bot->nick, "No chathub access.\n\n");
|
|
do_boot(i, conf.bot->nick, "No chathub access.\n\n");
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2510,10 +2456,10 @@ static void cmd_chattr(int idx, char *par)
|
|
|
mns.chan = 0;
|
|
mns.chan = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-#ifdef LEAF
|
|
|
|
|
- pls.global &=~(USER_OWNER | USER_ADMIN | USER_HUBA | USER_CHUBA);
|
|
|
|
|
- mns.global &=~(USER_OWNER | USER_ADMIN | USER_HUBA | USER_CHUBA);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ pls.global &=~(USER_OWNER | USER_ADMIN | USER_HUBA | USER_CHUBA);
|
|
|
|
|
+ mns.global &=~(USER_OWNER | USER_ADMIN | USER_HUBA | USER_CHUBA);
|
|
|
|
|
+ }
|
|
|
get_user_flagrec(u2, &user, par);
|
|
get_user_flagrec(u2, &user, par);
|
|
|
if (user.match & FR_GLOBAL) {
|
|
if (user.match & FR_GLOBAL) {
|
|
|
of = user.global;
|
|
of = user.global;
|
|
@@ -2558,15 +2504,12 @@ static void cmd_chattr(int idx, char *par)
|
|
|
else
|
|
else
|
|
|
dprintf(idx, "No flags for %s on %s.\n", hand, chan->dname);
|
|
dprintf(idx, "No flags for %s on %s.\n", hand, chan->dname);
|
|
|
}
|
|
}
|
|
|
-#ifdef LEAF
|
|
|
|
|
- if (chg)
|
|
|
|
|
|
|
+ if (chg && !conf.bot->hub)
|
|
|
check_this_user(hand, 0, NULL);
|
|
check_this_user(hand, 0, NULL);
|
|
|
-#endif /* LEAF */
|
|
|
|
|
if (tmpchg)
|
|
if (tmpchg)
|
|
|
free(tmpchg);
|
|
free(tmpchg);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_chat(int idx, char *par)
|
|
static void cmd_chat(int idx, char *par)
|
|
@@ -2707,13 +2650,12 @@ int exec_str(int idx, char *cmd) {
|
|
|
|
|
|
|
|
static void cmd_exec(int idx, char *par) {
|
|
static void cmd_exec(int idx, char *par) {
|
|
|
putlog(LOG_CMDS, "*", "#%s# exec %s", dcc[idx].nick, par);
|
|
putlog(LOG_CMDS, "*", "#%s# exec %s", dcc[idx].nick, par);
|
|
|
-#ifdef LEAF
|
|
|
|
|
- if (!isowner(dcc[idx].nick)) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!conf.bot->hub && !isowner(dcc[idx].nick)) {
|
|
|
putlog(LOG_WARN, "*", "%s attempted 'exec' %s", dcc[idx].nick, par);
|
|
putlog(LOG_WARN, "*", "%s attempted 'exec' %s", dcc[idx].nick, par);
|
|
|
dprintf(idx, "exec is only available to permanent owners on leaf bots\n");
|
|
dprintf(idx, "exec is only available to permanent owners on leaf bots\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
if (exec_str(idx, par))
|
|
if (exec_str(idx, par))
|
|
|
dprintf(idx, "Exec completed\n");
|
|
dprintf(idx, "Exec completed\n");
|
|
|
else
|
|
else
|
|
@@ -3044,13 +2986,14 @@ static void cmd_su(int idx, char *par)
|
|
|
else {
|
|
else {
|
|
|
get_user_flagrec(u, &fr, NULL);
|
|
get_user_flagrec(u, &fr, NULL);
|
|
|
ok = 1;
|
|
ok = 1;
|
|
|
-#ifdef HUB
|
|
|
|
|
- if (!glob_huba(fr))
|
|
|
|
|
- ok = 0;
|
|
|
|
|
-#else /* !HUB */
|
|
|
|
|
- if (ischanhub() && !glob_chuba(fr))
|
|
|
|
|
- ok = 0;
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (conf.bot->hub) {
|
|
|
|
|
+ if (!glob_huba(fr))
|
|
|
|
|
+ ok = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (ischanhub() && !glob_chuba(fr))
|
|
|
|
|
+ ok = 0;
|
|
|
|
|
+ }
|
|
|
if (!ok)
|
|
if (!ok)
|
|
|
dprintf(idx, "No party line access permitted for %s.\n", par);
|
|
dprintf(idx, "No party line access permitted for %s.\n", par);
|
|
|
else {
|
|
else {
|
|
@@ -3152,7 +3095,6 @@ static void cmd_page(int idx, char *par)
|
|
|
console_dostore(idx);
|
|
console_dostore(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_newleaf(int idx, char *par)
|
|
static void cmd_newleaf(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
@@ -3198,9 +3140,7 @@ static void cmd_newleaf(int idx, char *par)
|
|
|
addhost_by_handle(handle, host);
|
|
addhost_by_handle(handle, host);
|
|
|
dprintf(idx, "Added host '%s' to leaf: %s\n", host, handle);
|
|
dprintf(idx, "Added host '%s' to leaf: %s\n", host, handle);
|
|
|
}
|
|
}
|
|
|
-#ifdef HUB
|
|
|
|
|
write_userfile(idx);
|
|
write_userfile(idx);
|
|
|
-#endif /* HUB */
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3228,7 +3168,6 @@ static void cmd_nopass(int idx, char *par)
|
|
|
dprintf(idx, "Users without passwords: %s\n", users);
|
|
dprintf(idx, "Users without passwords: %s\n", users);
|
|
|
free(users);
|
|
free(users);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void cmd_pls_ignore(int idx, char *par)
|
|
static void cmd_pls_ignore(int idx, char *par)
|
|
|
{
|
|
{
|
|
@@ -3299,9 +3238,8 @@ static void cmd_pls_ignore(int idx, char *par)
|
|
|
dprintf(idx, "Now ignoring: %s (%s)\n", s, par);
|
|
dprintf(idx, "Now ignoring: %s (%s)\n", s, par);
|
|
|
addignore(s, dcc[idx].nick, (const char *) par, expire_time ? now + expire_time : 0L);
|
|
addignore(s, dcc[idx].nick, (const char *) par, expire_time ? now + expire_time : 0L);
|
|
|
putlog(LOG_CMDS, "*", "#%s# +ignore %s %s", dcc[idx].nick, s, par);
|
|
putlog(LOG_CMDS, "*", "#%s# +ignore %s %s", dcc[idx].nick, s, par);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3318,9 +3256,8 @@ static void cmd_mns_ignore(int idx, char *par)
|
|
|
if (delignore(buf)) {
|
|
if (delignore(buf)) {
|
|
|
putlog(LOG_CMDS, "*", "#%s# -ignore %s", dcc[idx].nick, buf);
|
|
putlog(LOG_CMDS, "*", "#%s# -ignore %s", dcc[idx].nick, buf);
|
|
|
dprintf(idx, "No longer ignoring: %s\n", buf);
|
|
dprintf(idx, "No longer ignoring: %s\n", buf);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "That ignore cannot be found.\n");
|
|
dprintf(idx, "That ignore cannot be found.\n");
|
|
|
}
|
|
}
|
|
@@ -3371,9 +3308,8 @@ static void cmd_pls_user(int idx, char *par)
|
|
|
dprintf(idx, "%s's initial password set to %s%s%s\n", handle, BOLD(idx), s, BOLD_END(idx));
|
|
dprintf(idx, "%s's initial password set to %s%s%s\n", handle, BOLD(idx), s, BOLD_END(idx));
|
|
|
dprintf(idx, "%s's initial secpass set to %s%s%s\n", handle, BOLD(idx), s2, BOLD_END(idx));
|
|
dprintf(idx, "%s's initial secpass set to %s%s%s\n", handle, BOLD(idx), s2, BOLD_END(idx));
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3426,14 +3362,12 @@ static void cmd_mns_user(int idx, char *par)
|
|
|
dprintf(idx, "You can't remove users who aren't bots!\n");
|
|
dprintf(idx, "You can't remove users who aren't bots!\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-#ifdef LEAF
|
|
|
|
|
- check_this_user(handle, 1, NULL);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ check_this_user(handle, 1, NULL);
|
|
|
if (deluser(handle)) {
|
|
if (deluser(handle)) {
|
|
|
dprintf(idx, "Removed %s: %s.\n", u2->bot ? "bot" : "user", handle);
|
|
dprintf(idx, "Removed %s: %s.\n", u2->bot ? "bot" : "user", handle);
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "Failed.\n");
|
|
dprintf(idx, "Failed.\n");
|
|
|
}
|
|
}
|
|
@@ -3515,12 +3449,10 @@ static void cmd_pls_host(int idx, char *par)
|
|
|
addhost_by_handle(handle, host);
|
|
addhost_by_handle(handle, host);
|
|
|
dprintf(idx, "Added host '%s' to %s.\n", host, handle);
|
|
dprintf(idx, "Added host '%s' to %s.\n", host, handle);
|
|
|
}
|
|
}
|
|
|
-#ifdef LEAF
|
|
|
|
|
- check_this_user(handle, 0, NULL);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ check_this_user(handle, 0, NULL);
|
|
|
|
|
+ else
|
|
|
|
|
+ write_userfile(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_mns_host(int idx, char *par)
|
|
static void cmd_mns_host(int idx, char *par)
|
|
@@ -3594,16 +3526,14 @@ static void cmd_mns_host(int idx, char *par)
|
|
|
host = newsplit(&par);
|
|
host = newsplit(&par);
|
|
|
addhost_by_handle(handle, host);
|
|
addhost_by_handle(handle, host);
|
|
|
if (delhost_by_handle(handle, host)) {
|
|
if (delhost_by_handle(handle, host)) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- check_this_user(handle, 2, host);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (!conf.bot->hub)
|
|
|
|
|
+ check_this_user(handle, 2, host);
|
|
|
dprintf(idx, "Removed host '%s' from %s.\n", host, handle);
|
|
dprintf(idx, "Removed host '%s' from %s.\n", host, handle);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
- write_userfile(idx);
|
|
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
+ if (conf.bot->hub)
|
|
|
|
|
+ write_userfile(idx);
|
|
|
} else
|
|
} else
|
|
|
dprintf(idx, "Failed.\n");
|
|
dprintf(idx, "Failed.\n");
|
|
|
}
|
|
}
|
|
@@ -3628,16 +3558,16 @@ static void cmd_botserver(int idx, char * par) {
|
|
|
|
|
|
|
|
|
|
|
|
|
static void rcmd_cursrv(char * fbot, char * fhand, char * fidx) {
|
|
static void rcmd_cursrv(char * fbot, char * fhand, char * fidx) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- char tmp[2048] = "";
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ char tmp[2048] = "";
|
|
|
|
|
|
|
|
- if (server_online)
|
|
|
|
|
- sprintf(tmp, "Currently: %-40s Lag: %d", cursrvname, server_lag);
|
|
|
|
|
- else
|
|
|
|
|
- sprintf(tmp, "Currently: none");
|
|
|
|
|
|
|
+ if (server_online)
|
|
|
|
|
+ sprintf(tmp, "Currently: %-40s Lag: %d", cursrvname, server_lag);
|
|
|
|
|
+ else
|
|
|
|
|
+ sprintf(tmp, "Currently: none");
|
|
|
|
|
|
|
|
- botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cmd_timesync(int idx, char *par) {
|
|
static void cmd_timesync(int idx, char *par) {
|
|
@@ -3657,7 +3587,6 @@ static void rcmd_timesync(char *frombot, char *fromhand, char *fromidx, char *pa
|
|
|
botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, tmp);
|
|
botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, tmp);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
/* netversion */
|
|
/* netversion */
|
|
|
static void cmd_netversion(int idx, char * par) {
|
|
static void cmd_netversion(int idx, char * par) {
|
|
|
putlog(LOG_CMDS, "*", "#%s# netversion", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# netversion", dcc[idx].nick);
|
|
@@ -3675,7 +3604,6 @@ static void cmd_botversion(int idx, char * par) {
|
|
|
}
|
|
}
|
|
|
botnet_send_cmd(conf.bot->nick, par, dcc[idx].nick, idx, "ver");
|
|
botnet_send_cmd(conf.bot->nick, par, dcc[idx].nick, idx, "ver");
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void rcmd_ver(char * fbot, char * fhand, char * fidx) {
|
|
static void rcmd_ver(char * fbot, char * fhand, char * fidx) {
|
|
|
char tmp[2048] = "";
|
|
char tmp[2048] = "";
|
|
@@ -3710,17 +3638,17 @@ static void cmd_botnick(int idx, char * par) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void rcmd_curnick(char * fbot, char * fhand, char * fidx) {
|
|
static void rcmd_curnick(char * fbot, char * fhand, char * fidx) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- char tmp[1024] = "";
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ char tmp[1024] = "";
|
|
|
|
|
|
|
|
- if (server_online)
|
|
|
|
|
- sprintf(tmp, "Currently: %-20s ", botname);
|
|
|
|
|
- if (strncmp(botname, origbotname, strlen(botname)))
|
|
|
|
|
- sprintf(tmp, "%sWant: %s", tmp, origbotname);
|
|
|
|
|
- if (!server_online)
|
|
|
|
|
- sprintf(tmp, "%s(not online)", tmp);
|
|
|
|
|
- botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
|
|
+ if (server_online)
|
|
|
|
|
+ sprintf(tmp, "Currently: %-20s ", botname);
|
|
|
|
|
+ if (strncmp(botname, origbotname, strlen(botname)))
|
|
|
|
|
+ sprintf(tmp, "%sWant: %s", tmp, origbotname);
|
|
|
|
|
+ if (!server_online)
|
|
|
|
|
+ sprintf(tmp, "%s(not online)", tmp);
|
|
|
|
|
+ botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* netmsg, botmsg */
|
|
/* netmsg, botmsg */
|
|
@@ -3763,20 +3691,19 @@ static void cmd_netmsg(int idx, char * par) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void rcmd_msg(char * tobot, char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
static void rcmd_msg(char * tobot, char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- char *nick = newsplit(&par);
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ char *nick = newsplit(&par);
|
|
|
|
|
|
|
|
- dprintf(DP_SERVER, "PRIVMSG %s :%s\n", nick, par);
|
|
|
|
|
- if (!strcmp(tobot, conf.bot->nick)) {
|
|
|
|
|
- char buf[1024] = "";
|
|
|
|
|
|
|
+ dprintf(DP_SERVER, "PRIVMSG %s :%s\n", nick, par);
|
|
|
|
|
+ if (!strcmp(tobot, conf.bot->nick)) {
|
|
|
|
|
+ char buf[1024] = "";
|
|
|
|
|
|
|
|
- egg_snprintf(buf, sizeof buf, "Sent message to %s", nick);
|
|
|
|
|
- botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, buf);
|
|
|
|
|
|
|
+ egg_snprintf(buf, sizeof buf, "Sent message to %s", nick);
|
|
|
|
|
+ botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, buf);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
/* netlag */
|
|
/* netlag */
|
|
|
static void cmd_netlag(int idx, char * par) {
|
|
static void cmd_netlag(int idx, char * par) {
|
|
|
time_t tm;
|
|
time_t tm;
|
|
@@ -3791,7 +3718,6 @@ static void cmd_netlag(int idx, char * par) {
|
|
|
dprintf(idx, "Sent ping to all linked bots\n");
|
|
dprintf(idx, "Sent ping to all linked bots\n");
|
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, tmp);
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, tmp);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void rcmd_ping(char * frombot, char *fromhand, char * fromidx, char * par) {
|
|
static void rcmd_ping(char * frombot, char *fromhand, char * fromidx, char * par) {
|
|
|
char tmp[64] = "";
|
|
char tmp[64] = "";
|
|
@@ -3814,7 +3740,6 @@ static void rcmd_pong(char *frombot, char *fromhand, char *fromidx, char *par) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* exec commands */
|
|
/* exec commands */
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_netw(int idx, char * par) {
|
|
static void cmd_netw(int idx, char * par) {
|
|
|
char tmp[128] = "";
|
|
char tmp[128] = "";
|
|
|
|
|
|
|
@@ -3850,7 +3775,6 @@ static void cmd_netlast(int idx, char * par) {
|
|
|
egg_snprintf(buf, sizeof par, "exec last %s", par);
|
|
egg_snprintf(buf, sizeof par, "exec last %s", par);
|
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
void crontab_show(struct userrec *u, int idx) {
|
|
void crontab_show(struct userrec *u, int idx) {
|
|
|
dprintf(idx, "Showing current crontab:\n");
|
|
dprintf(idx, "Showing current crontab:\n");
|
|
@@ -3942,7 +3866,6 @@ static void cmd_dns(int idx, char *par)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#ifdef HUB
|
|
|
|
|
static void cmd_netcrontab(int idx, char * par) {
|
|
static void cmd_netcrontab(int idx, char * par) {
|
|
|
char *cmd = NULL;
|
|
char *cmd = NULL;
|
|
|
|
|
|
|
@@ -3958,7 +3881,6 @@ static void cmd_netcrontab(int idx, char * par) {
|
|
|
egg_snprintf(buf, sizeof buf, "exec crontab %s %s", cmd, par);
|
|
egg_snprintf(buf, sizeof buf, "exec crontab %s %s", cmd, par);
|
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
|
|
botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
|
|
|
}
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
|
|
|
|
static void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
static void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
|
char *cmd = NULL, scmd[512] = "", *out = NULL, *err = NULL;
|
|
char *cmd = NULL, scmd[512] = "", *out = NULL, *err = NULL;
|
|
@@ -4071,22 +3993,22 @@ static void cmd_botjump(int idx, char * par) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void rcmd_jump(char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
static void rcmd_jump(char * frombot, char * fromhand, char * fromidx, char * par) {
|
|
|
-#ifdef LEAF
|
|
|
|
|
- if (par[0]) {
|
|
|
|
|
- char *other = newsplit(&par);
|
|
|
|
|
- port_t port = atoi(newsplit(&par));
|
|
|
|
|
|
|
+ if (!conf.bot->hub) {
|
|
|
|
|
+ if (par[0]) {
|
|
|
|
|
+ char *other = newsplit(&par);
|
|
|
|
|
+ port_t port = atoi(newsplit(&par));
|
|
|
|
|
+
|
|
|
|
|
+ if (!port)
|
|
|
|
|
+ port = default_port;
|
|
|
|
|
+ strlcpy(newserver, other, 120);
|
|
|
|
|
+ newserverport = port;
|
|
|
|
|
+ strlcpy(newserverpass, par, 120);
|
|
|
|
|
+ }
|
|
|
|
|
+ botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, "Jumping...");
|
|
|
|
|
|
|
|
- if (!port)
|
|
|
|
|
- port = default_port;
|
|
|
|
|
- strlcpy(newserver, other, 120);
|
|
|
|
|
- newserverport = port;
|
|
|
|
|
- strlcpy(newserverpass, par, 120);
|
|
|
|
|
|
|
+ nuke_server("Jumping...");
|
|
|
|
|
+ cycle_time = 0;
|
|
|
}
|
|
}
|
|
|
- botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, "Jumping...");
|
|
|
|
|
-
|
|
|
|
|
- nuke_server("Jumping...");
|
|
|
|
|
- cycle_time = 0;
|
|
|
|
|
-#endif /* LEAF */
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* "Remotable" commands */
|
|
/* "Remotable" commands */
|