Re: skip_target and NOTICE/PRIVMSG target handling

tabris <[email protected]> Thu, 5 May 2005 19:30:47 -0400
Newsgroups gmane.network.irc.irssi.devel
Message-ID <[email protected]>
On Saturday 30 April 2005 11:17 pm, tabris wrote:
> 	I have a tentative patch for skip_target() that handles Unreal's
> multi-prefix NOTICEs. I'm thinking that it's a bit hackish atm
> however, so want to know how I can get access to the isupport
> PREFIXes so that I can support any prefix.
	Patch is attached, but there really should be another/better way to do 
this. However I'd need a way to get the isupport PREFIX array and 
iterate over it. I may work on this later, track down how it's stored.

> 	I would appreciate pointers however on making this more universal,
> as I doubt that it will be accepted as-is.

-- 
Rube Walker: "Hey, Yogi, what time is it?"
Yogi Berra:  "You mean now?"
skip_target.diff (text/x-diff, 1.4 KB)
Index: src/fe-common/irc/fe-irc-commands.c
===================================================================
--- src/fe-common/irc/fe-irc-commands.c	(revision 3728)
+++ src/fe-common/irc/fe-irc-commands.c	(working copy)
@@ -43,13 +43,14 @@
 
 static const char *skip_target(const char *target)
 {
-	if (*target == '@') {
-		/* @#channel, @+#channel - Hybrid6 / Bahamut features */
-		if (target[1] == '+' && ischannel(target[2]))
-			target += 2;
-		else if (ischannel(target[1]))
-			target++;
-	}
+	int i = 0;
+	while ((target[i] == '~') || (target[i] == '&') || (target[i] == '@') || (target[i] == '%') || (target[i] == '+')) {
+		i++;
+	};
+
+	if(ischannel(target[i])) {
+		target += i;
+	};
 
 	return target;
 }
Index: src/fe-common/irc/fe-irc-messages.c
===================================================================
--- src/fe-common/irc/fe-irc-messages.c	(revision 3728)
+++ src/fe-common/irc/fe-irc-messages.c	(working copy)
@@ -39,13 +39,15 @@
 
 static const char *skip_target(const char *target)
 {
-	if (target != NULL && *target == '@') {
-		/* @#channel, @+#channel - Hybrid6 / Bahamut features */
-		if (target[1] == '+' && ischannel(target[2]))
-			target += 2;
-		else if (ischannel(target[1]))
-			target++;
-	}
+	int i = 0;
+	while ((target[i] == '~') || (target[i] == '&') ||
+		(target[i] == '@') || (target[i] == '%') || (target[i] == '+')) {
+		i++;
+	};
+
+	if(ischannel(target[i])) {
+		target += i;
+	};
 
 	return target;
 }
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBCeqyngbFCivvqDfQRAoJ6AKCwUaEU+aV9t1Ugy+DkQuIW0KUKIACgmT6i
F/BGEruKznwfv/8U63LnLJw=
=H/8o
-----END PGP SIGNATURE-----