summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authordane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-09-29 20:19:18 +0000
committerdane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-09-29 20:19:18 +0000
commit676b8eaf7fcec02ad2583dc0bcc531942b65068e (patch)
treed8405dc99f4b8a50935452374b7afc983dfde641 /src/misc.c
parentb6f83ea4db94339449c05be946477b729e9b991a (diff)
BUILD : 1.7.5 (362) BUGS : 17 143 147 166 172 173 NOTES : Applied patch 927 provided by Trystan.
git-svn-id: svn://svn.anope.org/anope/trunk@362 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@233 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/misc.c b/src/misc.c
index be34f3bf6..ec9e4944a 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -663,7 +663,7 @@ void EnforceQlinedNick(char *nick, char *killer)
}
}
-int nickIsServices(char *nick)
+int nickIsServices(char *nick, int bot)
{
int found = 0;
@@ -704,7 +704,7 @@ int nickIsServices(char *nick)
else if (s_GlobalNoticerAlias
&& (stricmp(nick, s_GlobalNoticerAlias) == 0))
found++;
- else if (s_BotServ) {
+ else if (s_BotServ && bot) {
BotInfo *bi;
int i;
for (i = 0; i < 256; i++) {
@@ -831,4 +831,58 @@ u_int32_t getrandom32(void)
return val;
}
+char *send_token(char *token1, char *token2)
+{
+ if (UseTokens && ircd->token && ircdcap->token) {
+ return token2;
+ }
+ else {
+ return token1;
+ }
+}
+
+int myNumToken(const char *str, const char dilim)
+{
+ int len, idx, counter = 0, start_pos = 0;
+ if (!str) {
+ return 0;
+ }
+ len = strlen(str);
+ for (idx = 0; idx <= len; idx++) {
+ if ((str[idx] == dilim) || (idx == len)) {
+ start_pos = idx + 1;
+ counter++;
+ }
+ }
+ return counter;
+}
+
+
+char *host_resolve(char *host)
+{
+ struct hostent *hentp = NULL;
+ uint32 ip = INADDR_NONE;
+ char ipbuf[16];
+ char *ipreturn;
+ struct in_addr addr;
+
+ ipreturn = NULL;
+
+ hentp = gethostbyname(host);
+
+ if (hentp) {
+ memcpy(&ip, hentp->h_addr, sizeof(hentp->h_length));
+ addr.s_addr = ip;
+ ntoa(addr, ipbuf, sizeof(ipbuf));
+ ipreturn = strdup(ipbuf);
+ if (debug) {
+ alog("Resolved %s to %s",host, ipbuf);
+ }
+ return ipreturn;
+ }
+ else {
+ return ipreturn;
+ }
+}
+