diff --git a/mailtransport/outboxactions.cpp b/mailtransport/outboxactions.cpp index 0dbff9142..35c6e9524 100644 --- a/mailtransport/outboxactions.cpp +++ b/mailtransport/outboxactions.cpp @@ -1,76 +1,104 @@ /* Copyright (c) 2009 Constantin Berzan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "outboxactions.h" #include "dispatchmodeattribute.h" #include "errorattribute.h" #include using namespace Akonadi; using namespace MailTransport; +class MailTransport::SendQueuedAction::Private +{ +}; + +SendQueuedAction::SendQueuedAction() + : d( new Private ) +{ +} + +SendQueuedAction::~SendQueuedAction() +{ + delete d; +} + ItemFetchScope SendQueuedAction::fetchScope() const { ItemFetchScope scope; scope.fetchFullPayload( false ); scope.fetchAttribute(); return scope; } bool SendQueuedAction::itemAccepted( const Item &item ) const { if( !item.hasAttribute() ) { kWarning() << "Item doesn't have DispatchModeAttribute."; return false; } return item.attribute()->dispatchMode() == DispatchModeAttribute::Never; } Job *SendQueuedAction::itemAction( const Item &item ) const { Item cp = item; cp.addAttribute( new DispatchModeAttribute ); // defaults to Immediately return new ItemModifyJob( cp ); } +class MailTransport::ClearErrorAction::Private +{ +}; + +ClearErrorAction::ClearErrorAction() + : d( new Private ) +{ +} + +ClearErrorAction::~ClearErrorAction() +{ + delete d; +} + ItemFetchScope ClearErrorAction::fetchScope() const { ItemFetchScope scope; scope.fetchFullPayload( false ); scope.fetchAttribute(); return scope; } bool ClearErrorAction::itemAccepted( const Item &item ) const { return item.hasAttribute(); } Job *ClearErrorAction::itemAction( const Item &item ) const { Item cp = item; cp.removeAttribute(); cp.clearFlag( "error" ); cp.setFlag( "queued" ); return new ItemModifyJob( cp ); } diff --git a/mailtransport/outboxactions.h b/mailtransport/outboxactions.h index ba6bd0f2c..ea574d158 100644 --- a/mailtransport/outboxactions.h +++ b/mailtransport/outboxactions.h @@ -1,73 +1,101 @@ /* Copyright (c) 2009 Constantin Berzan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MAILTRANSPORT_OUTBOXACTIONS_H #define MAILTRANSPORT_OUTBOXACTIONS_H #include #include #include #include namespace MailTransport { /** FilterAction that finds all messages with a DispatchMode of Never and assigns them a DispatchMode of Immediately. This is used to send "queued" messages on demand. @see FilterActionJob @author Constantin Berzan @since 4.4 */ class MAILTRANSPORT_EXPORT SendQueuedAction : public Akonadi::FilterAction { public: + /** Creates a SendQueuedAction. */ + SendQueuedAction(); + + /** Destroys this object. */ + virtual ~SendQueuedAction(); + /* reimpl */ virtual Akonadi::ItemFetchScope fetchScope() const; + + /* reimpl */ virtual bool itemAccepted( const Akonadi::Item &item ) const; + + /* reimpl */ virtual Akonadi::Job *itemAction( const Akonadi::Item &item ) const; + + private: + class Private; + Private *const d; }; /** FilterAction that finds all messages with an ErrorAttribute, removes the attribute, and sets the "queued" flag. This is used to retry sending messages that failed. @see FilterActionJob @author Constantin Berzan @since 4.4 */ class MAILTRANSPORT_EXPORT ClearErrorAction : public Akonadi::FilterAction { public: + /** Creates a ClearErrorAction. */ + ClearErrorAction(); + + /** Destroys this object. */ + virtual ~ClearErrorAction(); + /* reimpl */ virtual Akonadi::ItemFetchScope fetchScope() const; + + /* reimpl */ virtual bool itemAccepted( const Akonadi::Item &item ) const; + + /* reimpl */ virtual Akonadi::Job *itemAction( const Akonadi::Item &item ) const; + + private: + class Private; + Private *const d; }; } // namespace MailTransport #endif // MAILTRANSPORT_OUTBOXACTIONS_H