#include "modules.h"
#include "inspircd.h"
+extern InspIRCd* ServerInstance;
+
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
/* $ModDesc: Provides support for RFC 1413 ident lookups */
userrec* u; // user record that the lookup is associated with
int ufd;
- RFC1413(userrec* user, int maxtime, Server* S) : InspSocket(user->GetIPString(), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
+ RFC1413(InspIRCd* SI, userrec* user, int maxtime, Server* S) : InspSocket(SI, user->GetIPString(), 113, false, maxtime), Srv(S), u(user), ufd(user->fd)
{
- Srv->Log(DEBUG,"Ident: associated.");
+ log(DEBUG,"Ident: associated.");
}
virtual void OnTimeout()
if (u && (fd_ref_table[ufd] == u))
{
u->Shrink("ident_data");
- Srv->SendServ(u->fd,"NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using "+std::string(u->ident)+" instead.");
+ u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using "+std::string(u->ident)+" instead.");
}
}
{
if (u && (fd_ref_table[ufd] == u))
{
- strlcpy(u->ident,section,IDENTMAX);
- Srv->Log(DEBUG,"IDENT SET: "+std::string(u->ident));
- Srv->SendServ(u->fd,"NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
+ if (ServerInstance->IsIdent(section))
+ {
+ strlcpy(u->ident,section,IDENTMAX);
+ log(DEBUG,"IDENT SET: "+std::string(u->ident));
+ u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
+ }
}
}
return false;
themlen = sizeof(sock_them);
if ((getsockname(this->u->fd,(sockaddr*)&sock_us,&uslen) || getpeername(this->u->fd, (sockaddr*)&sock_them, &themlen)))
{
- Srv->Log(DEBUG,"Ident: failed to get socket names, bailing");
+ log(DEBUG,"Ident: failed to get socket names, bailing");
return false;
}
else
snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
#endif
this->Write(ident_request);
- Srv->Log(DEBUG,"Sent ident request, waiting for reply");
+ log(DEBUG,"Sent ident request, waiting for reply");
return true;
}
}
* is derived from InspSocket, and inserting it into the socket engine using the
* Server::AddSocket() call.
*/
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
- RFC1413* ident = new RFC1413(user, IdentTimeout, Srv);
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
+ RFC1413* ident = new RFC1413(ServerInstance, user, IdentTimeout, Srv);
if (ident->GetState() != I_ERROR)
{
user->Extend("ident_data", (char*)ident);
}
else
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead.");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead.");
DELETE(ident);
}
}