summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-02-20 01:05:16 -0500
committerAdam <Adam@anope.org>2011-02-20 01:05:16 -0500
commitc83b2b73d7c5f264dedb67b878d116b5b10a4742 (patch)
tree407251a2bb3bf738194b6ec7654b0872b6bab1d5 /src
parentdfbb5264fac5b418da536cc968aed4bf5cde8b76 (diff)
Much more work on the live SQL. Should work pretty decently now under heavy load.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/base.cpp3
-rw-r--r--src/bots.cpp4
-rw-r--r--src/command.cpp40
-rw-r--r--src/commands.cpp2
-rw-r--r--src/modulemanager.cpp2
-rw-r--r--src/threadengines/threadengine_pthread.cpp1
-rw-r--r--src/threadengines/threadengine_win32.cpp1
8 files changed, 33 insertions, 23 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 617029a9b..f606beff6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,5 @@
# Find all the *.cpp files within the current source directory, and sort the list
-file(GLOB SRC_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
-set(SRC_SRCS ${SRC_SRCS_C} ${SRC_SRCS_CPP})
+file(GLOB SRC_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
# If using Windows, add the windows.cpp, the win32 threading engine, and the socket engine to the list
if(WIN32)
diff --git a/src/base.cpp b/src/base.cpp
index d0eff0beb..537770bcd 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -1,4 +1,5 @@
#include "services.h"
+#include "modules.h"
Base::Base()
{
@@ -10,6 +11,8 @@ Base::~Base()
{
(*it)->Invalidate();
}
+
+ FOREACH_MOD(I_OnObjectDestroy, OnObjectDestroy(this));
}
void Base::AddReference(dynamic_reference_base *r)
diff --git a/src/bots.cpp b/src/bots.cpp
index 4f3ed76c9..254e987a1 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -111,6 +111,10 @@ BotInfo::~BotInfo()
}
}
+void BotInfo::SetIdent(const Anope::string &sident)
+{
+ this->ident = sident;
+}
void BotInfo::SetNewNick(const Anope::string &newnick)
{
diff --git a/src/command.cpp b/src/command.cpp
index ddf9a6622..cc23a72a5 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -8,26 +8,6 @@
#include "services.h"
#include "modules.h"
-CommandSource::~CommandSource()
-{
- for (std::list<Anope::string>::iterator it = this->reply.begin(), it_end = this->reply.end(); it != it_end; ++it)
- {
- const Anope::string &message = *it;
-
- // Send to the user if the reply is more than one line
- if (!this->fantasy || !this->ci || this->reply.size() > 1)
- u->SendMessage(this->service, message);
- else if (this->ci->botflags.HasFlag(BS_MSG_PRIVMSG))
- ircdproto->SendPrivmsg(this->service, this->ci->name, message.c_str());
- else if (this->ci->botflags.HasFlag(BS_MSG_NOTICE))
- ircdproto->SendNotice(this->service, this->ci->name, message.c_str());
- else if (this->ci->botflags.HasFlag(BS_MSG_NOTICEOPS))
- ircdproto->SendNoticeChanops(this->service, this->ci->c, message.c_str());
- else
- u->SendMessage(this->service, message);
- }
-}
-
void CommandSource::Reply(const char *message, ...)
{
va_list args;
@@ -52,6 +32,26 @@ void CommandSource::Reply(const Anope::string &message)
this->reply.push_back(tok);
}
+void CommandSource::DoReply()
+{
+ for (std::list<Anope::string>::iterator it = this->reply.begin(), it_end = this->reply.end(); it != it_end; ++it)
+ {
+ const Anope::string &message = *it;
+
+ // Send to the user if the reply is more than one line
+ if (!this->fantasy || !this->ci || this->reply.size() > 1)
+ u->SendMessage(this->service, message);
+ else if (this->ci->botflags.HasFlag(BS_MSG_PRIVMSG))
+ ircdproto->SendPrivmsg(this->service, this->ci->name, message.c_str());
+ else if (this->ci->botflags.HasFlag(BS_MSG_NOTICE))
+ ircdproto->SendNotice(this->service, this->ci->name, message.c_str());
+ else if (this->ci->botflags.HasFlag(BS_MSG_NOTICEOPS))
+ ircdproto->SendNoticeChanops(this->service, this->ci->c, message.c_str());
+ else
+ u->SendMessage(this->service, message);
+ }
+}
+
Command::Command(const Anope::string &sname, size_t min_params, size_t max_params, const Anope::string &spermission) : Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), name(sname), permission(spermission)
{
this->module = NULL;
diff --git a/src/commands.cpp b/src/commands.cpp
index e3a52a503..6944ac31e 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -168,6 +168,8 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command,
{
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, c, params));
}
+
+ source.DoReply();
}
/**
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 2c716acf6..d530b6e46 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -400,7 +400,7 @@ void ModuleManager::UnloadAll()
Module *m = *it++;
if (static_cast<MODType>(i) == m->type)
- DeleteModule(m);
+ UnloadModule(m, NULL);
}
}
}
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index e8242bb82..f28c43846 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -43,6 +43,7 @@ void Thread::Join()
*/
void Thread::Exit()
{
+ this->SetExitState();
pthread_exit(0);
}
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp
index 218f711c4..adefab800 100644
--- a/src/threadengines/threadengine_win32.cpp
+++ b/src/threadengines/threadengine_win32.cpp
@@ -35,6 +35,7 @@ void Thread::Join()
*/
void Thread::Exit()
{
+ this->SetExitState();
ExitThread(0);
}