00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If 00004 ** you did not receive the LICENSE file with this file, you may obtain it 00005 ** from the Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to 00008 ** the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file dangerousversionevent.h 00013 ** \version $Id: dangerousversionevent.h 2780 2008-06-21 21:48:32Z edmanm $ 00014 ** \brief Event sent when Tor realizes its version is not recommended 00015 */ 00016 00017 #ifndef _DANGEROUSVERSIONEVENT_H 00018 #define _DANGEROUSVERSIONEVENT_H 00019 00020 #include <QStringList> 00021 #include "generalstatusevent.h" 00022 00023 00024 class DangerousVersionEvent : public GeneralStatusEvent 00025 { 00026 public: 00027 /** Possible reasons Tor thinks its version is dangerous. */ 00028 enum Reason { 00029 UnrecognizedReason, 00030 NewVersion, /**< The current version is newer than any recommended 00031 version. */ 00032 ObsoleteVersion, /**< The current version is older than any recommended 00033 version. */ 00034 UnrecommendedVersion /**< The current version of Tor should not be used. */ 00035 }; 00036 00037 /** Constructor. */ 00038 DangerousVersionEvent(tc::Severity severity, Reason reason, 00039 const QString ¤tVersion, 00040 const QStringList &recommendedVersions) 00041 : GeneralStatusEvent(severity, GeneralStatusEvent::DangerousTorVersion), 00042 _reason(reason), 00043 _current(currentVersion), 00044 _recommended(recommendedVersions) {} 00045 00046 /** Returns the Reason enum value indicating the reason Tor thinks its 00047 * version is dangerous. */ 00048 Reason reason() const { return _reason; } 00049 /** Returns the user's current Tor version. */ 00050 QString currentVersion() const { return _current; } 00051 /** Returns a list of recommended Tor versions. */ 00052 QStringList recommendedVersions() const { return _recommended; } 00053 00054 /** Returns a DangerousVersionEvent::Reason enum value for <b>str</b>, 00055 * representing the reason why Tor thinks its version is dangerous. */ 00056 static Reason reasonFromString(const QString &str); 00057 00058 private: 00059 Reason _reason; /**< Reason this Tor version is dangerous. */ 00060 QString _current; /**< The user's current Tor version. */ 00061 QStringList _recommended; /**< A list of recommended Tor versions. */ 00062 }; 00063 00064 #endif 00065