load("examples/morse")
load("examples/rot13")
load("examples/nick_highlight")
load("examples/away")

def j(channel, key = ""):
  if channel != "" and channel[0] != '#' and channel[0] != '&':
    join('#' + channel, key)
  else:
    join(channel, key)

def l(channel):
  if channel == "":
    if pyirc.window()[0] == '#' or pyirc.window()[0] == '&':
      leave(pyirc.window())
  else:
    if channel[0] != '#' and channel[0] != '&':
      leave('#' + channel)
    else:
      leave(channel)

def lj():
  if pyirc.window()[0] == '#' or pyirc.window()[0] == '&':
    l("")
    j(pyirc.window())

wi = whois

def mode(dest, modes, parameters):
  if modes == "" and (pyirc.window()[0] == '#' or \
        pyirc.window()[0] == '&'):
     modes = dest
     dest =  pyirc.window()
  pyirc.mode(dest, modes, parameters)

on("TIMER", ".*:00", "echo('*** The time is now ' + p0)")

on("IDLE", "5", "away('Automatically set away')")

set("suppress_server_motd",1)
