Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
935e4296
Commit
935e4296
authored
Oct 11, 2017
by
Ronan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(Core): clean some dirty code...
parent
da407f79
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
133 additions
and
190 deletions
+133
-190
coreapi/authentication.c
coreapi/authentication.c
+1
-3
coreapi/bellesip_sal/sal_op_impl.c
coreapi/bellesip_sal/sal_op_impl.c
+4
-7
coreapi/carddav.c
coreapi/carddav.c
+30
-32
coreapi/chat.c
coreapi/chat.c
+1
-2
coreapi/friend.c
coreapi/friend.c
+1
-0
coreapi/friendlist.c
coreapi/friendlist.c
+8
-4
coreapi/info.c
coreapi/info.c
+5
-3
coreapi/linphonecore.c
coreapi/linphonecore.c
+4
-6
coreapi/vcard.cc
coreapi/vcard.cc
+1
-2
include/linphone/api/c-chat-message.h
include/linphone/api/c-chat-message.h
+13
-13
src/c-wrapper/api/c-chat-message.cpp
src/c-wrapper/api/c-chat-message.cpp
+18
-20
src/chat/chat-message.cpp
src/chat/chat-message.cpp
+5
-31
src/chat/chat-message.h
src/chat/chat-message.h
+21
-52
src/chat/chat-room.cpp
src/chat/chat-room.cpp
+12
-12
src/chat/real-time-text-chat-room.cpp
src/chat/real-time-text-chat-room.cpp
+7
-1
src/sal/sal.cpp
src/sal/sal.cpp
+2
-2
No files found.
coreapi/authentication.c
View file @
935e4296
...
...
@@ -28,8 +28,6 @@
#include "c-wrapper/c-wrapper.h"
using
namespace
LinphonePrivate
;
static
void
_linphone_auth_info_uninit
(
LinphoneAuthInfo
*
obj
);
static
void
_linphone_auth_info_copy
(
LinphoneAuthInfo
*
dst
,
const
LinphoneAuthInfo
*
src
);
...
...
@@ -438,7 +436,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
/* retry pending authentication operations */
for
(
l
=
elem
=
lc
->
sal
->
get_pending_auths
();
elem
!=
NULL
;
elem
=
elem
->
next
){
SalOp
*
op
=
(
SalOp
*
)
elem
->
data
;
LinphonePrivate
::
SalOp
*
op
=
static_cast
<
LinphonePrivate
::
SalOp
*
>
(
elem
->
data
)
;
LinphoneAuthInfo
*
ai
;
const
SalAuthInfo
*
req_sai
=
op
->
get_auth_requested
();
ai
=
(
LinphoneAuthInfo
*
)
_linphone_core_find_auth_info
(
lc
,
req_sai
->
realm
,
req_sai
->
username
,
req_sai
->
domain
,
FALSE
);
...
...
coreapi/bellesip_sal/sal_op_impl.c
View file @
935e4296
...
...
@@ -19,8 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sal_impl.h"
#include "sal/sal.h"
using
namespace
LinphonePrivate
;
SalReason
_sal_reason_from_sip_code
(
int
code
)
{
if
(
code
>=
100
&&
code
<
300
)
return
SalReasonNone
;
...
...
@@ -82,13 +80,12 @@ SalReason _sal_reason_from_sip_code(int code) {
}
const
SalErrorInfo
*
sal_error_info_none
(
void
){
static
SalErrorInfo
none
=
{
static
const
SalErrorInfo
none
=
{
SalReasonNone
,
(
char
*
)
"Ok"
,
200
,
NULL
,
NULL
,
NULL
};
return
&
none
;
}
...
...
@@ -122,7 +119,7 @@ void sal_error_info_set(SalErrorInfo *ei, SalReason reason, const char *protocol
else
{
ei
->
reason
=
reason
;
if
(
code
==
0
)
{
code
=
to_sip_code
(
reason
);
code
=
LinphonePrivate
::
to_sip_code
(
reason
);
}
}
ei
->
protocol_code
=
code
;
...
...
@@ -134,4 +131,4 @@ void sal_error_info_set(SalErrorInfo *ei, SalReason reason, const char *protocol
ei
->
full_string
=
ms_strdup_printf
(
"%s %s"
,
ei
->
status_string
,
ei
->
warnings
);
else
ei
->
full_string
=
ms_strdup
(
ei
->
status_string
);
}
}
\ No newline at end of file
}
coreapi/carddav.c
View file @
935e4296
...
...
@@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/core.h"
#include "private.h"
using
namespace
LinphonePrivate
;
LinphoneCardDavContext
*
linphone_carddav_context_new
(
LinphoneFriendList
*
lfl
)
{
LinphoneCardDavContext
*
carddav_context
=
NULL
;
...
...
@@ -69,7 +67,7 @@ static void linphone_carddav_client_to_server_sync_done(LinphoneCardDavContext *
if
(
!
success
)
{
ms_error
(
"[carddav] CardDAV client to server sync failure: %s"
,
msg
);
}
if
(
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
success
,
msg
);
}
...
...
@@ -82,7 +80,7 @@ static void linphone_carddav_server_to_client_sync_done(LinphoneCardDavContext *
}
else
{
ms_error
(
"[carddav] CardDAV server to client sync failure: %s"
,
msg
);
}
if
(
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
success
,
msg
);
}
...
...
@@ -120,7 +118,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li
LinphoneVcard
*
lvc
=
linphone_vcard_context_get_vcard_from_buffer
(
cdc
->
friend_list
->
lc
->
vcard_context
,
vCard
->
vcard
);
LinphoneFriend
*
lf
=
NULL
;
bctbx_list_t
*
local_friend
=
NULL
;
if
(
lvc
)
{
// Compute downloaded vCards' URL and save it (+ eTag)
char
*
vCard_name
=
strrchr
(
vCard
->
url
,
'/'
);
...
...
@@ -134,7 +132,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li
linphone_vcard_unref
(
lvc
);
/*ref is now owned by friend*/
if
(
lf
)
{
local_friend
=
bctbx_list_find_custom
(
friends
,
(
int
(
*
)(
const
void
*
,
const
void
*
))
find_matching_friend
,
lf
);
if
(
local_friend
)
{
LinphoneFriend
*
lf2
=
(
LinphoneFriend
*
)
local_friend
->
data
;
lf
->
storage_id
=
lf2
->
storage_id
;
...
...
@@ -144,7 +142,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li
lf
->
presence_received
=
lf2
->
presence_received
;
lf
->
lc
=
lf2
->
lc
;
lf
->
friend_list
=
lf2
->
friend_list
;
if
(
cdc
->
contact_updated_cb
)
{
ms_debug
(
"Contact updated: %s"
,
linphone_friend_get_name
(
lf
));
cdc
->
contact_updated_cb
(
cdc
,
lf
,
lf2
);
...
...
@@ -224,7 +222,7 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, bctbx_l
bctbx_list_t
*
friends
=
cdc
->
friend_list
->
friends
;
bctbx_list_t
*
friends_to_remove
=
NULL
;
bctbx_list_t
*
temp_list
=
NULL
;
while
(
friends
)
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
friends
->
data
;
if
(
lf
)
{
...
...
@@ -260,7 +258,7 @@ static void linphone_carddav_vcards_fetched(LinphoneCardDavContext *cdc, bctbx_l
friends_to_remove
=
bctbx_list_next
(
friends_to_remove
);
}
temp_list
=
bctbx_list_free_with_data
(
temp_list
,
(
void
(
*
)(
void
*
))
linphone_friend_unref
);
linphone_carddav_pull_vcards
(
cdc
,
vCards
);
bctbx_list_free_with_data
(
vCards
,
(
void
(
*
)(
void
*
))
linphone_carddav_response_free
);
}
...
...
@@ -340,22 +338,22 @@ static void linphone_carddav_query_free(LinphoneCardDavQuery *query) {
if
(
!
query
)
{
return
;
}
if
(
query
->
http_request_listener
)
{
belle_sip_object_unref
(
query
->
http_request_listener
);
query
->
http_request_listener
=
NULL
;
}
// Context will be freed later (in sync_done)
query
->
context
=
NULL
;
if
(
query
->
url
)
{
ms_free
(
query
->
url
);
}
if
(
query
->
body
)
{
ms_free
(
query
->
body
);
}
ms_free
(
query
);
}
...
...
@@ -380,7 +378,7 @@ static bool_t is_query_client_to_server_sync(LinphoneCardDavQuery *query) {
static
void
process_response_from_carddav_request
(
void
*
data
,
const
belle_http_response_event_t
*
event
)
{
LinphoneCardDavQuery
*
query
=
(
LinphoneCardDavQuery
*
)
data
;
if
(
event
->
response
)
{
int
code
=
belle_http_response_get_status_code
(
event
->
response
);
if
(
code
==
207
||
code
==
200
||
code
==
201
||
code
==
204
)
{
...
...
@@ -471,7 +469,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
const
char
*
realm
=
belle_sip_auth_event_get_realm
(
event
);
belle_generic_uri_t
*
uri
=
belle_generic_uri_parse
(
query
->
url
);
const
char
*
domain
=
belle_generic_uri_get_host
(
uri
);
if
(
cdc
->
auth_info
)
{
belle_sip_auth_event_set_username
(
event
,
cdc
->
auth_info
->
username
);
belle_sip_auth_event_set_passwd
(
event
,
cdc
->
auth_info
->
passwd
);
...
...
@@ -479,7 +477,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
}
else
{
LinphoneCore
*
lc
=
cdc
->
friend_list
->
lc
;
const
bctbx_list_t
*
auth_infos
=
linphone_core_get_auth_info_list
(
lc
);
ms_debug
(
"Looking for auth info for domain %s and realm %s"
,
domain
,
realm
);
while
(
auth_infos
)
{
LinphoneAuthInfo
*
auth_info
=
(
LinphoneAuthInfo
*
)
auth_infos
->
data
;
...
...
@@ -494,7 +492,7 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
}
auth_infos
=
bctbx_list_next
(
auth_infos
);
}
if
(
!
auth_infos
)
{
ms_error
(
"[carddav] Authentication requested during CardDAV request sending, and username/password weren't provided"
);
if
(
is_query_client_to_server_sync
(
query
))
{
...
...
@@ -525,7 +523,7 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
return
;
}
req
=
belle_http_request_create
(
query
->
method
,
uri
,
belle_sip_header_content_type_create
(
"application"
,
"xml; charset=utf-8"
),
NULL
);
if
(
!
req
)
{
if
(
cdc
&&
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
FALSE
,
"Could not create belle_http_request_t"
);
...
...
@@ -535,7 +533,7 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
linphone_carddav_query_free
(
query
);
return
;
}
ua
=
ms_strdup_printf
(
"%s/%s"
,
linphone_core_get_user_agent
(
cdc
->
friend_list
->
lc
),
linphone_core_get_version
());
belle_sip_message_add_header
((
belle_sip_message_t
*
)
req
,
belle_sip_header_create
(
"User-Agent"
,
ua
));
ms_free
(
ua
);
...
...
@@ -546,12 +544,12 @@ static void linphone_carddav_send_query(LinphoneCardDavQuery *query) {
}
else
if
(
strcmp
(
query
->
method
,
"PUT"
))
{
belle_sip_message_add_header
((
belle_sip_message_t
*
)
req
,
belle_sip_header_create
(
"If-None-Match"
,
"*"
));
}
if
(
query
->
body
)
{
bh
=
belle_sip_memory_body_handler_new_copy_from_buffer
(
query
->
body
,
strlen
(
query
->
body
),
NULL
,
NULL
);
belle_sip_message_set_body_handler
(
BELLE_SIP_MESSAGE
(
req
),
bh
?
BELLE_SIP_BODY_HANDLER
(
bh
)
:
NULL
);
}
cbs
.
process_response
=
process_response_from_carddav_request
;
cbs
.
process_io_error
=
process_io_error_from_carddav_request
;
cbs
.
process_auth_requested
=
process_auth_requested_from_carddav_request
;
...
...
@@ -575,7 +573,7 @@ static char* generate_url_from_server_address_and_uid(const char *server_url) {
char
*
result
=
NULL
;
if
(
server_url
)
{
char
*
uuid
=
reinterpret_cast
<
char
*>
(
ms_malloc
(
64
));
if
(
Sal
::
generate_uuid
(
uuid
,
64
)
==
0
)
{
if
(
LinphonePrivate
::
Sal
::
generate_uuid
(
uuid
,
64
)
==
0
)
{
char
*
url
=
reinterpret_cast
<
char
*>
(
ms_malloc
(
300
));
snprintf
(
url
,
300
,
"%s/linphone-%s.vcf"
,
server_url
,
uuid
);
ms_debug
(
"Generated url is %s"
,
url
);
...
...
@@ -594,7 +592,7 @@ void linphone_carddav_put_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *lf)
if
(
!
linphone_vcard_get_uid
(
lvc
))
{
linphone_vcard_generate_unique_id
(
lvc
);
}
if
(
!
linphone_vcard_get_url
(
lvc
))
{
char
*
url
=
generate_url_from_server_address_and_uid
(
cdc
->
friend_list
->
uri
);
if
(
url
)
{
...
...
@@ -609,7 +607,7 @@ void linphone_carddav_put_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *lf)
return
;
}
}
query
=
linphone_carddav_create_put_query
(
cdc
,
lvc
);
query
->
user_data
=
linphone_friend_ref
(
lf
);
linphone_carddav_send_query
(
query
);
...
...
@@ -620,11 +618,11 @@ void linphone_carddav_put_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *lf)
}
else
{
msg
=
"Unknown error"
;
}
if
(
msg
)
{
ms_error
(
"[carddav] %s"
,
msg
);
}
if
(
cdc
&&
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
FALSE
,
msg
);
}
...
...
@@ -647,7 +645,7 @@ void linphone_carddav_delete_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
if
(
lvc
&&
linphone_vcard_get_uid
(
lvc
)
&&
linphone_vcard_get_etag
(
lvc
))
{
LinphoneCardDavQuery
*
query
=
NULL
;
if
(
!
linphone_vcard_get_url
(
lvc
))
{
char
*
url
=
generate_url_from_server_address_and_uid
(
cdc
->
friend_list
->
uri
);
if
(
url
)
{
...
...
@@ -662,7 +660,7 @@ void linphone_carddav_delete_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *
return
;
}
}
query
=
linphone_carddav_create_delete_query
(
cdc
,
lvc
);
linphone_carddav_send_query
(
query
);
}
else
{
...
...
@@ -674,11 +672,11 @@ void linphone_carddav_delete_vcard(LinphoneCardDavContext *cdc, LinphoneFriend *
}
else
if
(
!
linphone_vcard_get_etag
(
lvc
))
{
msg
=
"LinphoneVcard doesn't have an eTag"
;
}
if
(
msg
)
{
ms_error
(
"[carddav] %s"
,
msg
);
}
if
(
cdc
&&
cdc
->
sync_done_cb
)
{
cdc
->
sync_done_cb
(
cdc
,
FALSE
,
msg
);
}
...
...
@@ -739,7 +737,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
LinphoneCardDavQuery
*
query
=
(
LinphoneCardDavQuery
*
)
ms_new0
(
LinphoneCardDavQuery
,
1
);
char
*
body
=
(
char
*
)
ms_malloc
((
bctbx_list_size
(
vcards
)
+
1
)
*
300
*
sizeof
(
char
));
bctbx_list_t
*
iterator
=
vcards
;
query
->
context
=
cdc
;
query
->
depth
=
"1"
;
query
->
ifmatch
=
NULL
;
...
...
@@ -760,7 +758,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
strcat
(
body
,
"</card:addressbook-multiget>"
);
query
->
body
=
ms_strdup
(
body
);
ms_free
(
body
);
return
query
;
}
...
...
coreapi/chat.c
View file @
935e4296
...
...
@@ -43,7 +43,6 @@
#include "content/content-type.h"
using
namespace
std
;
using
namespace
LinphonePrivate
;
void
linphone_core_disable_chat
(
LinphoneCore
*
lc
,
LinphoneReason
deny_reason
)
{
lc
->
chat_deny_code
=
deny_reason
;
...
...
@@ -156,7 +155,7 @@ LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const c
return
_linphone_core_get_or_create_chat_room
(
lc
,
to
);
}
int
linphone_core_message_received
(
LinphoneCore
*
lc
,
SalOp
*
op
,
const
SalMessage
*
sal_msg
)
{
int
linphone_core_message_received
(
LinphoneCore
*
lc
,
LinphonePrivate
::
SalOp
*
op
,
const
SalMessage
*
sal_msg
)
{
LinphoneAddress
*
addr
=
linphone_address_new
(
sal_msg
->
from
);
linphone_address_clean
(
addr
);
LinphoneChatRoom
*
cr
=
linphone_core_get_chat_room
(
lc
,
addr
);
...
...
coreapi/friend.c
View file @
935e4296
...
...
@@ -43,6 +43,7 @@
#include "c-wrapper/c-wrapper.h"
using
namespace
std
;
using
namespace
LinphonePrivate
;
const
char
*
linphone_online_status_to_string
(
LinphoneOnlineStatus
ss
){
...
...
coreapi/friendlist.c
View file @
935e4296
...
...
@@ -23,8 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c-wrapper/c-wrapper.h"
using
namespace
LinphonePrivate
;
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES
(
LinphoneFriendListCbs
);
BELLE_SIP_INSTANCIATE_VPTR
(
LinphoneFriendListCbs
,
belle_sip_object_t
,
...
...
@@ -796,7 +794,10 @@ LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFrien
return
NULL
;
}
LinphoneFriend
*
linphone_friend_list_find_friend_by_inc_subscribe
(
const
LinphoneFriendList
*
list
,
SalOp
*
op
)
{
LinphoneFriend
*
linphone_friend_list_find_friend_by_inc_subscribe
(
const
LinphoneFriendList
*
list
,
LinphonePrivate
::
SalOp
*
op
)
{
const
bctbx_list_t
*
elem
;
for
(
elem
=
list
->
friends
;
elem
!=
NULL
;
elem
=
bctbx_list_next
(
elem
))
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
bctbx_list_get_data
(
elem
);
...
...
@@ -805,7 +806,10 @@ LinphoneFriend * linphone_friend_list_find_friend_by_inc_subscribe(const Linphon
return
NULL
;
}
LinphoneFriend
*
linphone_friend_list_find_friend_by_out_subscribe
(
const
LinphoneFriendList
*
list
,
SalOp
*
op
)
{
LinphoneFriend
*
linphone_friend_list_find_friend_by_out_subscribe
(
const
LinphoneFriendList
*
list
,
LinphonePrivate
::
SalOp
*
op
)
{
const
bctbx_list_t
*
elem
;
for
(
elem
=
list
->
friends
;
elem
!=
NULL
;
elem
=
bctbx_list_next
(
elem
))
{
LinphoneFriend
*
lf
=
(
LinphoneFriend
*
)
bctbx_list_get_data
(
elem
);
...
...
coreapi/info.c
View file @
935e4296
...
...
@@ -28,8 +28,6 @@
#include "c-wrapper/c-wrapper.h"
using
namespace
LinphonePrivate
;
struct
_LinphoneInfoMessage
{
belle_sip_object_t
base
;
LinphoneContent
*
content
;
...
...
@@ -98,7 +96,11 @@ SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *i
return
im
->
headers
;
}
void
linphone_core_notify_info_message
(
LinphoneCore
*
lc
,
SalOp
*
op
,
SalBodyHandler
*
body_handler
){
void
linphone_core_notify_info_message
(
LinphoneCore
*
lc
,
LinphonePrivate
::
SalOp
*
op
,
SalBodyHandler
*
body_handler
)
{
LinphoneCall
*
call
=
(
LinphoneCall
*
)
op
->
get_user_pointer
();
if
(
call
){
LinphoneInfoMessage
*
info
=
linphone_core_create_info_message
(
lc
);
...
...
coreapi/linphonecore.c
View file @
935e4296
...
...
@@ -130,10 +130,6 @@ void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName);
#include "enum.h"
#include "contact_providers_priv.h"
using
namespace
LinphonePrivate
;
const
char
*
linphone_core_get_nat_address_resolved
(
LinphoneCore
*
lc
);
static
void
toggle_video_preview
(
LinphoneCore
*
lc
,
bool_t
val
);
...
...
@@ -147,6 +143,8 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val);
#define HOLD_MUSIC_WAV "toy-mono.wav"
#define HOLD_MUSIC_MKV "dont_wait_too_long.mkv"
using
namespace
LinphonePrivate
;
extern
Sal
::
Callbacks
linphone_sal_callbacks
;
...
...
@@ -3454,7 +3452,7 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
void
linphone_configure_op_with_proxy
(
LinphoneCore
*
lc
,
SalOp
*
op
,
const
LinphoneAddress
*
dest
,
SalCustomHeader
*
headers
,
bool_t
with_contact
,
LinphoneProxyConfig
*
proxy
){
bctbx_list_t
*
routes
=
NULL
;
const
char
*
identity
;
if
(
proxy
){
identity
=
linphone_proxy_config_get_identity
(
proxy
);
if
(
linphone_proxy_config_get_privacy
(
proxy
)
!=
LinphonePrivacyDefault
)
{
...
...
@@ -3479,7 +3477,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
op
->
set_to
(
addr
);
ms_free
(
addr
);
}
op
->
set_from
(
identity
);
op
->
set_sent_custom_header
(
headers
);
op
->
set_realm
(
linphone_proxy_config_get_realm
(
proxy
));
...
...
coreapi/vcard.cc
View file @
935e4296
...
...
@@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define VCARD_MD5_HASH_SIZE 16
using
namespace
std
;
using
namespace
LinphonePrivate
;
struct
_LinphoneVcardContext
{
shared_ptr
<
belcard
::
BelCardParser
>
parser
;
...
...
@@ -368,7 +367,7 @@ bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
if
(
linphone_vcard_get_uid
(
vCard
))
{
return
FALSE
;
}
if
(
Sal
::
generate_uuid
(
uuid
,
sizeof
(
uuid
))
==
0
)
{
if
(
LinphonePrivate
::
Sal
::
generate_uuid
(
uuid
,
sizeof
(
uuid
))
==
0
)
{
char
vcard_uuid
[
sizeof
(
uuid
)
+
4
];
snprintf
(
vcard_uuid
,
sizeof
(
vcard_uuid
),
"urn:%s"
,
uuid
);
linphone_vcard_set_uid
(
vCard
,
vcard_uuid
);
...
...
include/linphone/api/c-chat-message.h
View file @
935e4296
...
...
@@ -19,7 +19,7 @@
#ifndef _C_CHAT_MESSAGE_H_
#define _C_CHAT_MESSAGE_H_
#include "linphone/api/c-types.h"
#include "linphone/api/c-chat-message-cbs.h"
...
...
@@ -38,13 +38,13 @@ typedef enum _LinphoneChatMessageDir{
LinphoneChatMessageIncoming
,
LinphoneChatMessageOutgoing
}
LinphoneChatMessageDir
;
// =============================================================================
#ifdef __cplusplus
extern
"C"
{
#endif // ifdef __cplusplus
/**
* @addtogroup chatmessage
* @{
...
...
@@ -94,6 +94,13 @@ LINPHONE_PUBLIC time_t linphone_chat_message_get_time(const LinphoneChatMessage*
**/
LINPHONE_PUBLIC
bool_t
linphone_chat_message_is_outgoing
(
LinphoneChatMessage
*
msg
);
/**
* Get origin of the message
* @param[in] message #LinphoneChatMessage obj
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_from_address
(
LinphoneChatMessage
*
msg
);
/**
* Set origin of the message
* @param[in] message #LinphoneChatMessage obj
...
...
@@ -102,11 +109,11 @@ LINPHONE_PUBLIC bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage* ms
LINPHONE_PUBLIC
void
linphone_chat_message_set_from_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
from
);
/**
* Get
origi
n of the message
* Get
destinatio
n of the message
* @param[in] message #LinphoneChatMessage obj
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_
from
_address
(
LinphoneChatMessage
*
msg
);
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_
to
_address
(
LinphoneChatMessage
*
msg
);
/**
* Set destination of the message
...
...
@@ -115,13 +122,6 @@ LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_message_get_from_address(Li
*/
LINPHONE_PUBLIC
void
linphone_chat_message_set_to_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
addr
);
/**
* Get destination of the message
* @param[in] message #LinphoneChatMessage obj
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_to_address
(
LinphoneChatMessage
*
msg
);
/**
* Get the content type of a chat message.
* @param[in] message LinphoneChatMessage object
...
...
src/c-wrapper/api/c-chat-message.cpp
View file @
935e4296
...
...
@@ -35,7 +35,6 @@
// =============================================================================
using
namespace
std
;
using
namespace
LinphonePrivate
;
static
void
_linphone_chat_message_constructor
(
LinphoneChatMessage
*
msg
);
static
void
_linphone_chat_message_destructor
(
LinphoneChatMessage
*
msg
);
...
...
@@ -57,9 +56,9 @@ static void _linphone_chat_message_constructor (LinphoneChatMessage *msg) {
static
void
_linphone_chat_message_destructor
(
LinphoneChatMessage
*
msg
)
{
linphone_chat_message_cbs_unref
(
msg
->
cbs
);
msg
->
cbs
=
nullptr
;
if
(
msg
->
from
)
if
(
msg
->
from
)
linphone_address_unref
(
msg
->
from
);
if
(
msg
->
to
)
if
(
msg
->
to
)
linphone_address_unref
(
msg
->
to
);
if
(
msg
->
contentTypeCache
)
ms_free
(
msg
->
contentTypeCache
);
...
...
@@ -123,7 +122,7 @@ void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secur
}
bool_t
linphone_chat_message_is_outgoing
(
LinphoneChatMessage
*
msg
)
{
return
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
is
Outgoing
()
;
return
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
getDirection
()
==
LinphonePrivate
::
ChatMessage
::
Direction
::
Outgoing
;
}
LinphoneChatMessageDir
linphone_chat_message_get_direction
(
const
LinphoneChatMessage
*
msg
)
{
...
...
@@ -151,11 +150,11 @@ void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessa
}
const
char
*
linphone_chat_message_get_message_id
(
const
LinphoneChatMessage
*
msg
)
{
return
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
getId
().
c_str
();
return
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
getI
mdnMessageI
d
().
c_str
();
}
void
linphone_chat_message_set_message_id
(
LinphoneChatMessage
*
msg
,
char
*
id
)
{
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
setId
(
L_C_TO_STRING
(
id
));
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
setI
mdnMessageI
d
(
L_C_TO_STRING
(
id
));
}
void
linphone_chat_message_set_storage_id
(
LinphoneChatMessage
*
msg
,
unsigned
int
id
)
{
...
...
@@ -174,12 +173,6 @@ void linphone_chat_message_set_appdata(LinphoneChatMessage *msg, const char *dat
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
setAppdata
(
L_C_TO_STRING
(
data
));
}
void
linphone_chat_message_set_from_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
from
)
{
LinphonePrivate
::
Address
addr
;
if
(
from
)
addr
=
LinphonePrivate
::
Address
(
linphone_address_as_string
(
from
));
else
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
setFromAddress
(
addr
);
}
const
LinphoneAddress
*
linphone_chat_message_get_from_address
(
LinphoneChatMessage
*
msg
)
{
if
(
msg
->
from
)
linphone_address_unref
(
msg
->
from
);
...
...
@@ -187,10 +180,10 @@ const LinphoneAddress *linphone_chat_message_get_from_address(LinphoneChatMessag
return
msg
->
from
;
}
void
linphone_chat_message_set_
to
_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
to
)
{
void
linphone_chat_message_set_
from
_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
from
)
{
LinphonePrivate
::
Address
addr
;
if
(
to
)
addr
=
LinphonePrivate
::
Address
(
linphone_address_as_string
(
to
));
else
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
set
To
Address
(
addr
);
if
(
from
)
addr
=
LinphonePrivate
::
Address
(
linphone_address_as_string
(
from
));
else
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
set
From
Address
(
addr
);
}
const
LinphoneAddress
*
linphone_chat_message_get_to_address
(
LinphoneChatMessage
*
msg
)
{
...
...
@@ -200,6 +193,12 @@ const LinphoneAddress *linphone_chat_message_get_to_address(LinphoneChatMessage
return
msg
->
to
;
}
void
linphone_chat_message_set_to_address
(
LinphoneChatMessage
*
msg
,
const
LinphoneAddress
*
to
)
{
LinphonePrivate
::
Address
addr
;
if
(
to
)
addr
=
LinphonePrivate
::
Address
(
linphone_address_as_string
(
to
));
else
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
setToAddress
(
addr
);
}
const
char
*
linphone_chat_message_get_file_transfer_filepath
(
LinphoneChatMessage
*
msg
)
{
return
L_STRING_TO_C
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
getFileTransferFilepath
());
}
...
...
@@ -216,11 +215,11 @@ void linphone_chat_message_set_http_request(LinphoneChatMessage *msg, belle_http
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
setHttpRequest
(
request
);
}
SalOp
*
linphone_chat_message_get_sal_op
(
const
LinphoneChatMessage
*
msg
)
{
LinphonePrivate
::
SalOp
*
linphone_chat_message_get_sal_op
(
const
LinphoneChatMessage
*
msg
)
{
return
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
getSalOp
();
}
void
linphone_chat_message_set_sal_op
(
LinphoneChatMessage
*
msg
,
SalOp
*
op
)
{
void
linphone_chat_message_set_sal_op
(
LinphoneChatMessage
*
msg
,
LinphonePrivate
::
SalOp
*
op
)
{
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
setSalOp
(
op
);
}
...
...
@@ -330,7 +329,7 @@ const char * linphone_chat_message_get_content_type(LinphoneChatMessage *msg) {
}
void
linphone_chat_message_set_content_type
(
LinphoneChatMessage
*
msg
,
const
char
*
content_type
)
{
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
setContentType
(
ContentType
(
L_C_TO_STRING
(
content_type
)));
L_GET_PRIVATE_FROM_C_OBJECT
(
msg
)
->
setContentType
(
LinphonePrivate
::
ContentType
(
L_C_TO_STRING
(
content_type
)));
}
const
char
*
linphone_chat_message_get_text
(
LinphoneChatMessage
*
msg
)
{
...
...
@@ -359,9 +358,8 @@ const LinphoneAddress *linphone_chat_message_get_peer_address(LinphoneChatMessag
}
const
LinphoneAddress
*
linphone_chat_message_get_local_address
(
LinphoneChatMessage
*
msg
)
{
if
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
is
Outgoing
())
{
if
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
msg
)
->
getDirection
()
==
LinphonePrivate
::
ChatMessage
::
Direction
::
Outgoing
)
return
linphone_chat_message_get_from_address
(
msg
);
}
return
linphone_chat_message_get_to_address
(
msg
);
}
...
...
src/chat/chat-message.cpp
View file @
935e4296
...
...
@@ -1100,7 +1100,7 @@ void ChatMessagePrivate::send() {
}
linphone_address_unref
(
addr
);
}
q
->
setFromAddress
(
identity
);