{
public:
typedef unsigned Type;
+ static const Type invalidId = 0;
+
BaseMsgId()
- : value(0)
+ : value(invalidId)
{
}
MsgId MessagePrivate::getId() const
{
- int id = -1;
+ int id = MsgId::invalidId;
msg_get_int_value(m_MsgStruct, MSG_MESSAGE_ID_INT, &id);
return id;
}
ThreadId MessagePrivate::getThreadId() const
{
- int threadId = -1;
+ int threadId = ThreadId::invalidId;
msg_get_int_value(m_MsgStruct, MSG_MESSAGE_THREAD_ID_INT, &threadId);
return threadId;
}
MsgId MsgConversationItemPrivate::getMsgId() const
{
- int id = -1;
+ int id = MsgId::invalidId;
msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_ID_INT, &id);
return id;
}
ThreadId MsgConversationItemPrivate::getThreadId() const
{
- int id = -1;
+ int id = ThreadId::invalidId;
msg_get_int_value(m_MsgStruct, MSG_CONV_MSG_THREAD_ID_INT, &id);
return id;
}
ThreadId MsgStoragePrivate::getThreadId(const MsgAddressList &addressList)
{
- msg_thread_id_t id = -1;
+ msg_thread_id_t id = ThreadId::invalidId;
if(const MsgAddressListHandlePrivate *privateList = dynamic_cast<const MsgAddressListHandlePrivate*>(&addressList))
{
ThreadId MsgStoragePrivate::getThreadId(const std::list<std::string> &addressList)
{
- msg_thread_id_t tid = -1;
+ msg_thread_id_t tid = ThreadId::invalidId;
msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
if(msgInfo)
ThreadId MsgStoragePrivate::getThreadId(MsgId id)
{
- int threadId = -1;
+ int threadId = ThreadId::invalidId;
msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
ThreadId MsgThreadItemPrivate::getId() const
{
- int id = -1;
+ int id = ThreadId::invalidId;
msg_get_int_value(m_MsgStruct, MSG_THREAD_ID_INT, &id);
return id;
}
void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressList, bool decorateName)
{
int countContact = addressList.getLength();
+ if(countContact <= 0)
+ {
+ MSG_LOG_WARN("Msg address list is empty");
+ return;
+ }
+
const MsgAddress &addr = addressList[0];
if(countContact > 1)
m_ThumbId = m_App.getThumbnailMaker().getThumbId(addr);
updateName(addr, countContact, decorateName);
}
- else
- {
- MSG_LOG_WARN("Msg address list is empty");
- }
}
void BaseThreadListItem::updateName(const MsgAddress &address, int addressesCount, bool decorateName)