|
|
@@ -68,14 +68,12 @@ bool def_kill(struct user_entry *e)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifdef HUB
|
|
|
bool def_write_userfile(FILE * f, struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
if (lfprintf(f, "--%s %s\n", e->type->name, e->u.string) == EOF)
|
|
|
return 0;
|
|
|
return 1;
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
void *def_get(struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
@@ -120,9 +118,8 @@ bool def_set(struct userrec *u, struct user_entry *e, void *buf)
|
|
|
|
|
|
bool def_gotshare(struct userrec *u, struct user_entry *e, char *data, int idx)
|
|
|
{
|
|
|
-#ifdef HUB
|
|
|
- putlog(LOG_DEBUG, "@", "%s: change %s %s", dcc[idx].nick, e->type->name, u->handle);
|
|
|
-#endif
|
|
|
+ if (conf.bot->hub)
|
|
|
+ putlog(LOG_DEBUG, "@", "%s: change %s %s", dcc[idx].nick, e->type->name, u->handle);
|
|
|
return e->type->set(u, e, data);
|
|
|
}
|
|
|
|
|
|
@@ -143,9 +140,7 @@ struct user_entry_type USERENTRY_COMMENT =
|
|
|
0, /* always 0 ;) */
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -158,9 +153,7 @@ struct user_entry_type USERENTRY_INFO =
|
|
|
0, /* always 0 ;) */
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -193,9 +186,7 @@ struct user_entry_type USERENTRY_ADDED = {
|
|
|
0, /* always 0 ;) */
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -272,18 +263,18 @@ static bool config_unpack(struct userrec *u, struct user_entry *e)
|
|
|
|
|
|
static void config_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
{
|
|
|
-#ifdef HUB
|
|
|
- struct xtra_key *xk = NULL;
|
|
|
- struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
-
|
|
|
- get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
- /* scan thru xtra field, searching for matches */
|
|
|
- for (xk = (struct xtra_key *) e->u.extra; xk; xk = xk->next) {
|
|
|
- /* ok, it's a valid xtra field entry */
|
|
|
- if (glob_owner(fr))
|
|
|
- dprintf(idx, " %s: %s\n", xk->key, xk->data);
|
|
|
+ if (conf.bot->hub) {
|
|
|
+ struct xtra_key *xk = NULL;
|
|
|
+ struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
+
|
|
|
+ get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
+ /* scan thru xtra field, searching for matches */
|
|
|
+ for (xk = (struct xtra_key *) e->u.extra; xk; xk = xk->next) {
|
|
|
+ /* ok, it's a valid xtra field entry */
|
|
|
+ if (glob_owner(fr))
|
|
|
+ dprintf(idx, " %s: %s\n", xk->key, xk->data);
|
|
|
+ }
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
}
|
|
|
|
|
|
static bool config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
|
|
|
@@ -328,7 +319,6 @@ static bool config_gotshare(struct userrec *u, struct user_entry *e, char *buf,
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static bool config_write_userfile(FILE *f, struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
struct xtra_key *x = NULL;
|
|
|
@@ -337,7 +327,6 @@ static bool config_write_userfile(FILE *f, struct userrec *u, struct user_entry
|
|
|
lfprintf(f, "--CONFIG %s %s\n", x->key, x->data);
|
|
|
return 1;
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
static bool config_kill(struct user_entry *e)
|
|
|
{
|
|
|
@@ -357,9 +346,7 @@ struct user_entry_type USERENTRY_CONFIG = {
|
|
|
0,
|
|
|
config_gotshare,
|
|
|
config_unpack,
|
|
|
-#ifdef HUB
|
|
|
config_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
config_kill,
|
|
|
def_get,
|
|
|
config_set,
|
|
|
@@ -367,32 +354,26 @@ struct user_entry_type USERENTRY_CONFIG = {
|
|
|
"CONFIG"
|
|
|
};
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static void botmisc_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
{
|
|
|
- struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
+ if (conf.bot->hub) {
|
|
|
+ struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
|
|
|
- get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
- if (glob_admin(fr))
|
|
|
- dprintf(idx, " %s: %s\n", e->type->name, e->u.string ? e->u.string : "");
|
|
|
+ get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
+ if (glob_admin(fr))
|
|
|
+ dprintf(idx, " %s: %s\n", e->type->name, e->u.string ? e->u.string : "");
|
|
|
+ }
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
struct user_entry_type USERENTRY_USERNAME = {
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
-#ifdef HUB
|
|
|
botmisc_display,
|
|
|
-#else
|
|
|
- NULL,
|
|
|
-#endif /* HUB */
|
|
|
"USERNAME"
|
|
|
};
|
|
|
|
|
|
@@ -400,17 +381,11 @@ struct user_entry_type USERENTRY_NODENAME = {
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
-#ifdef HUB
|
|
|
botmisc_display,
|
|
|
-#else
|
|
|
- NULL,
|
|
|
-#endif /* HUB */
|
|
|
"NODENAME"
|
|
|
};
|
|
|
|
|
|
@@ -418,17 +393,11 @@ struct user_entry_type USERENTRY_OS = {
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
-#ifdef HUB
|
|
|
botmisc_display,
|
|
|
-#else
|
|
|
- NULL,
|
|
|
-#endif /* HUB */
|
|
|
"OS"
|
|
|
};
|
|
|
|
|
|
@@ -474,9 +443,7 @@ struct user_entry_type USERENTRY_STATS = {
|
|
|
0, /* always 0 ;) */
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -516,9 +483,7 @@ struct user_entry_type USERENTRY_MODIFIED =
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -564,9 +529,7 @@ struct user_entry_type USERENTRY_PASS =
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
pass_set,
|
|
|
@@ -606,9 +569,7 @@ struct user_entry_type USERENTRY_TMPPASS =
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
tmppass_set,
|
|
|
@@ -624,14 +585,14 @@ static void secpass_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
|
|
|
if (!strcmp(u->handle, dcc[idx].nick) || (glob_admin(fr) && isowner(dcc[idx].nick))) {
|
|
|
-#ifdef HUB
|
|
|
- dprintf(idx, " %s: %s\n", e->type->name, e->u.string);
|
|
|
-#else
|
|
|
- dprintf(idx, " %s: Hidden on leaf bots.", e->type->name);
|
|
|
- if (dcc[idx].u.chat->su_nick)
|
|
|
- dprintf(idx, " Nice try, %s.", dcc[idx].u.chat->su_nick);
|
|
|
- dprintf(idx, "\n");
|
|
|
-#endif /* HUB */
|
|
|
+ if (conf.bot->hub)
|
|
|
+ dprintf(idx, " %s: %s\n", e->type->name, e->u.string);
|
|
|
+ else {
|
|
|
+ dprintf(idx, " %s: Hidden on leaf bots.", e->type->name);
|
|
|
+ if (dcc[idx].u.chat->su_nick)
|
|
|
+ dprintf(idx, " Nice try, %s.", dcc[idx].u.chat->su_nick);
|
|
|
+ dprintf(idx, "\n");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -640,9 +601,7 @@ struct user_entry_type USERENTRY_SECPASS =
|
|
|
0,
|
|
|
def_gotshare,
|
|
|
def_unpack,
|
|
|
-#ifdef HUB
|
|
|
def_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
def_kill,
|
|
|
def_get,
|
|
|
def_set,
|
|
|
@@ -664,7 +623,6 @@ static bool laston_unpack(struct userrec *u, struct user_entry *e)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static bool laston_write_userfile(FILE * f, struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
struct laston_info *li = (struct laston_info *) e->u.extra;
|
|
|
@@ -674,7 +632,6 @@ static bool laston_write_userfile(FILE * f, struct userrec *u, struct user_entry
|
|
|
return 0;
|
|
|
return 1;
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
static bool laston_kill(struct user_entry *e)
|
|
|
{
|
|
|
@@ -729,9 +686,7 @@ struct user_entry_type USERENTRY_LASTON =
|
|
|
0, /* always 0 ;) */
|
|
|
laston_gotshare,
|
|
|
laston_unpack,
|
|
|
-#ifdef HUB
|
|
|
laston_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
laston_kill,
|
|
|
def_get,
|
|
|
laston_set,
|
|
|
@@ -795,7 +750,6 @@ static bool botaddr_kill(struct user_entry *e)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static bool botaddr_write_userfile(FILE *f, struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
register struct bot_addr *bi = (struct bot_addr *) e->u.extra;
|
|
|
@@ -805,7 +759,6 @@ static bool botaddr_write_userfile(FILE *f, struct userrec *u, struct user_entry
|
|
|
return 0;
|
|
|
return 1;
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
static bool botaddr_set(struct userrec *u, struct user_entry *e, void *buf)
|
|
|
{
|
|
|
@@ -835,25 +788,26 @@ static bool botaddr_set(struct userrec *u, struct user_entry *e, void *buf)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static void botaddr_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
{
|
|
|
- struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
+ if (conf.bot->hub) {
|
|
|
+ struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
|
|
|
|
|
|
- get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
- if (glob_admin(fr)) {
|
|
|
- register struct bot_addr *bi = (struct bot_addr *) e->u.extra;
|
|
|
- if (bi->address && bi->hublevel && bi->hublevel != 0) {
|
|
|
- dprintf(idx, " ADDRESS: %.70s\n", bi->address);
|
|
|
- dprintf(idx, " port: %d\n", bi->telnet_port);
|
|
|
+ get_user_flagrec(dcc[idx].user, &fr, NULL);
|
|
|
+ if (glob_admin(fr)) {
|
|
|
+ register struct bot_addr *bi = (struct bot_addr *) e->u.extra;
|
|
|
+
|
|
|
+ if (bi->address && bi->hublevel && bi->hublevel != 0) {
|
|
|
+ dprintf(idx, " ADDRESS: %.70s\n", bi->address);
|
|
|
+ dprintf(idx, " port: %d\n", bi->telnet_port);
|
|
|
+ }
|
|
|
+ if (bi->hublevel && bi->hublevel != 0)
|
|
|
+ dprintf(idx, " HUBLEVEL: %d\n", bi->hublevel);
|
|
|
+ if (bi->uplink && bi->uplink[0])
|
|
|
+ dprintf(idx, " UPLINK: %s\n", bi->uplink);
|
|
|
}
|
|
|
- if (bi->hublevel && bi->hublevel != 0)
|
|
|
- dprintf(idx, " HUBLEVEL: %d\n", bi->hublevel);
|
|
|
- if (bi->uplink && bi->uplink[0])
|
|
|
- dprintf(idx, " UPLINK: %s\n", bi->uplink);
|
|
|
}
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
static bool botaddr_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
|
|
|
{
|
|
|
@@ -880,21 +834,14 @@ struct user_entry_type USERENTRY_BOTADDR =
|
|
|
0, /* always 0 ;) */
|
|
|
botaddr_gotshare,
|
|
|
botaddr_unpack,
|
|
|
-#ifdef HUB
|
|
|
botaddr_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
botaddr_kill,
|
|
|
def_get,
|
|
|
botaddr_set,
|
|
|
-#ifdef HUB
|
|
|
botaddr_display,
|
|
|
-#else
|
|
|
- NULL,
|
|
|
-#endif /* HUB */
|
|
|
"BOTADDR"
|
|
|
};
|
|
|
|
|
|
-#ifdef HUB
|
|
|
static bool hosts_write_userfile(FILE *f, struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
struct list_type *h = NULL;
|
|
|
@@ -904,7 +851,6 @@ static bool hosts_write_userfile(FILE *f, struct userrec *u, struct user_entry *
|
|
|
return 0;
|
|
|
return 1;
|
|
|
}
|
|
|
-#endif /* HUB */
|
|
|
|
|
|
static bool hosts_null(struct userrec *u, struct user_entry *e)
|
|
|
{
|
|
|
@@ -920,11 +866,10 @@ static bool hosts_kill(struct user_entry *e)
|
|
|
|
|
|
static void hosts_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
{
|
|
|
-#ifdef LEAF
|
|
|
/* if this is a su, dont show hosts
|
|
|
* otherwise, let users see their own hosts */
|
|
|
- if (dcc[idx].simul || (!strcmp(u->handle,dcc[idx].nick) && !dcc[idx].u.chat->su_nick)) {
|
|
|
-#endif /* LEAF */
|
|
|
+ if (conf.bot->hub ||
|
|
|
+ (!conf.bot->hub && (dcc[idx].simul || (!strcmp(u->handle,dcc[idx].nick) && !dcc[idx].u.chat->su_nick)))) {
|
|
|
char s[1024] = "";
|
|
|
struct list_type *q = NULL;
|
|
|
|
|
|
@@ -946,14 +891,12 @@ static void hosts_display(int idx, struct user_entry *e, struct userrec *u)
|
|
|
}
|
|
|
if (s[0])
|
|
|
dprintf(idx, "%s\n", s);
|
|
|
-#ifdef LEAF
|
|
|
- } else {
|
|
|
+ } else if (!conf.bot->hub) {
|
|
|
dprintf(idx, " HOSTS: Hidden on leaf bots.");
|
|
|
if (dcc[idx].u.chat->su_nick)
|
|
|
dprintf(idx, " Nice try, %s.", dcc[idx].u.chat->su_nick);
|
|
|
dprintf(idx, "\n");
|
|
|
}
|
|
|
-#endif /* LEAF */
|
|
|
}
|
|
|
|
|
|
static bool hosts_set(struct userrec *u, struct user_entry *e, void *buf)
|
|
|
@@ -1006,9 +949,7 @@ struct user_entry_type USERENTRY_HOSTS =
|
|
|
0,
|
|
|
hosts_gotshare,
|
|
|
hosts_null,
|
|
|
-#ifdef HUB
|
|
|
hosts_write_userfile,
|
|
|
-#endif /* HUB */
|
|
|
hosts_kill,
|
|
|
def_get,
|
|
|
hosts_set,
|