bool MessagePrivate::isMms() const
{
- int type = MSG_TYPE_SMS;
- msg_get_int_value(m_MsgStruct, MSG_MESSAGE_TYPE_INT, &type);
-
- if(type == MSG_TYPE_MMS)
- return true;
- else if(type != MSG_TYPE_SMS)
- MSG_LOG("invalid msg type!", type);
-
- return false;
+ int nativeType = MSG_TYPE_INVALID;
+ msg_get_int_value(m_MsgStruct, MSG_MESSAGE_TYPE_INT, &nativeType);
+ return MsgUtilsPrivate::nativeToMessageType(nativeType) == Message::MT_MMS;
}
if(msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0)
{
- int msgType = MSG_TYPE_INVALID;
- msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &msgType);
+ int nativeType = MSG_TYPE_INVALID;
+ msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &nativeType);
+ Message::Type type = MsgUtilsPrivate::nativeToMessageType(nativeType);
- switch(msgType)
+ switch(type)
{
- case MSG_TYPE_SMS:
+ case Message::MT_SMS:
msgRef = std::make_shared<MessageSMSPrivate>(true, msg);
break;
- case MSG_TYPE_MMS:
+ case Message::MT_MMS:
msgRef = std::make_shared<MessageMmsPrivate>(true, msg);
break;
}
}
-int MsgUtilsPrivate::messageTypeToNative(Message::Type type)
-{
- switch(type)
- {
- case Message::MT_SMS:
- return MSG_TYPE_SMS;
-
- case Message::MT_MMS:
- return MSG_TYPE_MMS;
-
- default:
- return MSG_TYPE_INVALID;
- }
-}
-
Message::Type MsgUtilsPrivate::nativeToMessageType(int type)
{
switch(type)
{
case MSG_TYPE_SMS:
+ case MSG_TYPE_SMS_CB:
+ case MSG_TYPE_SMS_JAVACB:
+ case MSG_TYPE_SMS_WAPPUSH:
+ case MSG_TYPE_SMS_MWI:
+ case MSG_TYPE_SMS_SYNCML:
+ case MSG_TYPE_SMS_REJECT:
+ case MSG_TYPE_SMS_ETWS_PRIMARY:
+ case MSG_TYPE_SMS_ETWS_SECONDARY:
+ case MSG_TYPE_SMS_CMAS_PRESIDENTIAL:
+ case MSG_TYPE_SMS_CMAS_EXTREME:
+ case MSG_TYPE_SMS_CMAS_SEVERE:
+ case MSG_TYPE_SMS_CMAS_AMBER:
+ case MSG_TYPE_SMS_CMAS_TEST:
+ case MSG_TYPE_SMS_CMAS_EXERCISE:
+ case MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED:
return Message::MT_SMS;
case MSG_TYPE_MMS:
+ case MSG_TYPE_MMS_JAVA:
+ case MSG_TYPE_MMS_NOTI:
return Message::MT_MMS;
default:
static int directionToNative(Message::Direction direction);
static int addressTypeToNative(MsgAddress::AddressType type);
static int recipientTypeToNative(MsgAddress::RecipientType type);
- static int messageTypeToNative(Message::Type type);
static Message::Direction nativeToDirection(int direction);
static Message::MessageStorageType nativeToMessageStorage(int id);
static MsgAddress::AddressType nativeToAddressType(int type);