mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Notify presence list notify events only to the internal vtables.
This commit is contained in:
parent
c20bcb0d08
commit
ce01af18f7
6 changed files with 39 additions and 1 deletions
|
|
@ -88,6 +88,14 @@ LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, SalOp
|
|||
return linphone_event_new_with_op_base(lc,op,dir,name,TRUE);
|
||||
}
|
||||
|
||||
void linphone_event_set_internal(LinphoneEvent *lev, bool_t internal) {
|
||||
lev->internal = internal;
|
||||
}
|
||||
|
||||
bool_t linphone_event_is_internal(LinphoneEvent *lev) {
|
||||
return lev->internal;
|
||||
}
|
||||
|
||||
void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state){
|
||||
if (lev->subscription_state!=state){
|
||||
ms_message("LinphoneEvent [%p] moving to subscription state %s",lev,linphone_subscription_state_to_string(state));
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon
|
|||
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
|
||||
list->expected_notification_version = 0;
|
||||
list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires);
|
||||
linphone_event_set_internal(list->event, TRUE);
|
||||
linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe");
|
||||
linphone_event_add_custom_header(list->event, "Supported", "eventlist");
|
||||
linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml");
|
||||
|
|
|
|||
|
|
@ -1685,6 +1685,8 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
|
|||
const char *remote_provisioning_uri = NULL;
|
||||
LinphoneCoreVTable* local_vtable= linphone_core_v_table_new();
|
||||
LinphoneCoreVTable *internal_vtable = linphone_core_v_table_new();
|
||||
|
||||
linphone_core_v_table_set_internal(internal_vtable, TRUE);
|
||||
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
|
||||
|
||||
lc->config=lp_config_ref(config);
|
||||
|
|
|
|||
|
|
@ -2090,6 +2090,7 @@ typedef struct _LinphoneCoreVTable{
|
|||
LinphoneCoreLogCollectionUploadStateChangedCb log_collection_upload_state_changed; /**< Callback to upload collected logs */
|
||||
LinphoneCoreLogCollectionUploadProgressIndicationCb log_collection_upload_progress_indication; /**< Callback to indicate log collection upload progress */
|
||||
void *user_data; /**<User data associated with the above callbacks */
|
||||
bool_t internal;
|
||||
} LinphoneCoreVTable;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -976,6 +976,7 @@ struct _LinphoneEvent{
|
|||
int expires;
|
||||
bool_t terminating;
|
||||
bool_t is_out_of_dialog_op; /*used for out of dialog notify*/
|
||||
bool_t internal;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1103,6 +1104,8 @@ LinphoneEvent *linphone_event_new_with_op(LinphoneCore *lc, SalOp *op, LinphoneS
|
|||
* Useful for out of dialog notify
|
||||
* */
|
||||
LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, SalOp *op, LinphoneSubscriptionDir dir, const char *name);
|
||||
void linphone_event_set_internal(LinphoneEvent *lev, bool_t internal);
|
||||
bool_t linphone_event_is_internal(LinphoneEvent *lev);
|
||||
void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state);
|
||||
void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state);
|
||||
LinphoneSubscriptionState linphone_subscription_state_from_sal(SalSubscribeStatus ss);
|
||||
|
|
@ -1420,6 +1423,10 @@ typedef struct _VTableReference VTableReference;
|
|||
void v_table_reference_destroy(VTableReference *ref);
|
||||
|
||||
void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, bool_t autorelease);
|
||||
|
||||
void linphone_core_v_table_set_internal(LinphoneCoreVTable *table, bool_t internal);
|
||||
bool_t linphone_core_v_table_is_internal(LinphoneCoreVTable *table);
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
LINPHONE_PUBLIC MSWebCam *linphone_call_get_video_device(const LinphoneCall *call);
|
||||
MSWebCam *get_nowebcam_device(void);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ void* linphone_core_v_table_get_user_data(LinphoneCoreVTable *table) {
|
|||
return table->user_data;
|
||||
}
|
||||
|
||||
void linphone_core_v_table_set_internal(LinphoneCoreVTable *table, bool_t internal) {
|
||||
table->internal = internal;
|
||||
}
|
||||
|
||||
bool_t linphone_core_v_table_is_internal(LinphoneCoreVTable *table) {
|
||||
return table->internal;
|
||||
}
|
||||
|
||||
void linphone_core_v_table_destroy(LinphoneCoreVTable* table) {
|
||||
ms_free(table);
|
||||
}
|
||||
|
|
@ -66,6 +74,17 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
|
|||
}\
|
||||
if (has_cb) ms_message("Linphone core [%p] notifying [%s]",lc,#function_name)
|
||||
|
||||
#define NOTIFY_IF_EXIST_INTERNAL(function_name, internal, ...) \
|
||||
MSList* iterator; \
|
||||
VTableReference *ref; \
|
||||
bool_t has_cb = FALSE; \
|
||||
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next)\
|
||||
if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_vtable=ref->vtable)->function_name && (linphone_core_v_table_is_internal(lc->current_vtable) == internal)) {\
|
||||
lc->current_vtable->function_name(__VA_ARGS__);\
|
||||
has_cb = TRUE;\
|
||||
}\
|
||||
if (has_cb) ms_message("Linphone core [%p] notifying [%s]",lc,#function_name)
|
||||
|
||||
void linphone_core_notify_global_state_changed(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message) {
|
||||
NOTIFY_IF_EXIST(global_state_changed,lc,gstate,message);
|
||||
cleanup_dead_vtable_refs(lc);
|
||||
|
|
@ -229,7 +248,7 @@ void linphone_core_notify_network_reachable(LinphoneCore *lc, bool_t reachable)
|
|||
}
|
||||
|
||||
void linphone_core_notify_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body) {
|
||||
NOTIFY_IF_EXIST(notify_received, lc,lev,notified_event,body);
|
||||
NOTIFY_IF_EXIST_INTERNAL(notify_received, linphone_event_is_internal(lev), lc, lev, notified_event, body);
|
||||
cleanup_dead_vtable_refs(lc);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue