Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: HelpServ he_queue  (Read 4342 times)

0 Members and 1 Guest are viewing this topic.

John

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 19
    • IRCSpeed - The Network with a Difference
HelpServ he_queue
« on: November 21, 2013, 12:03:30 AM »

Hi Folks

This module is a good addition to the Help system placed on some networks. Unfortunately, I seem to have a small error with this.
The module can be found here and my comment below that.

Just in case the comment isn't obvious, I'll add it here too.

Quote from: istok
Anope Version: 1.8.6
Module Version: 1.0.1
Comments:
Works fine for me, except for 1 error. Every time a nickname is changed, doesn't matter if the nickname is NOT on the helpchannel or not, it will trigger the error.

Code: [Select]
Warning: [he_queue] Invalid event count in he_hook_nick (Count is 2, expected 1. Event will not be processed.
If this could be fixed it would make me very happy, stop all the nick changes from driving me nucking futs.

Here is the offending int block.

Code: [Select]
int he_hook_nick(int count, char **av) {
   User *u = NULL;
   char *data = NULL;

   Helpqueue *p = hqueue;
   User *helper = NULL;
   User *ticket_u = NULL;

   if(count != 1) {
      alog("Warning: [he_queue] Invalid event count in he_hook_nick (Count is %d, expected 1. Event will not be processed.", count);
      return MOD_CONT;
   }

   if(hqueue == NULL) {
      return MOD_CONT;
   }

   u = finduser(av[0]);
   if(u != NULL) {
      data = moduleGetData(&u->moduleData, "c_id");
      if(data != NULL) {
         while(p != NULL) {
            if(strcmp(data,p->c_id) == 0) {
               if(strlen(p->helper) > 0) {
                  helper = finduser(p->helper);
                  if(helper != NULL) {
                     moduleNoticeLang(s_HelpServ, helper, LANG_HELPME_CHANGE_NICK, p->c_id, p->nick, av[0]);
                  }
               }
               strcpy(p->nick, av[0]);
               break;
            }
            else {
               if(strlen(p->helper) > 0) {
                  if(strcmp(data,p->helper_c_id) == 0) {
                     ticket_u = finduser(p->nick);
                     if(ticket_u != NULL) {
                        moduleNoticeLang(s_HelpServ, ticket_u, LANG_HELPME_CHANGE_HELPERNICK, p->helper, av[0]);
                     }
                  }
                  strcpy(p->helper, av[0]);
               }
            }
            p = p->next;
         }
         free(data);
      }
   }
   return MOD_CONT;
}

I don't want to have to just comment out this alog, since it's there for a purpose, but if I'm unable to find any other fix then I'll simply remove the output. Thanks in advance.
« Last Edit: November 21, 2013, 01:26:06 AM by John »
Logged

Trystan Scott Lee

  • Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 343
Re: HelpServ he_queue
« Reply #1 on: November 21, 2013, 06:58:56 AM »

per https://github.com/anope/anope/blob/1.8/docs/EVENTS

 EVENT_CHANGE_NICK
        A user has just changed its nick.
        av[0]  The new nickname of the user. Event is called after the user has been changed
               to this nickname.
        av[1]  The old nickname of the user.

The array count will always be 2 [0, 1]

and from https://github.com/anope/anope/blob/1.8/src/users.c

send_event(EVENT_CHANGE_NICK, 2, nick, oldnick);

your code is

   if(count != 1) {
      alog("Warning: [he_queue] Invalid event count in he_hook_nick (Count is %d, expected 1. Event will not be processed.", count);
      return MOD_CONT;
   }

it should be

   if(count != 2) {
      alog("Warning: [he_queue] Invalid event count in he_hook_nick (Count is %d, expected 2. Event will not be processed.", count);
      return MOD_CONT;
   }
Logged
my God my tourniquet, return to me salvation

John

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 19
    • IRCSpeed - The Network with a Difference
Re: HelpServ he_queue
« Reply #2 on: November 21, 2013, 10:50:37 AM »

Awesome, thank you, Trystan  8)

I have now been able to fix several small issues that have been plaguing me a while. I'm a happy chappy.

After checking out some of the sites and code you mentioned, shouldnt the block be more like this?

Code: [Select]
if(count != 0) {
      alog("Warning: [he_queue] Invalid event count in he_hook_nick (Count is %d, expected 0. Event will not be processed.", count);
      return MOD_CONT;
   }

I couldn't find
Code: [Select]
send_event(EVENT_CHANGE_NICK, 2, nick, oldnick);
but I did find and read (line 65)
Code: [Select]
static void change_user_nick(User * user, const char *nick)and it never mentioned a 2 argument.
« Last Edit: November 23, 2013, 02:48:42 PM by John »
Logged
Pages: [1]   Go Up