summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp6
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp4
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp4
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_cgiirc.cpp2
-rw-r--r--src/modules/m_filter.h4
-rw-r--r--src/modules/m_namesx.cpp8
-rw-r--r--src/modules/m_services_account.cpp2
-rw-r--r--src/modules/m_ssl_dummy.cpp4
-rw-r--r--src/modules/m_svshold.cpp2
-rw-r--r--src/modules/m_swhois.cpp2
-rw-r--r--src/modules/m_taxonomy.cpp123
-rw-r--r--src/modules/m_uhnames.cpp8
13 files changed, 153 insertions, 18 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index f4b2b294f..0acc3683c 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -164,9 +164,9 @@ void Module::OnGetServerDescription(const std::string &servername,std::string &
void Module::OnSyncUser(userrec* user, Module* proto, void* opaque) { };
void Module::OnSyncChannel(chanrec* chan, Module* proto, void* opaque) { };
void Module::ProtoSendMode(void* opaque, int target_type, void* target, const std::string &modeline) { };
-void Module::OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, const std::string &extname) { };
-void Module::OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname) { };
-void Module::OnSyncOtherMetaData(Module* proto, void* opaque) { };
+void Module::OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, const std::string &extname, bool displayable) { };
+void Module::OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable) { };
+void Module::OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable) { };
void Module::OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata) { };
void Module::ProtoSendMetaData(void* opaque, int target_type, void* target, const std::string &extname, const std::string &extdata) { };
void Module::OnWallops(userrec* user, const std::string &text) { };
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index def9abdd2..0e923df41 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -559,7 +559,7 @@ class ModuleSSLGnuTLS : public Module
}
}
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
// check if the linking module wants to know about OUR metadata
if(extname == "ssl")
@@ -569,7 +569,7 @@ class ModuleSSLGnuTLS : public Module
{
// call this function in the linking module, let it format the data how it
// sees fit, and send it on its way. We dont need or want to know how.
- proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
+ proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, displayable ? "Enabled" : "ON");
}
}
}
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index ee672b798..53c595365 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -644,7 +644,7 @@ class ModuleSSLOpenSSL : public Module
}
}
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
// check if the linking module wants to know about OUR metadata
if (extname == "ssl")
@@ -654,7 +654,7 @@ class ModuleSSLOpenSSL : public Module
{
// call this function in the linking module, let it format the data how it
// sees fit, and send it on its way. We dont need or want to know how.
- proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
+ proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, displayable ? "Enabled" : "ON");
}
}
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 32cd40d83..5491f5e3a 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -172,7 +172,7 @@ class ModuleCBan : public Module
return 0;
}
- virtual void OnSyncOtherMetaData(Module* proto, void* opaque)
+ virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable)
{
for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
{
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 04a56b1fa..b3cc24839 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -209,7 +209,7 @@ public:
}
}
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
if((extname == "cgiirc_realhost") || (extname == "cgiirc_realip"))
{
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h
index b31a03271..5797cc310 100644
--- a/src/modules/m_filter.h
+++ b/src/modules/m_filter.h
@@ -54,7 +54,7 @@ class FilterBase : public Module
virtual Version GetVersion();
std::string EncodeFilter(FilterResult* filter);
FilterResult DecodeFilter(const std::string &data);
- virtual void OnSyncOtherMetaData(Module* proto, void* opaque);
+ virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable = false);
virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata);
virtual int OnStats(char symbol, userrec* user, string_list &results) = 0;
virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line);
@@ -343,7 +343,7 @@ FilterResult FilterBase::DecodeFilter(const std::string &data)
return res;
}
-void FilterBase::OnSyncOtherMetaData(Module* proto, void* opaque)
+void FilterBase::OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable)
{
this->SyncFilters(proto, opaque);
}
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp
index dd2b32e7b..db8270cb9 100644
--- a/src/modules/m_namesx.cpp
+++ b/src/modules/m_namesx.cpp
@@ -31,13 +31,19 @@ class ModuleNamesX : public Module
void Implements(char* List)
{
- List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
+ List[I_OnSyncUserMetaData] = List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
}
virtual ~ModuleNamesX()
{
}
+ void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
+ {
+ if ((displayable) && (extname == "NAMESX"))
+ proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "Enabled");
+ }
+
virtual Version GetVersion()
{
return Version(1,1,0,1,VF_VENDOR,API_VERSION);
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 04d5751ec..6defa1e2e 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -225,7 +225,7 @@ class ModuleServicesAccount : public Module
// this method is called. We should use the ProtoSendMetaData function after we've
// corrected decided how the data should look, to send the metadata on its way if
// it is ours.
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
// check if the linking module wants to know about OUR metadata
if (extname == "accountname")
diff --git a/src/modules/m_ssl_dummy.cpp b/src/modules/m_ssl_dummy.cpp
index 69e4da3e1..6f1ee4789 100644
--- a/src/modules/m_ssl_dummy.cpp
+++ b/src/modules/m_ssl_dummy.cpp
@@ -52,7 +52,7 @@ class ModuleSSLDummy : public Module
}
}
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
// check if the linking module wants to know about OUR metadata
if(extname == "ssl")
@@ -62,7 +62,7 @@ class ModuleSSLDummy : public Module
{
// call this function in the linking module, let it format the data how it
// sees fit, and send it on its way. We dont need or want to know how.
- proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "ON");
+ proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, displayable ? "Enabled" : "ON");
}
}
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index ad1ec8085..abef3d713 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -194,7 +194,7 @@ class ModuleSVSHold : public Module
return 0;
}
- virtual void OnSyncOtherMetaData(Module* proto, void* opaque)
+ virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable)
{
for(SVSHoldMap::iterator iter = HoldMap.begin(); iter != HoldMap.end(); iter++)
{
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 3dcdb10f2..a79b1d10a 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -123,7 +123,7 @@ class ModuleSWhois : public Module
// this method is called. We should use the ProtoSendMetaData function after we've
// corrected decided how the data should look, to send the metadata on its way if
// it is ours.
- virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname)
+ virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable)
{
// check if the linking module wants to know about OUR metadata
if (extname == "swhois")
diff --git a/src/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp
new file mode 100644
index 000000000..c573e7761
--- /dev/null
+++ b/src/modules/m_taxonomy.cpp
@@ -0,0 +1,123 @@
+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
+ *
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ * the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include <stdio.h>
+#include "users.h"
+#include "channels.h"
+#include "modules.h"
+#include "inspircd.h"
+
+/* $ModDesc: Provides the /TAXONOMY command, used to view all metadata attached to a user */
+
+/** Handle /WOOT
+ */
+class cmd_taxonomy : public command_t
+{
+ Module* Creator;
+ bool& claimed;
+ public:
+ /* Command 'taxonomy', takes no parameters and needs no special modes */
+ cmd_taxonomy (InspIRCd* Instance, Module* maker, bool &claim) : command_t(Instance,"TAXONOMY", 'o', 1), Creator(maker), claimed(claim)
+ {
+ this->source = "m_taxonomy.so";
+ }
+
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+ {
+ userrec* dest = ServerInstance->FindNick(parameters[0]);
+ if (dest)
+ {
+ std::deque<std::string> list;
+ list.clear();
+ user->GetExtList(list);
+ user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY ITEMS " + std::string(dest->nick) + " " +ConvToStr(list.size()));
+ for (unsigned int j = 0; j < list.size(); j++)
+ {
+ claimed = false;
+ FOREACH_MOD(I_OnSyncUserMetaData, OnSyncUserMetaData(user, Creator, dest, list[j], true));
+ if (!claimed)
+ {
+ user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY METADATA " + list[j] + " = <unknown>");
+ }
+ }
+ user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY END");
+ }
+ return CMD_FAILURE;
+ }
+};
+
+class ModuleTaxonomy : public Module
+{
+ cmd_taxonomy* newcommand;
+ bool claimed;
+ public:
+ ModuleTaxonomy(InspIRCd* Me)
+ : Module::Module(Me)
+ {
+
+ // Create a new command
+ newcommand = new cmd_taxonomy(ServerInstance, this, claimed);
+ ServerInstance->AddCommand(newcommand);
+ }
+
+ void Implements(char* List)
+ {
+ List[I_ProtoSendMetaData] = 1;
+ }
+
+ void ProtoSendMetaData(void* opaque, int target_type, void* target, const std::string &extname, const std::string &extdata)
+ {
+ if (target_type == TYPE_USER)
+ {
+ userrec* spool = (userrec*)opaque;
+ std::string taxstr = "304 " + std::string(spool->nick) + ":TAXONOMY METADATA "+extname+" = "+extdata;
+ spool->WriteServ(taxstr);
+ claimed = true;
+ }
+ }
+
+ virtual ~ModuleTaxonomy()
+ {
+ }
+
+ virtual Version GetVersion()
+ {
+ return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
+ }
+};
+
+
+class ModuleTaxonomyFactory : public ModuleFactory
+{
+ public:
+ ModuleTaxonomyFactory()
+ {
+ }
+
+ ~ModuleTaxonomyFactory()
+ {
+ }
+
+ virtual Module * CreateModule(InspIRCd* Me)
+ {
+ return new ModuleTaxonomy(Me);
+ }
+
+};
+
+
+extern "C" void * init_module( void )
+{
+ return new ModuleTaxonomyFactory;
+}
+
diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp
index b0981d58d..3663ab4ca 100644
--- a/src/modules/m_uhnames.cpp
+++ b/src/modules/m_uhnames.cpp
@@ -32,13 +32,19 @@ class ModuleUHNames : public Module
void Implements(char* List)
{
- List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
+ List[I_OnSyncUserMetaData] = List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
}
virtual ~ModuleUHNames()
{
}
+ void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
+ {
+ if ((displayable) && (extname == "UHNAMES"))
+ proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "Enabled");
+ }
+
virtual Version GetVersion()
{
return Version(1,1,0,1,VF_VENDOR,API_VERSION);