]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_ident.cpp
Mark +P mode as oper-only now that it no longer requires an explicit permission string
[user/henk/code/inspircd.git] / src / modules / m_ident.cpp
index 56fa47db8bae4c1e66d9a3aeac8ef837a4f6249c..ead8a2021fcaf9712f509c338ec2457af37401a5 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
 class IdentRequestSocket : public EventHandler
 {
  private:
-       User *user;                     /* User we are attached to */
+       LocalUser *user;                        /* User we are attached to */
        bool done;                      /* True if lookup is finished */
        std::string result;             /* Holds the ident string if done */
  public:
        time_t age;
 
-       IdentRequestSocket(User* u) : user(u), result(u->ident)
+       IdentRequestSocket(LocalUser* u) : user(u), result(u->ident)
        {
                age = ServerInstance->Time();
-               socklen_t size = 0;
 
                SetFd(socket(user->server_sa.sa.sa_family, SOCK_STREAM, 0));
 
@@ -110,7 +109,7 @@ class IdentRequestSocket : public EventHandler
                }
 
                /* Attempt to bind (ident requests must come from the ip the query is referring to */
-               if (ServerInstance->SE->Bind(GetFd(), &bindaddr.sa, size) < 0)
+               if (ServerInstance->SE->Bind(GetFd(), bindaddr) < 0)
                {
                        this->Close();
                        throw ModuleException("failed to bind()");
@@ -119,7 +118,7 @@ class IdentRequestSocket : public EventHandler
                ServerInstance->SE->NonBlocking(GetFd());
 
                /* Attempt connection (nonblocking) */
-               if (ServerInstance->SE->Connect(this, &connaddr.sa, size) == -1 && errno != EINPROGRESS)
+               if (ServerInstance->SE->Connect(this, &connaddr.sa, connaddr.sa_size()) == -1 && errno != EINPROGRESS)
                {
                        this->Close();
                        throw ModuleException("connect() failed");
@@ -291,7 +290,7 @@ class ModuleIdent : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Provides support for RFC1413 ident lookups", VF_VENDOR, API_VERSION);
+               return Version("Provides support for RFC1413 ident lookups", VF_VENDOR);
        }
 
        virtual void OnRehash(User *user)
@@ -303,7 +302,7 @@ class ModuleIdent : public Module
                        RequestTimeout = 5;
        }
 
-       virtual ModResult OnUserRegister(User *user)
+       virtual ModResult OnUserRegister(LocalUser *user)
        {
                ConfigTag* tag = user->MyClass->config;
                if (!tag->getBool("useident", true))
@@ -319,7 +318,7 @@ class ModuleIdent : public Module
 
                try
                {
-                       IdentRequestSocket *isock = new IdentRequestSocket(user);
+                       IdentRequestSocket *isock = new IdentRequestSocket(IS_LOCAL(user));
                        ext.set(user, isock);
                }
                catch (ModuleException &e)
@@ -334,7 +333,7 @@ class ModuleIdent : public Module
         * creating a Timer object and especially better than creating a
         * Timer per ident lookup!
         */
-       virtual ModResult OnCheckReady(User *user)
+       virtual ModResult OnCheckReady(LocalUser *user)
        {
                /* Does user have an ident socket attached at all? */
                IdentRequestSocket *isock = ext.get(user);
@@ -389,10 +388,10 @@ class ModuleIdent : public Module
        {
                /* Module unloading, tidy up users */
                if (target_type == TYPE_USER)
-                       OnUserDisconnect((User*)item);
+                       OnUserDisconnect((LocalUser*)item);
        }
 
-       virtual void OnUserDisconnect(User *user)
+       virtual void OnUserDisconnect(LocalUser *user)
        {
                /* User disconnect (generic socket detatch event) */
                IdentRequestSocket *isock = ext.get(user);