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
20dfd43a
Commit
20dfd43a
authored
Sep 19, 2013
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More coherent friend API.
parent
43186ab4
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
34 additions
and
26 deletions
+34
-26
console/commands.c
console/commands.c
+2
-2
coreapi/friend.c
coreapi/friend.c
+4
-4
coreapi/help/buddy_status.c
coreapi/help/buddy_status.c
+1
-1
coreapi/linphonecore_jni.cc
coreapi/linphonecore_jni.cc
+2
-2
coreapi/linphonefriend.h
coreapi/linphonefriend.h
+12
-2
coreapi/presence.c
coreapi/presence.c
+4
-4
coreapi/private.h
coreapi/private.h
+1
-3
gtk/buddylookup.c
gtk/buddylookup.c
+1
-1
gtk/calllogs.c
gtk/calllogs.c
+1
-1
gtk/chat.c
gtk/chat.c
+2
-2
gtk/friendlist.c
gtk/friendlist.c
+2
-2
tester/presence_tester.c
tester/presence_tester.c
+2
-2
No files found.
console/commands.c
View file @
20dfd43a
...
...
@@ -1022,7 +1022,7 @@ lpc_cmd_friend(LinphoneCore *lc, char *args)
linphonec_friend_add
(
lc
,
name
,
addr
);
#else
LinphoneFriend
*
new_friend
;
new_friend
=
linphone_friend_new_with_addr
(
args
);
new_friend
=
linphone_friend_new_with_addr
ess
(
args
);
linphone_core_add_friend
(
lc
,
new_friend
);
#endif
return
1
;
...
...
@@ -1852,7 +1852,7 @@ linphonec_friend_add(LinphoneCore *lc, const char *name, const char *addr)
char
url
[
PATH_MAX
];
snprintf
(
url
,
PATH_MAX
,
"%s <%s>"
,
name
,
addr
);
newFriend
=
linphone_friend_new_with_addr
(
url
);
newFriend
=
linphone_friend_new_with_addr
ess
(
url
);
linphone_core_add_friend
(
lc
,
newFriend
);
return
0
;
}
...
...
coreapi/friend.c
View file @
20dfd43a
...
...
@@ -78,7 +78,7 @@ static int friend_compare(const void * a, const void * b){
}
MSList
*
linphone_find_friend_by_addr
(
MSList
*
fl
,
const
LinphoneAddress
*
addr
,
LinphoneFriend
**
lf
){
MSList
*
linphone_find_friend_by_addr
ess
(
MSList
*
fl
,
const
LinphoneAddress
*
addr
,
LinphoneFriend
**
lf
){
MSList
*
res
=
NULL
;
LinphoneFriend
dummy
;
if
(
lf
!=
NULL
)
*
lf
=
NULL
;
...
...
@@ -145,7 +145,7 @@ LinphoneFriend * linphone_friend_new(){
return
obj
;
}
LinphoneFriend
*
linphone_friend_new_with_addr
(
const
char
*
addr
){
LinphoneFriend
*
linphone_friend_new_with_addr
ess
(
const
char
*
addr
){
LinphoneAddress
*
linphone_address
=
linphone_address_new
(
addr
);
LinphoneFriend
*
fr
;
...
...
@@ -154,7 +154,7 @@ LinphoneFriend *linphone_friend_new_with_addr(const char *addr){
return
NULL
;
}
fr
=
linphone_friend_new
();
linphone_friend_set_addr
(
fr
,
linphone_address
);
linphone_friend_set_addr
ess
(
fr
,
linphone_address
);
linphone_address_destroy
(
linphone_address
);
return
fr
;
}
...
...
@@ -605,7 +605,7 @@ LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int inde
if
(
tmp
==
NULL
)
{
return
NULL
;
}
lf
=
linphone_friend_new_with_addr
(
tmp
);
lf
=
linphone_friend_new_with_addr
ess
(
tmp
);
if
(
lf
==
NULL
)
{
return
NULL
;
}
...
...
coreapi/help/buddy_status.c
View file @
20dfd43a
...
...
@@ -155,7 +155,7 @@ int main(int argc, char *argv[]){
LinphoneFriend
*
my_friend
=
NULL
;
if
(
dest_friend
)
{
my_friend
=
linphone_friend_new_with_addr
(
dest_friend
);
/*creates friend object from dest*/
my_friend
=
linphone_friend_new_with_addr
ess
(
dest_friend
);
/*creates friend object from dest*/
if
(
my_friend
==
NULL
)
{
printf
(
"bad destination uri for friend [%s]
\n
"
,
dest_friend
);
goto
end
;
...
...
coreapi/linphonecore_jni.cc
View file @
20dfd43a
...
...
@@ -2042,7 +2042,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNI
if
(
jFriendUri
)
{
const
char
*
friendUri
=
env
->
GetStringUTFChars
(
jFriendUri
,
NULL
);
lResult
=
linphone_friend_new_with_addr
(
friendUri
);
lResult
=
linphone_friend_new_with_addr
ess
(
friendUri
);
env
->
ReleaseStringUTFChars
(
jFriendUri
,
friendUri
);
}
else
{
lResult
=
linphone_friend_new
();
...
...
@@ -2053,7 +2053,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setAddress(JNIEnv* en
,
jobject
thiz
,
jlong
ptr
,
jlong
linphoneAddress
)
{
linphone_friend_set_addr
((
LinphoneFriend
*
)
ptr
,(
LinphoneAddress
*
)
linphoneAddress
);
linphone_friend_set_addr
ess
((
LinphoneFriend
*
)
ptr
,(
LinphoneAddress
*
)
linphoneAddress
);
}
extern
"C"
jlong
Java_org_linphone_core_LinphoneFriendImpl_getAddress
(
JNIEnv
*
env
,
jobject
thiz
...
...
coreapi/linphonefriend.h
View file @
20dfd43a
...
...
@@ -121,12 +121,19 @@ typedef struct _LinphoneFriend LinphoneFriend;
* @return a new empty #LinphoneFriend
*/
LINPHONE_PUBLIC
LinphoneFriend
*
linphone_friend_new
();
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_addr()
* Contructor same as linphone_friend_new() + linphone_friend_set_addr
ess
()
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
*/
LINPHONE_PUBLIC
LinphoneFriend
*
linphone_friend_new_with_addr
(
const
char
*
addr
);
LINPHONE_PUBLIC
LinphoneFriend
*
linphone_friend_new_with_address
(
const
char
*
addr
);
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_address()
* @deprecated Use #linphone_friend_new_with_address instead
*/
#define linphone_friend_new_with_addr linphone_friend_new_with_address
/**
* Destructor
...
...
@@ -289,6 +296,9 @@ LINPHONE_PUBLIC LinphoneOnlineStatus linphone_core_get_presence_info(const Linph
*/
LINPHONE_PUBLIC
LinphonePresenceModel
*
linphone_core_get_presence_model
(
const
LinphoneCore
*
lc
);
/**
* @deprecated Use linphone_core_interpret_url() instead
*/
LINPHONE_PUBLIC
void
linphone_core_interpret_friend_uri
(
LinphoneCore
*
lc
,
const
char
*
uri
,
char
**
result
);
/**
...
...
coreapi/presence.c
View file @
20dfd43a
...
...
@@ -1502,7 +1502,7 @@ static LinphonePresenceModel * process_pidf_xml_presence_notification(xmlparsing
void
linphone_core_add_subscriber
(
LinphoneCore
*
lc
,
const
char
*
subscriber
,
SalOp
*
op
){
LinphoneFriend
*
fl
=
linphone_friend_new_with_addr
(
subscriber
);
LinphoneFriend
*
fl
=
linphone_friend_new_with_addr
ess
(
subscriber
);
if
(
fl
==
NULL
)
return
;
fl
->
insub
=
op
;
linphone_friend_set_inc_subscribe_policy
(
fl
,
LinphoneSPAccept
);
...
...
@@ -1555,14 +1555,14 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
}
/* check if we answer to this subscription */
if
(
linphone_find_friend_by_addr
(
lc
->
friends
,
uri
,
&
lf
)
!=
NULL
){
if
(
linphone_find_friend_by_addr
ess
(
lc
->
friends
,
uri
,
&
lf
)
!=
NULL
){
lf
->
insub
=
op
;
lf
->
inc_subscribe_pending
=
TRUE
;
sal_subscribe_accept
(
op
);
linphone_friend_done
(
lf
);
/*this will do all necessary actions */
}
else
{
/* check if this subscriber is in our black list */
if
(
linphone_find_friend_by_addr
(
lc
->
subscribers
,
uri
,
&
lf
)){
if
(
linphone_find_friend_by_addr
ess
(
lc
->
subscribers
,
uri
,
&
lf
)){
if
(
lf
->
pol
==
LinphoneSPDeny
){
ms_message
(
"Rejecting %s because we already rejected it once."
,
from
);
sal_subscribe_decline
(
op
,
SalReasonDeclined
);
...
...
@@ -1926,7 +1926,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
if
(
lf
==
NULL
&&
lp_config_get_int
(
lc
->
config
,
"sip"
,
"allow_out_of_subscribe_presence"
,
0
)){
const
SalAddress
*
addr
=
sal_op_get_from_address
(
op
);
lf
=
NULL
;
linphone_find_friend_by_addr
(
lc
->
friends
,(
LinphoneAddress
*
)
addr
,
&
lf
);
linphone_find_friend_by_addr
ess
(
lc
->
friends
,(
LinphoneAddress
*
)
addr
,
&
lf
);
}
if
(
lf
!=
NULL
){
LinphonePresenceActivity
*
activity
=
NULL
;
...
...
coreapi/private.h
View file @
20dfd43a
...
...
@@ -253,7 +253,7 @@ void linphone_friend_close_subscriptions(LinphoneFriend *lf);
void
linphone_friend_notify
(
LinphoneFriend
*
lf
,
LinphonePresenceModel
*
presence
);
LinphoneFriend
*
linphone_find_friend_by_inc_subscribe
(
MSList
*
l
,
SalOp
*
op
);
LinphoneFriend
*
linphone_find_friend_by_out_subscribe
(
MSList
*
l
,
SalOp
*
op
);
MSList
*
linphone_find_friend_by_addr
(
MSList
*
fl
,
const
LinphoneAddress
*
addr
,
LinphoneFriend
**
lf
);
MSList
*
linphone_find_friend_by_addr
ess
(
MSList
*
fl
,
const
LinphoneAddress
*
addr
,
LinphoneFriend
**
lf
);
int
parse_hostname_to_addr
(
const
char
*
server
,
struct
sockaddr_storage
*
ss
,
socklen_t
*
socklen
);
int
set_lock_file
();
...
...
@@ -303,8 +303,6 @@ void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, SalO
void
linphone_subscription_answered
(
LinphoneCore
*
lc
,
SalOp
*
op
);
void
linphone_subscription_closed
(
LinphoneCore
*
lc
,
SalOp
*
op
);
MSList
*
linphone_find_friend_by_addr
(
MSList
*
fl
,
const
LinphoneAddress
*
fri
,
LinphoneFriend
**
lf
);
void
linphone_core_update_allocated_audio_bandwidth
(
LinphoneCore
*
lc
);
void
linphone_core_update_allocated_audio_bandwidth_in_call
(
LinphoneCall
*
call
,
const
PayloadType
*
pt
);
...
...
gtk/buddylookup.c
View file @
20dfd43a
...
...
@@ -287,7 +287,7 @@ void linphone_gtk_add_buddy_from_database(GtkWidget *button){
gtk_tree_model_get
(
model
,
&
iter
,
LOOKUP_RESULT_SIP_URI
,
&
uri
,
LOOKUP_RESULT_NAME
,
&
name
,
-
1
);
addr
=
g_strdup_printf
(
"%s <%s>"
,
name
,
uri
);
lf
=
linphone_friend_new_with_addr
(
addr
);
lf
=
linphone_friend_new_with_addr
ess
(
addr
);
linphone_friend_set_inc_subscribe_policy
(
lf
,
presence
?
LinphoneSPAccept
:
LinphoneSPDeny
);
linphone_friend_send_subscribe
(
lf
,
presence
);
linphone_core_add_friend
(
linphone_gtk_get_core
(),
lf
);
...
...
gtk/calllogs.c
View file @
20dfd43a
...
...
@@ -82,7 +82,7 @@ void linphone_gtk_call_log_add_contact(GtkWidget *w){
la
=
(
LinphoneAddress
*
)
pla
;
if
(
la
!=
NULL
){
char
*
uri
=
linphone_address_as_string
(
la
);
lf
=
linphone_friend_new_with_addr
(
uri
);
lf
=
linphone_friend_new_with_addr
ess
(
uri
);
linphone_gtk_show_contact
(
lf
);
ms_free
(
uri
);
}
...
...
gtk/chat.c
View file @
20dfd43a
...
...
@@ -335,7 +335,7 @@ void display_history_message(GtkWidget *chat_view,MSList *messages,const Linphon
void
linphone_gtk_chat_add_contact
(
const
LinphoneAddress
*
addr
){
LinphoneFriend
*
lf
=
NULL
;
char
*
uri
=
linphone_address_as_string
(
addr
);
lf
=
linphone_friend_new_with_addr
(
uri
);
lf
=
linphone_friend_new_with_addr
ess
(
uri
);
ms_free
(
uri
);
char
*
fixed_uri
=
NULL
;
gboolean
show_presence
=
FALSE
;
...
...
@@ -348,7 +348,7 @@ void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){
linphone_gtk_display_something
(
GTK_MESSAGE_WARNING
,
_
(
"Invalid sip contact !"
));
return
;
}
linphone_friend_set_addr
(
lf
,
addr
);
linphone_friend_set_addr
ess
(
lf
,
addr
);
linphone_core_add_friend
(
linphone_gtk_get_core
(),
lf
);
ms_free
(
fixed_uri
);
linphone_gtk_show_friends
();
...
...
gtk/friendlist.c
View file @
20dfd43a
...
...
@@ -450,7 +450,7 @@ static void icon_press_handler(GtkEntry *entry){
}
lf
=
linphone_core_get_friend_by_address
(
linphone_gtk_get_core
(),
uri
);
if
(
lf
==
NULL
)
lf
=
linphone_friend_new_with_addr
(
uri
);
lf
=
linphone_friend_new_with_addr
ess
(
uri
);
if
(
lf
!=
NULL
){
linphone_gtk_show_contact
(
lf
);
}
...
...
@@ -886,7 +886,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
}
friend_address
=
linphone_address_new
(
fixed_uri
);
linphone_address_set_display_name
(
friend_address
,
name
);
linphone_friend_set_addr
(
lf
,
friend_address
);
linphone_friend_set_addr
ess
(
lf
,
friend_address
);
linphone_address_destroy
(
friend_address
);
linphone_friend_send_subscribe
(
lf
,
show_presence
);
...
...
tester/presence_tester.c
View file @
20dfd43a
...
...
@@ -146,7 +146,7 @@ static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,Linph
char
*
identity
=
linphone_address_as_string_uri_only
(
callee_mgr
->
identity
);
LinphoneFriend
*
friend
=
linphone_friend_new_with_addr
(
identity
);
LinphoneFriend
*
friend
=
linphone_friend_new_with_addr
ess
(
identity
);
linphone_friend_edit
(
friend
);
linphone_friend_enable_subscribes
(
friend
,
TRUE
);
linphone_friend_done
(
friend
);
...
...
@@ -211,7 +211,7 @@ static void simple_subscribe(void) {
static
void
unsubscribe_while_subscribing
(
void
)
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneFriend
*
friend
=
linphone_friend_new_with_addr
(
"sip:toto@git.linphone.org"
);
/*any unexisting address*/
LinphoneFriend
*
friend
=
linphone_friend_new_with_addr
ess
(
"sip:toto@git.linphone.org"
);
/*any unexisting address*/
linphone_friend_edit
(
friend
);
linphone_friend_enable_subscribes
(
friend
,
TRUE
);
linphone_friend_done
(
friend
);
...
...
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