create new tag
, view all tags

Archive of ImmediateNotifyPluginDev

  • Note: The AfterSaveHandler is included in CairoRelease
  • This plugin has many patches that need rolling in

Patching SMTP.pm

I've added SMTP support to Walter's ImmediateNotifyPlugin as well as support for groups.

-- JuergenPabel - 25 Mar 2003

On my TWiki installation I added the following line to sub handleNotify in SMTP.pm (at line 39). I then modified immediatenotify-SMTP.tmpl to be more like mailnotify.tmpl. I think the resulting email is much cleaner.

    $template = &TWiki::handleCommonTags( $template, $topic );

-- RonKellam - 18 Mar 2003

  • I didn't write the SMTP module, but if you e-mail a patch to me with any changes you think should be made I'll apply them unless the original author objects. (I'll have to ask him whether he plans to maintain that portion of the code, or hand it over to my management. If he wants to retain control I'd rather he package his stuff separately, and will implement that if the issue arises. If I'm gonna be maintaining it, I think it's easier for everyone involved to offer it bundled with the original code.)

-- WalterMundt - 18 Mar 2003

This SMTP.pm sounds like it should be available centrally - in TWiki::Net::SMTP.

-- MartinCleaver - 06 Jan 2005

The SMTP support was submitted by JuergenPabel, and I haven't spent the time yet to fully integrate it with the code. I plan on doing some work on this plugin in the near future, including setting up support for a default notification method, etc. I'll respond to your concerns in order:

-- WalterMundt - 09 Apr 2003

Just an update - JuergenPabel contacted me after my last posting saying that he had some fixes to his SMTP method code. He appeared to be willing to let me take it over (which makes things easier on me overall), but I'm going to wait until he sends me his fixes before I pull together version 0.3.

-- WalterMundt - 14 Apr 2003

Patching Net::Jabber

I should probably contact the Net::Jabber maintainer at some point and ask him to integrate my patch. Since the source code is obviously not designed to run under taint-checking at all, it doesn't lose anything by running with taint-checking enabled but worked around in the manner I've done in the patch. (Note that for the special purposes of this plugin, the workaround is pretty safe...but I'm not sure the same would be true in a more general Jabber client, especially something like a Web-based one.)

If you can't patch the Net::Jabber source code (e.g. you operate in a hosted web environment where CPAN installation is shared and installed by the admins. In this case installation of any standard (read: unmodified) CPAN modules can be okay, but modified ones not okay.

You have two options:

  1. Manually download the attached patch, and install the Net::Jabber module under your own user account, and then adjust setlib.cfg so that your custom library path is placed before the standard ones in the @INC array. If you need further info on how to do this, contact me via e-mail or instant message, and/or set up a request on the Support web.
  2. I don't recommend doing this, but the alternative is to turn off taint-checking in your TWiki installation. This would be done by removing the "T" flag from all the first lines of the TWiki binaries. Then you ask your administrator to install the standard Net::Jabber module just like any other. This might be easier, but is less secure.

-- WalterMundt - 30 Mar 2003


There seems to be a deficiency in the parsing of the user name list in the WebImmediateNotify topic - it can't handle the use of %MAINWEB% TWiki variable - it expects a user name to be of the form Main.RonKellam.

-- RonKellam - 18 Mar 2003

  • the inability to handle the use of MAINWEB...I'll see about fixing that soonish. -- WalterMundt - 18 Mar 2003

Change requests

I am interested in ImmediateNotifyPlugin in twiki. However, I noticed the last updated to attachement is 2003,three years ago. For this plugin, there are quite a lot of topics related.This make me confused as there is no enough time to consolidate them for me. Would you please give a unified view on this plugin or similar functional plugin( to send email/notification for change,update immediately,can support imap/smtp/jabber).Thanks.

-- ZhiweiSun - 05 Jul 2006

One last thing - my preference would be for the WebImmediateNotify topic to be named WebNotifyImmediate - what do others think? -- RonKellam - 18 Mar 2003

  • renaming to WebNotifyImmediate: not a bad idea at all. When I fix the MAINWEB thing (may be a day or two), I'll change this, and add a variable in the plugin topic to adjust this as desired. That way people who already have things set up with the old topic name can just set the new variable and not have to rename all the WebImmediateNotify's. -- WalterMundt - 18 Mar 2003

-- RonKellam - 18 Mar 2003

I noticed some of the same bugs that were reported earlier and have fixes for a few of them. If they haven't been fixed yet I'd be happy to supply fixes. These are the bugs that I have fixes for:

  • Use handleCommonTags() to expand the TWiki system variables in mail notifications
  • Allow proper formatted user names in IMMEDIATENOTIFY setting (e.g. Main.UserName)
  • User names setup using IMMEDIATENOTIFY on a topic were getting ignored

There's another problem that I haven't tracked down because I have a workaround, but if I'm doing something wrong or if there's a fix I'd love to know about it:

  • If only one user is listed in a topic's IMMEDIATENOTIFY setting then the user name must be followed by a comma or else the user won't be notified

-- KevinFurbish - 15 Apr 2003

I note that this is incompatible with MailNotificationEnhanced because it makes a direct call to TWikiDotPm's getEmailOfUser(). MailNotificationEnhanced moves that to MailNotifyDotPm thus breaking save.

On the face of it the solution is to add a new entry to FuncDotPm.

-- MartinCleaver - 20 Nov 2003

I just spent most of the afternoon trying to get this plugin to work. It turns out that the syntax of WebImmediateNotify is different from the normal WebNotify topic. Immediate conclusions:

1) The plugin should check if it actually sent the email. Change line 47 of SMTP.pm to the two lines below does the trick.

        my($status) = &$sendEmail( $msg );
        if ($status) { &$debug("- SMTP error: $status"); }

2) If you forget about Jabber, there is no need in the first place to even create the different syntax. TWiki::getEmailNotifyList already accepts a second parameter for the topicname. Calling TWiki::getEmailNotifyList($web, "WebImmediateNotify") returns a nice list of email addresses. Since I don't care about Jabber, I will probably just do this.

3) Requiring that user pages exist is an issue for me. I am authenticating users against the NT domain, meaning that registration on TWiki is optional. And I want those users to receive immediate emails, since I am trying to create something resembling a forum...

4) Sending email may not be very fast when the mail server likes to check every name. Sending the notifications should probably be asynchronous, to allow fast responses to the user saving the page. As it is, that user must wait while the emails are being sent...


I realize this is not the support forum, but I thought this info might be relavant to this group. Additionally, if someone has some insight or suggestions It would probably be useful to others as noted by the number of complaints about the docs in for this Plugin.

Ok, I have to agree with the folks in the ImmediateNotifyPluginDev group, the docs are terrible. If you don't want to include some example configs in the distro, please include them in the Dev area. I am unable to get the plugin to recognize the users to notify. My config is as follows:

TWiki/ImmediateNotifyPlugin contains:

  • Notification method configuration:
      • Set METHODS = Jabber
  • Jabber method configuration:
      • Set JABBER_USERNAME = WebImmediateNotify?
      • Set JABBER_SERVER = jabber.XXXXXX.com

  • Debug plugin: (See output in data/debug.txt)
      • Set DEBUG = 1
Main/WebImmediateNotify contains:

NOTE: I've tried just EricAiken and EricAiken, and also the above.

The topic I'm editing contains:

I put some debug statements in the ImmediateNotifyPlugin.pm as follows:

    $text =~ /\t+\* Set IMMEDIATENOTIFY = (.*)/;
    my $topicUserList = $2;
    my @names;
debug("- $pluginName: text=$text");
debug("- $pluginName: 1=$1");
debug("- $pluginName: 2=$2");
debug("- $pluginName: names=@names");
debug("- $pluginName: topicUserList=$topicUserList");
    if ($topicUserList) {
        my @names = split / *[, ] */, $topicUserList;
debug("- $pluginName: names_in_if=@names");
debug("- $pluginName: topicUserList_in_if=$topicUserList");

    my $notifyTopic = TWiki::Func::readTopicText($web, "WebImmediateNotify");
debug("- $pluginName: notifyTopic=$notifyTopic");
    my $mainWeb = TWiki::Func::getPreferencesValue("MAINWEB") || "Main";
    while ($notifyTopic =~ /\t+\* $mainWeb\.([^\r\n]+)/go) {
debug("- $pluginName: Im in the while loop");
        push @names, $1 if $1;

    unless (@names) {
        debug("- $pluginName: No names registered for notification.");

Here's the debug.txt output:

31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: Loading method Jabber...
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin::Jabber OK
31 Dec 2003 - 09:57 - TWiki::Plugins::ImmediateNotifyPlugin::initPlugin( Main.EricAiken ) is OK
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin::afterSaveHandler( Main.EricAiken )
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: text=      * Name: EricAiken
        * Email: Eric_Aiken@risingmist.com
        * Comment:

        * Set IMMEDIATENOTIFY = Main.EricAiken
        * Jabber: EricAiken@jabber.risingmist.com

__Related topics__
        * %TWIKIWEB%.%WIKIPREFSTOPIC% has site-level preferences of %WIKITOOLNAME%.
        * %WEBPREFSTOPIC% has preferences of the %WIKITOOLNAME%.%WEB% web.
        * %MAINWEB%.%WIKIUSERSTOPIC% has a list of other TWiki users.

31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: 1=Main.EricAiken
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: 2=
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: names=
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: topicUserList=
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: notifyTopic=%META:TOPICINFO{author="EricAiken" date="1072892974" format="1.0" version="1.3"}%
        * Set IMMEDIATENOTIFY = Main.EricAiken,
31 Dec 2003 - 09:57 - ImmediateNotifyPlugin: No names registered for notification.

-- EricAiken - 30 Dec 2003

Note that $2 is always empty and therefore my $topicUserList = $2; is always empty. I'm not a perl programmer so I'm not sure where i'm going wrong.

I've patched persuant to the ImmediateNotifyPluginDev group suggestions including the SMTP template.

-- JoaquimBaptista - 16 Dec 2003

I've attached a patch I made to ImmediateNotifyPlugin.pm that makes per-page notifications work. It looked like someone had started it, changed their mind, tried again, and then broke it. Primarily, it was a problem with the matching method. Now adding a list item on the page with " * Set IMMEDIATENOTIFY = " and a list of users will cause that list of users to get notifications on changing of that particular page. This should solve the problem EricAiken was having.

The patch is called "perpage-inp.patch" in the files section at the bottom of this page.

-- KyleVanderBeek - 31 Aug 2004

Kyles patch removed the fallback to SMTP. I made a new patch that adds a check - if there are no methods given in the user topic, it enables the fallback mechanism again.

The patch is called "default-to-smtp-again.patch".

-- SteffenPoulsen - 17 Dec 2004

Nice plugin - just what I've been after... (but) the installation doco sucks. I had to dive down into the Perl code to work out what needed to be configured where... How about some sample WebImmediateNotify, user pages, etc in the zip.

-- RonKellam - 18 Mar 2003

The documentation: while it could certainly use some improvement, it's not high on my list of priorities. As far as including samples with the plugin...I think I could make up some sample topics and package them separately, but I'd really rather not include them with the package. Were I installing it, it'd just be one more bit of trash to get rid of once I knew what was going on. I want the plugin package to contain only those files needed for the proper operation of the plugin.

-- WalterMundt - 18 Mar 2003

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-07-27 - SteffenPoulsen
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.