]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/handshaketimer.cpp
Remove space indents
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / handshaketimer.cpp
1 #include "configreader.h"
2 #include "users.h"
3 #include "channels.h"
4 #include "modules.h"
5 #include "commands/cmd_whois.h"
6 #include "commands/cmd_stats.h"
7 #include "socket.h"
8 #include "inspircd.h"
9 #include "wildcard.h"
10 #include "xline.h"
11 #include "transport.h"
12
13 #include "m_spanningtree/main.h"
14 #include "m_spanningtree/utils.h"
15 #include "m_spanningtree/treeserver.h"
16 #include "m_spanningtree/link.h"
17 #include "m_spanningtree/treesocket.h"
18 #include "m_spanningtree/handshaketimer.h"
19
20 HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u) : InspTimer(1, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u)
21 {
22         thefd = sock->GetFd();
23 }
24
25 void HandshakeTimer::Tick(time_t TIME)
26 {
27         if (Instance->SE->GetRef(thefd) == sock)
28         {
29                 if (sock->GetHook() && InspSocketHSCompleteRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send())
30                 {
31                         InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
32                         sock->SendCapabilities();
33                         if (sock->GetLinkState() == CONNECTING)
34                         {
35                                 sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+lnk->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
36                         }
37                 }
38                 else
39                 {
40                         Instance->Timers->AddTimer(new HandshakeTimer(Instance, sock, lnk, Utils));
41                 }
42         }
43 }