Use standard map.
This commit is contained in:
parent
b330df5a8d
commit
b4544a79fe
@ -21,7 +21,7 @@
|
|||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
|
|
||||||
std::unordered_map<std::string, struct channel_info> channels;
|
std::map<std::string, struct channel_info> channels;
|
||||||
|
|
||||||
int NeoComm_join_channel(const char *channel_name) {
|
int NeoComm_join_channel(const char *channel_name) {
|
||||||
if(not node.isRunning())
|
if(not node.isRunning())
|
||||||
@ -82,8 +82,11 @@ struct message *NeoComm_get_next_message(const char *channel_name) {
|
|||||||
struct message *msg =
|
struct message *msg =
|
||||||
static_cast<struct message*>(malloc(sizeof(struct message)));
|
static_cast<struct message*>(malloc(sizeof(struct message)));
|
||||||
|
|
||||||
msg->msg = new_msg->msg.c_str();
|
*msg = {
|
||||||
// TODO: add the rest of these
|
/*.msg =*/ new_msg->msg.c_str(),
|
||||||
|
/*.sent =*/ new_msg->date,
|
||||||
|
// TODO: add the rest of these
|
||||||
|
};
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <opendht.h>
|
#include <opendht.h>
|
||||||
#include <unordered_map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -34,4 +34,4 @@ struct channel_info {
|
|||||||
extern dht::DhtRunner node;
|
extern dht::DhtRunner node;
|
||||||
|
|
||||||
// the key element is the name of the channel
|
// the key element is the name of the channel
|
||||||
extern std::unordered_map<std::string, struct channel_info> channels;
|
extern std::map<std::string, struct channel_info> channels;
|
||||||
|
Loading…
Reference in New Issue
Block a user