Created message handling functions.
This commit is contained in:
parent
d5a33ccd79
commit
bcb01f256d
@ -73,3 +73,21 @@ void NeoComm_leave_channel(const char *channel_name) {
|
||||
node.cancelListen(channel->hash, channel->token.get());
|
||||
channels.erase(s_chan_name);
|
||||
}
|
||||
|
||||
struct message *NeoComm_get_next_message(const char *channel_name) {
|
||||
const std::string s_chan_name(channel_name);
|
||||
if(channels[s_chan_name].msgs.empty())
|
||||
return NULL;
|
||||
const dht::ImMessage *new_msg = &channels[s_chan_name].msgs.front();
|
||||
struct message *msg =
|
||||
static_cast<struct message*>(malloc(sizeof(struct message)));
|
||||
|
||||
msg->msg = new_msg->msg.c_str();
|
||||
// TODO: add the rest of these
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
void NeoComm_free_message(struct message *msg) {
|
||||
free(msg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user