--- smsdaemon/SmsPdu.cpp 2008/12/11 22:32:58 176 +++ smsdaemon/SmsPdu.cpp 2008/12/12 12:13:05 178 @@ -13,6 +13,11 @@ #include "Logger.h" #include "Util.h" +#include "Exceptions.h" +#include +#include +#include + using namespace std; @@ -274,29 +279,79 @@ } + std::list partlist; + typedef std::list::iterator iterator; + + SMS ConcatenateParts(SmsPart& part) + { + SMS sms; + if (part.group == -1) + { + sms.SetMessage(part.message); + sms.SetSender(part.sender); + } + else + { + partlist.push_back(part); + + vector vec; + for (iterator it=partlist.begin(); it!=partlist.end(); ++it) + { + SmsPart& current = *it; + if (current.sender == part.sender && current.group == part.group) + vec.push_back(current); + } + + if (vec.size() == (unsigned)part.count) //we have all parts + { + sort(vec.begin(), vec.end()); + string message; + for (unsigned i=0; i& udh, SmsPart& part) { - if (udh.size() == 0) { + if (udh.size() == 0) + { Logger::logMessage("ParseUdh(): empty udh"); return; } - if (udh[0] != 0) { + if (udh[0] != 0) + { Logger::logMessage("unknown UDH type"); return; } + + if (udh.size() < 5) + { + Logger::logMessage("UDH to short to be multipart"); + return; + } part.group = udh[2]; part.count = udh[3];