--- smsdaemon/SmsToolTransceiver.cpp 2008/12/12 12:54:27 180 +++ smsdaemon/SmsToolTransceiver.cpp 2008/12/18 06:53:29 196 @@ -23,7 +23,7 @@ string appendSlash(string& str) { if (str.at(str.length()-1) != '/'); - str += "/"; + str += "/"; return str; } @@ -34,21 +34,25 @@ try { inboxdir = cmn->GetConfigfile()->GetValue("smstools","inboxdir").StringValue(); - } catch (...) { + } + catch (...) + { Logger::logMessage("Config error> smstools::inboxdir not specified"); exit(1); } try { outgoingdir = cmn->GetConfigfile()->GetValue("smstools","outgoingdir").StringValue(); - } catch (...) { + } + catch (...) + { Logger::logMessage("Config error> smstools::outgoingdir not specified"); exit(1); } inboxdir = appendSlash(inboxdir); outgoingdir = appendSlash(outgoingdir); - + } @@ -71,7 +75,7 @@ out.close(); Common::instance()->smsCounter.outgoing++; - + int result = rename(tempfile.c_str(), destfile.c_str()); if (result) @@ -93,7 +97,7 @@ std::vector vec; DIR* dir = opendir( inboxdir.c_str() ); - if (dir != 0) + if (dir != 0) { dirent* entry; while ( (entry = readdir(dir)) != 0) @@ -106,8 +110,8 @@ { SMS sms = ParseFile( inboxdir + entry->d_name); vec.push_back(sms); - } - catch (std::exception& e) + } + catch (std::exception& e) { Logger::logMessage(e.what()); } @@ -129,13 +133,13 @@ SMS SmsToolTransceiver::ParseFile(std::string path) { SMS sms; - + string file = Util::readfile(path); int result = ::unlink(path.c_str()); - if (result) + if (result) { string message = "SmsTool> unlink "; - message += path; + message += path; message += " failed: "; message += strerror(errno); throw std::runtime_error( message ); @@ -144,7 +148,8 @@ unsigned int pos = file.find("\n\n"); - if (pos != string::npos) { + if (pos != string::npos) + { string header = file.substr(0,pos); string body = file.substr(pos+2,1024); @@ -153,7 +158,9 @@ ParseHeaders(header, sms); - } else { + } + else + { throw std::runtime_error("SmsTool: invalid incomming file"); } @@ -164,7 +171,7 @@ { std::vector headers = Util::str_split(headerstring, "\n"); - for (unsigned int i=0; i