/[weechat]/weechat/src/plugins/weechat-plugin.h
ViewVC logotype

Diff of /weechat/src/plugins/weechat-plugin.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by flashcode, Sun Oct 23 22:07:18 2005 UTC revision 1.6 by flashcode, Tue Oct 25 17:37:13 2005 UTC
# Line 52  typedef int (t_plugin_handler_func) (t_w Line 52  typedef int (t_plugin_handler_func) (t_w
52    
53  /* message handler, called when an IRC messages is received */  /* message handler, called when an IRC messages is received */
54    
55  typedef struct t_plugin_msg_handler t_plugin_msg_handler;  typedef enum t_handler_type t_handler_type;
56    
57  struct t_plugin_msg_handler  enum t_handler_type
58  {  {
59      char *irc_command;                  /* name of IRC command (PRIVMSG, ..)   */      HANDLER_MESSAGE,
60      t_plugin_handler_func *msg_handler; /* pointer to message handler          */      HANDLER_COMMAND
     char *msg_handler_args;             /* arguments sent to message handler   */  
     void *msg_handler_pointer;          /* pointer sent to message handler     */  
       
     int running;                        /* 1 if currently running              */  
                                         /* (used to prevent circular call)     */  
     t_plugin_msg_handler *prev_handler; /* link to previous handler            */  
     t_plugin_msg_handler *next_handler; /* link to next handler                */  
61  };  };
62    
63  /* command handler, to add new commands to WeeChat */  typedef struct t_plugin_handler t_plugin_handler;
   
 typedef struct t_plugin_cmd_handler t_plugin_cmd_handler;  
64    
65  struct t_plugin_cmd_handler  struct t_plugin_handler
66  {  {
67        t_handler_type type;                /* handler type                        */
68        
69        /* data for message handler */
70        char *irc_command;                  /* name of IRC command (PRIVMSG, ..)   */
71        
72        /* data for command handler */
73      char *command;                      /* name of command (without first '/') */      char *command;                      /* name of command (without first '/') */
74      char *description;                  /* (for /help) short cmd description   */      char *description;                  /* (for /help) short cmd description   */
75      char *arguments;                    /* (for /help) command arguments       */      char *arguments;                    /* (for /help) command arguments       */
76      char *arguments_description;        /* (for /help) args long description   */      char *arguments_description;        /* (for /help) args long description   */
     /* command handler */  
     t_plugin_handler_func *cmd_handler; /* pointer to command handler          */  
     char *cmd_handler_args;             /* arguments sent to command handler   */  
     void *cmd_handler_pointer;          /* pointer sent to command handler     */  
77            
78        /* data common to all handlers */
79        t_plugin_handler_func *handler;     /* pointer to handler                  */
80        char *handler_args;                 /* arguments sent to handler           */
81        void *handler_pointer;              /* pointer sent to handler             */
82        
83        /* for internal use */
84      int running;                        /* 1 if currently running              */      int running;                        /* 1 if currently running              */
85                                          /* (used to prevent circular call)     */                                          /* (used to prevent circular call)     */
86      t_plugin_cmd_handler *prev_handler; /* link to previous handler            */      t_plugin_handler *prev_handler;     /* link to previous handler            */
87      t_plugin_cmd_handler *next_handler; /* link to next handler                */      t_plugin_handler *next_handler;     /* link to next handler                */
88  };  };
89    
90  /* plugin, a WeeChat plugin, which is a dynamic library */  /* plugin, a WeeChat plugin, which is a dynamic library */
# Line 100  struct t_weechat_plugin Line 99  struct t_weechat_plugin
99      char *version;                      /* plugin version                      */      char *version;                      /* plugin version                      */
100            
101      /* plugin handlers */      /* plugin handlers */
102      t_plugin_msg_handler *msg_handlers; /* IRC message handlers                */      t_plugin_handler *handlers;         /* pointer to first handler            */
103      t_plugin_msg_handler *last_msg_handler;      t_plugin_handler *last_handler;     /* pointer to last handler             */
104      t_plugin_cmd_handler *cmd_handlers; /* command handlers                    */      
     t_plugin_cmd_handler *last_cmd_handler;  
   
105      /* links to previous/next plugins */      /* links to previous/next plugins */
106      t_weechat_plugin *prev_plugin;      /* link to previous plugin             */      t_weechat_plugin *prev_plugin;      /* link to previous plugin             */
107      t_weechat_plugin *next_plugin;      /* link to next plugin                 */      t_weechat_plugin *next_plugin;      /* link to next plugin                 */
# Line 127  struct t_weechat_plugin Line 124  struct t_weechat_plugin
124      void (*printf_server) (t_weechat_plugin *, char *, ...);      void (*printf_server) (t_weechat_plugin *, char *, ...);
125      void (*infobar_printf) (t_weechat_plugin *, int, char *, ...);      void (*infobar_printf) (t_weechat_plugin *, int, char *, ...);
126            
127      t_plugin_msg_handler *(*msg_handler_add) (t_weechat_plugin *, char *,      t_plugin_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
128                                                t_plugin_handler_func *,                                            t_plugin_handler_func *,
129                                                char *, void *);                                            char *, void *);
130      void (*msg_handler_remove) (t_weechat_plugin *, t_plugin_msg_handler *);      t_plugin_handler *(*cmd_handler_add) (t_weechat_plugin *, char *,
131      void (*msg_handler_remove_all) (t_weechat_plugin *);                                            char *, char *, char *,
132      t_plugin_cmd_handler *(*cmd_handler_add) (t_weechat_plugin *, char *,                                            t_plugin_handler_func *,
133                                                char *, char *, char *,                                            char *, void *);
134                                                t_plugin_handler_func *,      void (*handler_remove) (t_weechat_plugin *, t_plugin_handler *);
135                                                char *, void *);      void (*handler_remove_all) (t_weechat_plugin *);
     void (*cmd_handler_remove) (t_weechat_plugin *, t_plugin_cmd_handler *);  
     void (*cmd_handler_remove_all) (t_weechat_plugin *);  
136            
137      void (*exec_command) (t_weechat_plugin *, char *, char *, char *);      void (*exec_command) (t_weechat_plugin *, char *, char *, char *);
138      char *(*get_info) (t_weechat_plugin *, char *, char *, char *);      char *(*get_info) (t_weechat_plugin *, char *, char *, char *);
# Line 166  extern void weechat_plugin_printf_server Line 161  extern void weechat_plugin_printf_server
161  extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...);  extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...);
162    
163  /* handler functions */  /* handler functions */
164  extern t_plugin_msg_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *,  extern t_plugin_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *,
165                                                               t_plugin_handler_func *,                                                           t_plugin_handler_func *,
166                                                               char *, void *);                                                           char *, void *);
167  extern void weechat_plugin_msg_handler_remove (t_weechat_plugin *, t_plugin_msg_handler *);  extern t_plugin_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *, char *,
168  extern void weechat_plugin_msg_handler_remove_all (t_weechat_plugin *);                                                           char *, char *, char *,
169  extern t_plugin_cmd_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *, char *,                                                           t_plugin_handler_func *,
170                                                               char *, char *, char *,                                                           char *, void *);
171                                                               t_plugin_handler_func *,  extern void weechat_plugin_handler_remove (t_weechat_plugin *, t_plugin_handler *);
172                                                               char *, void *);  extern void weechat_plugin_handler_remove_all (t_weechat_plugin *);
 extern void weechat_plugin_cmd_handler_remove (t_weechat_plugin *, t_plugin_cmd_handler *);  
 extern void weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *);  
173    
174  /* other functions */  /* other functions */
175  extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *);  extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *);

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26