-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTools.cpp
More file actions
34 lines (32 loc) · 1006 Bytes
/
Tools.cpp
File metadata and controls
34 lines (32 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "Tools.hpp"
#include "server.hpp"
#include "Channel.hpp"
#include "Client.hpp"
std::vector<std::string> split_multiple_targets(std::string channel_name)
{
std::vector<std::string> target_names;
if (channel_name.find(',', 0) != std::string::npos)
{
while (channel_name.find(',', 0) != std::string::npos)
{
std::string tmp = channel_name.substr(0, channel_name.find(',', 0));
channel_name.erase(0, channel_name.find(',', 0) + 1);
target_names.push_back(tmp);
}
std::string tmp = channel_name.substr(0);
// channel_name.erase(0, channel_name.find(' ', 0));
target_names.push_back(tmp);
}
else
target_names.push_back(channel_name);
return (target_names);
}
int Server::check_if_channel_exist(std::string n)
{
for(std::vector<Channel>::iterator i = channels.begin() ; channels.end() != i ; i++)
{
if (i->get_name() == n)
return (1);
}
return (0);
}