Remove code to write bans to csv files.

This commit is contained in:
Jilles Tjoelker 2010-02-22 19:09:46 +01:00
parent 3fe59c99c7
commit 22342cd11f
2 changed files with 1 additions and 169 deletions

View file

@ -335,23 +335,11 @@ extern void yyerror(const char *);
extern int conf_yy_fatal_error(const char *); extern int conf_yy_fatal_error(const char *);
extern int conf_fgets(char *, int, FILE *); extern int conf_fgets(char *, int, FILE *);
typedef enum
{
CONF_TYPE,
KLINE_TYPE,
DLINE_TYPE,
RESV_TYPE
}
KlineType;
extern void write_confitem(KlineType, struct Client *, char *, char *,
const char *, const char *, const char *, int);
extern void add_temp_kline(struct ConfItem *); extern void add_temp_kline(struct ConfItem *);
extern void add_temp_dline(struct ConfItem *); extern void add_temp_dline(struct ConfItem *);
extern void report_temp_klines(struct Client *); extern void report_temp_klines(struct Client *);
extern void show_temp_klines(struct Client *, rb_dlink_list *); extern void show_temp_klines(struct Client *, rb_dlink_list *);
extern const char *get_conf_name(KlineType);
extern int rehash(int); extern int rehash(int);
extern void rehash_bans(int); extern void rehash_bans(int);

View file

@ -1103,7 +1103,7 @@ read_conf_files(int cold)
conf_fbfile_in = NULL; conf_fbfile_in = NULL;
filename = get_conf_name(CONF_TYPE); filename = ConfigFileEntry.configfile;
/* We need to know the initial filename for the yyerror() to report /* We need to know the initial filename for the yyerror() to report
FIXME: The full path is in conffilenamebuf first time since we FIXME: The full path is in conffilenamebuf first time since we
@ -1235,162 +1235,6 @@ clear_out_old_conf(void)
} }
/* write_confitem()
*
* inputs - kline, dline or resv type flag
* - client pointer to report to
* - user name of target
* - host name of target
* - reason for target
* - time string
* - type of xline
* output - NONE
* side effects - This function takes care of finding the right conf
* file and adding the line to it, as well as notifying
* opers and the user.
*/
void
write_confitem(KlineType type, struct Client *source_p, char *user,
char *host, const char *reason, const char *oper_reason,
const char *current_date, int xtype)
{
char buffer[1024];
FILE *out;
const char *filename; /* filename to use for kline */
filename = get_conf_name(type);
if(type == KLINE_TYPE)
{
if(EmptyString(oper_reason))
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added K-Line for [%s@%s] [%s]",
get_oper_name(source_p), user,
host, reason);
ilog(L_KLINE, "K %s 0 %s %s %s",
get_oper_name(source_p), user, host, reason);
}
else
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added K-Line for [%s@%s] [%s|%s]",
get_oper_name(source_p), user,
host, reason, oper_reason);
ilog(L_KLINE, "K %s 0 %s %s %s|%s",
get_oper_name(source_p), user, host,
reason, oper_reason);
}
sendto_one_notice(source_p, ":Added K-Line [%s@%s]",
user, host);
}
else if(type == DLINE_TYPE)
{
if(EmptyString(oper_reason))
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added D-Line for [%s] [%s]",
get_oper_name(source_p), host, reason);
ilog(L_KLINE, "D %s 0 %s %s",
get_oper_name(source_p), host, reason);
}
else
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added D-Line for [%s] [%s|%s]",
get_oper_name(source_p), host,
reason, oper_reason);
ilog(L_KLINE, "D %s 0 %s %s|%s",
get_oper_name(source_p), host,
reason, oper_reason);
}
sendto_one_notice(source_p, ":Added D-Line [%s] to %s", host, filename);
}
else if(type == RESV_TYPE)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added RESV for [%s] [%s]",
get_oper_name(source_p), host, reason);
ilog(L_KLINE, "R %s 0 %s %s",
get_oper_name(source_p), host, reason);
sendto_one_notice(source_p, ":Added RESV for [%s] [%s]",
host, reason);
}
if((out = fopen(filename, "a")) == NULL)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "*** Problem opening %s ", filename);
sendto_one_notice(source_p, ":*** Problem opening file, added temporarily only");
return;
}
if(oper_reason == NULL)
oper_reason = "";
if(type == KLINE_TYPE)
{
rb_snprintf(buffer, sizeof(buffer),
"\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n",
user, host, reason, oper_reason, current_date,
get_oper_name(source_p), (long int)rb_current_time());
}
else if(type == DLINE_TYPE)
{
rb_snprintf(buffer, sizeof(buffer),
"\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",%ld\n", host,
reason, oper_reason, current_date, get_oper_name(source_p), (long int)rb_current_time());
}
else if(type == RESV_TYPE)
{
rb_snprintf(buffer, sizeof(buffer), "\"%s\",\"%s\",\"%s\",%ld\n",
host, reason, get_oper_name(source_p), (long int)rb_current_time());
}
if(fputs(buffer, out) == -1)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "*** Problem writing to %s", filename);
sendto_one_notice(source_p, ":*** Problem writing to file, added temporarily only");
fclose(out);
return;
}
if (fclose(out))
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "*** Problem writing to %s", filename);
sendto_one_notice(source_p, ":*** Problem writing to file, added temporarily only");
return;
}
}
/* get_conf_name
*
* inputs - type of conf file to return name of file for
* output - pointer to filename for type of conf
* side effects - none
*/
const char *
get_conf_name(KlineType type)
{
if(type == CONF_TYPE)
{
return (ConfigFileEntry.configfile);
}
else if(type == DLINE_TYPE)
{
return (ConfigFileEntry.dlinefile);
}
else if(type == RESV_TYPE)
{
return (ConfigFileEntry.resvfile);
}
return ConfigFileEntry.klinefile;
}
/* /*
* conf_add_class_to_conf * conf_add_class_to_conf
* inputs - pointer to config item * inputs - pointer to config item