Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
caacc7a8
Commit
caacc7a8
authored
Nov 27, 2017
by
Sylvain Berfini
🐮
Browse files
Started ChatRoom getLastChatMessage
parent
1a68000f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
0 deletions
+23
-0
include/linphone/api/c-chat-room.h
include/linphone/api/c-chat-room.h
+7
-0
src/c-wrapper/api/c-chat-room.cpp
src/c-wrapper/api/c-chat-room.cpp
+4
-0
src/chat/chat-room/chat-room.cpp
src/chat/chat-room/chat-room.cpp
+4
-0
src/chat/chat-room/chat-room.h
src/chat/chat-room/chat-room.h
+2
-0
src/db/main-db.cpp
src/db/main-db.cpp
+5
-0
src/db/main-db.h
src/db/main-db.h
+1
-0
No files found.
include/linphone/api/c-chat-room.h
View file @
caacc7a8
...
...
@@ -202,6 +202,13 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_events (LinphoneCha
*/
LINPHONE_PUBLIC
bctbx_list_t
*
linphone_chat_room_get_history_range_events
(
LinphoneChatRoom
*
cr
,
int
begin
,
int
end
);
/**
* Gets the last chat message sent or received in this chat room
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which last message should be retrieved
* @return the latest #LinphoneChatMessage
*/
LINPHONE_PUBLIC
LinphoneChatMessage
*
linphone_chat_room_get_last_message_in_history
(
LinphoneChatRoom
*
cr
);
LINPHONE_PUBLIC
LinphoneChatMessage
*
linphone_chat_room_find_message
(
LinphoneChatRoom
*
cr
,
const
char
*
message_id
);
/**
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
caacc7a8
...
...
@@ -217,6 +217,10 @@ bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr,
);
}
LinphoneChatMessage
*
linphone_chat_room_get_last_message_in_history
(
LinphoneChatRoom
*
cr
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
getLastMessageInHistory
());
}
LinphoneChatMessage
*
linphone_chat_room_find_message
(
LinphoneChatRoom
*
cr
,
const
char
*
message_id
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
findMessage
(
message_id
));
}
...
...
src/chat/chat-room/chat-room.cpp
View file @
caacc7a8
...
...
@@ -447,6 +447,10 @@ list<shared_ptr<ChatMessage> > ChatRoom::getHistoryRange (int startm, int endm)
return
list
<
shared_ptr
<
ChatMessage
>>
();
}
shared_ptr
<
ChatMessage
>
ChatRoom
::
getLastMessageInHistory
()
const
{
return
getCore
()
->
getPrivate
()
->
mainDb
->
getLastChatMessage
(
getChatRoomId
());
}
int
ChatRoom
::
getUnreadChatMessagesCount
()
{
return
getCore
()
->
getPrivate
()
->
mainDb
->
getUnreadChatMessagesCount
(
getChatRoomId
());
}
...
...
src/chat/chat-room/chat-room.h
View file @
caacc7a8
...
...
@@ -58,6 +58,8 @@ public:
virtual
CapabilitiesMask
getCapabilities
()
const
=
0
;
std
::
shared_ptr
<
ChatMessage
>
getLastMessageInHistory
()
const
;
// TODO: Remove useless functions.
void
compose
();
std
::
shared_ptr
<
ChatMessage
>
createFileTransferMessage
(
const
LinphoneContent
*
initialContent
);
...
...
src/db/main-db.cpp
View file @
caacc7a8
...
...
@@ -1389,6 +1389,11 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
return
list
<
shared_ptr
<
ChatMessage
>>
();
}
shared_ptr
<
ChatMessage
>
MainDb
::
getLastChatMessage
(
const
ChatRoomId
&
chatRoomId
)
const
{
// TODO.
return
nullptr
;
}
list
<
shared_ptr
<
EventLog
>>
MainDb
::
getHistory
(
const
ChatRoomId
&
chatRoomId
,
int
nLast
,
FilterMask
mask
)
const
{
return
getHistoryRange
(
chatRoomId
,
0
,
nLast
-
1
,
mask
);
}
...
...
src/db/main-db.h
View file @
caacc7a8
...
...
@@ -77,6 +77,7 @@ public:
int
getUnreadChatMessagesCount
(
const
ChatRoomId
&
chatRoomId
=
ChatRoomId
())
const
;
void
markChatMessagesAsRead
(
const
ChatRoomId
&
chatRoomId
=
ChatRoomId
())
const
;
std
::
list
<
std
::
shared_ptr
<
ChatMessage
>>
getUnreadChatMessages
(
const
ChatRoomId
&
chatRoomId
=
ChatRoomId
())
const
;
std
::
shared_ptr
<
ChatMessage
>
getLastChatMessage
(
const
ChatRoomId
&
chatRoomId
=
ChatRoomId
())
const
;
// ---------------------------------------------------------------------------
// Conference events.
...
...
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