Ejemplo n.º 1
0
// Get channels list.
void meth::GetChannelsList(LogicalConnections::iterator conn, String user_chnls, String &response) {
	ChannelsList channels = GetChannels();
	bool first_channel = true;

	response = "[";
	for (ChannelsList::iterator channel = channels.begin(); channel != channels.end(); channel++) {
		if (channel->visibility == 1) {
			// Add comma before each channel except first.
			if (!first_channel) {
				response += ",";
			} else {
            	first_channel = false;
            }
			response += "{";
			AddPair(response, "name", channel->name, true, true);
			AddPair(response, "topic", channel->topic, true, true);
			AddPair(response, "users_online", channel->online_users, false, true);
			AddPair(response, "access", (int) channel->access, false, false);
			response += "}";
		}
	}

	response += "]";
}
Ejemplo n.º 2
0
void remove_channel(ChannelsList& channels, channel_ptr which_node)
{
    auto it = std::find(channels.begin(), channels.end(), which_node);
    BITCOIN_ASSERT(it != channels.end());
    channels.erase(it);
}