summaryrefslogblamecommitdiff
path: root/src/map/irc-bot.h
blob: d1bf0866d158bf6de10113a5ca07aaecbf4d396b (plain) (tree)

























































                                                                                   
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Base Author: shennetsind @ http://hercules.ws


#ifndef _IRC_BOT_H_
#define _IRC_BOT_H_

#define IRC_FUNC_LENGTH 30

struct hChSysCh;

struct irc_func {
	char name[IRC_FUNC_LENGTH];
	void (*func)(int, char*, char*, char*, char*);
};

struct irc_bot_interface {
	int fd;
	bool isIn;
	unsigned int last_try;
	unsigned char fails;
	unsigned long ip;
	unsigned short port;
	/* */
	struct hChSysCh *channel;
	/* */
	struct {
		struct irc_func **list;
		unsigned int size;
	} funcs;
	/* */
	void (*init) (void);
	void (*final) (void);
	/* */
	int (*parse) (int fd);
	void (*parse_sub) (int fd, char *str);
	void (*parse_source) (char *source, char *nick, char *ident, char *host);
	/* */
	struct irc_func* (*func_search) (char* function_name);
	/* */
	int (*connect_timer) (int tid, unsigned int tick, int id, intptr_t data);
	int (*identify_timer) (int tid, unsigned int tick, int id, intptr_t data);
	int (*join_timer) (int tid, unsigned int tick, int id, intptr_t data);
	/* */
	void (*send)(char *str);
	void (*relay) (char *name, char *msg);
	/* */
	void (*pong) (int fd, char *cmd, char *source, char *target, char *msg);
	void (*join) (int fd, char *cmd, char *source, char *target, char *msg);
	void (*privmsg) (int fd, char *cmd, char *source, char *target, char *msg);
} irc_bot_s;

struct irc_bot_interface *ircbot;

void ircbot_defaults(void);

#endif /* _IRC_BOT_H_ */