Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: No "OnJoinUser" available for modules ?  (Read 788 times)

0 Members and 1 Guest are viewing this topic.

CrazyCat

  • Anope User
  • Online Online
  • Posts: 238
    • French Eggdrop community
No "OnJoinUser" available for modules ?
« 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 ?

Sadie

  • Team
  • *
  • Offline Offline
  • Posts: 6
Logged

CrazyCat

  • Anope User
  • Online Online
  • Posts: 238
    • French Eggdrop community
Re: No "OnJoinUser" available for modules ?
« Reply #3 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
Pages: [1]   Go Up