control: Use std::string in TransactionEntry to ctore messaging payload.
Originally there was a fixed-size char array, which didn't allow to work with long hex strings. (cherry picked from commit fdc6fc85f9f431438ef7279975c2f7c230cb4aa5)
This commit is contained in:
parent
c39af79c75
commit
25cef9ef96
|
@ -63,7 +63,6 @@ TransactionEntry::TransactionEntry()
|
|||
mT3113(gConfig.getNum("GSM.T3113")),
|
||||
mTR1M(TR1Mms)
|
||||
{
|
||||
mMessage[0]='\0';
|
||||
}
|
||||
|
||||
// Form for MT transactions.
|
||||
|
@ -82,8 +81,7 @@ TransactionEntry::TransactionEntry(const L3MobileIdentity& wSubscriber,
|
|||
mT3113(gConfig.getNum("GSM.T3113")),
|
||||
mTR1M(TR1Mms)
|
||||
{
|
||||
if (wMessage) strncpy(mMessage,wMessage,160);
|
||||
else mMessage[0]='\0';
|
||||
if (wMessage) mMessage = wMessage;
|
||||
}
|
||||
|
||||
// Form for MO transactions.
|
||||
|
@ -102,7 +100,6 @@ TransactionEntry::TransactionEntry(const L3MobileIdentity& wSubscriber,
|
|||
mT3113(gConfig.getNum("GSM.T3113")),
|
||||
mTR1M(TR1Mms)
|
||||
{
|
||||
mMessage[0]='\0';
|
||||
}
|
||||
|
||||
// Form for MT transactions.
|
||||
|
@ -120,7 +117,6 @@ TransactionEntry::TransactionEntry(const L3MobileIdentity& wSubscriber,
|
|||
mT3113(gConfig.getNum("GSM.T3113")),
|
||||
mTR1M(TR1Mms)
|
||||
{
|
||||
mMessage[0]='\0';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ class TransactionEntry {
|
|||
Q931CallState mQ931State; ///< the GSM/ISDN/Q.931 call state
|
||||
Timeval mStateTimer; ///< timestamp of last state change.
|
||||
|
||||
char mMessage[256]; ///< text messaging payload
|
||||
std::string mMessage; ///< text messaging payload
|
||||
|
||||
/**@name Timers from GSM and Q.931 (network side) */
|
||||
//@{
|
||||
|
@ -467,12 +467,10 @@ class TransactionEntry {
|
|||
|
||||
const GSM::L3CallingPartyBCDNumber& calling() const { return mCalling; }
|
||||
|
||||
const char* message() const { return mMessage; }
|
||||
void message(const char *wMessage, unsigned length)
|
||||
const char* message() const { return mMessage.data(); }
|
||||
void message(const char *wMessage)
|
||||
{
|
||||
unsigned tocopy = (length > 255) ? 255 : length;
|
||||
memcpy(mMessage, wMessage, tocopy);
|
||||
mMessage[tocopy] ='\0';
|
||||
mMessage = wMessage;
|
||||
}
|
||||
|
||||
unsigned ID() const { return mID; }
|
||||
|
|
|
@ -363,7 +363,7 @@ bool SIPInterface::checkInvite( osip_message_t * msg )
|
|||
if (!body) return false;
|
||||
char *text = body->body;
|
||||
if (text) {
|
||||
transaction.message(text, body->length);
|
||||
transaction.message(text);
|
||||
}
|
||||
else LOG(NOTICE) << "MTSMS incoming MESSAGE method with no message body for " << mobile_id;
|
||||
}
|
||||
|
|
Reference in New Issue