2024-02-16 21:28:11 +00:00
|
|
|
#ifndef CHANNEL_H
|
|
|
|
#define CHANNEL_H
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windef.h>
|
|
|
|
#else
|
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "irc.h"
|
|
|
|
#include "events.h"
|
|
|
|
|
|
|
|
#define CHAN_PRIV_OP "@"
|
|
|
|
#define CHAN_PRIV_HALF "%"
|
|
|
|
#define CHAN_PRIV_VOICE "+"
|
|
|
|
#define CHAN_PRIV_OWNER "~"
|
|
|
|
#define CHAN_PRIV_ADMIN "&"
|
|
|
|
|
2024-02-17 04:54:16 +00:00
|
|
|
// debug 352: chan: #bbsn, user: ~shadow, host: services.ephasic.org, server: memphis.ephasic.org, nick: Shadow, flags: H*, realname: shadow
|
|
|
|
|
2024-02-16 21:28:11 +00:00
|
|
|
struct user
|
|
|
|
{
|
|
|
|
char nick[50];
|
2024-02-17 04:54:16 +00:00
|
|
|
char user[50];
|
2024-02-16 21:28:11 +00:00
|
|
|
char host[256];
|
|
|
|
char real_name[512];
|
2024-02-17 04:54:16 +00:00
|
|
|
char server[256];
|
|
|
|
|
2024-02-16 21:28:11 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
BOOL is_op;
|
|
|
|
BOOL is_halfop;
|
|
|
|
BOOL is_voice;
|
|
|
|
BOOL is_owner;
|
|
|
|
BOOL is_admin;
|
2024-03-08 06:38:00 +00:00
|
|
|
|
|
|
|
BOOL is_botadmin;
|
2024-02-16 21:28:11 +00:00
|
|
|
#else
|
|
|
|
bool is_op;
|
|
|
|
bool is_halfop;
|
|
|
|
bool is_voice;
|
|
|
|
bool is_owner;
|
|
|
|
bool is_admin;
|
2024-03-08 06:38:00 +00:00
|
|
|
|
|
|
|
bool is_botadmin;
|
2024-02-16 21:28:11 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
struct channel
|
|
|
|
{
|
|
|
|
char name[32];
|
|
|
|
int user_count;
|
|
|
|
|
|
|
|
struct user *users;
|
|
|
|
};
|
|
|
|
|
2024-02-24 01:57:59 +00:00
|
|
|
extern struct channel *channels[60];
|
|
|
|
|
2024-02-16 21:28:11 +00:00
|
|
|
void add_channel(char *name);
|
|
|
|
void remove_channel(char *name);
|
|
|
|
void add_user_to_channel(char *user, char *host, char *chan);
|
|
|
|
void remove_user_from_channel(char *user, char *chan);
|
|
|
|
void update_nick(char *old_nick, char *new_nick);
|
|
|
|
void update_host(char *nick, char *host);
|
2024-02-17 04:54:16 +00:00
|
|
|
void update_user(char *nick, char *user);
|
|
|
|
void update_server(char *nick, char *server);
|
|
|
|
void update_realname(char *nick, char *real_name);
|
2024-02-16 21:28:11 +00:00
|
|
|
void user_quit(char *nick);
|
|
|
|
void set_realname(char *nick, char *real_name);
|
2024-02-24 01:57:59 +00:00
|
|
|
struct user *get_user(char *nick);
|
|
|
|
|
|
|
|
MY_API char *get_user_host(char *nick);
|
|
|
|
MY_API char *get_user_user(char *nick);
|
2024-02-16 21:28:11 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
MY_API BOOL is_op(char *chan, char *nick);
|
|
|
|
MY_API BOOL is_halfop(char *chan, char *nick);
|
|
|
|
MY_API BOOL is_voice(char *chan, char *nick);
|
|
|
|
MY_API BOOL channel_exists(char *chan);
|
|
|
|
MY_API BOOL user_exists(char *chan, char *nick);
|
2024-02-16 23:32:54 +00:00
|
|
|
MY_API BOOL is_on_channel(char *nick, char *chan);
|
2024-03-08 06:38:00 +00:00
|
|
|
MY_API BOOL is_botadmin(char *nick);
|
2024-02-16 21:28:11 +00:00
|
|
|
#else
|
|
|
|
MY_API bool is_op(char *chan, char *nick);
|
|
|
|
MY_API bool is_halfop(char *chan, char *nick);
|
|
|
|
MY_API bool is_voice(char *chan, char *nick);
|
|
|
|
MY_API bool is_owner(char *chan, char *nick);
|
|
|
|
MY_API bool is_admin(char *chan, char *nick);
|
|
|
|
MY_API bool channel_exists(char *chan);
|
|
|
|
MY_API bool user_exists(char *chan, char *nick);
|
2024-02-16 23:32:54 +00:00
|
|
|
MY_API bool is_on_channel(char *nick, char *chan);
|
2024-03-08 06:38:00 +00:00
|
|
|
MY_API bool is_botadmin(char *nick);
|
2024-02-16 21:28:11 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|