Index: bitlbee.h
===================================================================
--- bitlbee.h	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ bitlbee.h	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -137,5 +137,4 @@
 #include "log.h"
 #include "ini.h"
-#include "help.h"
 #include "query.h"
 #include "sock.h"
@@ -147,5 +146,5 @@
 	int listen_socket;
 	gint listen_watch_source_id;
-	help_t *help;
+	struct help *help;
 	char *conf_file;
 	conf_t *conf;
Index: doc/CHANGES
===================================================================
--- doc/CHANGES	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ doc/CHANGES	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -4,11 +4,9 @@
 http://bugs.bitlbee.org/bitlbee/timeline?daysback=90&changeset=on
 
-Version ...
-- For the first time since 2007, a dev snapshot. Like then, this is pretty
-  stable already (running on testing.bitlbee.org for weeks by now), but not
-  all planned features for the next major release are ready yet, and there
-  may be some rough edges in the interface and documentation.
-- Loads of new stuff, mostly ready for a new major release, but starting with
-  a dev snapshot. A few changes that were planned for a long time already:
+Version 
+- Important: This version drops backward compatibility with the file format
+  used for user settings in versions before 1.2. If you're upgrading from
+  very old BitlBee versions (like 1.0.x), you'll have to recreate your
+  BitlBee account - or use an 1.2.x BitlBee once to do the conversion.
 - Rewrote the IRC core, which brings:
   * Support for multiple (control) channels, so you can have one channel per
@@ -63,4 +61,14 @@
 - Updated Yahoo! module to be in sync again with libyahoo2. This mostly
   fixes issues with authorization requests.
+- Show if a contact is mobile or not. See "help set mobile_is_away".
+- Easier handling of XMPP chatroom invitations.
+- The chatroom mode of the Twitter module is now enabled by default, since
+  this was by far the most popular. To disable it, see "help set mode".
+- Added some Twitter-specific commands that can only be used in the Twitter
+  window. Most important addition: Retweets. See "help set commands".
+- Removed some ancient account/nick migration scripts and added one for
+  easier switching from Pidgin and other libpurple-based clients to BitlBee.
+- Many bug fixes in both the core and IM modules, small feature enhancements
+  and other minor changes.
 
 Finished ...
Index: doc/FAQ
===================================================================
--- doc/FAQ	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ doc/FAQ	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -62,15 +62,10 @@
    These days, we replaced the Yahoo! code with libyahoo2 (which is a
    separate Yahoo! module. It's derived from Gaim, but separately
-   maintained) and wrote our own MSN module. More modules are probably going
-   to be changed, so in the near future, the API might be the only thing
-   left from Gaim.
-
-Q: What's that Gaim doing in BitlBee error messages and my Jabber resource?
-A: Ah, well, as you probably know we use some of Gaim's IM-modules, and we
-   don't think it's worth our time to do a search-and-replace over the whole
-   source to get rid of every reference to Gaim. In fact, we don't want to,
-   since we don't want to pretend we wrote all that code.
+   maintained) and wrote our own MSN, Jabber and Twitter modules from
+   scratch. Most of the API has also been changed, so by now the only traces
+   of Gaim left are in the "nogaim" filename.
    
-   About Jabber: If you want a different resource string, you can set it
-   when logging in by appending it to your Jabber ID, like:
-   lintux@jabber.com/BitlBee
+   There is good news for Gaim (or now Pidgin, of course) fans though:
+   BitlBee can now be compiled to use libpurple for all IM interactions.
+   This makes BitlBee a bit more resource-hungry, but adds support for many
+   IM protocols/networks that couldn't be used from BitlBee so far.
Index: doc/README
===================================================================
--- doc/README	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ doc/README	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -67,10 +67,10 @@
 platform. Any recent version of GLib (2.4 or higher) will work.
 
-These days, MSN Messenger clients have to connect to the MS Passport servers
-through HTTPS. BitlBee can use several SSL libraries for this: GnuTLS, NSS
-(which comes with Mozilla) and OpenSSL. OpenSSL is not GPL-compatible in some
-situations, so using GnuTLS or NSS is preferred. However, especially on *BSD,
-OpenSSL can be considered part of the operating system, which eliminates the
-GPL incompatibility.
+These days, many IM protocols use SSL/TLS connections (for authentication
+or for the whole session). BitlBee can use several SSL libraries for this:
+GnuTLS, NSS (which comes with Mozilla) and OpenSSL. OpenSSL is not GPL-
+compatible in some situations, so using GnuTLS is preferred. However,
+especially on *BSD, OpenSSL can be considered part of the operating system,
+which eliminates the GPL incompatibility.
 
 The incompatibility is also the reason why the SSL library detection code
Index: doc/user-guide/misc.xml
===================================================================
--- doc/user-guide/misc.xml	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ doc/user-guide/misc.xml	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -268,6 +268,39 @@
 </sect1>
 
+<sect1 id="whatsnew010206">
+<title>New stuff in BitlBee 1.2.6</title>
+
+<para>
+Twitter support. See <emphasis>help account add twitter</emphasis>.
+</para>
+</sect1>
+
+<sect1 id="whatsnew010300">
+<title>New stuff in BitlBee 1.3dev</title>
+
+<para>
+Support for multiple configurable control channels, each with a subset of
+your contact list. See <emphasis>help channels</emphasis> for more
+information.
+</para>
+
+<para>
+File transfer support for some protocols (more if you use libpurple). Just
+/DCC SEND stuff. Incoming files also become DCC transfers.
+</para>
+
+<para>
+Only if you run your own BitlBee instance: You can build a BitlBee that uses
+libpurple for connecting to IM networks instead of its own code, adding
+support for some of the more obscure IM protocols and features.
+</para>
+
+<para>
+Many more things, briefly described in <emphasis>help news1.3</emphasis>.
+</para>
+</sect1>
+
 <sect1 id="news1.3">
-<title>New stuff in BitlBee 1.3dev</title>
+<title>New stuff in BitlBee 1.3dev (details)</title>
 
 <para>
Index: help.c
===================================================================
--- help.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ help.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2009 Wilmer van der Gaast and others                *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -26,4 +26,5 @@
 #define BITLBEE_CORE
 #include "bitlbee.h"
+#include "help.h"
 #undef read 
 #undef write
@@ -194,2 +195,23 @@
 	return 1;
 }
+
+char *help_get_whatsnew( help_t **help, int old )
+{
+	GString *ret = NULL;
+	help_t *h;
+	int v;
+	
+	for( h = *help; h; h = h->next )
+		if( h->title != NULL && strncmp( h->title, "whatsnew", 8 ) == 0 &&
+		    sscanf( h->title + 8, "%x", &v ) == 1 && v > old )
+		{
+			char *s = help_get( &h, h->title );
+			if( ret == NULL )
+				ret = g_string_new( s );
+			else
+				g_string_append_printf( ret, "\n\n%s", s );
+			g_free( s );
+		}
+	
+	return ret ? g_string_free( ret, FALSE ) : NULL;
+}
Index: help.h
===================================================================
--- help.h	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ help.h	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -47,4 +47,5 @@
 char *help_get( help_t **help, char *title );
 int help_add_mem( help_t **help, const char *title, const char *content_ );
+char *help_get_whatsnew( help_t **help, int old );
 
 #endif
Index: irc.c
===================================================================
--- irc.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ irc.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -112,4 +112,5 @@
 	s = set_add( &b->set, "last_version", NULL, NULL, irc );
 	s->flags |= SET_HIDDEN;
+	s->value = g_strdup_printf( "%d", BITLBEE_VERSION_CODE );
 	s = set_add( &b->set, "lcnicks", "true", set_eval_bool, irc );
 	s = set_add( &b->set, "nick_format", "%-@nick", NULL, irc );
Index: irc_channel.c
===================================================================
--- irc_channel.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ irc_channel.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -192,5 +192,5 @@
 	if( strcmp( value, "control" ) == 0 )
 		new = &control_channel_funcs;
-	else if( strcmp( value, "chat" ) == 0 )
+	else if( ic != ic->irc->default_channel && strcmp( value, "chat" ) == 0 )
 		new = &irc_channel_im_chat_funcs;
 	else
Index: irc_commands.c
===================================================================
--- irc_commands.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ irc_commands.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -26,4 +26,5 @@
 #define BITLBEE_CORE
 #include "bitlbee.h"
+#include "help.h"
 #include "ipc.h"
 
Index: irc_im.c
===================================================================
--- irc_im.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ irc_im.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -530,5 +530,5 @@
 	irc_channel_t *ic = c->ui_data;
 	
-	if( ic == NULL )
+	if( ic == NULL || bu == NULL )
 		return FALSE;
 	
Index: irc_send.c
===================================================================
--- irc_send.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ irc_send.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -114,5 +114,5 @@
 	irc_channel_t *ic = NULL;
 	irc_user_t *iu = irc->root;
-	char text[1024];
+	char text[1100];
 	va_list params;
 	char *dst;
Index: motd.txt
===================================================================
--- motd.txt	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ motd.txt	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -17,3 +17,2 @@
  
 ... Buzzing, haha, get it?
-%
Index: protocols/bee_chat.c
===================================================================
--- protocols/bee_chat.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ protocols/bee_chat.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -196,5 +196,5 @@
 	}
 	
-	if( bee->ui->chat_remove_user )
+	if( bee->ui->chat_remove_user && bu )
 		bee->ui->chat_remove_user( bee, c, bu );
 }
Index: protocols/purple/purple.c
===================================================================
--- protocols/purple/purple.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ protocols/purple/purple.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -80,4 +80,26 @@
 	char help_title[64];
 	GString *help;
+	static gboolean dir_fixed = FALSE;
+	
+	/* Layer violation coming up: Making an exception for libpurple here.
+	   Dig in the IRC state a bit to get a username. Ideally we should
+	   check if s/he identified but this info doesn't seem *that* important.
+	   It's just that fecking libpurple can't *not* store this shit.
+	   
+	   Remember that libpurple is not really meant to be used on public
+	   servers anyway! */
+	if( !dir_fixed )
+	{
+		irc_t *irc = acc->bee->ui_data;
+		char *dir;
+		
+		dir = g_strdup_printf( "%s/purple/%s", global.conf->configdir, irc->user->nick );
+		purple_util_set_user_dir( dir );
+		g_free( dir );
+		
+		purple_blist_load();
+		purple_prefs_load();
+		dir_fixed = TRUE;
+	}
 	
 	help = g_string_new( "" );
@@ -254,5 +276,6 @@
 	PurpleAccount *pa;
 	
-	if( local_bee != NULL && local_bee != acc->bee )
+	if( ( local_bee != NULL && local_bee != acc->bee ) ||
+	    ( global.conf->runmode == RUNMODE_DAEMON && !getenv( "BITLBEE_DEBUG" ) ) )
 	{
 		imcb_error( ic,  "Daemon mode detected. Do *not* try to use libpurple in daemon mode! "
@@ -351,4 +374,7 @@
 	account_t *acc = set->data;
 	struct im_connection *ic = acc->ic;
+	
+	if( ic )
+		imcb_log( ic, "Changing display_name not currently supported with libpurple!" );
 	
 	return NULL;
@@ -517,5 +543,5 @@
 }
 
-struct groupchat *purple_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password )
+struct groupchat *purple_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password, set_t **sets )
 {
 	PurpleAccount *pa = ic->proto_data;
@@ -1132,4 +1158,5 @@
 	GList *prots;
 	GString *help;
+	char *dir;
 	
 	if( B_EV_IO_READ != PURPLE_INPUT_READ ||
@@ -1140,5 +1167,8 @@
 	}
 	
-	purple_util_set_user_dir( "/tmp" );
+	dir = g_strdup_printf( "%s/purple", global.conf->configdir );
+	purple_util_set_user_dir( dir );
+	g_free( dir );
+	
 	purple_debug_set_enabled( FALSE );
 	purple_core_set_ui_ops( &bee_core_uiops );
@@ -1151,10 +1181,5 @@
 	}
 	
-	/* This seems like stateful shit we don't want... */
 	purple_set_blist( purple_blist_new() );
-	purple_blist_load();
-	
-	/* Meh? */
-	purple_prefs_load();
 	
 	/* No, really. So far there were ui_ops for everything, but now suddenly
@@ -1221,5 +1246,6 @@
 	
 	g_string_append( help, "\n\nFor used protocols, more information about available "
-	                 "settings can be found using \x02help purple <protocol name>\x02" );
+	                 "settings can be found using \x02help purple <protocol name>\x02 "
+	                 "(create an account using that protocol first!)" );
 	
 	/* Add a simple dynamically-generated help item listing all
Index: protocols/twitter/twitter.c
===================================================================
--- protocols/twitter/twitter.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ protocols/twitter/twitter.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -29,4 +29,14 @@
 #include "url.h"
 
+#define twitter_msg( ic, fmt... ) \
+	do {                                                        \
+		struct twitter_data *td = ic->proto_data;           \
+		if( td->home_timeline_gc )                          \
+			imcb_chat_log( td->home_timeline_gc, fmt ); \
+		else                                                \
+			imcb_log( ic, fmt );                        \
+	} while( 0 );
+		
+
 /**
  * Main loop function
@@ -436,4 +446,6 @@
 		if( id )
 			twitter_status_destroy( ic, id );
+		else
+			twitter_msg( ic, "Could not undo last action" );
 		
 		g_free( cmds );
@@ -467,4 +479,7 @@
 		if( id )
 			twitter_status_retweet( ic, id );
+		else
+			twitter_msg( ic, "User `%s' does not exist or didn't "
+			                 "post any statuses recently", cmd[1] );
 		
 		g_free( cmds );
Index: root_commands.c
===================================================================
--- root_commands.c	(revision 04cd284bce74c114fde3043c951a5c8ef9eb79ae)
+++ root_commands.c	(revision 62f53b508742804d5df6533150f17d41e6afcbb2)
@@ -1293,35 +1293,19 @@
 {
 	int last = set_getint( &irc->b->set, "last_version" );
-	GString *msg = g_string_new( "" );
-	char s[16];
+	char s[16], *msg;
 	
 	if( last >= BITLBEE_VERSION_CODE )
 		return;
 	
-	if( last < 0x010206 ) /* 1.2.6 */
-	{
-		g_string_append( msg,
-			"Twitter support. See \x02help account add twitter\x02.\n" );
-	}
-	if( last < 0x010300 ) /* 1.3dev */
-	{
-		g_string_append( msg,
-			"Support for multiple configurable control channels, "
-			"each with a subset of your contact list. See "
-			"\x02help channels\x02 for more information.\n"
-			"File transfer support for some protocols (more if "
-			"you use libpurple). Just /DCC SEND stuff. Incoming "
-			"files also become DCC transfers.\n"
-			"Many more things, briefly described in "
-			"\x02help news1.3\x02.\n" );
-	}
-	
-	if( msg->len > 0 )
+	msg = help_get_whatsnew( &(global.help), last );
+	
+	if( msg )
 		irc_usermsg( irc, "%s: This seems to be your first time using this "
 		                  "this version of BitlBee. Here's a list of new "
 		                  "features you may like to know about:\n\n%s\n",
-		                  irc->user->nick, msg->str );
-	
-	g_string_free( msg, TRUE );
+		                  irc->user->nick, msg );
+	
+	g_free( msg );
+	
 	g_snprintf( s, sizeof( s ), "%d", BITLBEE_VERSION_CODE );
 	set_setstr( &irc->b->set, "last_version", s );
