summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp29
-rw-r--r--src/modules.cpp45
2 files changed, 73 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 547d47536..ac5de7267 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -2534,6 +2534,7 @@ void handle_pipe(char token,char* params,serverrec* source,serverrec* reply, cha
void process_restricted_commands(char token,char* params,serverrec* source,serverrec* reply, char* tcp_host,char* ipaddr,int port)
{
char buffer[MAXBUF];
+ int MOD_RESULT = 0;
switch(token)
{
@@ -2751,7 +2752,33 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
break;
// anything else
default:
- WriteOpers("WARNING! Unknown datagram type '%c'",token);
+ MOD_RESULT = 0;
+ string_list s;
+ char* data = strtok(params," ");
+ while (data)
+ {
+ if (*data == ':')
+ {
+ // the last item is a special case
+ data++;
+ char datalast[MAXBUF];
+ strlcpy(datalast,data,MAXBUF);
+ data = strtok(NULL," ");
+ while (data)
+ {
+ strlcpy(datalast," ",MAXBUF);
+ strlcpy(datalast,data,MAXBUF);
+ data = strtok(NULL," ");
+ }
+ s.push_back(data);
+ break;
+ }
+ s.push_back(data);
+ data = strtok(NULL," ");
+ }
+ FOREACH_RESULT(OnMeshToken(token,s,source,reply,tcp_host,ipaddr,port));
+ if (!MOD_RESULT)
+ WriteOpers("WARNING! Unknown datagram type '%c'",token);
break;
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index f7b716470..aa856e7c0 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -346,6 +346,7 @@ void Module::OnStats(char symbol) { };
int Module::OnChangeLocalUserHost(userrec* user, std::string newhost) { return 0; };
int Module::OnChangeLocalUserGECOS(userrec* user, std::string newhost) { return 0; };
int Module::OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic) { return 0; };
+int Module::OnMeshToken(char token,string_list params,serverrec* source,serverrec* reply, std::string tcp_host,std::string ipaddr,int port) { return 0; };
// server is a wrapper class that provides methods to all of the C-style
// exports in the core
@@ -714,6 +715,50 @@ bool Server::IsValidMask(std::string mask)
return true;
}
+void Server::MeshSendAll(std::string text)
+{
+ NetSendToAll((char*)text.c_str());
+}
+
+void Server::MeshSendCommon(userrec* user, std::string text)
+{
+ if (user)
+ NetSendToCommon(user,(char*)text.c_str());
+}
+
+void Server::MeshSendAllAlive(std::string text)
+{
+ NetSendToAllAlive((char*)text.c_str());
+}
+
+void Server::MeshSendUnicast(std::string destination, std::string text)
+{
+ NetSendToOne((char*)destination.c_str(),(char*)text.c_str());
+}
+
+void Server::MeshSendAllExcept(std::string target, std::string text)
+{
+ NetSendToAllExcept(target.c_str(),(char*)text.c_str());
+}
+
+bool Server::MeshCheckChan(chanrec *c,std::string servername)
+{
+ if (c)
+ {
+ return ChanAnyOnThisServer(c,(char*)servername.c_str());
+ }
+ else return false;
+}
+
+bool Server::MeshCheckCommon(userrec* u,std::string servername)
+{
+ if (u)
+ {
+ return CommonOnThisServer(u,(char*)servername.c_str());
+ }
+ else return false;
+}
+
ConfigReader::ConfigReader()
{
this->cache = new std::stringstream(std::stringstream::in | std::stringstream::out);