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
60aee12e
Commit
60aee12e
authored
Aug 28, 2014
by
Ghislain MARY
Browse files
Fix linphone_core_get_chat_room() that was not creating the chat room if it did not exist yet.
parent
bb673bb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
coreapi/chat.c
coreapi/chat.c
+22
-15
coreapi/linphonecore.h
coreapi/linphonecore.h
+1
-1
No files found.
coreapi/chat.c
View file @
60aee12e
...
...
@@ -268,16 +268,19 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t,
FALSE
);
static
LinphoneChatRoom
*
_linphone_core_create_chat_room
(
LinphoneCore
*
lc
,
const
char
*
to
){
LinphoneAddress
*
parsed_url
=
NULL
;
if
((
parsed_url
=
linphone_core_interpret_url
(
lc
,
to
))
!=
NULL
){
LinphoneChatRoom
*
cr
=
belle_sip_object_new
(
LinphoneChatRoom
);
cr
->
lc
=
lc
;
cr
->
peer
=
linphone_address_as_string
(
parsed_url
);
cr
->
peer_url
=
parsed_url
;
lc
->
chatrooms
=
ms_list_append
(
lc
->
chatrooms
,(
void
*
)
cr
);
static
LinphoneChatRoom
*
_linphone_core_create_chat_room
(
LinphoneCore
*
lc
,
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
cr
=
belle_sip_object_new
(
LinphoneChatRoom
);
cr
->
lc
=
lc
;
cr
->
peer
=
linphone_address_as_string
(
addr
);
cr
->
peer_url
=
addr
;
lc
->
chatrooms
=
ms_list_append
(
lc
->
chatrooms
,
(
void
*
)
cr
);
return
cr
;
}
static
LinphoneChatRoom
*
_linphone_core_create_chat_room_from_url
(
LinphoneCore
*
lc
,
const
char
*
to
)
{
LinphoneAddress
*
parsed_url
=
NULL
;
if
((
parsed_url
=
linphone_core_interpret_url
(
lc
,
to
))
!=
NULL
)
{
return
_linphone_core_create_chat_room
(
lc
,
parsed_url
);
}
return
NULL
;
}
...
...
@@ -306,7 +309,7 @@ static LinphoneChatRoom * _linphone_core_get_or_create_chat_room(LinphoneCore* l
ret
=
_linphone_core_get_chat_room
(
lc
,
to_addr
);
linphone_address_destroy
(
to_addr
);
if
(
!
ret
){
ret
=
_linphone_core_create_chat_room
(
lc
,
to
);
ret
=
_linphone_core_create_chat_room
_from_url
(
lc
,
to
);
}
return
ret
;
}
...
...
@@ -339,8 +342,12 @@ LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *
* @param addr a linphone address.
* @returns #LinphoneChatRoom where messaging can take place.
**/
LinphoneChatRoom
*
linphone_core_get_chat_room
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
addr
){
return
_linphone_core_get_chat_room
(
lc
,
addr
);
LinphoneChatRoom
*
linphone_core_get_chat_room
(
LinphoneCore
*
lc
,
LinphoneAddress
*
addr
){
LinphoneChatRoom
*
ret
=
_linphone_core_get_chat_room
(
lc
,
addr
);
if
(
!
ret
)
{
ret
=
_linphone_core_create_chat_room
(
lc
,
addr
);
}
return
ret
;
}
/**
...
...
coreapi/linphonecore.h
View file @
60aee12e
...
...
@@ -1374,7 +1374,7 @@ typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,Linph
LINPHONE_PUBLIC
void
linphone_core_set_chat_database_path
(
LinphoneCore
*
lc
,
const
char
*
path
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_create_chat_room
(
LinphoneCore
*
lc
,
const
char
*
to
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_get_or_create_chat_room
(
LinphoneCore
*
lc
,
const
char
*
to
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_get_chat_room
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
addr
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_get_chat_room
(
LinphoneCore
*
lc
,
LinphoneAddress
*
addr
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_get_chat_room_from_uri
(
LinphoneCore
*
lc
,
const
char
*
to
);
LINPHONE_PUBLIC
void
linphone_core_disable_chat
(
LinphoneCore
*
lc
,
LinphoneReason
deny_reason
);
LINPHONE_PUBLIC
void
linphone_core_enable_chat
(
LinphoneCore
*
lc
);
...
...
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