Added getter functions.
This commit is contained in:
		@@ -143,6 +143,21 @@ int NeoComm_join_channel(const char *channel_name);
 | 
			
		||||
 */
 | 
			
		||||
int NeoComm_leave_channel(const char *channel_name);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Retrieve a list of the channels that the client is listening to.
 | 
			
		||||
 *
 | 
			
		||||
 * @return A list of channels separated by spaces.
 | 
			
		||||
 */
 | 
			
		||||
const char *NeoComm_get_channel_list();
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Retrieve the current number of channels that the client is listening
 | 
			
		||||
 * to.
 | 
			
		||||
 *
 | 
			
		||||
 * @return The number of channels the client is listening to.
 | 
			
		||||
 */
 | 
			
		||||
unsigned int NeoComm_get_num_channels();
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Get the next available message (in chronological order) for
 | 
			
		||||
 * a given channel.
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,8 @@ static std::uniform_int_distribution<dht::Value::Id> rand_id;
 | 
			
		||||
 | 
			
		||||
static std::map<time_t, int> sent_messages;
 | 
			
		||||
 | 
			
		||||
static std::string channel_list;
 | 
			
		||||
 | 
			
		||||
int NeoComm_join_channel(const char *channel_name) {
 | 
			
		||||
	if(not node.isRunning())
 | 
			
		||||
	{
 | 
			
		||||
@@ -101,3 +103,14 @@ int NeoComm_leave_channel(const char *channel_name) {
 | 
			
		||||
	channels.erase(s_chan_name);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *NeoComm_get_channel_list() {
 | 
			
		||||
	channel_list.clear();
 | 
			
		||||
	for(auto &i : channels)
 | 
			
		||||
		channel_list += i.first + " ";
 | 
			
		||||
	return channel_list.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned int NeoComm_get_num_channels() {
 | 
			
		||||
	return channels.size();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user