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
9b846f0e
Commit
9b846f0e
authored
Apr 23, 2013
by
jehan
Browse files
better support of publish
parent
06a9ea3c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
coreapi/bellesip_sal/sal_op_presence.c
coreapi/bellesip_sal/sal_op_presence.c
+2
-1
coreapi/bellesip_sal/sal_op_publish.c
coreapi/bellesip_sal/sal_op_publish.c
+19
-10
tester/presence_tester.c
tester/presence_tester.c
+5
-0
No files found.
coreapi/bellesip_sal/sal_op_presence.c
View file @
9b846f0e
...
...
@@ -392,9 +392,10 @@ void sal_add_presence_info(belle_sip_message_t *notify, SalPresenceStatus online
mk_presence_body
(
online_status
,
contact_info
,
buf
,
sizeof
(
buf
),
presence_style
);
belle_sip_message_remove_header
(
BELLE_SIP_MESSAGE
(
notify
),
BELLE_SIP_CONTENT_TYPE
);
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
notify
)
,
BELLE_SIP_HEADER
(
belle_sip_header_content_type_create
(
"application"
,
presence_style
?
"xpidf+xml"
:
"pidf+xml"
)));
belle_sip_message_remove_header
(
BELLE_SIP_MESSAGE
(
notify
),
BELLE_SIP_CONTENT_LENGTH
);
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
notify
)
,
BELLE_SIP_HEADER
(
belle_sip_header_content_length_create
(
content_length
=
strlen
(
buf
))));
belle_sip_message_set_body
(
BELLE_SIP_MESSAGE
(
notify
),
buf
,
content_length
);
...
...
coreapi/bellesip_sal/sal_op_publish.c
View file @
9b846f0e
...
...
@@ -32,15 +32,24 @@ static void publish_refresher_listener ( const belle_sip_refresher_t* refresher
/*presence publish */
int
sal_publish
(
SalOp
*
op
,
const
char
*
from
,
const
char
*
to
,
SalPresenceStatus
status
){
belle_sip_request_t
*
req
=
NULL
;
if
(
from
)
sal_op_set_from
(
op
,
from
);
if
(
to
)
sal_op_set_to
(
op
,
to
);
op
->
type
=
SalOpPublish
;
req
=
sal_op_build_request
(
op
,
"PUBLISH"
);
sal_add_presence_info
(
BELLE_SIP_MESSAGE
(
req
),
status
);
return
sal_op_send_and_create_refresher
(
op
,
req
,
600
,
publish_refresher_listener
);
if
(
!
op
->
refresher
||
!
belle_sip_refresher_get_transaction
(
op
->
refresher
))
{
if
(
from
)
sal_op_set_from
(
op
,
from
);
if
(
to
)
sal_op_set_to
(
op
,
to
);
op
->
type
=
SalOpPublish
;
req
=
sal_op_build_request
(
op
,
"PUBLISH"
);
belle_sip_message_add_header
(
BELLE_SIP_MESSAGE
(
req
),
belle_sip_header_create
(
"Event"
,
"presence"
));
sal_add_presence_info
(
BELLE_SIP_MESSAGE
(
req
),
status
);
return
sal_op_send_and_create_refresher
(
op
,
req
,
600
,
publish_refresher_listener
);
}
else
{
/*update status*/
const
belle_sip_client_transaction_t
*
last_publish_trans
=
belle_sip_refresher_get_transaction
(
op
->
refresher
);
belle_sip_request_t
*
last_publish
=
belle_sip_transaction_get_request
(
BELLE_SIP_TRANSACTION
(
last_publish_trans
));
/*update status*/
sal_add_presence_info
(
BELLE_SIP_MESSAGE
(
last_publish
),
status
);
return
belle_sip_refresher_refresh
(
op
->
refresher
,
BELLE_SIP_REFRESHER_REUSE_EXPIRES
);
}
}
tester/presence_tester.c
View file @
9b846f0e
...
...
@@ -78,6 +78,11 @@ static void simple_publish(void) {
linphone_core_iterate
(
marie
->
lc
);
ms_usleep
(
100000
);
}
linphone_core_set_presence_info
(
marie
->
lc
,
0
,
NULL
,
LinphoneStatusOffline
);
for
(
i
=
0
;
i
<
10
;
i
++
)
{
linphone_core_iterate
(
marie
->
lc
);
ms_usleep
(
100000
);
}
linphone_core_manager_destroy
(
marie
);
}
...
...
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