-
Notifications
You must be signed in to change notification settings - Fork 0
/
keepalive.py
19 lines (17 loc) · 868 Bytes
/
keepalive.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import znc
class pingtimer(znc.Timer):
def RunJob(self):
self.GetModule().PutModule('Sending version number {0} to IRC network...'.format(self.counter))
self.GetModule().PutIRC('version')
self.counter = self.counter + 1
class keepalive(znc.Module):
description = "Keep connections through NAT to idle IRC networks alive."
module_types = [znc.CModInfo.NetworkModule,znc.CModInfo.GlobalModule,znc.CModInfo.UserModule]
# def OnIRCConnected(self):
# timer = self.CreateTimer(pingtimer, interval=5, cycles=0, description='Sends version command to IRC network.')
# timer.counter=0
# return znc.CONTINUE
def OnLoad(self, args, message):
timer = self.CreateTimer(pingtimer, interval=60, cycles=0, description='Sends version command to IRC network.')
timer.counter=0
return znc.CONTINUE