- std::string *webirc_hostname, *webirc_ip;
- if(user->GetExt("cgiirc_webirc_hostname", webirc_hostname))
- {
- strlcpy(user->host,webirc_hostname->c_str(),63);
- strlcpy(user->dhost,webirc_hostname->c_str(),63);
- delete webirc_hostname;
- user->InvalidateCache();
- user->Shrink("cgiirc_webirc_hostname");
- }
- if(user->GetExt("cgiirc_webirc_ip", webirc_ip))
- {
- bool valid=false;
- user->RemoveCloneCounts();
-#ifdef IPV6
- valid = (inet_pton(AF_INET6, webirc_ip->c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0);
-
- if(!valid)
- valid = (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr));
-#else
- if (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr))
- valid = true;
-#endif
-
- delete webirc_ip;
- user->InvalidateCache();
- user->Shrink("cgiirc_webirc_ip");
- ServerInstance->AddLocalClone(user);
- ServerInstance->AddGlobalClone(user);
- user->CheckClass();
- }
+ std::string *webirc_hostname = cmd.webirc_hostname.get(user);
+ std::string *webirc_ip = cmd.webirc_ip.get(user);
+ if (!webirc_ip)
+ return;
+ ServerInstance->Users->RemoveCloneCounts(user);
+ user->SetClientIP(webirc_ip->c_str());
+ user->InvalidateCache();
+ if (webirc_hostname && webirc_hostname->length() < 64)
+ user->host = user->dhost = *webirc_hostname;
+ else
+ user->host = user->dhost = user->GetIPString();
+ user->InvalidateCache();
+ ServerInstance->Users->AddLocalClone(user);
+ ServerInstance->Users->AddGlobalClone(user);
+ user->SetClass();
+ user->CheckClass();
+ user->CheckLines(true);
+ cmd.webirc_ip.unset(user);
+ cmd.webirc_hostname.unset(user);