# Path: conf.py
# CONF_FILE = os.path.join(urk.userpath,'urk.conf')
# def pprint(obj, depth=-2):
# def save(*args):


import time
import ui
from conf import conf


def setupRaw(e):
    e.network._message_timeout = False

def onSocketConnect(e):
    timeout = conf.get("server_traffic_timeout", 120)*1000
    e.network._message_timeout = False
    if timeout:
        e.network._message_timeout_source = ui.register_timer(timeout, check_timeout, e.network)
    else:
        e.network._message_timeout_source = None

def check_timeout(network):
    if network._message_timeout:
        network.raw("PING %s" % network.me)

# Path: conf.py
# CONF_FILE = os.path.join(urk.userpath,'urk.conf')
# def pprint(obj, depth=-2):
# def save(*args):


# Path: scripts/timeout.py
import time
import ui
from conf import conf



def setupRaw(e):
    e.network._message_timeout = False

def onSocketConnect(e):
    timeout = conf.get("server_traffic_timeout", 120)*1000
    e.network._message_timeout = False
    if timeout:
        e.network._message_timeout_source = ui.register_timer(timeout, check_timeout, e.network)
    else:
        e.network._message_timeout_source = None

def check_timeout(network):
    if network._message_timeout:
        network.raw("PING %s" % network.me)

        timeout = conf.get("server_death_timeout", 240)*1000