ekg2
|
00001 /* $Id: commands.h 4528 2008-08-28 08:19:35Z darkjames $ */ 00002 00003 /* 00004 * (C) Copyright 2001-2002 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * Dawid Jarosz <dawjar@poczta.onet.pl> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License Version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __EKG_COMMANDS_H 00022 #define __EKG_COMMANDS_H 00023 00024 #include "plugins.h" 00025 #include "themes.h" 00026 #include "sessions.h" 00027 00028 #define printq(x...) do { if (!quiet) { print(x); } } while(0) 00029 00030 #define COMMAND(x) int x(const char *name, const char **params, session_t *session, const char *target, int quiet) 00031 00032 typedef COMMAND(command_func_t); 00033 00034 #define COMMAND_REMOTE 0x01 00035 00036 typedef struct command { 00037 struct command *next; 00038 00039 /* public: */ 00040 char *name; /* ekg2-remote: OK */ 00041 plugin_t *__plugin; /* ekg2-remote: NONE */ /* ncurses: OK */ 00042 00043 /* private: */ 00044 char **params; /* ekg2-remote: OK */ 00045 command_func_t *__function; /* ekg2-remote: NONE, OK */ 00046 int flags; /* ekg2-remote: NONE */ 00047 char **possibilities; /* ekg2-remote: NONE */ 00048 } command_t; 00049 00050 extern command_t *commands; 00051 00052 command_t *command_add(plugin_t *plugin, const char *name, char *params, command_func_t function, int flags, char *possibilities); 00053 command_t *remote_command_add(const char *name, char *params); 00054 00055 void command_init(); 00056 command_t *commands_removei(command_t *c); 00057 void commands_destroy(); 00058 int command_exec(const char *target, session_t *session, const char *line, int quiet); 00059 int command_exec_format(const char *target, session_t *session, int quiet, const char *format, ...); 00060 /* 00061 * jakaś malutka lista tych, do których były wysyłane wiadomości. 00062 */ 00063 #define SEND_NICKS_MAX 100 00064 00065 extern char *send_nicks[SEND_NICKS_MAX]; 00066 extern int send_nicks_count, send_nicks_index; 00067 00068 void tabnick_add(const char *nick); 00069 void tabnick_remove(const char *nick); 00070 00071 int binding_help(int a, int b); 00072 int binding_quick_list(int a, int b); 00073 00074 int match_arg(const char *arg, char shortopt, const char *longopt, int longoptlen); 00075 00076 #endif /* __EKG_COMMANDS_H */ 00077 00078 /* 00079 * Local Variables: 00080 * mode: c 00081 * c-file-style: "k&r" 00082 * c-basic-offset: 8 00083 * indent-tabs-mode: t 00084 * End: 00085 */