diff src/protocols/irc/irc.c @ 4621:69f028a6f357

[gaim-migrate @ 4912] Added half-op support, used on some IRC networks. Also fixed the bug where trying to IM a person in a chat with a @, %, or + prefix was keeping that prefix for the username in the IM window. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 27 Feb 2003 09:42:18 +0000
parents 5fcb44d771d2
children d19872836812
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Wed Feb 26 06:21:50 2003 +0000
+++ b/src/protocols/irc/irc.c	Thu Feb 27 09:42:18 2003 +0000
@@ -759,7 +759,7 @@
 	struct gaim_conversation *c = irc_find_chat(gc, room);
 	GList *r;
 
-	if (mode != 'o' && mode != 'v')
+	if (mode != 'o' && mode != 'v' && mode != 'h')
 		return;
 
 	if (!c)
@@ -767,33 +767,52 @@
 
 	r = gaim_chat_get_users(GAIM_CHAT(c));
 	while (r) {
-		gboolean op = FALSE, voice = FALSE;
+		gboolean op = FALSE, halfop = FALSE, voice = FALSE;
 		char *who = r->data;
+
 		if (*who == '@') {
 			op = TRUE;
 			who++;
 		}
+
+		if (*who == '%') {
+			halfop = TRUE;
+			who++;
+		}
+
 		if (*who == '+') {
 			voice = TRUE;
 			who++;
 		}
+
 		if (!strcmp(who, nick)) {
 			char *tmp, buf[IRC_BUF_LEN];
+
 			if (mode == 'o') {
 				if (sign == '-')
 					op = FALSE;
 				else
 					op = TRUE;
 			}
+
+			if (mode == 'h') {
+				if (sign == '-')
+					halfop = FALSE;
+				else
+					halfop = TRUE;
+			}
+
 			if (mode == 'v') {
 				if (sign == '-')
 					voice = FALSE;
 				else
 					voice = TRUE;
 			}
+
 			tmp = g_strdup(r->data);
-			g_snprintf(buf, sizeof(buf), "%s%s%s", op ? "@" : "",
-				   voice ? "+" : "", nick);
+			g_snprintf(buf, sizeof(buf), "%s%s%s",
+					   (op ? "@" : (halfop ? "%" : "")),
+					   voice ? "+" : "", nick);
 			gaim_chat_rename_user(GAIM_CHAT(c), tmp, buf);
 			g_free(tmp);
 			return;
@@ -1114,6 +1133,8 @@
 			char *who = r->data;
 			if (*who == '@')
 				who++;
+			if (*who == '%')
+				who++;
 			if (*who == '+')
 				who++;
 			if (!g_strcasecmp(who, nick)) {
@@ -1154,6 +1175,8 @@
 			int n = 0;
 			if (*who == '@')
 				buf[n++] = *who++;
+			if (*who == '%')
+				buf[n++] = *who++;
 			if (*who == '+')
 				buf[n++] = *who++;
 			g_snprintf(buf + n, sizeof(buf) - n, "%s", new);
@@ -1633,6 +1656,8 @@
 		char *who = r->data;
 		if (*who == '@')
 			who++;
+		if (*who == '%')
+			who++;
 		if (*who == '+')
 			who++;
 		if (!g_strcasecmp(who, nick)) {
@@ -2291,7 +2316,7 @@
 static int 
 irc_send_im(struct gaim_connection *gc, char *who, char *what, int len, int flags)
 {
-	if (*who == '@' || *who == '+')
+	if (*who == '@' || *who == '%' || *who == '+')
 		return send_msg(gc, who + 1, what);
 	return send_msg(gc, who, what);
 }
@@ -2710,6 +2735,8 @@
 
 	if (*who == '@')
 		who++;
+	if (*who == '%')
+		who++;
 	if (*who == '+')
 		who++;