Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
6a91163a
Commit
6a91163a
authored
Jan 10, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unstable
parent
491ceedd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+17
-7
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+0
-1
No files found.
tests/src/components/chat/ChatModel.cpp
View file @
6a91163a
...
@@ -14,6 +14,15 @@ using namespace std;
...
@@ -14,6 +14,15 @@ using namespace std;
// =============================================================================
// =============================================================================
class
ChatModel
::
MessageHandlers
:
public
linphone
::
ChatMessageListener
{
class
ChatModel
::
MessageHandlers
:
public
linphone
::
ChatMessageListener
{
public:
MessageHandlers
(
ChatModel
*
chat_model
)
:
m_chat_model
(
chat_model
)
{}
~
MessageHandlers
()
{
qDebug
()
<<
"handlers"
;
}
private:
void
onFileTransferRecv
(
void
onFileTransferRecv
(
const
shared_ptr
<
linphone
::
ChatMessage
>
&
message
,
const
shared_ptr
<
linphone
::
ChatMessage
>
&
message
,
const
shared_ptr
<
linphone
::
Content
>
&
content
,
const
shared_ptr
<
linphone
::
Content
>
&
content
,
...
@@ -41,19 +50,21 @@ class ChatModel::MessageHandlers : public linphone::ChatMessageListener {
...
@@ -41,19 +50,21 @@ class ChatModel::MessageHandlers : public linphone::ChatMessageListener {
}
}
void
onMsgStateChanged
(
const
shared_ptr
<
linphone
::
ChatMessage
>
&
message
,
linphone
::
ChatMessageState
state
)
override
{
void
onMsgStateChanged
(
const
shared_ptr
<
linphone
::
ChatMessage
>
&
message
,
linphone
::
ChatMessageState
state
)
override
{
ChatModel
*
chat
=
static_cast
<
ChatModel
*>
(
message
->
getUserData
())
;
ChatModel
&
chat
=
*
m_chat_model
;
auto
it
=
find_if
(
chat
->
m_entries
.
begin
(),
chat
->
m_entries
.
end
(),
[
&
message
](
const
ChatEntryData
&
pair
)
{
auto
it
=
find_if
(
chat
.
m_entries
.
begin
(),
chat
.
m_entries
.
end
(),
[
&
message
](
const
ChatEntryData
&
pair
)
{
return
pair
.
second
==
message
;
return
pair
.
second
==
message
;
});
});
if
(
it
==
chat
->
m_entries
.
end
())
if
(
it
==
chat
.
m_entries
.
end
())
return
;
return
;
(
*
it
).
first
[
"state"
]
=
state
;
(
*
it
).
first
[
"state"
]
=
state
;
int
row
=
distance
(
chat
->
m_entries
.
begin
(),
it
);
int
row
=
distance
(
chat
.
m_entries
.
begin
(),
it
);
emit
chat
->
dataChanged
(
chat
->
index
(
row
,
0
),
chat
->
index
(
row
,
0
));
emit
chat
.
dataChanged
(
chat
.
index
(
row
,
0
),
chat
.
index
(
row
,
0
));
}
}
ChatModel
*
m_chat_model
;
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -227,8 +238,7 @@ void ChatModel::removeAllEntries () {
...
@@ -227,8 +238,7 @@ void ChatModel::removeAllEntries () {
void
ChatModel
::
sendMessage
(
const
QString
&
message
)
{
void
ChatModel
::
sendMessage
(
const
QString
&
message
)
{
shared_ptr
<
linphone
::
ChatMessage
>
_message
=
m_chat_room
->
createMessage
(
::
Utils
::
qStringToLinphoneString
(
message
));
shared_ptr
<
linphone
::
ChatMessage
>
_message
=
m_chat_room
->
createMessage
(
::
Utils
::
qStringToLinphoneString
(
message
));
_message
->
setUserData
(
this
);
_message
->
setListener
(
make_shared
<
MessageHandlers
>
(
this
));
_message
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendChatMessage
(
_message
);
m_chat_room
->
sendChatMessage
(
_message
);
insertMessageAtEnd
(
_message
);
insertMessageAtEnd
(
_message
);
}
}
...
...
tests/src/components/chat/ChatModel.hpp
View file @
6a91163a
...
@@ -96,7 +96,6 @@ private:
...
@@ -96,7 +96,6 @@ private:
std
::
shared_ptr
<
linphone
::
ChatRoom
>
m_chat_room
;
std
::
shared_ptr
<
linphone
::
ChatRoom
>
m_chat_room
;
std
::
shared_ptr
<
CoreHandlers
>
m_core_handlers
;
std
::
shared_ptr
<
CoreHandlers
>
m_core_handlers
;
std
::
shared_ptr
<
MessageHandlers
>
m_message_handlers
;
};
};
#endif // CHAT_MODEL_H_
#endif // CHAT_MODEL_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