register_hooks

Troy Piggins <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
[Sincerely sorry if this message is a double up.  I've had some
mail server problems last week and not sure if the original went
through.]

I am using a couple of display filters - t-prot and one I wrote
using demime.  Previously I have always had the demime one
registered with

  () = register_hook ("read_article_hook", "demime_pgp");

and t-prot I could turn on and off with

define register_t_prot () {
	if (1 == register_hook("read_article_hook", "t_prot")) {
		popup_window("t-prot status", "t-prot filtering activated");
	}
	else {
		error("t-prot filtering NOT activated");
	}
}

define unregister_t_prot () {
	if (1 == unregister_hook("read_article_hook", "t_prot")) {
		popup_window("t-prot status", "t-prot filtering deactivated");
	}
	else {
		error("t-prot filtering NOT deactivated");
	}
}

% filtering is enabled by default:
register_hook("read_article_hook", "t_prot");

and

setkey article register_t_prot "\e6"
setkey article unregister_t_prot "\e7"

Now I thought I'd change things a little so I could turn on or
off all display filters.  Here's what I did:

define register_display_filters () {
  () = register_hook ("read_article_hook", "demime_pgp");
  () = register_hook ("read_article_hook", "t_prot");
}

define unregister_display_filters () {
  () = unregister_hook ("read_article_hook", "demime_pgp");
  () = unregister_hook ("read_article_hook", "t_prot");
}

% filtering is enabled by default:
() = register_hook("read_article_hook", "register_display_filters");

That works fine when I start slrn.  However I can't toggle them
on or off, because the following key bindings don't seem to work,
although they are giving errors:

setkey article register_display_filters "\e6"
setkey article unregister_display_filters "\e7"

Can someone please explain why and how to fix it?  Thanks.

Is it because the read_article hooks are nested?  If so, how come
the "default" one works?

-- 
Troy Piggins
  ,-o   Ubuntu v6.06 (Dapper Drake): kernel 2.6.15-26, 
 o   )  postfix 2.2.10, procmail 3.22, mutt 1.5.12i,
  `-o   slrn 0.9.8.1pl1/rt (score_color patch), vim 7.0

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.