summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h3
-rw-r--r--src/channels.cpp3
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_chanfilter.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp2
-rw-r--r--src/modules/m_foobar.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp4
7 files changed, 11 insertions, 7 deletions
diff --git a/include/modules.h b/include/modules.h
index bbf99b5d0..cf7e8c52d 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -353,8 +353,9 @@ class Module : public classbase
* and the details of the channel they have left is available in the variable chanrec *channel
* @param user The user who is parting
* @param channel The channel being parted
+ * @param partmessage The part message, or an empty string
*/
- virtual void OnUserPart(userrec* user, chanrec* channel);
+ virtual void OnUserPart(userrec* user, chanrec* channel, std::string partmessage);
/** Called on rehash.
* This method is called prior to a /REHASH or when a SIGHUP is received from the operating
diff --git a/src/channels.cpp b/src/channels.cpp
index 5af0f3329..552da3a5d 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -404,7 +404,6 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool
if (!Ptr)
return NULL;
- FOREACH_MOD(I_OnUserPart,OnUserPart(user,Ptr));
log(DEBUG,"del_channel: removing: %s %s",user->nick,Ptr->name);
for (unsigned int i =0; i < user->chans.size(); i++)
@@ -414,10 +413,12 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool
{
if (reason)
{
+ FOREACH_MOD(I_OnUserPart,OnUserPart(user,Ptr,reason));
WriteChannel(Ptr,user,"PART %s :%s",Ptr->name, reason);
}
else
{
+ FOREACH_MOD(I_OnUserPart,OnUserPart(user,Ptr,""));
WriteChannel(Ptr,user,"PART :%s",Ptr->name);
}
user->chans[i].uc_modes = 0;
diff --git a/src/modules.cpp b/src/modules.cpp
index fdd9f0c5b..1d20239d7 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -223,7 +223,7 @@ void Module::OnUserConnect(userrec* user) { }
void Module::OnUserQuit(userrec* user, std::string message) { }
void Module::OnUserDisconnect(userrec* user) { }
void Module::OnUserJoin(userrec* user, chanrec* channel) { }
-void Module::OnUserPart(userrec* user, chanrec* channel) { }
+void Module::OnUserPart(userrec* user, chanrec* channel, std::string partmessage) { }
void Module::OnRehash(std::string parameter) { }
void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 69c4ca0a3..edd87ecff 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -72,7 +72,7 @@ class ModuleChanFilter : public Module
output = temp2.substr(0,temp2.length()-1);
}
- virtual void OnUserPart(userrec* user, chanrec* channel)
+ virtual void OnUserPart(userrec* user, chanrec* channel, std::string partreason)
{
// when the last user parts, delete the list
if (Srv->CountUsers(channel) == 1)
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 6f12566d0..8e2319037 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -85,7 +85,7 @@ class ModuleChanProtect : public Module
user->Shrink("cm_protect_"+std::string(chan->name));
}
- virtual void OnUserPart(userrec* user, chanrec* channel)
+ virtual void OnUserPart(userrec* user, chanrec* channel, std::string partreason)
{
// FIX: when someone parts a channel we must remove their Extensibles!
user->Shrink("cm_founder_"+std::string(channel->name));
diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp
index 65b88f494..531176299 100644
--- a/src/modules/m_foobar.cpp
+++ b/src/modules/m_foobar.cpp
@@ -86,7 +86,7 @@ class ModuleFoobar : public Module
Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c);
}
- virtual void OnUserPart(userrec* user, chanrec* channel)
+ virtual void OnUserPart(userrec* user, chanrec* channel, std::string partreason)
{
// method called when a user parts a channel
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index b0530442b..124583ff1 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -2988,12 +2988,14 @@ class ModuleSpanningTree : public Module
DoOneToMany(user->nick,"FNAME",params);
}
- virtual void OnUserPart(userrec* user, chanrec* channel)
+ virtual void OnUserPart(userrec* user, chanrec* channel, std::string partmessage)
{
if (user->fd > -1)
{
std::deque<std::string> params;
params.push_back(channel->name);
+ if (partmessage != "")
+ params.push_back(":"+partmessage);
DoOneToMany(user->nick,"PART",params);
}
}