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
8063ae02
Commit
8063ae02
authored
Sep 11, 2017
by
Ghislain MARY
Browse files
Create classes for the different types of chat rooms.
parent
5600ce3a
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
coreapi/chat.c
View file @
8063ae02
...
...
@@ -36,14 +36,16 @@
#include "linphone/wrapper_utils.h"
#include "c-wrapper/c-tools.h"
#include "chat/chat-room-p.h"
#include "chat/chat-room.h"
#include "chat/basic-chat-room.h"
#include "chat/real-time-text-chat-room.h"
#include "chat/real-time-text-chat-room-p.h"
#include "utils/content-type.h"
struct
_LinphoneChatRoom
{
belle_sip_object_t
base
;
void
*
user_data
;
LinphonePrivate
::
ChatRoom
*
cr
;
LinphoneAddress
*
peerAddressCache
;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneChatRoom
);
...
...
@@ -163,13 +165,20 @@ const bctbx_list_t *linphone_core_get_chat_rooms(LinphoneCore *lc) {
}
static
bool_t
linphone_chat_room_matches
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
from
)
{
return
linphone_address_weak_equal
(
cr
->
cr
->
getPeerAddress
(),
from
);
LinphoneAddress
*
addr
=
linphone_address_new
(
cr
->
cr
->
getPeerAddress
().
asString
().
c_str
());
bool_t
result
=
linphone_address_weak_equal
(
addr
,
from
);
linphone_address_unref
(
addr
);
return
result
;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES
(
LinphoneChatRoom
);
static
void
_linphone_chat_room_destroy
(
LinphoneChatRoom
*
cr
)
{
delete
cr
->
cr
;
if
(
cr
->
peerAddressCache
)
{
linphone_address_unref
(
cr
->
peerAddressCache
);
cr
->
peerAddressCache
=
nullptr
;
}
}
BELLE_SIP_INSTANCIATE_VPTR
(
LinphoneChatRoom
,
belle_sip_object_t
,
...
...
@@ -178,14 +187,17 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t,
NULL
,
// marshal
FALSE
);
LinphoneChatRoom
*
_linphone_core_create_chat_room_base
(
LinphoneCore
*
lc
,
LinphoneAddress
*
addr
){
LinphoneChatRoom
*
_linphone_core_create_chat_room_base
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
cr
=
belle_sip_object_new
(
LinphoneChatRoom
);
cr
->
cr
=
new
LinphonePrivate
::
ChatRoom
(
lc
,
addr
);
if
(
linphone_core_realtime_text_enabled
(
lc
))
cr
->
cr
=
new
LinphonePrivate
::
RealTimeTextChatRoom
(
lc
,
*
L_GET_CPP_PTR_FROM_C_STRUCT
(
addr
,
Address
).
get
());
else
cr
->
cr
=
new
LinphonePrivate
::
BasicChatRoom
(
lc
,
*
L_GET_CPP_PTR_FROM_C_STRUCT
(
addr
,
Address
).
get
());
L_GET_PRIVATE
(
cr
->
cr
)
->
setCBackPointer
(
cr
);
return
cr
;
}
static
LinphoneChatRoom
*
_linphone_core_create_chat_room
(
LinphoneCore
*
lc
,
LinphoneAddress
*
addr
)
{
static
LinphoneChatRoom
*
_linphone_core_create_chat_room
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
cr
=
_linphone_core_create_chat_room_base
(
lc
,
addr
);
lc
->
chatrooms
=
bctbx_list_append
(
lc
->
chatrooms
,
(
void
*
)
cr
);
return
cr
;
...
...
@@ -238,7 +250,7 @@ static LinphoneChatRoom *_linphone_core_get_or_create_chat_room(LinphoneCore *lc
LinphoneChatRoom
*
linphone_core_get_chat_room
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
ret
=
_linphone_core_get_chat_room
(
lc
,
addr
);
if
(
!
ret
)
{
ret
=
_linphone_core_create_chat_room
(
lc
,
linphone_address_clone
(
addr
)
);
ret
=
_linphone_core_create_chat_room
(
lc
,
addr
);
}
return
ret
;
}
...
...
@@ -391,16 +403,20 @@ bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *cr) {
return
cr
->
cr
->
isRemoteComposing
();
}
LinphoneCore
*
linphone_chat_room_get_lc
(
LinphoneChatRoom
*
cr
)
{
LinphoneCore
*
linphone_chat_room_get_lc
(
const
LinphoneChatRoom
*
cr
)
{
return
linphone_chat_room_get_core
(
cr
);
}
LinphoneCore
*
linphone_chat_room_get_core
(
LinphoneChatRoom
*
cr
)
{
LinphoneCore
*
linphone_chat_room_get_core
(
const
LinphoneChatRoom
*
cr
)
{
return
cr
->
cr
->
getCore
();
}
const
LinphoneAddress
*
linphone_chat_room_get_peer_address
(
LinphoneChatRoom
*
cr
)
{
return
cr
->
cr
->
getPeerAddress
();
if
(
cr
->
peerAddressCache
)
{
linphone_address_unref
(
cr
->
peerAddressCache
);
}
cr
->
peerAddressCache
=
linphone_address_new
(
cr
->
cr
->
getPeerAddress
().
asString
().
c_str
());
return
cr
->
peerAddressCache
;
}
LinphoneChatMessage
*
linphone_chat_room_create_message
(
LinphoneChatRoom
*
cr
,
const
char
*
message
)
{
...
...
@@ -599,46 +615,52 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
}
void
linphone_core_real_time_text_received
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
,
uint32_t
character
,
LinphoneCall
*
call
)
{
L_GET_PRIVATE
(
cr
->
cr
)
->
realtimeTextReceived
(
character
,
call
);
if
(
linphone_core_realtime_text_enabled
(
lc
))
L_GET_PRIVATE
(
static_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
*>
(
cr
->
cr
))
->
realtimeTextReceived
(
character
,
call
);
}
uint32_t
linphone_chat_room_get_char
(
const
LinphoneChatRoom
*
cr
)
{
return
cr
->
cr
->
getChar
();
if
(
linphone_core_realtime_text_enabled
(
linphone_chat_room_get_core
(
cr
)))
return
static_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
*>
(
cr
->
cr
)
->
getChar
();
return
0
;
}
LinphoneStatus
linphone_chat_message_put_char
(
LinphoneChatMessage
*
msg
,
uint32_t
character
)
{
LinphoneChatRoom
*
cr
=
linphone_chat_message_get_chat_room
(
msg
);
LinphoneCall
*
call
=
cr
->
cr
->
getCall
();
LinphoneCore
*
lc
=
cr
->
cr
->
getCore
();
const
uint32_t
new_line
=
0x2028
;
const
uint32_t
crlf
=
0x0D0A
;
const
uint32_t
lf
=
0x0A
;
if
(
!
call
||
!
linphone_call_get_stream
(
call
,
LinphoneStreamTypeText
))
{
return
-
1
;
}
if
(
character
==
new_line
||
character
==
crlf
||
character
==
lf
)
{
if
(
lc
&&
lp_config_get_int
(
lc
->
config
,
"misc"
,
"store_rtt_messages"
,
1
)
==
1
)
{
ms_debug
(
"New line sent, forge a message with content %s"
,
msg
->
message
);
msg
->
time
=
ms_time
(
0
);
msg
->
state
=
LinphoneChatMessageStateDisplayed
;
msg
->
dir
=
LinphoneChatMessageOutgoing
;
if
(
msg
->
from
)
linphone_address_unref
(
msg
->
from
);
msg
->
from
=
linphone_address_new
(
linphone_core_get_identity
(
lc
));
msg
->
storage_id
=
linphone_chat_message_store
(
msg
);
ms_free
(
msg
->
message
);
msg
->
message
=
NULL
;
if
(
linphone_core_realtime_text_enabled
(
linphone_chat_room_get_core
(
cr
)))
{
LinphoneCall
*
call
=
static_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
*>
(
cr
->
cr
)
->
getCall
();
LinphoneCore
*
lc
=
static_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
*>
(
cr
->
cr
)
->
getCore
();
const
uint32_t
new_line
=
0x2028
;
const
uint32_t
crlf
=
0x0D0A
;
const
uint32_t
lf
=
0x0A
;
if
(
!
call
||
!
linphone_call_get_stream
(
call
,
LinphoneStreamTypeText
))
{
return
-
1
;
}
}
else
{
char
*
value
=
LinphonePrivate
::
Utils
::
utf8ToChar
(
character
);
msg
->
message
=
ms_strcat_printf
(
msg
->
message
,
value
);
ms_debug
(
"Sent RTT character: %s (%lu), pending text is %s"
,
value
,
(
unsigned
long
)
character
,
msg
->
message
);
delete
value
;
}
text_stream_putchar32
(
reinterpret_cast
<
TextStream
*>
(
linphone_call_get_stream
(
call
,
LinphoneStreamTypeText
)),
character
);
return
0
;
if
(
character
==
new_line
||
character
==
crlf
||
character
==
lf
)
{
if
(
lc
&&
lp_config_get_int
(
lc
->
config
,
"misc"
,
"store_rtt_messages"
,
1
)
==
1
)
{
ms_debug
(
"New line sent, forge a message with content %s"
,
msg
->
message
);
msg
->
time
=
ms_time
(
0
);
msg
->
state
=
LinphoneChatMessageStateDisplayed
;
msg
->
dir
=
LinphoneChatMessageOutgoing
;
if
(
msg
->
from
)
linphone_address_unref
(
msg
->
from
);
msg
->
from
=
linphone_address_new
(
linphone_core_get_identity
(
lc
));
msg
->
storage_id
=
linphone_chat_message_store
(
msg
);
ms_free
(
msg
->
message
);
msg
->
message
=
NULL
;
}
}
else
{
char
*
value
=
LinphonePrivate
::
Utils
::
utf8ToChar
(
character
);
msg
->
message
=
ms_strcat_printf
(
msg
->
message
,
value
);
ms_debug
(
"Sent RTT character: %s (%lu), pending text is %s"
,
value
,
(
unsigned
long
)
character
,
msg
->
message
);
delete
value
;
}
text_stream_putchar32
(
reinterpret_cast
<
TextStream
*>
(
linphone_call_get_stream
(
call
,
LinphoneStreamTypeText
)),
character
);
return
0
;
}
return
-
1
;
}
const
char
*
linphone_chat_message_get_message_id
(
const
LinphoneChatMessage
*
cm
)
{
...
...
@@ -650,7 +672,9 @@ void linphone_chat_room_compose(LinphoneChatRoom *cr) {
}
LinphoneCall
*
linphone_chat_room_get_call
(
const
LinphoneChatRoom
*
room
)
{
return
room
->
cr
->
getCall
();
if
(
linphone_core_realtime_text_enabled
(
linphone_chat_room_get_core
(
room
)))
return
static_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
*>
(
room
->
cr
)
->
getCall
();
return
nullptr
;
}
void
linphone_chat_room_set_call
(
LinphoneChatRoom
*
cr
,
LinphoneCall
*
call
)
{
...
...
@@ -773,7 +797,10 @@ const LinphoneAddress *linphone_chat_message_get_to_address(const LinphoneChatMe
if
(
msg
->
to
)
return
msg
->
to
;
if
(
msg
->
dir
==
LinphoneChatMessageOutgoing
)
{
return
msg
->
chat_room
->
cr
->
getPeerAddress
();
if
(
msg
->
chat_room
->
peerAddressCache
)
linphone_address_unref
(
msg
->
chat_room
->
peerAddressCache
);
msg
->
chat_room
->
peerAddressCache
=
linphone_address_new
(
msg
->
chat_room
->
cr
->
getPeerAddress
().
asString
().
c_str
());
return
msg
->
chat_room
->
peerAddressCache
;
}
return
NULL
;
}
...
...
include/linphone/chat.h
View file @
8063ae02
...
...
@@ -207,12 +207,12 @@ LINPHONE_PUBLIC int linphone_chat_room_get_unread_messages_count(LinphoneChatRoo
* @deprecated use linphone_chat_room_get_core()
* @donotwrap
**/
LINPHONE_PUBLIC
LINPHONE_DEPRECATED
LinphoneCore
*
linphone_chat_room_get_lc
(
LinphoneChatRoom
*
cr
);
LINPHONE_PUBLIC
LINPHONE_DEPRECATED
LinphoneCore
*
linphone_chat_room_get_lc
(
const
LinphoneChatRoom
*
cr
);
/**
* Returns back pointer to #LinphoneCore object.
**/
LINPHONE_PUBLIC
LinphoneCore
*
linphone_chat_room_get_core
(
LinphoneChatRoom
*
cr
);
LINPHONE_PUBLIC
LinphoneCore
*
linphone_chat_room_get_core
(
const
LinphoneChatRoom
*
cr
);
/**
* When realtime text is enabled #linphone_call_params_realtime_text_enabled, #LinphoneCoreIsComposingReceivedCb is call everytime a char is received from peer.
...
...
src/CMakeLists.txt
View file @
8063ae02
...
...
@@ -28,9 +28,13 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
call/call-listener.h
call/call-p.h
call/call.h
chat/basic-chat-room.h
chat/basic-chat-room-p.h
chat/chat-message.h
chat/chat-room-p.h
chat/chat-room.h
chat/client-group-chat-room.h
chat/client-group-chat-room-p.h
chat/cpim/cpim.h
chat/cpim/header/cpim-core-headers.h
chat/cpim/header/cpim-generic-header.h
...
...
@@ -41,6 +45,8 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/cpim/parser/cpim-parser.h
chat/imdn.h
chat/is-composing.h
chat/real-time-text-chat-room.h
chat/real-time-text-chat-room-p.h
conference/conference-listener.h
conference/conference-p.h
conference/conference.h
...
...
@@ -90,8 +96,10 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
c-wrapper/api/c-address.cpp
c-wrapper/api/c-event-log.cpp
call/call.cpp
chat/basic-chat-room.cpp
chat/chat-message.cpp
chat/chat-room.cpp
chat/client-group-chat-room.cpp
chat/cpim/header/cpim-core-headers.cpp
chat/cpim/header/cpim-generic-header.cpp
chat/cpim/header/cpim-header.cpp
...
...
@@ -100,6 +108,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/cpim/parser/cpim-parser.cpp
chat/imdn.cpp
chat/is-composing.cpp
chat/real-time-text-chat-room.cpp
conference/conference.cpp
conference/local-conference.cpp
conference/params/call-session-params.cpp
...
...
src/chat/basic-chat-room-p.h
0 → 100644
View file @
8063ae02
/*
* basic-chat-room-p.h
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BASIC_CHAT_ROOM_P_H_
#define _BASIC_CHAT_ROOM_P_H_
// From coreapi.
#include "private.h"
#include "basic-chat-room.h"
#include "chat/chat-room-p.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
BasicChatRoomPrivate
:
public
ChatRoomPrivate
{
public:
BasicChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
virtual
~
BasicChatRoomPrivate
()
=
default
;
private:
std
::
string
dummyConferenceId
;
L_DECLARE_PUBLIC
(
BasicChatRoom
);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _BASIC_CHAT_ROOM_P_H_
src/chat/basic-chat-room.cpp
0 → 100644
View file @
8063ae02
/*
* basic-chat-room.cpp
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "basic-chat-room-p.h"
#include "logger/logger.h"
// =============================================================================
using
namespace
std
;
LINPHONE_BEGIN_NAMESPACE
BasicChatRoomPrivate
::
BasicChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
,
peerAddress
)
{}
// =============================================================================
BasicChatRoom
::
BasicChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoom
(
*
new
BasicChatRoomPrivate
(
core
,
peerAddress
))
{}
// -----------------------------------------------------------------------------
shared_ptr
<
Participant
>
BasicChatRoom
::
addParticipant
(
const
Address
&
addr
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
lError
()
<<
"addParticipant() is not allowed on a BasicChatRoom"
;
return
nullptr
;
}
void
BasicChatRoom
::
addParticipants
(
const
list
<
Address
>
&
addresses
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
lError
()
<<
"addParticipants() is not allowed on a BasicChatRoom"
;
}
const
string
&
BasicChatRoom
::
getId
()
const
{
L_D
(
const
BasicChatRoom
);
lError
()
<<
"a BasicChatRoom does not have a conference id"
;
return
d
->
dummyConferenceId
;
}
int
BasicChatRoom
::
getNbParticipants
()
const
{
return
1
;
}
list
<
shared_ptr
<
Participant
>>
BasicChatRoom
::
getParticipants
()
const
{
L_D
(
const
BasicChatRoom
);
list
<
shared_ptr
<
Participant
>>
l
;
l
.
push_back
(
make_shared
<
Participant
>
(
d
->
peerAddress
));
return
l
;
}
void
BasicChatRoom
::
removeParticipant
(
const
shared_ptr
<
Participant
>
participant
)
{
lError
()
<<
"removeParticipant() is not allowed on a BasicChatRoom"
;
}
void
BasicChatRoom
::
removeParticipants
(
const
list
<
shared_ptr
<
Participant
>>
participants
)
{
lError
()
<<
"removeParticipants() is not allowed on a BasicChatRoom"
;
}
LINPHONE_END_NAMESPACE
src/chat/basic-chat-room.h
0 → 100644
View file @
8063ae02
/*
* basic-chat-room.h
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BASIC_CHAT_ROOM_H_
#define _BASIC_CHAT_ROOM_H_
// From coreapi
#include "private.h"
#include "chat/chat-room.h"
#include "conference/conference-interface.h"
#include "linphone/types.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
BasicChatRoomPrivate
;
class
BasicChatRoom
:
public
ChatRoom
{
public:
BasicChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
virtual
~
BasicChatRoom
()
=
default
;
/* ConferenceInterface */
std
::
shared_ptr
<
Participant
>
addParticipant
(
const
Address
&
addr
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
const
std
::
string
&
getId
()
const
;
int
getNbParticipants
()
const
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
;
void
removeParticipant
(
const
std
::
shared_ptr
<
Participant
>
participant
);
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
participants
);
private:
L_DECLARE_PRIVATE
(
BasicChatRoom
);
L_DISABLE_COPY
(
BasicChatRoom
);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _BASIC_CHAT_ROOM_H_
src/chat/chat-room-p.h
View file @
8063ae02
...
...
@@ -33,7 +33,7 @@ LINPHONE_BEGIN_NAMESPACE
class
ChatRoomPrivate
:
public
ObjectPrivate
,
public
IsComposingListener
{
public:
ChatRoomPrivate
(
LinphoneCore
*
core
);
ChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
virtual
~
ChatRoomPrivate
();
private:
...
...
@@ -62,7 +62,7 @@ public:
this
->
call
=
call
;
}
pr
ivate
:
pr
otected
:
void
sendIsComposingNotification
();
int
createChatMessageFromDb
(
int
argc
,
char
**
argv
,
char
**
colName
);
...
...
@@ -78,7 +78,7 @@ public:
LinphoneReason
messageReceived
(
SalOp
*
op
,
const
SalMessage
*
msg
);
void
realtimeTextReceived
(
uint32_t
character
,
LinphoneCall
*
call
);
pr
ivate
:
pr
otected
:
void
chatMessageReceived
(
LinphoneChatMessage
*
msg
);
void
imdnReceived
(
const
std
::
string
&
text
);
void
isComposingReceived
(
const
std
::
string
&
text
);
...
...
@@ -92,8 +92,7 @@ public:
LinphoneChatRoom
*
cBackPointer
=
nullptr
;
LinphoneCore
*
core
=
nullptr
;
LinphoneCall
*
call
=
nullptr
;
LinphoneAddress
*
peerAddress
=
nullptr
;
std
::
string
peer
;
Address
peerAddress
;
int
unreadCount
=
-
1
;
bool
isComposing
=
false
;
bool
remoteIsComposing
=
false
;
...
...
src/chat/chat-room.cpp
View file @
8063ae02
This diff is collapsed.
Click to expand it.
src/chat/chat-room.h
View file @
8063ae02
...
...
@@ -24,7 +24,9 @@
#include <list>
#include "address/address.h"
#include "object/object.h"
#include "conference/conference-interface.h"
#include "linphone/types.h"
...
...
@@ -34,9 +36,9 @@ LINPHONE_BEGIN_NAMESPACE
class
ChatRoomPrivate
;
class
ChatRoom
:
public
Object
{
class
ChatRoom
:
public
Object
,
public
ConferenceInterface
{
public:
ChatRoom
(
LinphoneCore
*
core
,
Linphone
Address
*
peerAddress
);
ChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
virtual
~
ChatRoom
()
=
default
;
void
compose
();
...
...
@@ -46,19 +48,20 @@ public:
void
deleteMessage
(
LinphoneChatMessage
*
msg
);
LinphoneChatMessage
*
findMessage
(
const
std
::
string
&
messageId
);
LinphoneChatMessage
*
findMessageWithDirection
(
const
std
::
string
&
messageId
,
LinphoneChatMessageDir
direction
);
uint32_t
getChar
()
const
;
std
::
list
<
LinphoneChatMessage
*>
getHistory
(
int
nbMessages
);
int
getHistorySize
();
std
::
list
<
LinphoneChatMessage
*>
getHistoryRange
(
int
startm
,
int
endm
);
int
getUnreadMessagesCount
();
bool
isRemoteComposing
()
const
;
void
markAsRead
();
void
sendMessage
(
LinphoneChatMessage
*
msg
);
virtual
void
sendMessage
(
LinphoneChatMessage
*
msg
);
LinphoneCall
*
getCall
()
const
;
LinphoneCore
*
getCore
()
const
;
const
LinphoneAddress
*
getPeerAddress
()
const
;
const
Address
&
getPeerAddress
()
const
;
protected:
explicit
ChatRoom
(
ChatRoomPrivate
&
p
);
private:
L_DECLARE_PRIVATE
(
ChatRoom
);
...
...
src/chat/client-group-chat-room-p.h
0 → 100644
View file @
8063ae02
/*
* client-group-chat-room-p.h
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CLIENT_GROUP_CHAT_ROOM_P_H_
#define _CLIENT_GROUP_CHAT_ROOM_P_H_
// From coreapi.
#include "private.h"
#include "client-group-chat-room.h"
#include "chat/chat-room-p.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
ClientGroupChatRoomPrivate
:
public
ChatRoomPrivate
{
public:
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
virtual
~
ClientGroupChatRoomPrivate
()
=
default
;
private:
L_DECLARE_PUBLIC
(
ClientGroupChatRoom
);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CLIENT_GROUP_CHAT_ROOM_P_H_
src/chat/client-group-chat-room.cpp
0 → 100644
View file @
8063ae02
/*
* client-group-chat-room.cpp
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "client-group-chat-room-p.h"
#include "logger/logger.h"
// =============================================================================
using
namespace
std
;
LINPHONE_BEGIN_NAMESPACE
ClientGroupChatRoomPrivate
::
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
,
peerAddress
)
{}
LINPHONE_END_NAMESPACE
src/chat/client-group-chat-room.h
0 → 100644
View file @
8063ae02
/*
* client-group-chat-room.h
* Copyright (C) 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CLIENT_GROUP_CHAT_ROOM_H_
#define _CLIENT_GROUP_CHAT_ROOM_H_
// From coreapi
#include "private.h"
#include "chat/chat-room.h"
#include "linphone/types.h"