/* * Copyright (C) 2017 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /* Message Types */ typedef unsigned long long stamp_t; typedef struct server_t server_t; typedef struct channel_t channel_t; typedef enum { IRC, XMPP, } protocol_t; typedef struct server_t { protocol_t protocol; char *name; server_t *next; } server_t; typedef struct channel_t { server_t *server; char *name; channel_t *next; } channel_t; typedef struct { channel_t *channel; stamp_t when; char *from; char *text; } message_t; /* Global Data */ extern server_t *servers; extern channel_t *channels; extern message_t *messages; extern int history; /* Chat functions */ void chat_init(void); void chat_config(const char *group, const char *name, const char *key, const char *value); void chat_notice(channel_t *channel, const char *from, const char *fmt, ...); void chat_recv(channel_t *channel, const char *from, const char *msg); void chat_send(channel_t *channel, const char *msg); void chat_exit(void); server_t *add_server(const char *name, protocol_t protocol); channel_t *add_channel(const char *name, server_t *server); server_t *find_server(const char *name); channel_t *find_channel(const char *name); /* Protocol functions */ extern void irc_init(void); extern server_t *irc_server(void); extern channel_t *irc_channel(void); extern void irc_config(server_t *server, channel_t *channel, const char *group, const char *name, const char *key, const char *value); extern void irc_send(message_t *msg); extern void irc_exit(void); extern void xmpp_init(void); extern server_t *xmpp_server(void); extern channel_t *xmpp_channel(void); extern void xmpp_config(server_t *server, channel_t *channel, const char *group, const char *name, const char *key, const char *value); extern void xmpp_send(message_t *msg); extern void xmpp_exit(void);