Anope Development > Modules

No "OnJoinUser" available for modules ?

(1/1)

CrazyCat:
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 ?

Sadie:
https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489

CrazyCat:

--- Quote from: Sadie on September 20, 2023, 08:39:55 PM ---https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489

--- End quote ---

I was searching the wrong way :)
Thx Sadie !

CrazyCat:
Well, I've a weird bug.
In my module, I do:

--- Code: ---   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);
   }
--- End code ---
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

Navigation

[0] Message Index

Go to full version