Anope IRC Services

Anope Development => Modules => Topic started by: CrazyCat on September 20, 2023, 05:08:07 PM

Title: No "OnJoinUser" available for modules ?
Post 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 ?
Title: Re: No "OnJoinUser" available for modules ?
Post by: Sadie on September 20, 2023, 08:39:55 PM
https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489
Title: Re: No "OnJoinUser" available for modules ?
Post by: CrazyCat on September 20, 2023, 11:00:54 PM
https://github.com/anope/anope/blob/2.0/include/modules.h#L482-L489

I was searching the wrong way :)
Thx Sadie !
Title: Re: No "OnJoinUser" available for modules ?
Post by: CrazyCat on September 21, 2023, 12:29:50 PM
Well, I've a weird bug.
In my module, I do:
Code: [Select]
   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