Index: irc.c
===================================================================
--- irc.c	(revision f55cfe93aeae5c24fd067e28733826d7e3029085)
+++ irc.c	(revision 52e6e17d3b3610afd6d6b997257b72e798d95c47)
@@ -113,4 +113,5 @@
 	set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc );
 	set_add( &irc->set, "handle_unknown", "root", NULL, irc );
+	set_add( &irc->set, "halfop_buddies", "false", set_eval_halfop_buddies, irc );
 	set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc );
 	set_add( &irc->set, "op_buddies", "false", set_eval_op_buddies, irc );
Index: otr.c
===================================================================
--- otr.c	(revision f55cfe93aeae5c24fd067e28733826d7e3029085)
+++ otr.c	(revision 52e6e17d3b3610afd6d6b997257b72e798d95c47)
@@ -982,29 +982,54 @@
 int otr_update_modeflags(irc_t *irc, user_t *u)
 {
-	char *vo = set_getstr(&irc->set, "voice_buddies");
-	char *oo = set_getstr(&irc->set, "op_buddies");
-	char eflag=0, tflag=0;
-	int e = u->encrypted;
-	int t = (u->encrypted > 1);
-	
-	if(!strcmp(vo, "encrypted"))
-		eflag='v';
-	else if(!strcmp(oo, "encrypted"))
-		eflag='o';
-	if(!strcmp(vo, "trusted"))
-		tflag='v';
-	else if(!strcmp(oo, "trusted"))
-		tflag='o';
-	
-	if(!eflag)
+	char *vb = set_getstr(&irc->set, "voice_buddies");
+	char *hb = set_getstr(&irc->set, "halfop_buddies");
+	char *ob = set_getstr(&irc->set, "op_buddies");
+	int encrypted = u->encrypted;
+	int trusted = u->encrypted > 1;
+	char flags[7];
+	int nflags;
+	char *p = flags;
+	int i;
+	
+	if(!strcmp(vb, "encrypted")) {
+		*(p++) = encrypted ? '+' : '-';
+		*(p++) = 'v';
+		nflags++;
+	} else if(!strcmp(vb, "trusted")) {
+		*(p++) = trusted ? '+' : '-';
+		*(p++) = 'v';
+		nflags++;
+	}
+	if(!strcmp(hb, "encrypted")) {
+		*(p++) = encrypted ? '+' : '-';
+		*(p++) = 'h';
+		nflags++;
+	} else if(!strcmp(hb, "trusted")) {
+		*(p++) = trusted ? '+' : '-';
+		*(p++) = 'h';
+		nflags++;
+	}
+	if(!strcmp(ob, "encrypted")) {
+		*(p++) = encrypted ? '+' : '-';
+		*(p++) = 'o';
+		nflags++;
+	} else if(!strcmp(ob, "trusted")) {
+		*(p++) = trusted ? '+' : '-';
+		*(p++) = 'o';
+		nflags++;
+	}
+	*p = '\0';
+	
+	p = g_malloc(nflags * (strlen(u->nick)+1) + 1);
+	*p = '\0';
+	if(!p)
 		return 0;
-	
-	if(tflag) {
-		irc_write( irc, ":%s!%s@%s MODE %s %c%c%c%c %s %s", irc->mynick, irc->mynick, irc->myhost,
-			irc->channel, e?'+':'-', eflag, t?'+':'-', tflag, u->nick, u->nick );
-	} else {
-		irc_write( irc, ":%s!%s@%s MODE %s %c%c %s", irc->mynick, irc->mynick, irc->myhost,
-			irc->channel, e?'+':'-', eflag, u->nick );
-	}
+	for(i=0; i<nflags; i++) {
+		strcat(p, " ");
+		strcat(p, u->nick);
+	}
+	irc_write( irc, ":%s!%s@%s MODE %s %s%s", irc->mynick, irc->mynick, irc->myhost,
+		irc->channel, flags, p );
+	g_free(p);
 		
 	return 1;
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision f55cfe93aeae5c24fd067e28733826d7e3029085)
+++ protocols/nogaim.c	(revision 52e6e17d3b3610afd6d6b997257b72e798d95c47)
@@ -620,4 +620,8 @@
 		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 );
 		}
Index: set.c
===================================================================
--- set.c	(revision f55cfe93aeae5c24fd067e28733826d7e3029085)
+++ set.c	(revision 52e6e17d3b3610afd6d6b997257b72e798d95c47)
@@ -345,4 +345,9 @@
 }
 
+char *set_eval_halfop_buddies( set_t *set, char *value )
+{
+	return set_eval_mode_buddies(set, value, 'h');
+}
+
 char *set_eval_voice_buddies( set_t *set, char *value )
 {
Index: set.h
===================================================================
--- set.h	(revision f55cfe93aeae5c24fd067e28733826d7e3029085)
+++ set.h	(revision 52e6e17d3b3610afd6d6b997257b72e798d95c47)
@@ -99,4 +99,5 @@
 char *set_eval_op_user( set_t *set, char *value );
 char *set_eval_op_buddies( set_t *set, char *value );
+char *set_eval_halfop_buddies( set_t *set, char *value );
 char *set_eval_voice_buddies( set_t *set, char *value );
 char *set_eval_charset( set_t *set, char *value );
