]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_flashpolicyd.cpp
Some more text fixes and improvements (#1618).
[user/henk/code/inspircd.git] / src / modules / m_flashpolicyd.cpp
index 8f847e1117772feb24050241344fdb2876e8913a..923c0cbffc6870c10ab86eab446b1be50dc114d1 100644 (file)
@@ -84,7 +84,7 @@ class ModuleFlashPD : public Module
  public:
        ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
        {
-               if (from->bind_tag->getString("type") != "flashpolicyd")
+               if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "flashpolicyd"))
                        return MOD_RES_PASSTHRU;
 
                if (policy_reply.empty())
@@ -97,7 +97,6 @@ class ModuleFlashPD : public Module
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("flashpolicyd");
-               timeout = tag->getInt("timeout", 5, 1);
                std::string file = tag->getString("file");
 
                if (!file.empty())
@@ -109,10 +108,7 @@ class ModuleFlashPD : public Module
                        }
                        catch (CoreException&)
                        {
-                               const std::string error_message = "A file was specified for FlashPD, but it could not be loaded.";
-                               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, error_message);
-                               ServerInstance->SNO->WriteGlobalSno('a', error_message);
-                               policy_reply.clear();
+                               throw ModuleException("A file was specified for FlashPD, but it could not be loaded at " + tag->getTagLocation());
                        }
                        return;
                }
@@ -123,10 +119,10 @@ class ModuleFlashPD : public Module
                for (std::vector<ListenSocket*>::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i)
                {
                                ListenSocket* ls = *i;
-                               if (ls->bind_tag->getString("type", "clients") != "clients" || ls->bind_tag->getString("ssl", "plaintext") != "plaintext")
+                               if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients"), "clients") || !ls->bind_tag->getString("ssl").empty())
                                        continue;
 
-                               to_ports.append(ConvToStr(ls->bind_port)).push_back(',');
+                               to_ports.append(ConvToStr(ls->bind_sa.port())).push_back(',');
                }
 
                if (to_ports.empty())
@@ -144,9 +140,10 @@ class ModuleFlashPD : public Module
 <site-control permitted-cross-domain-policies=\"master-only\"/>\
 <allow-access-from domain=\"*\" to-ports=\"" + to_ports + "\" />\
 </cross-domain-policy>";
+               timeout = tag->getDuration("timeout", 5, 1);
        }
 
-       CullResult cull()
+       CullResult cull() CXX11_OVERRIDE
        {
                for (insp::intrusive_list<FlashPDSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i)
                {
@@ -158,7 +155,7 @@ class ModuleFlashPD : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Flash Policy Daemon. Allows Flash IRC clients to connect", VF_VENDOR);
+               return Version("Flash Policy Daemon, allows Flash IRC clients to connect", VF_VENDOR);
        }
 };