// // MCConnectionLoggerUtils.cc // mailcore2 // // Created by DINH Viêt Hoà on 6/24/13. // Copyright (c) 2013 MailCore. All rights reserved. // #include "MCConnectionLoggerUtils.h" #include #include "MCConnectionLogger.h" mailcore::ConnectionLogType mailcore::getConnectionType(int log_type) { ConnectionLogType type = ConnectionLogTypeGeneric; bool isBuffer = false; switch (log_type) { case MAILSTREAM_LOG_TYPE_INFO_GENERIC: type = ConnectionLogTypeGeneric; break; case MAILSTREAM_LOG_TYPE_INFO_RECEIVED: type = ConnectionLogTypeReceived; break; case MAILSTREAM_LOG_TYPE_INFO_SENT: type = ConnectionLogTypeSent; break; case MAILSTREAM_LOG_TYPE_ERROR_GENERIC: type = ConnectionLogTypeErrorGeneric; isBuffer = true; break; case MAILSTREAM_LOG_TYPE_ERROR_RECEIVED: type = ConnectionLogTypeErrorReceived; isBuffer = true; break; case MAILSTREAM_LOG_TYPE_ERROR_SENT: type = ConnectionLogTypeErrorSent; isBuffer = true; break; case MAILSTREAM_LOG_TYPE_DATA_RECEIVED: type = ConnectionLogTypeReceived; isBuffer = true; break; case MAILSTREAM_LOG_TYPE_DATA_SENT: type = ConnectionLogTypeSent; isBuffer = true; break; case MAILSTREAM_LOG_TYPE_DATA_SENT_PRIVATE: type = ConnectionLogTypeSentPrivate; isBuffer = true; break; } return type; } bool mailcore::isBufferFromLogType(int log_type) { bool isBuffer = false; switch (log_type) { case MAILSTREAM_LOG_TYPE_ERROR_GENERIC: case MAILSTREAM_LOG_TYPE_ERROR_RECEIVED: case MAILSTREAM_LOG_TYPE_ERROR_SENT: case MAILSTREAM_LOG_TYPE_DATA_RECEIVED: case MAILSTREAM_LOG_TYPE_DATA_SENT: case MAILSTREAM_LOG_TYPE_DATA_SENT_PRIVATE: isBuffer = true; break; } return isBuffer; }