ekg2  GIT master
commands.h
Idź do dokumentacji tego pliku.
1 /* $Id: commands.h 4528 2008-08-28 08:19:35Z darkjames $ */
2 
3 /*
4  * (C) Copyright 2001-2002 Wojtek Kaniewski <wojtekka@irc.pl>
5  * Dawid Jarosz <dawjar@poczta.onet.pl>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License Version 2 as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 #ifndef __EKG_COMMANDS_H
22 #define __EKG_COMMANDS_H
23 
24 #include "plugins.h"
25 #include "themes.h"
26 #include "sessions.h"
27 
28 #define printq(x...) do { if (!quiet) { print(x); } } while(0)
29 
30 #define COMMAND(x) int x(const char *name, const char **params, session_t *session, const char *target, int quiet)
31 
33 
34 #define COMMAND_REMOTE 0x01
35 
36 typedef struct command {
37  struct command *next;
38 
39 /* public: */
40  char *name; /* ekg2-remote: OK */
41  plugin_t *__plugin; /* ekg2-remote: NONE */ /* ncurses: OK */
42 
43 /* private: */
44  char **params; /* ekg2-remote: OK */
45  command_func_t *__function; /* ekg2-remote: NONE, OK */
46  int flags; /* ekg2-remote: NONE */
47  char **possibilities; /* ekg2-remote: NONE */
48 } command_t;
49 
50 extern command_t *commands;
51 
52 command_t *command_add(plugin_t *plugin, const char *name, char *params, command_func_t function, int flags, char *possibilities);
53 command_t *remote_command_add(const char *name, char *params);
54 
55 void command_init();
57 void commands_destroy();
58 int command_exec(const char *target, session_t *session, const char *line, int quiet);
59 int command_exec_format(const char *target, session_t *session, int quiet, const char *format, ...);
60 /*
61  * jakaś malutka lista tych, do których były wysyłane wiadomości.
62  */
63 #define SEND_NICKS_MAX 100
64 
65 extern char *send_nicks[SEND_NICKS_MAX];
67 
68 void tabnick_add(const char *nick);
69 void tabnick_remove(const char *nick);
70 
71 int binding_help(int a, int b);
72 int binding_quick_list(int a, int b);
73 
74 int match_arg(const char *arg, char shortopt, const char *longopt, int longoptlen);
75 
76 #endif /* __EKG_COMMANDS_H */
77 
78 /*
79  * Local Variables:
80  * mode: c
81  * c-file-style: "k&r"
82  * c-basic-offset: 8
83  * indent-tabs-mode: t
84  * End:
85  */
int match_arg(const char *arg, char shortopt, const char *longopt, int longoptlen)
Definition: commands.c:114
char * send_nicks[100]
Definition: commands.c:77
command_flags_t flags
Definition: commands.h:71
void tabnick_remove(const char *nick)
Definition: commands.c:163
int send_nicks_index
Definition: commands.c:78
Definition: sessions.h:127
char ** params
Definition: commands.h:69
struct command command_t
#define COMMAND(x)
Definition: commands.h:30
Definition: commands.h:63
#define SEND_NICKS_MAX
Definition: commands.h:63
Definition: ekg_hash_benchmark.c:47
struct command * next
Definition: commands.h:37
int command_exec(const char *target, session_t *session, const char *line, int quiet)
Definition: commands.c:2431
char ** possibilities
Definition: commands.h:72
GSList * commands
Definition: commands.c:81
Definition: plugins.h:76
char * name
Definition: commands.h:40
void command_init()
Definition: commands.c:3648
#define line
Definition: bindings.c:50
int send_nicks_count
Definition: commands.c:78
int command_func_t(const char *name, const char **params, session_t *session, const char *target, int quiet)
Definition: commands.h:61
plugin_t * __plugin
Definition: commands.h:41
command_t * remote_command_add(const char *name, char *params)
const char * name
Definition: commands.h:65
command_t * commands_removei(command_t *c)
void tabnick_add(const char *nick)
Definition: commands.c:136
int command_exec_format(const char *target, session_t *session, int quiet, const char *format,...)
Definition: commands.c:2778
int flags
Definition: commands.h:46
int binding_help(int a, int b)
Definition: bindings.c:80
command_t * command_add(plugin_t *plugin, const char *name, char *params, command_func_t function, command_flags_t flags, char *possibilities)
Definition: commands.c:3570
void commands_destroy()
Definition: commands.c:105
int binding_quick_list(int a, int b)
Definition: bindings.c:47
command_func_t * __function
Definition: commands.h:45