diff --git a/src/channel.cpp b/src/channel.cpp index cf12ebc..00a17a8 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -21,7 +21,7 @@ #include "error.hpp" #include "globals.hpp" -std::unordered_map channels; +std::map channels; int NeoComm_join_channel(const char *channel_name) { if(not node.isRunning()) @@ -82,8 +82,11 @@ struct message *NeoComm_get_next_message(const char *channel_name) { struct message *msg = static_cast(malloc(sizeof(struct message))); - msg->msg = new_msg->msg.c_str(); - // TODO: add the rest of these + *msg = { + /*.msg =*/ new_msg->msg.c_str(), + /*.sent =*/ new_msg->date, + // TODO: add the rest of these + }; return msg; } diff --git a/src/globals.hpp b/src/globals.hpp index 19c4c4f..8f57996 100644 --- a/src/globals.hpp +++ b/src/globals.hpp @@ -19,7 +19,7 @@ #pragma once #include -#include +#include #include #include #include @@ -34,4 +34,4 @@ struct channel_info { extern dht::DhtRunner node; // the key element is the name of the channel -extern std::unordered_map channels; +extern std::map channels;