From df5547af726b75a3256dd313c484dc04f9f438c9 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 17 Apr 2011 03:33:00 +0000 Subject: [PATCH] Add .xxx TLD to country(), and some more const-correctness. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@122 13b04d17-f746-0410-82c6-800466cd88b0 --- include/misc.h | 2 +- source/misc.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/misc.h b/include/misc.h index cc3d010..6fe3745 100644 --- a/include/misc.h +++ b/include/misc.h @@ -118,7 +118,7 @@ ChannelList * BX_prepare_command (int *, char *, int); int timer_unban (void *, char *); void check_server_connect (int); - const char *country(char *); + const char *country(const char *); int do_newuser (char *, char *, char *); int char_fucknut (register unsigned char *, char, int); BanList *ban_is_on_channel(register char *, register ChannelList *); diff --git a/source/misc.c b/source/misc.c index 522c933..07680ab 100644 --- a/source/misc.c +++ b/source/misc.c @@ -4902,7 +4902,7 @@ void check_server_connect(int server) #endif } -const char *country(char *hostname) +const char *country(const char *hostname) { #ifndef BITCHX_LITE static const struct { @@ -5181,10 +5181,12 @@ static const struct { {"PRO", "Professional" }, {"TEL", "Contact Information" }, {"TRAVEL", "Travel Industry" }, + {"XXX", "Porn" }, {NULL, NULL} }; -char *p; -int i = 0; + const char *p; + int i = 0; + if (!hostname || !*hostname || isdigit((unsigned char)hostname[strlen(hostname)-1])) return "unknown"; if ((p = strrchr(hostname, '.')))