Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/jabber/jabber.c	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -511,4 +511,5 @@
 	
 	ret->name = "jabber";
+    ret->mms = 0;                        /* no limit */
 	ret->login = jabber_login;
 	ret->init = jabber_init;
Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/msn/msn.c	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -372,4 +372,5 @@
 	
 	ret->name = "msn";
+    ret->mms = 1409;         /* this guess taken from libotr UPGRADING file */
 	ret->login = msn_login;
 	ret->init = msn_init;
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/nogaim.c	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -603,8 +603,7 @@
 	
 	/* LISPy... */
-	if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) &&		/* Don't do a thing when user doesn't want it */
-	    ( u->online ) &&						/* Don't touch offline people */
-	    ( ( ( u->online != oo ) && !u->away ) ||			/* Voice joining people */
-	      ( ( u->online == oo ) && ( oa == !u->away ) ) ) )		/* (De)voice people changing state */
+	if( ( u->online ) &&						/* Don't touch offline people */
+	    ( ( ( u->online != oo ) && !u->away ) ||			/* Do joining people */
+	      ( ( u->online == oo ) && ( oa == !u->away ) ) ) )		/* Do people changing state */
 	{
 		char *from;
@@ -619,6 +618,16 @@
 			                                    ic->irc->myhost );
 		}
-		irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
-		                                          u->away?'-':'+', u->nick );
+		if(!strcmp(set_getstr(&ic->irc->set, "voice_buddies"), "notaway")) {
+			irc_write( ic->irc, ":%s MODE %s %cv %s", from, ic->irc->channel,
+		 	                                         u->away?'-':'+', u->nick );
+		}
+		if(!strcmp(set_getstr(&ic->irc->set, "halfop_buddies"), "notaway")) {
+			irc_write( ic->irc, ":%s MODE %s %ch %s", from, ic->irc->channel,
+		 	                                         u->away?'-':'+', u->nick );
+		}
+		if(!strcmp(set_getstr(&ic->irc->set, "op_buddies"), "notaway")) {
+			irc_write( ic->irc, ":%s MODE %s %co %s", from, ic->irc->channel,
+		 	                                         u->away?'-':'+', u->nick );
+		}
 		g_free( from );
 	}
@@ -630,7 +639,13 @@
 	char *wrapped;
 	user_t *u;
-	
+
+	/* pass the message through OTR */
+	msg = otr_handle_message(ic, handle, msg);
+	if(!msg) {
+		/* this was an internal OTR protocol message */
+		return;
+	}
+
 	u = user_findhandle( ic, handle );
-	
 	if( !u )
 	{
@@ -642,4 +657,5 @@
 				imcb_log( ic, "Ignoring message from unknown handle %s", handle );
 			
+			g_free(msg);
 			return;
 		}
@@ -674,4 +690,5 @@
 	irc_msgfrom( irc, u->nick, wrapped );
 	g_free( wrapped );
+	g_free( msg );
 }
 
@@ -914,68 +931,4 @@
 
 
-/* Misc. BitlBee stuff which shouldn't really be here */
-
-char *set_eval_away_devoice( set_t *set, char *value )
-{
-	irc_t *irc = set->data;
-	int st;
-	
-	if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) )
-		st = 1;
-	else if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) )
-		st = 0;
-	else if( sscanf( value, "%d", &st ) != 1 )
-		return( NULL );
-	
-	st = st != 0;
-	
-	/* Horror.... */
-	
-	if( st != set_getbool( &irc->set, "away_devoice" ) )
-	{
-		char list[80] = "";
-		user_t *u = irc->users;
-		int i = 0, count = 0;
-		char pm;
-		char v[80];
-		
-		if( st )
-			pm = '+';
-		else
-			pm = '-';
-		
-		while( u )
-		{
-			if( u->ic && u->online && !u->away )
-			{
-				if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
-				{
-					for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
-					irc_write( irc, ":%s MODE %s %c%s%s",
-					           irc->myhost,
-		        			   irc->channel, pm, v, list );
-					
-					*list = 0;
-					count = 0;
-				}
-				
-				sprintf( list + strlen( list ), " %s", u->nick );
-				count ++;
-			}
-			u = u->next;
-		}
-		
-		/* $v = 'v' x $i */
-		for( i = 0; i < count; v[i++] = 'v' ); v[i] = 0;
-		irc_write( irc, ":%s MODE %s %c%s%s", irc->myhost,
-		                                            irc->channel, pm, v, list );
-	}
-	
-	return( set_eval_bool( set, value ) );
-}
-
-
-
-
 /* The plan is to not allow straight calls to prpl functions anymore, but do
    them all from some wrappers. We'll start to define some down here: */
@@ -991,8 +944,9 @@
 		msg = buf;
 	}
-	
-	st = ic->acc->prpl->buddy_msg( ic, handle, msg, flags );
-	g_free( buf );
-	
+
+	/* if compiled without otr support, this just calls the prpl buddy_msg */
+	st = otr_send_message(ic, handle, msg, flags);
+	
+	g_free(buf);
 	return st;
 }
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/nogaim.h	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -136,4 +136,8 @@
 	 * - The user sees this name ie. when imcb_log() is used. */
 	const char *name;
+    /* Maximum Message Size of this protocol.
+     * - Introduced for OTR, in order to fragment large protocol messages.
+     * - 0 means "unlimited". */
+    unsigned int mms;
 
 	/* Added this one to be able to add per-account settings, don't think
@@ -317,5 +321,4 @@
 
 /* Misc. stuff */
-char *set_eval_away_devoice( set_t *set, char *value );
 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
 void cancel_auto_reconnect( struct account *a );
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/oscar/oscar.c	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -2605,4 +2605,5 @@
 	struct prpl *ret = g_new0(struct prpl, 1);
 	ret->name = "oscar";
+    ret->mms = 2343;       /* this guess taken from libotr UPGRADING file */
 	ret->away_states = oscar_away_states;
 	ret->init = oscar_init;
Index: protocols/yahoo/yahoo.c
===================================================================
--- protocols/yahoo/yahoo.c	(revision a73e91a40ac1110e772214a3401105aeb86d35e4)
+++ protocols/yahoo/yahoo.c	(revision 12cc58b34a98ae010cf1718e994b63da35ddd7c2)
@@ -354,4 +354,5 @@
 	struct prpl *ret = g_new0(struct prpl, 1);
 	ret->name = "yahoo";
+    ret->mms = 832;           /* this guess taken from libotr UPGRADING file */
 	ret->init = byahoo_init;
 	
