Index: bitlbee.h
===================================================================
--- bitlbee.h	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ bitlbee.h	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -27,5 +27,7 @@
 #define _BITLBEE_H
 
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE /* Stupid GNU :-P */
+#endif
 
 /* Depend on Windows 2000 for now since we need getaddrinfo() */
Index: configure
===================================================================
--- configure	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ configure	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -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
Index: lib/misc.c
===================================================================
--- lib/misc.c	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ lib/misc.c	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -34,4 +34,5 @@
 #include "nogaim.h"
 #include "base64.h"
+#include "md5.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -523,5 +524,5 @@
 
 /* Word wrapping. Yes, I know this isn't UTF-8 clean. I'm willing to take the risk. */
-char *word_wrap( char *msg, int line_len )
+char *word_wrap( const char *msg, int line_len )
 {
 	GString *ret = g_string_sized_new( strlen( msg ) + 16 );
Index: lib/misc.h
===================================================================
--- lib/misc.h	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ lib/misc.h	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -62,5 +62,5 @@
 G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol, char *domain );
 
-G_MODULE_EXPORT char *word_wrap( char *msg, int line_len );
+G_MODULE_EXPORT char *word_wrap( const char *msg, int line_len );
 
 G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl );
Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ protocols/msn/msn.c	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -26,4 +26,8 @@
 #include "nogaim.h"
 #include "msn.h"
+
+int msn_chat_id;
+GSList *msn_connections;
+GSList *msn_switchboards;
 
 static char *msn_set_display_name( set_t *set, char *value );
Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ protocols/msn/msn.h	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -135,5 +135,5 @@
 #define STATUS_SB_CHAT_SPARE	8	/* Same, but also for groupchats (not used yet). */
 
-int msn_chat_id;
+extern int msn_chat_id;
 extern const struct msn_away_state msn_away_state_list[];
 extern const struct msn_status_code msn_status_code_list[];
@@ -144,6 +144,6 @@
    connection), the callback should check whether it's still listed here
    before doing *anything* else. */
-GSList *msn_connections;
-GSList *msn_switchboards;
+extern GSList *msn_connections;
+extern GSList *msn_switchboards;
 
 /* ns.c */
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ protocols/nogaim.c	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -371,5 +371,5 @@
 /* list.c */
 
-void imcb_add_buddy( struct im_connection *ic, char *handle, char *group )
+void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group )
 {
 	user_t *u;
@@ -445,5 +445,5 @@
 }
 
-void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
+void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname )
 {
 	user_t *u = user_findhandle( ic, handle );
@@ -480,5 +480,5 @@
 }
 
-void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group )
+void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group )
 {
 	user_t *u;
@@ -490,5 +490,5 @@
 /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM
    modules to suggest a nickname for a handle. */
-void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick )
+void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick )
 {
 	user_t *u = user_findhandle( ic, handle );
@@ -702,5 +702,5 @@
 }
 
-void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at )
+void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at )
 {
 	irc_t *irc = ic->irc;
@@ -835,5 +835,5 @@
 }
 
-void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at )
+void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at )
 {
 	struct im_connection *ic = c->ic;
@@ -907,5 +907,5 @@
 /* buddy_chat.c */
 
-void imcb_chat_add_buddy( struct groupchat *b, char *handle )
+void imcb_chat_add_buddy( struct groupchat *b, const char *handle )
 {
 	user_t *u = user_findhandle( b->ic, handle );
@@ -942,5 +942,5 @@
 
 /* This function is one BIG hack... :-( EREWRITE */
-void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason )
+void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason )
 {
 	user_t *u;
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision 8fb1263325c6839b792c352283abac3f63142fa2)
+++ protocols/nogaim.h	(revision fb009891bb60921401ffeb47b33cf35a246cbe34)
@@ -275,9 +275,9 @@
  * user, usually after a login, or if the user added a buddy and the IM
  * server confirms that the add was successful. Don't forget to do this! */
-G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group );
-G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group );
+G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group );
+G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group );
 G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle );
-G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname );
-G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick );
+G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname );
+G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
 
 /* Buddy activity */
@@ -289,5 +289,5 @@
 /* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle );
 /* Call when a handle says something. 'flags' and 'sent_at may be just 0. */
-G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, uint32_t flags, time_t sent_at );
+G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at );
 G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, uint32_t flags );
 G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
@@ -302,9 +302,9 @@
  *   user, too. */
 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle );
-G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle );
+G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );
 /* To remove a handle from a group chat. Reason can be NULL. */
-G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason );
+G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason );
 /* To tell BitlBee 'who' said 'msg' in 'c'. 'flags' and 'sent_at' can be 0. */
-G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at );
+G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at );
 /* System messages specific to a groupchat, so they can be displayed in the right context. */
 G_MODULE_EXPORT void imcb_chat_log( struct groupchat *c, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
