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 generalstatusevent.cpp 00013 ** \version $Id: generalstatusevent.cpp 2362 2008-02-29 04:30:11Z edmanm $ 00014 ** \brief Base class for all general Tor status events 00015 */ 00016 00017 #include "generalstatusevent.h" 00018 00019 00020 /** Returns a GeneralStatusEvent::Status enum value for the status value 00021 * represented by <b>str</b>. */ 00022 GeneralStatusEvent::Status 00023 GeneralStatusEvent::statusFromString(const QString &str) 00024 { 00025 if (!str.compare("CLOCK_JUMPED", Qt::CaseInsensitive)) 00026 return ClockJumped; 00027 if (!str.compare("DANGEROUS_VERSION", Qt::CaseInsensitive)) 00028 return DangerousTorVersion; 00029 if (!str.compare("TOO_MANY_CONNECTIONS", Qt::CaseInsensitive)) 00030 return TooManyConnections; 00031 if (!str.compare("BUG", Qt::CaseInsensitive)) 00032 return TorBug; 00033 if (!str.compare("CLOCK_SKEW", Qt::CaseInsensitive)) 00034 return ClockSkew; 00035 if (!str.compare("BAD_LIBEVENT", Qt::CaseInsensitive)) 00036 return BadLibevent; 00037 if (!str.compare("DIR_ALL_UNREACHABLE", Qt::CaseInsensitive)) 00038 return DirAllUnreachable; 00039 return UnrecognizedStatus; 00040 } 00041