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
dbb43562
Commit
dbb43562
authored
Dec 12, 2017
by
Ronan
Browse files
feat(ChatRoom): add BasicToClientGroupChatRoom impl (todo: migration algorithm)
parent
87ca435a
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/chat/chat-room/abstract-chat-room.h
View file @
dbb43562
...
...
@@ -33,6 +33,7 @@ class ChatRoomId;
class
EventLog
;
class
LINPHONE_PUBLIC
AbstractChatRoom
:
public
Object
,
public
CoreAccessor
,
public
ConferenceInterface
{
friend
class
BasicToClientGroupChatRoomPrivate
;
friend
class
ChatMessage
;
friend
class
ChatMessagePrivate
;
friend
class
CorePrivate
;
...
...
src/chat/chat-room/basic-to-client-group-chat-room.cpp
View file @
dbb43562
/*
* basic-to-client-group-chat-room.cpp
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "abstract-chat-room-p.h"
#include "basic-to-client-group-chat-room.h"
#include "chat-room.h"
// =============================================================================
using
namespace
std
;
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
class
BasicToClientGroupChatRoomPrivate
:
public
AbstractChatRoomPrivate
{
public:
shared_ptr
<
AbstractChatRoom
>
chatRoom
;
private:
inline
void
setCreationTime
(
time_t
creationTime
)
override
{
chatRoom
->
getPrivate
()
->
setCreationTime
(
creationTime
);
}
inline
void
setLastUpdateTime
(
time_t
lastUpdateTime
)
override
{
chatRoom
->
getPrivate
()
->
setLastUpdateTime
(
lastUpdateTime
);
}
inline
void
setState
(
BasicToClientGroupChatRoom
::
State
state
)
override
{
chatRoom
->
getPrivate
()
->
setState
(
state
);
}
inline
void
sendChatMessage
(
const
shared_ptr
<
ChatMessage
>
&
chatMessage
)
override
{
chatRoom
->
getPrivate
()
->
sendChatMessage
(
chatMessage
);
}
inline
void
addTransientEvent
(
const
shared_ptr
<
EventLog
>
&
eventLog
)
override
{
chatRoom
->
getPrivate
()
->
addTransientEvent
(
eventLog
);
}
inline
void
removeTransientEvent
(
const
shared_ptr
<
EventLog
>
&
eventLog
)
override
{
chatRoom
->
getPrivate
()
->
removeTransientEvent
(
eventLog
);
}
inline
void
notifyUndecryptableChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
chatMessage
)
override
{
chatRoom
->
getPrivate
()
->
notifyUndecryptableChatMessageReceived
(
chatMessage
);
}
inline
LinphoneReason
onSipMessageReceived
(
SalOp
*
op
,
const
SalMessage
*
message
)
override
{
return
chatRoom
->
getPrivate
()
->
onSipMessageReceived
(
op
,
message
);
}
inline
void
onChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
chatMessage
)
override
{
chatRoom
->
getPrivate
()
->
onChatMessageReceived
(
chatMessage
);
}
};
// =============================================================================
BasicToClientGroupChatRoom
::
BasicToClientGroupChatRoom
(
const
shared_ptr
<
ChatRoom
>
&
chatRoom
)
:
AbstractChatRoom
(
*
new
BasicToClientGroupChatRoomPrivate
,
chatRoom
->
getCore
())
{
L_D
();
d
->
chatRoom
=
chatRoom
;
}
// -----------------------------------------------------------------------------
const
ChatRoomId
&
BasicToClientGroupChatRoom
::
getChatRoomId
()
const
{
L_D
();
return
d
->
chatRoom
->
getChatRoomId
();
}
const
IdentityAddress
&
BasicToClientGroupChatRoom
::
getPeerAddress
()
const
{
L_D
();
return
d
->
chatRoom
->
getPeerAddress
();
}
const
IdentityAddress
&
BasicToClientGroupChatRoom
::
getLocalAddress
()
const
{
L_D
();
return
d
->
chatRoom
->
getLocalAddress
();
}
// -----------------------------------------------------------------------------
time_t
BasicToClientGroupChatRoom
::
getCreationTime
()
const
{
L_D
();
return
d
->
chatRoom
->
getCreationTime
();
}
time_t
BasicToClientGroupChatRoom
::
getLastUpdateTime
()
const
{
L_D
();
return
d
->
chatRoom
->
getLastUpdateTime
();
}
// -----------------------------------------------------------------------------
BasicToClientGroupChatRoom
::
State
BasicToClientGroupChatRoom
::
getState
()
const
{
L_D
();
return
d
->
chatRoom
->
getState
();
}
// -----------------------------------------------------------------------------
list
<
shared_ptr
<
EventLog
>>
BasicToClientGroupChatRoom
::
getHistory
(
int
nLast
)
const
{
L_D
();
return
d
->
chatRoom
->
getHistory
(
nLast
);
}
list
<
shared_ptr
<
EventLog
>>
BasicToClientGroupChatRoom
::
getHistoryRange
(
int
begin
,
int
end
)
const
{
L_D
();
return
d
->
chatRoom
->
getHistoryRange
(
begin
,
end
);
}
int
BasicToClientGroupChatRoom
::
getHistorySize
()
const
{
L_D
();
return
d
->
chatRoom
->
getHistorySize
();
}
void
BasicToClientGroupChatRoom
::
deleteHistory
()
{
L_D
();
d
->
chatRoom
->
deleteHistory
();
}
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
getLastChatMessageInHistory
()
const
{
L_D
();
return
d
->
chatRoom
->
getLastChatMessageInHistory
();
}
int
BasicToClientGroupChatRoom
::
getChatMessageCount
()
const
{
L_D
();
return
d
->
chatRoom
->
getChatMessageCount
();
}
int
BasicToClientGroupChatRoom
::
getUnreadChatMessageCount
()
const
{
L_D
();
return
d
->
chatRoom
->
getUnreadChatMessageCount
();
}
// -----------------------------------------------------------------------------
void
BasicToClientGroupChatRoom
::
compose
()
{
L_D
();
return
d
->
chatRoom
->
compose
();
}
bool
BasicToClientGroupChatRoom
::
isRemoteComposing
()
const
{
L_D
();
return
d
->
chatRoom
->
isRemoteComposing
();
}
list
<
IdentityAddress
>
BasicToClientGroupChatRoom
::
getComposingAddresses
()
const
{
L_D
();
return
d
->
chatRoom
->
getComposingAddresses
();
}
// -----------------------------------------------------------------------------
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
createChatMessage
()
{
L_D
();
return
d
->
chatRoom
->
createChatMessage
();
}
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
createChatMessage
(
const
string
&
text
)
{
L_D
();
return
d
->
chatRoom
->
createChatMessage
(
text
);
}
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
createFileTransferMessage
(
const
LinphoneContent
*
initialContent
)
{
L_D
();
return
d
->
chatRoom
->
createFileTransferMessage
(
initialContent
);
}
// -----------------------------------------------------------------------------
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
findChatMessage
(
const
string
&
messageId
)
const
{
L_D
();
return
d
->
chatRoom
->
findChatMessage
(
messageId
);
}
shared_ptr
<
ChatMessage
>
BasicToClientGroupChatRoom
::
findChatMessage
(
const
string
&
messageId
,
ChatMessage
::
Direction
direction
)
const
{
L_D
();
return
d
->
chatRoom
->
findChatMessage
(
messageId
,
direction
);
}
void
BasicToClientGroupChatRoom
::
markAsRead
()
{
L_D
();
d
->
chatRoom
->
markAsRead
();
}
LINPHONE_END_NAMESPACE
src/chat/chat-room/basic-to-client-group-chat-room.h
View file @
dbb43562
/*
* basic-to-client-group-chat-room.h
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _BASIC_TO_CLIENT_GROUP_CHAT_ROOM_H_
#define _BASIC_TO_CLIENT_GROUP_CHAT_ROOM_H_
#include "abstract-chat-room.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
BasicToClientGroupChatRoomPrivate
;
class
ChatRoom
;
class
LINPHONE_PUBLIC
BasicToClientGroupChatRoom
:
public
AbstractChatRoom
{
public:
BasicToClientGroupChatRoom
(
const
std
::
shared_ptr
<
ChatRoom
>
&
chatRoom
);
const
ChatRoomId
&
getChatRoomId
()
const
override
;
const
IdentityAddress
&
getPeerAddress
()
const
override
;
const
IdentityAddress
&
getLocalAddress
()
const
override
;
time_t
getCreationTime
()
const
override
;
time_t
getLastUpdateTime
()
const
override
;
State
getState
()
const
override
;
std
::
list
<
std
::
shared_ptr
<
EventLog
>>
getHistory
(
int
nLast
)
const
override
;
std
::
list
<
std
::
shared_ptr
<
EventLog
>>
getHistoryRange
(
int
begin
,
int
end
)
const
override
;
int
getHistorySize
()
const
override
;
void
deleteHistory
()
override
;
std
::
shared_ptr
<
ChatMessage
>
getLastChatMessageInHistory
()
const
override
;
int
getChatMessageCount
()
const
override
;
int
getUnreadChatMessageCount
()
const
override
;
void
compose
()
override
;
bool
isRemoteComposing
()
const
override
;
std
::
list
<
IdentityAddress
>
getComposingAddresses
()
const
override
;
std
::
shared_ptr
<
ChatMessage
>
createChatMessage
()
override
;
std
::
shared_ptr
<
ChatMessage
>
createChatMessage
(
const
std
::
string
&
text
)
override
;
// TODO: Remove LinphoneContent by LinphonePrivate::Content.
std
::
shared_ptr
<
ChatMessage
>
createFileTransferMessage
(
const
LinphoneContent
*
initialContent
)
override
;
std
::
shared_ptr
<
ChatMessage
>
findChatMessage
(
const
std
::
string
&
messageId
)
const
override
;
std
::
shared_ptr
<
ChatMessage
>
findChatMessage
(
const
std
::
string
&
messageId
,
ChatMessage
::
Direction
direction
)
const
override
;
void
markAsRead
()
override
;
private:
L_DECLARE_PRIVATE
(
BasicToClientGroupChatRoom
);
L_DISABLE_COPY
(
BasicToClientGroupChatRoom
);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _BASIC_TO_CLIENT_GROUP_CHAT_ROOM_H_
src/chat/chat-room/chat-room.cpp
View file @
dbb43562
...
...
@@ -350,7 +350,7 @@ void ChatRoom::deleteHistory () {
getCore
()
->
getPrivate
()
->
mainDb
->
cleanHistory
(
getChatRoomId
());
}
shared_ptr
<
ChatMessage
>
ChatRoom
::
getLastChatMessageInHistory
()
const
{
shared_ptr
<
ChatMessage
>
ChatRoom
::
getLastChatMessageInHistory
()
const
{
return
getCore
()
->
getPrivate
()
->
mainDb
->
getLastChatMessage
(
getChatRoomId
());
}
...
...
@@ -379,7 +379,7 @@ bool ChatRoom::isRemoteComposing () const {
return
!
d
->
remoteIsComposing
.
empty
();
}
std
::
list
<
IdentityAddress
>
ChatRoom
::
getComposingAddresses
()
const
{
list
<
IdentityAddress
>
ChatRoom
::
getComposingAddresses
()
const
{
L_D
();
return
d
->
remoteIsComposing
;
}
...
...
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