Moderators: Eric, Tomas, robin, Michael
{============================================================================
{ Toggle Read/UnRead Script - Date: August 27th 2003 - Author: Ron Bos (NL)
{
{ This script toggles the "read"/"unread" status of marked messages by
{ changing the "X-Poco-Status" header in PocoMail V3, or the "Status"
{ header in PocoMail V2.
{
{ The script should be assigned to a Script Button on the Toolbar.
{
{ The contents of the "(X-Poco-)Status" header can be:
{
{ xB - Bounced
{ xF - Forwarded
{ xP - Pending (Draft messages)
{ xQ - Queued
{ xS - Sent
{ xW - Replied
{
{ x can be either R or U (Read/Unread)
{
{ Modifications:
{ 28Sep2004 - M.Motek - Add option to automatically move messages to read/unread mailboxes.
{==========================================================================
External $AutoMove "Automatically move messages? (Yes or No)" "No"
External $ReadMailbox "Read mailbox%mailboxes%" ""
External $UnreadMailbox "Unread mailbox%mailboxes%" ""
LowerCase $AutoMove
{
{ Determine the PocoMail version.
{
Char $Version 1 $PocoVersion
If $Version = 3 Then Version-3
If $Version = 2 Then Version-2
{ If not 2 or 3, Just Exit
Exit
:Version-3
Set $Status-Header "X-Poco-Status:"
GoTo Check-Status
:Version-2
Set $Status-Header "Status:"
{
{ Get the "Status-Header" and save it in $Status
{
:Check-Status
ReadHeader $Status $Status-Header %message
{
{ Save the "Read/Unread" flag.
{
Char $Read-Flag 1 $Status
{
{ Get rid of the original "Read/Unread" flag,
{ but preserve the other flag.
{
ChopString $Status 1 1
Set $TargetMailbox $ReadMailbox
If $Read-Flag = U Then Mark-Read
Set $TargetMailbox $UnreadMailbox
If $Read-Flag = R Then Mark-UnRead
{
{ Just exit if no "Read/Unread" flag found.
{
Exit
{
{ Insert the toggled "Read/Unread" flag in $Status.
{
:Mark-Read
InsertString $Status 1 R
GoTo Replace-Status-Header
:Mark-UnRead
InsertString $Status 1 U
{
{ Replace the original Status-Header with
{ the updated $Status value.
{
:Replace-Status-Header
DeleteHeader $Status-Header %message
AddHeader %message $Status-Header $Status
If $AutoMove ! "yes" Then Done
AppendToFile True
SaveMessage %message $TargetMailbox
DeleteMessage %message
:Done
Exit
Return to PocoScript Help and How-To
Users browsing this forum: No registered users and 3 guests