#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Univention Debug
#  listener script
#
# Copyright (C) 2001-2009 Univention GmbH
#
# http://www.univention.de/
#
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Binary versions of this file provided by Univention to you as
# well as other copyrighted, protected or trademarked materials like
# Logos, graphics, fonts, specific documentations and configurations,
# cryptographic keys etc. are subject to a license agreement between
# you and Univention.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA	 02110-1301	 USA

import listener
import univention_baseconfig
import os, grp
import univention.debug

name='debug'
description='Debug Listener'
filter='(&(objectClass=*)(uid=User1))'
attributes=[]

def initialize():
	pass

def handler(dn, new, old):
	change=''
	if old:
		if new:
			change='modify'
		else:
			change='delete'
	else:
		if new:
			change='new'
	univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, 'DEBUG(%s): old: %s' % (change, old))
	univention.debug.debug(univention.debug.LISTENER, univention.debug.ERROR, 'DEBUG(%s): new: %s' % (change, new))

