Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Robert Maerkisch
kaidan
Commits
52c1b1a9
Commit
52c1b1a9
authored
Aug 01, 2017
by
Linus Jahn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash on getting incoming message
parent
4334f774
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
src/MessageHandler.cpp
src/MessageHandler.cpp
+8
-8
src/MessageHandler.h
src/MessageHandler.h
+1
-1
No files found.
src/MessageHandler.cpp
View file @
52c1b1a9
...
...
@@ -61,16 +61,16 @@ MessageHandler::MessageHandler(gloox::Client *client, MessageModel *messageModel
this
->
messageModel
=
messageModel
;
this
->
rosterModel
=
rosterModel
;
this
->
client
=
client
;
this
->
chatPartner
=
new
QString
(
""
);
this
->
chatPartner
=
QString
(
""
);
}
MessageHandler
::~
MessageHandler
()
{
}
void
MessageHandler
::
setCurrentChatPartner
(
QString
*
chatPartner
)
void
MessageHandler
::
setCurrentChatPartner
(
QString
*
chatPartner
)
{
this
->
chatPartner
=
chatPartner
;
this
->
chatPartner
=
*
chatPartner
;
resetUnreadMessagesForJid
(
chatPartner
);
}
...
...
@@ -134,18 +134,18 @@ void MessageHandler::handleMessage(const gloox::Message &stanza, gloox::MessageS
// the contact can differ if the message is really from a contact or just
// a forward of another of the user's clients
const
QString
*
contactJid
=
isSentByMe
?
&
toJid
:
&
fromJid
;
const
QString
contactJid
=
isSentByMe
?
toJid
:
fromJid
;
// update the last message for this contact
rosterModel
->
setLastMessageForJid
(
contactJid
,
&
body
);
rosterModel
->
setLastMessageForJid
(
&
contactJid
,
&
body
);
// update the last exchanged for this contact
updateLastExchangedOfJid
(
contactJid
);
updateLastExchangedOfJid
(
&
contactJid
);
// Increase unread message counter
// don't add new unread message if chat is opened or we wrote the message
if
(
*
contactJid
!=
*
chatPartner
&&
!
isSentByMe
)
newUnreadMessageForJid
(
contactJid
);
if
(
chatPartner
!=
contactJid
&&
!
isSentByMe
)
newUnreadMessageForJid
(
&
contactJid
);
}
if
(
message
->
hasEmbeddedStanza
())
{
...
...
src/MessageHandler.h
View file @
52c1b1a9
...
...
@@ -51,7 +51,7 @@ private:
gloox
::
Client
*
client
;
MessageModel
*
messageModel
;
RosterModel
*
rosterModel
;
QString
*
chatPartner
;
QString
chatPartner
;
};
#endif // MESSAGEHANDLER_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment