#include "s_newconf.h"
#include "hostmask.h"
#include "client.h"
-#include "irc_string.h"
+#include "match.h"
#include "hash.h"
/* conf_add_fields()
user_field, operreason_field, date_field);
if(aconf->host != NULL)
- add_conf_by_address(aconf->host, CONF_KILL, aconf->user, aconf);
+ add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf);
}
}
}
}
+char *
+xline_encode_spaces(const char *mask)
+{
+ int i, j;
+ int spaces = 0;
+ int backslash = 0;
+ char *encoded;
+
+ for (i = 0; mask[i] != '\0'; i++)
+ if (mask[i] == ' ')
+ spaces++;
+ encoded = rb_malloc(i + spaces + 1);
+ for (i = 0, j = 0; mask[i] != '\0'; i++)
+ {
+ if (mask[i] == '\\')
+ backslash = !backslash;
+ else if (mask[i] == ' ')
+ {
+ if (!backslash)
+ encoded[j++] = '\\';
+ encoded[j++] = 's';
+ backslash = 0;
+ continue;
+ }
+ else
+ backslash = 0;
+ encoded[j++] = mask[i];
+ }
+ return encoded;
+}
+
void
parse_x_file(FILE * file)
{
char *reason_field = NULL;
char line[BUFSIZE];
char *p;
+ char *encoded;
while (fgets(line, sizeof(line), file))
{
(strchr(reason_field, ':') != NULL))
continue;
+ encoded = xline_encode_spaces(gecos_field);
+ if (find_xline_mask(encoded) != NULL)
+ {
+ rb_free(encoded);
+ continue;
+ }
+
aconf = make_conf();
aconf->status = CONF_XLINE;
- aconf->name = rb_strdup(gecos_field);
+ aconf->host = encoded;
aconf->passwd = rb_strdup(reason_field);
rb_dlinkAddAlloc(aconf, &xline_conf_list);
aconf->status = CONF_RESV_CHANNEL;
aconf->port = 0;
- aconf->name = rb_strdup(host_field);
+ aconf->host = rb_strdup(host_field);
aconf->passwd = rb_strdup(reason_field);
- add_to_resv_hash(aconf->name, aconf);
+ add_to_resv_hash(aconf->host, aconf);
}
else if(clean_resv_nick(host_field))
{
aconf->status = CONF_RESV_NICK;
aconf->port = 0;
- aconf->name = rb_strdup(host_field);
+ aconf->host = rb_strdup(host_field);
aconf->passwd = rb_strdup(reason_field);
rb_dlinkAddAlloc(aconf, &resv_conf_list);
}