[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - How to cancel outgoing filter from inside the script

How to cancel outgoing filter from inside the script

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

How to cancel outgoing filter from inside the script

Postby frazmi » Thu Sep 30, 2004 10:43 pm

I have a script that checks the internal consistency of messages. I want to invoke the script as an outgoing filter (similar to the Subject Reminder script). If the script finds no errors, the message should be sent. However, if the script finds errors, then the message should not be sent.

The problem: so far I can't find any good way to stop Poco's send routine from inside the script. I need something like a "StopSending" command. Any ideas?

The code might look something like this:
Code: Select all
:BadFormat
      ReadTo $to %message
      Set $m "Could not find license key in message to"
      AddStrings $m $CRLF $to "Quitting with forced error."
      StopSending
      MessageBox $m

      EXIT
frazmi
Poco Enthusiast
 
Posts: 248
Joined: Tue Jul 27, 2004 1:27 am
Location: South Korea

Postby robin » Fri Oct 01, 2004 1:03 am

Hi frazmi - could you look at this from the other way round? Set the script to send the message if it does not find an error.

I realise that this is not quite as transparent as you might like, but you could reconfigure the main tool bar to attach the script to a button and remove the default send button.

JAT.
robin
 

Postby frazmi » Fri Oct 01, 2004 1:24 am

Well, redoing the script the way you suggest would be easy. But I've already got 27 scripts to run off the 10 custom buttons...

If the custom buttons were bigger, I'd give up one of them as a permanent send button -- but they are too tiny.

Good ideas, though, and thanks.

Anybody else have an idea about stopping the send operation? And again, is what happens "as designed" or is this an unintended side effect? (That is, should the message go out even if the required script fails?)
frazmi
Poco Enthusiast
 
Posts: 248
Joined: Tue Jul 27, 2004 1:27 am
Location: South Korea

Postby robin » Fri Oct 01, 2004 2:42 am

frazmi wrote:Well, redoing the script the way you suggest would be easy. But I've already got 27 scripts to run off the 10 custom buttons...
:lol: ah - I see now!
robin
 

Postby Pete » Fri Oct 01, 2004 5:54 am

Welcome back, frazmi. For perhaps the first time ever, you've let my post count exceed yours. :)

Whoever wrote the script that checks for missing attachments had some ideas about your original question. That script is probably in the Extras section of the website.

I use my own version of that script. I'm not sure if it's necessary to have the Clear commands AND the DeleteMessage command, but I just left all of that in the script.
Code: Select all
Set $OnErrorMessage ""
AddStrings $OnErrorMessage "Error in " $pocoScriptName
Set $OnErrorGoTo "POCO_ERROR"

ReadBody $body %message
LocateLine #lineNum "attach" $body False
If #lineNum > -1 then CHECK_ATTACHMENT
LocateLine #lineNum "enc" $body False
If #lineNum > -1 then CHECK_ATTACHMENT
Goto DONE

:CHECK_ATTACHMENT
ReadAttached $attachedFiles %message
If $attachedFiles ! "" then DONE

Set $msg "You typed the words attach* or enc* but didn't attach anything. %var%"
InputBox $whatToDo $msg "Send Anyway|Edit Message"
if $whatToDo = "Send Anyway" then DONE
EditMessage %message

{ If message is abandoned in editor, make sure it doesn't get sent anyway!!!
ClearTo %message
ClearCC %message
ClearBCC %message
DeleteMessage %message

:DONE
Exit

:POCO_ERROR
Exit
Pete
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 0 guests

cron