Advertisement
westor

test module for reproduce invisible_user_in_channel() bug

May 26th, 2022 (edited)
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "unrealircd.h"
  2.  
  3. ModuleHeader MOD_HEADER = {
  4.     "mymod",
  5.     "1.0",
  6.     "Just a test module",
  7.     "westor",
  8.     "unrealircd-6",
  9. };
  10.  
  11. int avatar_chanmsg(Client *client, Channel *channel, MessageTag *mtags, const char *text, SendType sendtype);
  12.  
  13. MOD_INIT() {
  14.     HookAdd(modinfo->handle, HOOKTYPE_PRE_CHANMSG, -100000000, mymod_chanmsg); // yeah lets use this priority just in case
  15.  
  16.     return MOD_SUCCESS;
  17. }
  18.  
  19. MOD_LOAD() { return MOD_SUCCESS; }
  20. MOD_UNLOAD() { return MOD_SUCCESS; }
  21.  
  22. int mymod_chanmsg(Client *client, Channel *channel, MessageTag *mtags, const char *text, SendType sendtype) {
  23.     if (IsULine(client) || IsServer(client)) { return 0; }
  24.  
  25.     int invi = invisible_user_in_channel(client, channel);
  26.     int has_d = has_channel_mode(channel, 'd');
  27.     int has_D = has_channel_mode(channel, 'D');
  28.  
  29.     unreal_log(ULOG_INFO, "mymod", "MYMOD_TEST_CHANMSG", client, "$client is invisible on $chan [invisible: $invi] [+D: $D] [+d: $d]",
  30.                 log_data_channel("chan", channel),
  31.                 log_data_integer("invi", invi),
  32.                 log_data_integer("D", has_D),
  33.                 log_data_integer("d", has_d));
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement