ferencd@0: ferencd@0: ferencd@0: /** Time out handler. ferencd@0: * Used to stop the current operation after too much time, or if the user ferencd@0: * requested cancellation. ferencd@0: */ ferencd@0: class timeoutHandler : public vmime::net::timeoutHandler ferencd@0: { ferencd@0: public: ferencd@0: ferencd@0: bool isTimeOut() ferencd@0: { ferencd@0: // This is a cancellation point: return true if you want to cancel ferencd@0: // the current operation. If you return true, handleTimeOut() will ferencd@0: // be called just after this, and before actually cancelling the ferencd@0: // operation ferencd@0: return false; ferencd@0: } ferencd@0: ferencd@0: void resetTimeOut() ferencd@0: { ferencd@0: // Called at the beginning of an operation (eg. connecting, ferencd@0: // a read() or a write() on a socket...) ferencd@0: } ferencd@0: ferencd@0: bool handleTimeOut() ferencd@0: { ferencd@0: // If isTimeOut() returned true, this function will be called. This ferencd@0: // allows you to interact with the user, ie. display a prompt to ferencd@0: // know whether he wants to cancel the operation. ferencd@0: ferencd@0: // If you return true here, the operation will be actually cancelled. ferencd@0: // If not, the time out is reset and the operation continues. ferencd@0: return true; ferencd@0: } ferencd@0: }; ferencd@0: ferencd@0: ferencd@0: class timeoutHandlerFactory : public vmime::net::timeoutHandlerFactory ferencd@0: { ferencd@0: public: ferencd@0: ferencd@0: vmime::shared_ptr create() ferencd@0: { ferencd@0: return vmime::make_shared (); ferencd@0: } ferencd@0: }; ferencd@0: