-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
65 lines (51 loc) · 1.69 KB
/
main.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (C) 2001-2009 Jan Vidar Krey, [email protected]
* See the file "COPYING" for licensing details.
*/
#include <samurai/samurai.h>
#include <samurai/io/net/socketmonitor.h>
#include <iostream>
#include <string>
#include <vector>
#include "irclink.h"
#include "ircserver.h"
#include "ircconfig.h"
class EventHandler : public IRC::ServerEventHandler
{
public:
protected:
void OnConnected(IRC::ServerConnection*) { }
void OnDisconnected(IRC::ServerConnection*) { }
void OnNickError(IRC::ServerConnection*) { }
void OnMessage(IRC::ServerConnection*) { }
void OnPing(IRC::ServerConnection*) { }
void OnRawMessage(IRC::ServerConnection*) { }
};
void run_tests()
{
IRC::Message m1(":[email protected] PRIVMSG #fw :why not");
IRC::Message m2(":[email protected] QUIT :http://www.mibbit.com ajax IRC Client");
std::cout << "test 1 " << m1.getArgument(0, false) << std::endl;
std::cout << "test 2 " << m1.getArgument(1, false) << std::endl;
std::cout << "test 3 " << m1.getArgument(2, false) << std::endl;
std::cout << "test 4 " << m1.getArguments(1, true) << std::endl;
}
int main(int argc, char** argv)
{
(void) argc;
(void) argv;
bool running = true;
Samurai::IO::Net::SocketMonitor* monitor = Samurai::IO::Net::SocketMonitor::getInstance();
std::cout << "ircprx" << std::endl;
IRC::ServerConfig serverConfig("irc.efnet.org");
serverConfig.setIdentity("qopiaz", "qopiaz__", "jalla", "Tester Jalla");
serverConfig.addChannel("#ircprx");
serverConfig.addChannel("#fw");
EventHandler handler;
IRC::ServerConnection connection(&serverConfig, &handler);
connection.connect();
while (running)
{
monitor->wait(5000);
}
}