Further cleanups in dcc.c, removing unused variables and reworking dcc_exempt_save().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@430 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
54
source/dcc.c
54
source/dcc.c
@@ -416,15 +416,14 @@ char *othername = NULL;
|
|||||||
*/
|
*/
|
||||||
DCC_List *find_dcc_pending(char *nick, char *desc, char *othername, int type, int remove, int num)
|
DCC_List *find_dcc_pending(char *nick, char *desc, char *othername, int type, int remove, int num)
|
||||||
{
|
{
|
||||||
unsigned long dcc_type;
|
unsigned long dcc_type;
|
||||||
unsigned long flags;
|
SocketList *s;
|
||||||
SocketList *s;
|
DCC_int *n;
|
||||||
DCC_int *n;
|
DCC_List *new_i;
|
||||||
DCC_List *new_i;
|
DCC_List *last_i = NULL;
|
||||||
DCC_List *last_i = NULL;
|
|
||||||
for (new_i = pending_dcc; new_i; last_i = new_i, new_i = new_i->next)
|
for (new_i = pending_dcc; new_i; last_i = new_i, new_i = new_i->next)
|
||||||
{
|
{
|
||||||
flags = new_i->sock.flags;
|
|
||||||
s = &new_i->sock;
|
s = &new_i->sock;
|
||||||
n = (DCC_int *)s->info;
|
n = (DCC_int *)s->info;
|
||||||
dcc_type = s->flags & DCC_TYPES;
|
dcc_type = s->flags & DCC_TYPES;
|
||||||
@@ -2087,19 +2086,11 @@ void BX_dcc_resend(char *command, char *args)
|
|||||||
|
|
||||||
void start_dcc_get(int snum)
|
void start_dcc_get(int snum)
|
||||||
{
|
{
|
||||||
DCC_int *n;
|
SocketList *s = get_socket(snum);
|
||||||
SocketList *s;
|
DCC_int *n = s->info;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
unsigned long type;
|
char buffer[MAX_DCC_BLOCK_SIZE+1];
|
||||||
int tdcc = 0;
|
int err;
|
||||||
char buffer[MAX_DCC_BLOCK_SIZE+1];
|
|
||||||
int err;
|
|
||||||
s = get_socket(snum);
|
|
||||||
n = (DCC_int *)s->info;
|
|
||||||
type = s->flags & DCC_TYPES;
|
|
||||||
tdcc = s->flags & DCC_TDCC;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set_display_target(NULL, LOG_DCC);
|
set_display_target(NULL, LOG_DCC);
|
||||||
bytes_read = read(snum, buffer, MAX_DCC_BLOCK_SIZE);
|
bytes_read = read(snum, buffer, MAX_DCC_BLOCK_SIZE);
|
||||||
@@ -2996,7 +2987,7 @@ char *nick;
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
userage("/dcc exempt", "+nick to add, nick to remove");
|
userage("dcc exempt", "+nick to add, nick to remove");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nick = next_arg(args, &args);
|
nick = next_arg(args, &args);
|
||||||
@@ -3021,32 +3012,27 @@ char *nick;
|
|||||||
bitchsay("added %s to dcc exempt list", nick);
|
bitchsay("added %s to dcc exempt list", nick);
|
||||||
}
|
}
|
||||||
else if (remove && !nptr)
|
else if (remove && !nptr)
|
||||||
put_it("%s", convert_output_format("$G: %RDCC%n No such nick on the exempt list %K[%W$0%K]", "%s", nick));
|
put_it("%s", convert_output_format("$G %RDCC%n No such nick on the exempt list %K[%W$0%K]", "%s", nick));
|
||||||
nick = next_arg(args, &args);
|
nick = next_arg(args, &args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int dcc_exempt_save(FILE *fptr)
|
int dcc_exempt_save(FILE *fptr)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
List *nptr = NULL;
|
List *nptr = NULL;
|
||||||
if (dcc_no_flood)
|
|
||||||
{
|
fprintf(fptr, "# Exemptions from DCC autoget / flooding controls\n");
|
||||||
fprintf(fptr, "# Dcc Exempt from autoget OFF list\n");
|
|
||||||
fprintf(fptr, "DCC EXEMPT ");
|
|
||||||
}
|
|
||||||
for (nptr = next_namelist(dcc_no_flood, NULL, DCC_HASHSIZE); nptr; nptr = next_namelist(dcc_no_flood, nptr, DCC_HASHSIZE))
|
for (nptr = next_namelist(dcc_no_flood, NULL, DCC_HASHSIZE); nptr; nptr = next_namelist(dcc_no_flood, nptr, DCC_HASHSIZE))
|
||||||
{
|
{
|
||||||
fprintf(fptr, "+%s ", nptr->name);
|
fprintf(fptr, "DCC EXEMPT +%s\n", nptr->name);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (dcc_no_flood)
|
|
||||||
{
|
|
||||||
fprintf(fptr, "\n");
|
|
||||||
if (count && do_hook(SAVEFILE_LIST, "DCCexempt %d", count))
|
if (count && do_hook(SAVEFILE_LIST, "DCCexempt %d", count))
|
||||||
bitchsay("Saved %d DccExempt entries", count);
|
bitchsay("Saved %d DccExempt entries", count);
|
||||||
|
|
||||||
}
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user