Anope IRC Services
Anope Development => Modules => Topic started by: CrazyCat on September 20, 2023, 05:08:07 PM
-
Hi there,
I'm working on a little module and want to hook when a user joins a channel, but looking at channels.cpp, there is no equivalent to OnLeaveChannel (for quit and part).
Do I search in wrong way or is this really missing ?
-
https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489
-
https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489
I was searching the wrong way :)
Thx Sadie !
-
Well, I've a weird bug.
In my module, I do:
void OnJoinChannel(User *u, Channel *c) anope_override
{
if (!c->ci)
return;
query = "INSERT INTO `" + prefix + "chanlog` (chan, nick, type) VALUES (@chan@, @nick@, 'JOIN');";
query.SetValue("chan", c->name);
query.SetValue("nick", GetDisplay(u));
this->RunQuery(query);
}
void OnPartChannel(User *u, Channel *c, Anope::string &channel, Anope::string &msg) anope_override
{
if (!c->ci)
return;
query = "INSERT INTO `" + prefix + "chanlog` (chan, nick, type, content) VALUES (@chan@, @nick@, 'PART', @content@);";
query.SetValue("chan", c->name);
query.SetValue("nick", GetDisplay(u));
query.SetValue("content", msg);
this->RunQuery(query);
}
The OnJoinChannel works well but the OnPartChannel does nothing, as if it was not called.
No compilation error, no sql error, sounds weird.
I also did a function to log pub and action which works well... Can't understand what the trouble is