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


import events
import ui
import windows
import chaninfo
from conf import conf
        ('http://', 1),
        ('https://', 1),
        ('ftp://', 1),
        ('www', 2),
        ]]

    for check_url in to_check:
        if check_url(e._target):
            return True
    
    return False
    
def is_chan(e):
    # click on a #channel
    return e.window.network and e._target and \
            e._target[0] in e.window.network.isupport.get('CHANTYPES', '&#$+')

def get_autojoin_list(network):
    perform = conf.get('networks',{}).get(network.name,{}).get('perform',())
    channels = set()
    for line in perform:
        if line.startswith('join ') and ' ' not in line[5:]:
            channels.update(line[5:].split(','))
    return channels

def add_autojoin(network, channel):
    if 'networks' not in conf:
        conf['networks'] = {}
    if network.name not in conf['networks']:
        conf['networks'][network.name] = {'server': network.server}

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


# Path: scripts/clicks.py
import events
import ui
import windows
import chaninfo
from conf import conf

        ('http://', 1),
        ('https://', 1),
        ('ftp://', 1),
        ('www', 2),
        ]]

    for check_url in to_check:
        if check_url(e._target):
            return True
    
    return False
    
def is_chan(e):
    # click on a #channel
    return e.window.network and e._target and \
            e._target[0] in e.window.network.isupport.get('CHANTYPES', '&#$+')

def get_autojoin_list(network):
    perform = conf.get('networks',{}).get(network.name,{}).get('perform',())
    channels = set()
    for line in perform:
        if line.startswith('join ') and ' ' not in line[5:]:
            channels.update(line[5:].split(','))
    return channels

def add_autojoin(network, channel):
    if 'networks' not in conf:
        conf['networks'] = {}
    if network.name not in conf['networks']:
        conf['networks'][network.name] = {'server': network.server}

        conf['start_networks'] = conf.get('start_networks',[]) + [network.name]