Index: bitlbee.h
===================================================================
--- bitlbee.h	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ bitlbee.h	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -163,5 +163,4 @@
 
 char *set_eval_root_nick( set_t *set, char *new_nick );
-char *set_eval_control_channel( set_t *set, char *new_name );
 
 extern global_t global;
Index: configure
===================================================================
--- configure	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ configure	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -20,5 +20,5 @@
 ipcsocket='/var/run/bitlbee.sock'
 pcdir='$prefix/lib/pkgconfig'
-systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64"
+systemlibdirs="/lib /usr/lib /usr/local/lib"
 
 msn=1
@@ -156,5 +156,5 @@
 
 echo CFLAGS=$CFLAGS >> Makefile.settings
-echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
+echo CFLAGS+=-I`pwd` -iquote`pwd`/lib -iquote`pwd`/protocols -I. >> Makefile.settings
 
 echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
@@ -295,32 +295,26 @@
 detect_resolv_dynamic()
 {
-	TMPFILE=$(mktemp)
-	ret=1
-	echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null
+	echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -lresolv >/dev/null 2>/dev/null
 	if [ "$?" = "0" ]; then
 		echo 'EFLAGS+=-lresolv' >> Makefile.settings
-		ret=0
-	fi
-
-	rm -f $TMPFILE
-	return $ret
+		return 0
+	fi
+
+	return 1
 }
 
 detect_resolv_static()
 {
-	TMPFILE=$(mktemp)
-	ret=1
 	for i in $systemlibdirs; do
 		if [ -f $i/libresolv.a ]; then
-			echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
+			echo "$RESOLV_TESTCODE" | $CC -o /dev/null -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
 			if [ "$?" = "0" ]; then
 				echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
-				ret=0
+				return 0
 			fi
 		fi
 	done
 
-	rm -f $TMPFILE
-	return $ret
+	return 1
 }
 
Index: debian/bitlbee.init
===================================================================
--- debian/bitlbee.init	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/bitlbee.init	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -41,5 +41,13 @@
 	chown bitlbee: /var/run/bitlbee.pid
 	
-	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+	# 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 \
 		--exec $DAEMON -- -p $BITLBEE_PORT -P $PIDFILE $BITLBEE_OPTS
 }
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/changelog	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -1,52 +1,2 @@
-bitlbee (1.2.5-1) unstable; urgency=low
-
-  * New upstream version.
-  * Fixed issues with server-side MSN nickname corruption. (Closes: #538756)
-  * Debconf translation fixes/additions. (Closes: #541754, #563504)
-
- -- Wilmer van der Gaast <wilmer@gaast.net>  Wed, 17 Mar 2010 14:59:27 +0000
-
-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 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/config	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -2,21 +2,15 @@
 
 . /usr/share/debconf/confmodule
-[ -f /etc/default/bitlbee ] && . /etc/default/bitlbee
 
 db_title BitlBee
 
-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;
+db_get bitlbee/serveport
+if [ "$RET" = "stillhavetoask" ]; then
+	if netstat -ltn | grep ':6667' 2> /dev/null > /dev/null; then
+		port=6668;
+	else
+		port=6667;
 	fi
+	db_set bitlbee/serveport $port;
 fi
 
Index: debian/control
===================================================================
--- debian/control	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/control	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -19,5 +19,5 @@
 Package: bitlbee-dev
 Architecture: all
-Depends: bitlbee (>= ${source:Version}), bitlbee (<< ${source:Version}.1~)
+Depends: bitlbee (= ${binary:Version})
 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 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/patches/bitlbee.conf.diff	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -1,22 +1,13 @@
---- 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 @@
+=== 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 @@
  ## 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/po/POTFILES.in
===================================================================
--- debian/po/POTFILES.in	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/po/POTFILES.in	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -1,1 +1,1 @@
-[type: gettext/rfc822deb] templates
+[type: gettext/rfc822deb] bitlbee.templates.master
Index: bian/po/ru.po
===================================================================
--- debian/po/ru.po	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ 	(revision )
@@ -1,47 +1,0 @@
-# translation of ru.po to Russian
-#
-#    Translators, if you are not familiar with the PO format, gettext
-#    documentation is worth reading, especially sections dedicated to
-#    this format, e.g. by running:
-#         info -n '(gettext)PO Files'
-#         info -n '(gettext)Header Entry'
-#    Some information specific to po-debconf are available at
-#            /usr/share/doc/po-debconf/README-trans
-#         or http://www.debian.org/intl/l10n/po-debconf/README-trans#
-#    Developers do not need to manually edit POT or PO files.
-#
-# Yuri Kozlov <yuray@komyakino.ru>, 2009.
-msgid ""
-msgstr ""
-"Project-Id-Version: bitlbee 1.2.3-2\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-09-25 18:12+0200\n"
-"PO-Revision-Date: 2009-08-05 20:43+0400\n"
-"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
-"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms:  nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
-
-#. Type: string
-#. Description
-#: ../bitlbee.templates.master:4
-msgid "On what TCP port should BitlBee listen for connections?"
-msgstr "Номер порта TCP, на котором BitlBee должен ожидать подключений:"
-
-#. Type: string
-#. Description
-#: ../bitlbee.templates.master:4
-msgid ""
-"BitlBee normally listens on the regular IRC port, 6667. This might not be a "
-"very good idea when you're running a real IRC daemon as well. 6668 might be "
-"a good alternative. Leaving this value blank means that BitlBee will not be "
-"run automatically."
-msgstr ""
-"Обычно, BitlBee прослушивает штатный порт IRC, 6667. Это может быть "
-"не лучшим решением, если у вас также запущена служба IRC. Хорошей "
-"альтернативой является номер 6668. Если оставить поле пустым, то "
-"BitlBee не будет запускаться автоматически."
-
Index: debian/postinst
===================================================================
--- debian/postinst	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/postinst	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -33,5 +33,5 @@
 ## /etc/default/bitlbee: Auto-generated/updated script.
 ##
-## If running in (fork)daemon mode, listen on this TCP port.
+## Don't edit this line, use dpkg-reconfigure bitlbee
 BITLBEE_PORT="$PORT"
 
@@ -61,4 +61,11 @@
 	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 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ debian/prerm	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -11,5 +11,5 @@
 else
 	if which invoke-rc.d >/dev/null 2>&1; then
-		invoke-rc.d bitlbee stop || exit 0
+		invoke-rc.d bitblee stop || exit 0
 	else
 		/etc/init.d/bitlbee stop || exit 0
Index: doc/user-guide/commands.xml
===================================================================
--- doc/user-guide/commands.xml	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ doc/user-guide/commands.xml	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -511,14 +511,4 @@
 	</bitlbee-setting>
 
-	<bitlbee-setting name="control_channel" type="string" scope="global">
-		<default>&amp;bitlbee</default>
-
-		<description>
-			<para>
-				Normally the control channel where you can see all your contacts is called "&amp;bitlbee". If you don't like this name, you can rename it to anything else using the <emphasis>rename</emphasis> command, or by changing this setting.
-			</para>
-		</description>
-	</bitlbee-setting>
-
 	<bitlbee-setting name="debug" type="boolean" scope="global">
 		<default>false</default>
@@ -583,15 +573,4 @@
 				</para>
 			</note>
-		</description>
-
-	</bitlbee-setting>
-
-	<bitlbee-setting name="ignore_auth_requests" type="boolean" scope="account">
-		<default>true</default>
-
-		<description>
-			<para>
-				Only supported by OSCAR so far, you can use this setting to ignore ICQ authorization requests, which are hardly used for legitimate (i.e. non-spam) reasons anymore.
-			</para>
 		</description>
 
Index: irc.c
===================================================================
--- irc.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ irc.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -172,5 +172,4 @@
 	s = set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc );
 	s = set_add( &irc->set, "charset", "utf-8", set_eval_charset, irc );
-	s = set_add( &irc->set, "control_channel", irc->channel, set_eval_control_channel, irc );
 	s = set_add( &irc->set, "debug", "false", set_eval_bool, irc );
 	s = set_add( &irc->set, "default_target", "root", NULL, irc );
Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/jabber/jabber.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -57,6 +57,4 @@
 	set_t *s;
 	char str[16];
-	
-	s = set_add( &acc->set, "activity_timeout", "600", set_eval_int, acc );
 	
 	g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] );
@@ -323,5 +321,5 @@
 		bud = jabber_buddy_by_ext_jid( ic, who, 0 );
 	else
-		bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_BARE_OK );
+		bud = jabber_buddy_by_jid( ic, who, 0 );
 	
 	node = xt_new_node( "body", message, NULL );
@@ -368,7 +366,15 @@
 static void jabber_get_info( struct im_connection *ic, char *who )
 {
+	struct jabber_data *jd = ic->proto_data;
 	struct jabber_buddy *bud;
 	
-	bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_FIRST );
+	if( strchr( who, '/' ) )
+		bud = jabber_buddy_by_jid( ic, who, 0 );
+	else
+	{
+		char *s = jabber_normalize( who );
+		bud = g_hash_table_lookup( jd->buddies, s );
+		g_free( s );
+	}
 	
 	while( bud )
Index: protocols/jabber/jabber.h
===================================================================
--- protocols/jabber/jabber.h	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/jabber/jabber.h	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -120,11 +120,4 @@
 };
 
-/* Somewhat messy data structure: We have a hash table with the bare JID as
-   the key and the head of a struct jabber_buddy list as the value. The head
-   is always a bare JID. If the JID has other resources (often the case,
-   except for some transports that don't support multiple resources), those
-   follow. In that case, the bare JID at the beginning doesn't actually
-   refer to a real session and should only be used for operations that
-   support incomplete JIDs. */
 struct jabber_buddy
 {
@@ -141,5 +134,5 @@
 	GSList *features;
 	
-	time_t last_msg;
+	time_t last_act;
 	jabber_buddy_flags_t flags;
 	
@@ -278,6 +271,4 @@
 	GET_BUDDY_EXACT = 2,	/* Get an exact match (only makes sense with bare JIDs). */
 	GET_BUDDY_FIRST = 4,	/* No selection, simply get the first resource for this JID. */
-	GET_BUDDY_BARE = 8,	/* Get the bare version of the JID (possibly inexistent). */
-	GET_BUDDY_BARE_OK = 16,	/* Allow returning a bare JID if that seems better. */
 } get_buddy_flags_t;
 
Index: protocols/jabber/jabber_util.c
===================================================================
--- protocols/jabber/jabber_util.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/jabber/jabber_util.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -4,5 +4,5 @@
 *  Jabber module - Misc. stuff                                              *
 *                                                                           *
-*  Copyright 2006-2010 Wilmer van der Gaast <wilmer@gaast.net>              
+*  Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net>                   *
 *                                                                           *
 *  This program is free software; you can redistribute it and/or modify     *
@@ -349,9 +349,4 @@
 	if( ( bud = g_hash_table_lookup( jd->buddies, full_jid ) ) )
 	{
-		/* The first entry is always a bare JID. If there are more, we
-		   should ignore the first one here. */
-		if( bud->next )
-			bud = bud->next;
-		
 		/* If this is a transport buddy or whatever, it can't have more
 		   than one instance, so this is always wrong: */
@@ -388,13 +383,8 @@
 	else
 	{
-		new->full_jid = new->bare_jid = g_strdup( full_jid );
+		/* Keep in mind that full_jid currently isn't really
+		   a full JID... */
+		new->bare_jid = g_strdup( full_jid );
 		g_hash_table_insert( jd->buddies, new->bare_jid, new );
-		
-		if( s )
-		{
-			new->next = g_new0( struct jabber_buddy, 1 );
-			new->next->bare_jid = new->bare_jid;
-			new = new->next;
-		}
 	}
 	
@@ -422,5 +412,5 @@
 {
 	struct jabber_data *jd = ic->proto_data;
-	struct jabber_buddy *bud, *head;
+	struct jabber_buddy *bud;
 	char *s, *jid;
 	
@@ -434,9 +424,4 @@
 		if( ( bud = g_hash_table_lookup( jd->buddies, jid ) ) )
 		{
-			bare_exists = 1;
-			
-			if( bud->next )
-				bud = bud->next;
-			
 			/* Just return the first one for this bare JID. */
 			if( flags & GET_BUDDY_FIRST )
@@ -460,7 +445,14 @@
 					break;
 		}
+		else
+		{
+			/* This variable tells the if down here that the bare
+			   JID already exists and we should feel free to add
+			   more resources, if the caller asked for that. */
+			bare_exists = 1;
+		}
 		
 		if( bud == NULL && ( flags & GET_BUDDY_CREAT ) &&
-		    ( bare_exists || imcb_find_buddy( ic, jid ) ) )
+		    ( !bare_exists || imcb_find_buddy( ic, jid ) ) )
 		{
 			*s = '/';
@@ -476,6 +468,5 @@
 		char *set;
 		
-		head = g_hash_table_lookup( jd->buddies, jid );
-		bud = ( head && head->next ) ? head->next : head;
+		bud = g_hash_table_lookup( jd->buddies, jid );
 		
 		g_free( jid );
@@ -494,6 +485,4 @@
 			/* Looks like the caller doesn't care about details. */
 			return bud;
-		else if( flags & GET_BUDDY_BARE )
-			return head;
 		
 		best_prio = best_time = bud;
@@ -502,5 +491,5 @@
 			if( bud->priority > best_prio->priority )
 				best_prio = bud;
-			if( bud->last_msg > best_time->last_msg )
+			if( bud->last_act > best_time->last_act )
 				best_time = bud;
 		}
@@ -508,15 +497,8 @@
 		if( ( set = set_getstr( &ic->acc->set, "resource_select" ) ) == NULL )
 			return NULL;
-		else if( strcmp( set, "priority" ) == 0 )
+		else if( strcmp( set, "activity" ) == 0 )
+			return best_time;
+		else /* if( strcmp( set, "priority" ) == 0 ) */
 			return best_prio;
-		else if( flags & GET_BUDDY_BARE_OK ) /* && strcmp( set, "activity" ) == 0 */
-		{
-			if( best_time->last_msg + set_getint( &ic->acc->set, "activity_timeout" ) >= time( NULL ) )
-				return best_time;
-			else
-				return head;
-		}
-		else
-			return best_time;
 	}
 }
@@ -560,5 +542,5 @@
 {
 	struct jabber_data *jd = ic->proto_data;
-	struct jabber_buddy *bud, *prev = NULL, *bi;
+	struct jabber_buddy *bud, *prev, *bi;
 	char *s, *full_jid;
 	
@@ -570,7 +552,4 @@
 	if( ( bud = g_hash_table_lookup( jd->buddies, full_jid ) ) )
 	{
-		if( bud->next )
-			bud = (prev=bud)->next;
-		
 		/* If there's only one item in the list (and if the resource
 		   matches), removing it is simple. (And the hash reference
@@ -580,5 +559,14 @@
 		      ( bud->resource && s && strcmp( bud->resource, s + 1 ) == 0 ) ) )
 		{
-			return jabber_buddy_remove_bare( ic, full_jid );
+			g_hash_table_remove( jd->buddies, bud->bare_jid );
+			g_free( bud->bare_jid );
+			g_free( bud->ext_jid );
+			g_free( bud->full_jid );
+			g_free( bud->away_message );
+			g_free( bud );
+			
+			g_free( full_jid );
+			
+			return 1;
 		}
 		else if( s == NULL || bud->resource == NULL )
@@ -591,5 +579,5 @@
 		else
 		{
-			for( bi = bud; bi; bi = (prev=bi)->next )
+			for( bi = bud, prev = NULL; bi; bi = (prev=bi)->next )
 				if( strcmp( bi->resource, s + 1 ) == 0 )
 					break;
@@ -602,5 +590,6 @@
 					prev->next = bi->next;
 				else
-					/* Don't think this should ever happen anymore. */
+					/* The hash table should point at the second
+					   item, because we're removing the first. */
 					g_hash_table_replace( jd->buddies, bi->bare_jid, bi->next );
 				
Index: protocols/jabber/message.c
===================================================================
--- protocols/jabber/message.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/jabber/message.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -71,5 +71,5 @@
 			if( bud )
 			{
-				bud->last_msg = time( NULL );
+				bud->last_act = time( NULL );
 				from = bud->ext_jid ? : bud->bare_jid;
 			}
Index: protocols/jabber/presence.c
===================================================================
--- protocols/jabber/presence.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/jabber/presence.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -68,4 +68,7 @@
 		{
 			bud->away_state = NULL;
+			/* Let's only set last_act if there's *no* away state,
+			   since it could be some auto-away thingy. */
+			bud->last_act = time( NULL );
 		}
 		
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ protocols/oscar/oscar.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -373,13 +373,9 @@
 	set_t *s;
 	
+	s = set_add( &acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc );
+	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
+	
 	if (isdigit(acc->user[0])) {
-		set_add(&acc->set, "ignore_auth_requests", "false", set_eval_bool, acc);
-	}
-	
-	s = set_add(&acc->set, "server", AIM_DEFAULT_LOGIN_SERVER, set_eval_account, acc);
-	s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
-	
-	if(isdigit(acc->user[0])) {
-		s = set_add(&acc->set, "web_aware", "false", set_eval_bool, acc);
+		s = set_add( &acc->set, "web_aware", "false", set_eval_bool, acc );
 		s->flags |= ACC_SET_OFFLINE_ONLY;
 	}
@@ -1216,13 +1212,8 @@
  */
 static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
-	struct icq_auth *data;
+	struct icq_auth *data = g_new(struct icq_auth, 1);
 	char *reason = NULL;
 	char *dialog_msg;
-
-	if (set_getbool(&ic->acc->set, "ignore_auth_requests"))
-		return;
-	
-	data = g_new(struct icq_auth, 1);
-
+	
 	if (strlen(msg) > 6)
 		reason = msg + 6;
Index: root_commands.c
===================================================================
--- root_commands.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ root_commands.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  * Copyright 2002-2004 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -654,19 +654,4 @@
 		irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] );
 	}
-	else if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
-	{
-		if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) )
-		{
-			u = user_find( irc, irc->nick );
-			
-			irc_part( irc, u, irc->channel );
-			g_free( irc->channel );
-			irc->channel = g_strdup( cmd[2] );
-			irc_join( irc, u, irc->channel );
-			
-			if( strcmp( cmd[0], "set_rename" ) != 0 )
-				set_setstr( &irc->set, "control_channel", cmd[2] );
-		}
-	}
 	else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) )
 	{
@@ -716,18 +701,4 @@
 	
 	return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : SET_INVALID;
-}
-
-char *set_eval_control_channel( set_t *set, char *new_name )
-{
-	irc_t *irc = set->data;
-	
-	if( strcmp( irc->channel, new_name ) != 0 )
-	{
-		char *cmd[] = { "set_rename", irc->channel, new_name, NULL };
-		
-		cmd_rename( irc, cmd );
-	}
-	
-	return strcmp( irc->channel, new_name ) == 0 ? new_name : SET_INVALID;
 }
 
Index: tests/check_jabber_util.c
===================================================================
--- tests/check_jabber_util.c	(revision 767a148faa35c18cdf4da77b5919a2f6e2df868a)
+++ tests/check_jabber_util.c	(revision a81d679654e36055ce9913cd7541885b41380947)
@@ -14,10 +14,10 @@
 	
 	budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" );
-	budw1->last_msg = time( NULL ) - 100;
+	budw1->last_act = time( NULL ) - 100;
 	budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" );
 	budw2->priority = 2;
-	budw2->last_msg = time( NULL );
+	budw2->last_act = time( NULL );
 	budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" );
-	budw3->last_msg = time( NULL ) - 200;
+	budw3->last_act = time( NULL ) - 200;
 	budw3->priority = 4;
 	/* TODO(wilmer): Shouldn't this just return budw3? */
@@ -60,37 +60,16 @@
 	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) );
 	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) );
-	
-	/* Test activity_timeout and GET_BUDDY_BARE_OK. */
-	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) == budw1 );
-	budw1->last_msg -= 50;
-	fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) ) != NULL );
-	fail_unless( strcmp( bud->full_jid, "wilmer@gaast.net" ) == 0 );
+	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
 	
 	fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
 	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
 	
-	fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
-	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/bitlbee" ) );
-	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/BitlBee" ) );
-	fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) );
-	
 	/* Check if remove_bare() indeed gets rid of all. */
-	/* disable this one for now.
 	fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) );
 	fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) );
-	*/
 
 	fail_if( jabber_buddy_remove( ic, "nekkid@lamejab.net/Illegal" ) );
 	fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) );
 	fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) );
-	
-	/* Fixing a bug in this branch that caused information to get lost when
-	   removing the first full JID from a list. */
-	jabber_buddy_add( ic, "bugtest@google.com/A" );
-	jabber_buddy_add( ic, "bugtest@google.com/B" );
-	jabber_buddy_add( ic, "bugtest@google.com/C" );
-	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) );
-	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) );
-	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) );
 }
 
@@ -106,5 +85,4 @@
 	jd->buddies = g_hash_table_new( g_str_hash, g_str_equal );
 	set_add( &ic->acc->set, "resource_select", "priority", NULL, ic->acc );
-	set_add( &ic->acc->set, "activity_timeout", "120", NULL, ic->acc );
 	
 	suite_add_tcase (s, tc_core);
