From b4544a79fe9767d3ec8b028fafa13117c1a5897e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Mon, 25 Sep 2017 12:21:32 +0200 Subject: [PATCH] Use standard map. --- src/channel.cpp | 9 ++++++--- src/globals.hpp | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) 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;