2015-03-24 10:12:35 +00:00
|
|
|
/*
|
|
|
|
* xbot: Just another IRC bot
|
|
|
|
*
|
|
|
|
* Written by Aaron Blakely <aaron@ephasic.org>
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef IRC_H
|
|
|
|
#define IRC_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-03-06 02:12:10 +00:00
|
|
|
#include "db.h"
|
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#endif
|
|
|
|
|
2024-02-24 01:57:59 +00:00
|
|
|
#define OUTBUF_SIZE 60000
|
|
|
|
#define INBUF_SIZE 60000
|
2024-02-13 07:22:10 +00:00
|
|
|
|
2015-03-24 10:12:35 +00:00
|
|
|
struct irc_conn
|
|
|
|
{
|
2024-02-13 07:22:10 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
SOCKET srv_fd;
|
|
|
|
#else
|
2015-03-24 10:12:35 +00:00
|
|
|
FILE *srv_fd;
|
2024-02-13 07:22:10 +00:00
|
|
|
#endif
|
2015-03-24 10:12:35 +00:00
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
char nick[32];
|
2024-02-16 21:28:11 +00:00
|
|
|
char admin[64];
|
2024-02-13 07:22:10 +00:00
|
|
|
char host[256];
|
|
|
|
char port[5];
|
|
|
|
char real_name[512];
|
2015-03-24 10:12:35 +00:00
|
|
|
|
2024-03-06 02:12:10 +00:00
|
|
|
char db_file[256];
|
|
|
|
struct db_table *db;
|
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
// I/O Buffers
|
2024-02-24 01:57:59 +00:00
|
|
|
char *out;
|
|
|
|
char *in;
|
2015-03-24 10:12:35 +00:00
|
|
|
};
|
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
typedef struct handler event_handler;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#ifdef MY_DLL_EXPORTS
|
|
|
|
#define MY_API __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define MY_API __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define MY_API
|
|
|
|
#endif
|
|
|
|
|
2024-02-16 21:28:11 +00:00
|
|
|
void irc_connect(struct irc_conn *bot);
|
|
|
|
void irc_auth(struct irc_conn *bot);
|
|
|
|
|
2024-02-13 07:22:10 +00:00
|
|
|
MY_API void irc_notice(struct irc_conn *bot, char *to, char *fmt, ...);
|
|
|
|
MY_API void irc_privmsg(struct irc_conn *bot, char *to, char *fmt, ...);
|
|
|
|
MY_API void irc_raw(struct irc_conn *bot, char *fmt, ...);
|
2024-02-16 21:28:11 +00:00
|
|
|
MY_API void irc_join(struct irc_conn *bot, char *channel);
|
|
|
|
MY_API void irc_part(struct irc_conn *bot, char *channel, char *reason);
|
2024-02-24 01:57:59 +00:00
|
|
|
MY_API void irc_ban(struct irc_conn *bot, char *channel, char *nick);
|
|
|
|
MY_API void irc_kick(struct irc_conn *bot, char *channel, char *user, char *reason);
|
|
|
|
MY_API void irc_mode(struct irc_conn *bot, char *channel, char *mode);
|
2024-03-02 08:11:50 +00:00
|
|
|
MY_API void irc_ctcp(struct irc_conn *bot, char *to, char *fmt, ...);
|
2024-02-16 21:28:11 +00:00
|
|
|
|
|
|
|
void irc_parse_raw(struct irc_conn *bot, char *raw);
|
2015-03-24 10:12:35 +00:00
|
|
|
|
2016-02-22 04:40:41 +00:00
|
|
|
#endif
|