chanuser::chanuser(const char *m, const chan *ch, const int f, const bool scan) #ifdef HAVE_MODULES : CustomDataStorage() #endif { char *a = strchr(m, '!'); char *b = strchr(m, '@'); reason = NULL; if(!a || !b) { memset(this, 0, sizeof(chanuser)); return; } mem_strncpy(nick, m, (int) abs(m - a) +1); mem_strncpy(ident, a+1, (int) abs(a - b)); mem_strcpy(host, b+1); flags = f; if(scan) flags |= userlist.getFlags(m, ch); hash = ::hash32(nick); handle = NULL; switch(isValidIp(host)) { case 4: dnsinfo = HOST_IPV4; mem_strcpy(ip4, host); mem_strcpy(ip6, ""); break; case 6: dnsinfo = HOST_IPV6; mem_strcpy(ip4, ""); mem_strcpy(ip6, host); break; default: dnsinfo = HOST_DOMAIN; mem_strcpy(ip4, ""); mem_strcpy(ip6, ""); break; } clones_to_check = CLONE_HOST | CLONE_IPV6 | CLONE_IPV4 | CLONE_IDENT | CLONE_PROXY; HOOK( onNewChanuser( this ) ); }
const char *src_line( const char *line, int len ) { char *pt; if (!Lines) src_create(); ++Info.line; Info.index = Used; Info.offset = 0; Lines[Used] = mem_strncpy( StringHeap, line, len ); for (pt = (char*)__UNCONST(Lines[Used]); *pt; pt++) if (*pt == '\t') *pt = ' '; PRINTF(MAA_SRC,("Line %d: %s",Used,Lines[Used])); if (++Used >= Count) Lines = xrealloc( Lines, (Count += INCREMENT) * sizeof( char * ) ); return Lines[ Used - 1 ]; }
chanuser::chanuser(const char *str) #ifdef HAVE_MODULES : CustomDataStorage() #endif { char *a = strchr(str, '!'); if(a) mem_strncpy(nick, str, (int) abs(str - a) + 1); else mem_strcpy(nick, str); flags = 0; ident = NULL; host = NULL; hash = ::hash32(nick); handle = NULL; reason = NULL; ip4 = NULL; ip6 = NULL; HOOK( onNewChanuser( this ) ); }
const char *str_pool_copyn( str_Pool pool, const char *s, int length ) { poolInfo p = (poolInfo)pool; return mem_strncpy( p->string, s, length ); }