This repository has been archived on 2021-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
lemonbbs/src/chat.h
2021-12-15 18:52:53 +01:00

23 lines
747 B
C

#ifndef LEMONBBS_CHAT_H
#define LEMONBBS_CHAT_H
#include "settings.h"
#include "connlist.h"
struct Channel {
char name[CHANNEL_NAME_LEN]; // null-terminated
struct Connection* clients[USERS_PER_CHANNEL];
pthread_mutex_t clientsLock;
};
unsigned int getChannelCount();
void setChannelName(int channelId, const char* name);
const char* getChannelName(size_t channelId);
void initChat(unsigned int channelCount);
int removeChatUser(size_t channelId, int64_t userId);
int addChatUser(size_t channelId, struct Connection* userConnection);
void broadcastString(size_t channelId, const char* message, size_t messageLength);
int isUserInChat(size_t channelId, int64_t userId);
int countUsers(size_t channelId);
#endif