Adding more interfaces to be implemented.
This commit is contained in:
parent
d695daf736
commit
f079d926b7
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "identity.hpp"
|
||||||
|
|
||||||
|
namespace neocomm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Container class of all data and basic functions pertaining to
|
||||||
|
* channel functionality.
|
||||||
|
*/
|
||||||
|
class channel {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Initialize the channel class and start receiving messages
|
||||||
|
* for the given ID.
|
||||||
|
*
|
||||||
|
* @param chan_id The ID of the channel.
|
||||||
|
*/
|
||||||
|
channel(const std::string &chan_id); // TODO
|
||||||
|
~channel(); // TODO
|
||||||
|
private:
|
||||||
|
const std::string chan_id;
|
||||||
|
std::vector<identity> identities; // users currently known to be in the channel
|
||||||
|
std::vector<message> msgs; // messages to and from the channel
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
34
include/neocomm/identity.hpp
Normal file
34
include/neocomm/identity.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace neocomm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Container class for data pertaining to a user.
|
||||||
|
*/
|
||||||
|
class identity {
|
||||||
|
public:
|
||||||
|
private:
|
||||||
|
const std::string id;
|
||||||
|
std::string nick;
|
||||||
|
std::string client_info;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
#include "identity.hpp"
|
||||||
|
|
||||||
|
namespace neocomm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Container for data of a user message.
|
||||||
|
*/
|
||||||
|
class message {
|
||||||
|
private:
|
||||||
|
const std::string text;
|
||||||
|
const struct tm time_stamp;
|
||||||
|
const identity from;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "channel.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <opendht.h>
|
#include <opendht.h>
|
||||||
|
|
||||||
@ -70,7 +73,30 @@ public:
|
|||||||
*/
|
*/
|
||||||
void export_nodes(const std::string &node_file);
|
void export_nodes(const std::string &node_file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Join and receive messages from a channel.
|
||||||
|
*
|
||||||
|
* @param chan_id The ID of the channel.
|
||||||
|
*/
|
||||||
|
void join_channel(const std::string &chan_id); // TODO
|
||||||
|
/**
|
||||||
|
* @brief Retrieve the channel object.
|
||||||
|
*
|
||||||
|
* @param chan_id The ID of the channel.
|
||||||
|
*
|
||||||
|
* @return The channel object.
|
||||||
|
*/
|
||||||
|
channel* get_channel(const std::string &chan_id); // TODO
|
||||||
|
/**
|
||||||
|
* @brief Leave a channel.
|
||||||
|
*
|
||||||
|
* @param chan_id The ID of the channel.
|
||||||
|
*/
|
||||||
|
void leave_channel(const std::string &chan_id); // TODO
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::vector<channel> channels;
|
||||||
dht::DhtRunner dht_node;
|
dht::DhtRunner dht_node;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ neocomm::node::node(const std::string &node_file,
|
|||||||
// rethrow exception
|
// rethrow exception
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import_nodes(node_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
neocomm::node::~node() {
|
neocomm::node::~node() {
|
||||||
|
Loading…
Reference in New Issue
Block a user