23 lines
747 B
C
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
|