[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 - Script to reply to styled messages

Script to reply to styled messages

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Script to reply to styled messages

Postby Michael » Sun Oct 15, 2006 1:49 pm

The script below is one I started writing to reply to styled messages. I doesn't do a perfect job but it has worked on the few occasions I've needed it. If anyone wants to make changes to it I simply ask that you post the revisions in this thread so everyone can benefit from them.

Code: Select all
{  Reply using user's styling codes (fonts, colours, etc)
{  Author: M.Motek - July 3, 2001
{
{  Use: Run against selected messages to generate replys that maintain the user's styling codes.
{  Restrictions/Notes:
{  1. This script does not check for and remove imbedded JavaScript.
{  2. This script does not use the reply header text from the poco settings.

{  Modifications:

Set &DebugModeOff False

External $BlockQuoteHeader "Block quote header" "<BLOCKQUOTE class=replbq style='PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid'>"
If &DebugModeOff Then Initialization
MessageBox $BlockQuoteHeader

:Initialization
Set $ReplyHeader "On %sent%, %sender% wrote:"
ReadAllHeaders $hdrs %message
LocateLine #ix "From:" $hdrs
GetLine $from #ix $hdrs
ChopString $from 1 5

LocateLine #ix "Subject:" $hdrs
GetLine $temp #ix $hdrs
ChopString $temp 1 8
AddStrings $subject "Re:" $temp

ReadRawBody $body %message
Set #i 0
LineCount #body-size $body
:QuoteLoop
   GetLine $line #i $body
   Trim $line
   Set $prefix $line
   ChopString $prefix 6 99999
   LowerCase $prefix
   If $prefix ! "<div>" Then TestLoop
   StringPos #j ">" $line
   If #j = 0 Then NoBrace
      Inc #j
      Set $prefix $line
      ChopString $prefix #j 9999
      Dec #j
      ChopString $line 1 #j
:ReplaceLine
     AddStrings $prefix "&gt;" $line
      DeleteLine $body #i
      InsertLine $body #i $prefix
      GoTo TestLoop
:NoBrace
      Set $prefix ""
     GoTo ReplaceLine
:TestLoop
   Inc #i
   If #i < #body-size Then QuoteLoop

CreateMessage %m
AddTo %m $from
AddHeader %m "Subject:" $subject

ReplaceCVT $ReplyHeader %Message False
LocateLine #ix "<BODY" $body False
Inc #ix
InsertLine $body #ix $ReplyHeader
LocateLine #ix "<HTML" $Body False
If #ix = 0 Then SetBody
  DeleteLine $Body 0 #ix
:SetBody
If &DebugModeOff Then SetBody
MessageBox $body
:SetBody
AssignStyledBody %m $body
EditMessage %m
Exit
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron