Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Extend module interface  (Read 4029 times)

0 Members and 1 Guest are viewing this topic.

Reboot

  • Guest
Extend module interface
« on: July 12, 2006, 03:26:17 PM »

It would be nice if there would be alternative commands to create commands and messages that take an extra parameter that is then passed as a parameter to the callback function.

Example:

Code: [Select]

void AnopeInit(void) {
    void *para = "some parameter";
    msg = createMessageParameter("PRIVMSG", my_privmsg, para);
    moduleAddMessage(msg, MOD_TAIL);
}

int my_privmsg(char *source, int ac, char **msg, void *para) {
    /* para is "some parameter" */
}


That woud allow creating multi purpose callbacks that behave differently depending on their parameter but generally are the same code. A flag can be used to remember which function was used to create the message and then anope can call the old or new callback depending on the flag.
Logged

Dave Robson

  • Team
  • *
  • Offline Offline
  • Posts: 357
(No subject)
« Reply #1 on: July 13, 2006, 11:53:22 AM »

im not entierly sure what benifit this would be, what am i missing? :/
Logged
Pages: [1]   Go Up