diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | IRC.cpp (renamed from IRC.cc) | 0 | ||||
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | main.cpp | 11 |
4 files changed, 21 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e33439a --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | kankri | ||
2 | *.o | ||
diff --git a/IRC.cc b/IRC.cpp index b6b4da4..b6b4da4 100755 --- a/IRC.cc +++ b/IRC.cpp | |||
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d9a33df --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,13 @@ | |||
1 | CC = g++ | ||
2 | LD = g++ | ||
3 | TARGET = kankri | ||
4 | SOURCE = IRC.cpp main.cpp | ||
5 | MODULES = $(addsuffix .o,$(patsubst %.cpp,%,$(SOURCE))) | ||
6 | CCFLAGS = -I/usr/local/Cellar/yaml-cpp/0.5.0/include | ||
7 | LDFLAGS = -lyaml-cpp | ||
8 | |||
9 | $(TARGET): $(MODULES) | ||
10 | $(LD) $(MODULES) $(LDFLAGS) -o $(TARGET) | ||
11 | |||
12 | $(MODULES): %.o: %.cpp | ||
13 | $(CC) -c $? -o $@ $(CCFLAGS) \ No newline at end of file | ||
diff --git a/main.cpp b/main.cpp index 99f8cad..1ef7833 100644 --- a/main.cpp +++ b/main.cpp | |||
@@ -20,7 +20,11 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | char* hostname, nick, port, password, channel; | 23 | char* hostname; |
24 | char* nick; | ||
25 | int port; | ||
26 | char* password; | ||
27 | char* channel; | ||
24 | 28 | ||
25 | char* _(const char* str) | 29 | char* _(const char* str) |
26 | { | 30 | { |
@@ -32,8 +36,6 @@ char* _(const char* str) | |||
32 | int message(char* params, irc_reply_data* hostd, void* conn) | 36 | int message(char* params, irc_reply_data* hostd, void* conn) |
33 | { | 37 | { |
34 | std::string str(params); | 38 | std::string str(params); |
35 | std::string thetime(asctime(gettime())); | ||
36 | thetime = thetime.substr(4,15); | ||
37 | 39 | ||
38 | if (*hostd->target != '#') | 40 | if (*hostd->target != '#') |
39 | { | 41 | { |
@@ -62,12 +64,11 @@ void terminate(int param) | |||
62 | 64 | ||
63 | int main(int argc, char** argv) | 65 | int main(int argc, char** argv) |
64 | { | 66 | { |
65 | atexit(end_logging); | ||
66 | signal(SIGTERM, terminate); | 67 | signal(SIGTERM, terminate); |
67 | 68 | ||
68 | YAML::Node config = YAML::LoadFile("config.yml"); | 69 | YAML::Node config = YAML::LoadFile("config.yml"); |
69 | hostname = _(config["hostname"].as<std::string>().c_str()); | 70 | hostname = _(config["hostname"].as<std::string>().c_str()); |
70 | port = _(config["port"].as<std::string>().c_str()); | 71 | port = config["port"].as<int>(); |
71 | nick = _(config["nick"].as<std::string>().c_str()); | 72 | nick = _(config["nick"].as<std::string>().c_str()); |
72 | password = _(config["password"].as<std::string>().c_str()); | 73 | password = _(config["password"].as<std::string>().c_str()); |
73 | channel = _(config["password"].as<std::string>().c_str()); | 74 | channel = _(config["password"].as<std::string>().c_str()); |