Index: debian/bitlbee.init
===================================================================
--- debian/bitlbee.init	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/bitlbee.init	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -41,13 +41,5 @@
 	chown bitlbee: /var/run/bitlbee.pid
 	
-	# Clean up after the bug between 1.2-5 and 1.2.1-2 where BitlBee ran
-	# as root. (#494656 and #495877) Fixing this in the postinst script
-	# is not enough since the user will restart his BitlBee after up-
-	# grading the package, and the BitlBee running as root will then
-	# save its settings, re-setting ownership of the file to root.
-	# TODO: Remove this after a few revisions.
-	find /var/lib/bitlbee -uid 0 -name '*.xml' -exec chown bitlbee: {} \;
-
-	start-stop-daemon --start --quiet \
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
 		--exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS
 }
Index: debian/changelog
===================================================================
--- debian/changelog	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/changelog	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -1,2 +1,44 @@
+bitlbee (1.2.4-2) unstable; urgency=low
+
+  * Merging in some changes from bzr-head:
+  * Use libresolv.so where possible. (Closes: #551775)
+  * Some include file changes that make the bitlbee-dev package useful again.
+
+ -- Wilmer van der Gaast <wilmer@gaast.net>  Thu, 19 Nov 2009 23:02:43 +0000
+
+bitlbee (1.2.4-1) unstable; urgency=low
+
+  * New upstream version.
+  * Fixed issues with Yahoo! (Closes: #536178)
+
+ -- Wilmer van der Gaast <wilmer@gaast.net>  Sat, 17 Oct 2009 18:12:45 +0100
+
+bitlbee (1.2.3-2) unstable; urgency=low
+
+  * Fixed bitblee typo in prerm (introduced by NMU 1.2.1-1.1).
+    (Closes: #531287)
+  * Fixed bitlbee.deb dep in bitlbee-dev to deal with binary NMUs.
+    (Closes: #531219)
+  * Fixed free port detection code in debian/config which was a bit limited
+    and also buggy.
+  * Removing code that edits bitlbee.conf from postinst (and chown code in
+    the init script), it's not really necessary anymore; bitlbee may only
+    still run as root if the admin doesn't read conffile diffs.
+    (Closes: #514572)
+  * No longer overwriting port number info in /etc/default/bitlbee with
+    what's in debconf. (Closes: #514148)
+  * Added notes about the above two changes to bitlbee.conf.
+
+ -- Wilmer van der Gaast <wilmer@gaast.net>  Sun, 07 Jun 2009 21:17:39 +0100
+
+bitlbee (1.2.3-1) unstable; urgency=critical
+
+  * New upstream version.
+  * Fixes another account hijacking issue. (Closes: #498159)
+  * Restored --pidfile argument to start-stop-daemon, otherwise the init
+    script fails to restart BitlBee when users are connected.
+
+ -- Wilmer van der Gaast <wilmer@gaast.net>  Sun, 07 Sep 2008 18:53:04 +0100
+
 bitlbee (1.2.2-1) unstable; urgency=critical
 
Index: debian/config
===================================================================
--- debian/config	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/config	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -2,15 +2,21 @@
 
 . /usr/share/debconf/confmodule
+[ -f /etc/default/bitlbee ] && . /etc/default/bitlbee
 
 db_title BitlBee
 
-db_get bitlbee/serveport
-if [ "$RET" = "stillhavetoask" ]; then
-	if netstat -ltn | grep ':6667' 2> /dev/null > /dev/null; then
-		port=6668;
-	else
-		port=6667;
+if [ -n "$BITLBEE_PORT" ]; then
+	db_set bitlbee/serveport "$BITLBEE_PORT"
+else
+	db_get bitlbee/serveport
+	if [ "$RET" = "stillhavetoask" ]; then
+		listens=$(netstat -ltn | awk '{print $4}')
+		for port in 6667 6666 6668 6669; do
+			if [ $(expr "$listens " : ".*:$port\s") = "0" ]; then
+				break
+			fi
+		done
+		db_set bitlbee/serveport $port;
 	fi
-	db_set bitlbee/serveport $port;
 fi
 
Index: debian/control
===================================================================
--- debian/control	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/control	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -19,5 +19,5 @@
 Package: bitlbee-dev
 Architecture: all
-Depends: bitlbee (= ${binary:Version})
+Depends: bitlbee (>= ${source:Version}), bitlbee (<< ${source:Version}.1~)
 Description: An IRC to other chat networks gateway
  This program can be used as an IRC server which forwards everything you
Index: debian/patches/bitlbee.conf.diff
===================================================================
--- debian/patches/bitlbee.conf.diff	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/patches/bitlbee.conf.diff	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -1,13 +1,22 @@
-=== modified file 'bitlbee.conf'
---- debian/bitlbee/etc/bitlbee/bitlbee.conf	2008-08-26 22:33:54 +0000
-+++ debian/bitlbee/etc/bitlbee/bitlbee.conf	2008-08-27 23:18:13 +0000
-@@ -23,7 +23,7 @@
+--- debian/bitlbee/etc/bitlbee/bitlbee.conf	2009-06-01 00:20:24.000000000 +0100
++++ debian/bitlbee/etc/bitlbee/bitlbee.conf	2009-06-07 21:16:19.000000000 +0100
+@@ -23,13 +23,18 @@
  ## If BitlBee is started by root as a daemon, it can drop root privileges,
  ## and change to the specified user.
  ##
 -# User = bitlbee
++## DEBIAN NOTE: Without this, BitlBee will run as root!
++##
 +User = bitlbee
  
  ## DaemonPort/DaemonInterface:
  ##
-
+ ## For daemon mode, you can specify on what interface and port the daemon
+ ## should be listening for connections.
+ ##
++## DEBIAN NOTE: The init script passes the -p flag to use the port number
++## set using debconf, this overrides the DaemonPort setting here.
++##
+ # DaemonInterface = 0.0.0.0
+ # DaemonPort = 6667
+ 
Index: debian/postinst
===================================================================
--- debian/postinst	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/postinst	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -33,5 +33,5 @@
 ## /etc/default/bitlbee: Auto-generated/updated script.
 ##
-## Don't edit this line, use dpkg-reconfigure bitlbee
+## If running in (fork)daemon mode, listen on this TCP port.
 BITLBEE_PORT="$PORT"
 
@@ -61,11 +61,4 @@
 	else
 		mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt
-	fi
-fi
-
-if ! grep -qi '^User *= *' /etc/bitlbee/bitlbee.conf; then
-	echo 'Updating configuration file, enabling User-setting...'
-	if ! sed -i -e 's/# *User *= *.*/User = bitlbee/i' /etc/bitlbee/bitlbee.conf; then
-		echo 'Failed! BitlBee may run as root now, please check your configs.'
 	fi
 fi
Index: debian/prerm
===================================================================
--- debian/prerm	(revision f9928cb319c2879a56b7280f09723b26035982d0)
+++ debian/prerm	(revision 75554d0a484d21f95fcf24394f89c541a650acaf)
@@ -11,5 +11,5 @@
 else
 	if which invoke-rc.d >/dev/null 2>&1; then
-		invoke-rc.d bitblee stop || exit 0
+		invoke-rc.d bitlbee stop || exit 0
 	else
 		/etc/init.d/bitlbee stop || exit 0
