mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
isupport patch by David Leadbeater
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3211 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
3ccbd0405b
commit
217283caea
30 changed files with 520 additions and 133 deletions
|
|
@ -1,30 +1,43 @@
|
|||
#ifndef __MODES_H
|
||||
#define __MODES_H
|
||||
|
||||
#include "irc-channels.h"
|
||||
|
||||
typedef void mode_func_t(IRC_CHANNEL_REC *, const char *, char, char,
|
||||
char *, GString *);
|
||||
|
||||
struct modes_type {
|
||||
mode_func_t *func;
|
||||
char prefix;
|
||||
};
|
||||
|
||||
/* modes that have argument always */
|
||||
#define HAS_MODE_ARG_ALWAYS(mode) \
|
||||
((mode) == 'b' || (mode) == 'e' || (mode) == 'I' || (mode) == 'q' || \
|
||||
(mode) == 'd' || (mode) == 'o' || (mode) == 'h' || (mode) == 'v' || \
|
||||
(mode) == 'O' || (mode) == 'k' || (mode) == 'f')
|
||||
#define HAS_MODE_ARG_ALWAYS(server, mode) \
|
||||
(server->modes[(int)(unsigned char) mode].func == modes_type_a || \
|
||||
server->modes[(int)(unsigned char) mode].func == modes_type_b || \
|
||||
server->modes[(int)(unsigned char) mode].func == modes_type_prefix)
|
||||
|
||||
/* modes that have argument when being set (+) */
|
||||
#define HAS_MODE_ARG_SET(mode) \
|
||||
(HAS_MODE_ARG_ALWAYS(mode) || (mode) == 'l')
|
||||
#define HAS_MODE_ARG_SET(server, mode) \
|
||||
(HAS_MODE_ARG_ALWAYS(server, mode) || \
|
||||
server->modes[(int)(unsigned char) mode].func == modes_type_c)
|
||||
|
||||
/* modes that have argument when being unset (-) */
|
||||
#define HAS_MODE_ARG_UNSET(mode) \
|
||||
HAS_MODE_ARG_ALWAYS(mode)
|
||||
#define HAS_MODE_ARG_UNSET(server, mode) \
|
||||
HAS_MODE_ARG_ALWAYS(server, mode)
|
||||
|
||||
#define HAS_MODE_ARG(type, mode) \
|
||||
((type) == '+' ? HAS_MODE_ARG_SET(mode) : HAS_MODE_ARG_UNSET(mode))
|
||||
#define HAS_MODE_ARG(server, type, mode) \
|
||||
((type) == '+' ? HAS_MODE_ARG_SET(server,mode) : \
|
||||
HAS_MODE_ARG_UNSET(server, mode))
|
||||
|
||||
void modes_init(void);
|
||||
void modes_deinit(void);
|
||||
void modes_server_init(IRC_SERVER_REC *);
|
||||
|
||||
/* add `mode' to `old' - return newly allocated mode.
|
||||
`channel' specifies if we're parsing channel mode and we should try
|
||||
to join mode arguments too. */
|
||||
char *modes_join(const char *old, const char *mode, int channel);
|
||||
char *modes_join(IRC_SERVER_REC *server, const char *old, const char *mode, int channel);
|
||||
|
||||
int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode);
|
||||
|
||||
|
|
@ -36,4 +49,10 @@ void channel_set_singlemode(IRC_CHANNEL_REC *channel, const char *nicks,
|
|||
void channel_set_mode(IRC_SERVER_REC *server, const char *channel,
|
||||
const char *mode);
|
||||
|
||||
mode_func_t modes_type_a;
|
||||
mode_func_t modes_type_b;
|
||||
mode_func_t modes_type_c;
|
||||
mode_func_t modes_type_d;
|
||||
mode_func_t modes_type_prefix;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue