mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Add factory functions to create common linphone objects.
This commit is contained in:
parent
3573ab67d3
commit
10734524fe
8 changed files with 174 additions and 12 deletions
|
|
@ -182,4 +182,8 @@ int linphone_address_get_port(const LinphoneAddress *u) {
|
|||
return sal_address_get_port(u);
|
||||
}
|
||||
|
||||
LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address) {
|
||||
return linphone_address_new(address);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -281,6 +281,10 @@ static void write_auth_infos(LinphoneCore *lc){
|
|||
linphone_auth_info_write_config(lc->config,NULL,i); /* mark the end */
|
||||
}
|
||||
|
||||
LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *lc, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm) {
|
||||
return linphone_auth_info_new(username, userid, passwd, ha1, realm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds authentication information to the LinphoneCore.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -427,6 +427,14 @@ void linphone_friend_done(LinphoneFriend *fr){
|
|||
linphone_friend_apply(fr,fr->lc);
|
||||
}
|
||||
|
||||
LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) {
|
||||
return linphone_friend_new();
|
||||
}
|
||||
|
||||
LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address) {
|
||||
return linphone_friend_new_with_address(address);
|
||||
}
|
||||
|
||||
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf)
|
||||
{
|
||||
ms_return_if_fail(lf->lc==NULL);
|
||||
|
|
|
|||
|
|
@ -5570,10 +5570,14 @@ void ui_config_uninit(LinphoneCore* lc)
|
|||
* sections and pairs of key=value in the configuration file.
|
||||
*
|
||||
**/
|
||||
LpConfig *linphone_core_get_config(LinphoneCore *lc){
|
||||
LpConfig * linphone_core_get_config(LinphoneCore *lc){
|
||||
return lc->config;
|
||||
}
|
||||
|
||||
LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename) {
|
||||
return lp_config_new(filename);
|
||||
}
|
||||
|
||||
static void linphone_core_uninit(LinphoneCore *lc)
|
||||
{
|
||||
linphone_core_free_hooks(lc);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ typedef struct _LinphoneCore LinphoneCore;
|
|||
|
||||
struct _LpConfig;
|
||||
|
||||
typedef struct _LpConfig LpConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Disable a sip transport
|
||||
|
|
@ -194,6 +196,15 @@ LINPHONE_PUBLIC char *linphone_address_as_string_uri_only(const LinphoneAddress
|
|||
LINPHONE_PUBLIC bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
|
||||
LINPHONE_PUBLIC void linphone_address_destroy(LinphoneAddress *u);
|
||||
|
||||
/**
|
||||
* Create a #LinphoneAddress object by parsing the user supplied address, given as a string.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] address String containing the user supplied address
|
||||
* @return The create #LinphoneAddress object
|
||||
* @ingroup linphone_address
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address);
|
||||
|
||||
struct _SipSetupContext;
|
||||
|
||||
|
||||
|
|
@ -814,7 +825,7 @@ LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i
|
|||
|
||||
/* you don't need those function*/
|
||||
void linphone_auth_info_destroy(LinphoneAuthInfo *info);
|
||||
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
|
||||
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos);
|
||||
|
||||
|
||||
struct _LinphoneChatRoom;
|
||||
|
|
@ -1169,7 +1180,7 @@ LINPHONE_PUBLIC LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable
|
|||
* callbacks) using linphone_core_get_user_data().
|
||||
* @see linphone_core_new
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata);
|
||||
LINPHONE_PUBLIC LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, LpConfig *config, void *userdata);
|
||||
|
||||
/* function to be periodically called in a main loop */
|
||||
/* For ICE to work properly it should be called every 20ms */
|
||||
|
|
@ -1331,10 +1342,10 @@ LINPHONE_PUBLIC const char *linphone_core_get_payload_type_description(LinphoneC
|
|||
LINPHONE_PUBLIC bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
|
||||
|
||||
/**
|
||||
* @ingroup proxy
|
||||
*Create a proxy config with default value from Linphone core.
|
||||
*@param lc #LinphoneCore object
|
||||
*@return #LinphoneProxyConfig with defualt value set
|
||||
* Create a proxy config with default values from Linphone core.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return #LinphoneProxyConfig with default values set
|
||||
* @ingroup proxy
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc);
|
||||
|
||||
|
|
@ -1352,6 +1363,19 @@ void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
|
|||
|
||||
LINPHONE_PUBLIC int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
|
||||
|
||||
/**
|
||||
* Create an authentication information with default values from Linphone core.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] username String containing the username part of the authentication credentials
|
||||
* @param[in] userid String containing the username to use to calculate the authentication digest
|
||||
* @param[in] passwd String containing the password part of the authentication credentials
|
||||
* @param[in] ha1 String containing a hash of the password
|
||||
* @param[in] realm String used to discriminate different SIP domains
|
||||
* @return #LinphoneAuthInfo with default values set
|
||||
* @ingroup authentication
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *lc, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm);
|
||||
|
||||
LINPHONE_PUBLIC void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
|
||||
|
||||
void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
|
||||
|
|
@ -1652,7 +1676,15 @@ LINPHONE_PUBLIC void linphone_core_set_user_data(LinphoneCore *lc, void *userdat
|
|||
|
||||
/* returns LpConfig object to read/write to the config file: usefull if you wish to extend
|
||||
the config file with your own sections */
|
||||
LINPHONE_PUBLIC struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
|
||||
LINPHONE_PUBLIC LpConfig * linphone_core_get_config(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Create a LpConfig object from a user config file.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] filename The filename of the config file to read to fill the instantiated LpConfig
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename);
|
||||
|
||||
/*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
|
||||
void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneCoreWaitingCallback cb, void *user_context);
|
||||
|
|
|
|||
|
|
@ -265,7 +265,22 @@ LINPHONE_PUBLIC const char *linphone_online_status_to_string(LinphoneOnlineStatu
|
|||
|
||||
|
||||
/**
|
||||
* @brief Set my presence status
|
||||
* Create a default LinphoneFriend.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return The created #LinphoneFriend object
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Create a LinphoneFriend from the given address.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] address A string containing the address to create the LinphoneFriend from
|
||||
* @return The created #LinphoneFriend object
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address);
|
||||
|
||||
/**
|
||||
* Set my presence status
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] minutes_away how long in away
|
||||
* @param[in] alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
|
||||
|
|
@ -275,14 +290,14 @@ LINPHONE_PUBLIC const char *linphone_online_status_to_string(LinphoneOnlineStatu
|
|||
LINPHONE_PUBLIC void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *alternative_contact,LinphoneOnlineStatus os);
|
||||
|
||||
/**
|
||||
* @brief Set my presence status
|
||||
* Set my presence model
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] presence #LinphonePresenceModel
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence);
|
||||
|
||||
/**
|
||||
* @brief Get my presence status
|
||||
* Get my presence status
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return #LinphoneOnlineStatus
|
||||
* @deprecated Use linphone_core_get_presence_model() instead
|
||||
|
|
@ -290,7 +305,7 @@ LINPHONE_PUBLIC void linphone_core_set_presence_model(LinphoneCore *lc, Linphone
|
|||
LINPHONE_PUBLIC LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* @brief Get my presence status
|
||||
* Get my presence model
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @return A #LinphonePresenceModel object, or NULL if no presence model has been set.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -867,6 +867,73 @@ void linphone_presence_note_set_user_data(LinphonePresenceNote *note, void *user
|
|||
void * linphone_presence_note_get_user_data(LinphonePresenceNote *note);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* LINPHONE CORE FUNCTIONS RELATED TO PRESENCE *
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Create a LinphonePresenceActivity with the given type and description.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] acttype The #LinphonePresenceActivityType to set for the activity.
|
||||
* @param[in] description An additional description of the activity to set for the activity. Can be NULL if no additional description is to be added.
|
||||
* @returns The created #LinphonePresenceActivity object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceActivity * linphone_core_create_presence_activity(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description);
|
||||
|
||||
/**
|
||||
* Create a default LinphonePresenceModel.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @returns The created #LinphonePresenceModel object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceModel * linphone_core_create_presence_model(LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Create a LinphonePresenceModel with the given activity type and activity description.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] acttype The #LinphonePresenceActivityType to set for the activity of the created model.
|
||||
* @param[in] description An additional description of the activity to set for the activity. Can be NULL if no additional description is to be added.
|
||||
* @returns The created #LinphonePresenceModel object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceModel * linphone_core_create_presence_model_with_activity(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description);
|
||||
|
||||
/**
|
||||
* Create a LinphonePresenceModel with the given activity type, activity description, note content and note language.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] acttype The #LinphonePresenceActivityType to set for the activity of the created model.
|
||||
* @param[in] description An additional description of the activity to set for the activity. Can be NULL if no additional description is to be added.
|
||||
* @param[in] note The content of the note to be added to the created model.
|
||||
* @param[in] lang The language of the note to be added to the created model.
|
||||
* @returns The created #LinphonePresenceModel object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceModel * linphone_core_create_presence_model_with_activity_and_note(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description, const char *note, const char *lang);
|
||||
|
||||
/**
|
||||
* Create a LinphonePresenceNote with the given content and language.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] content The content of the note to be created.
|
||||
* @param[in] lang The language of the note to be created.
|
||||
* @returns The created #LinphonePresenceNote object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceNote * linphone_core_create_presence_note(LinphoneCore *lc, const char *content, const char *lang);
|
||||
|
||||
/**
|
||||
* Create a LinphonePresencePerson with the given id.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] id The id of the person to be created.
|
||||
* @returns The created #LinphonePresencePerson object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresencePerson * linphone_core_create_presence_person(LinphoneCore *lc, const char *id);
|
||||
|
||||
/**
|
||||
* Create a LinphonePresenceService with the given id, basic status and contact.
|
||||
* @param[in] lc #LinphoneCore object.
|
||||
* @param[in] id The id of the service to be created.
|
||||
* @param[in] basic_status The basic status of the service to be created.
|
||||
* @param[in] contact A string containing a contact information corresponding to the service to be created.
|
||||
* @returns The created #LinphonePresenceService object.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceService * linphone_core_create_presence_service(LinphoneCore *lc, const char *id, LinphonePresenceBasicStatus basic_status, const char *contact);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1984,3 +1984,31 @@ void linphone_subscription_closed(LinphoneCore *lc, SalOp *op){
|
|||
ms_warning("Receiving unsuscribe for unknown in-subscribtion from %s", sal_op_get_from(op));
|
||||
}
|
||||
}
|
||||
|
||||
LinphonePresenceActivity * linphone_core_create_presence_activity(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description) {
|
||||
return linphone_presence_activity_new(acttype, description);
|
||||
}
|
||||
|
||||
LinphonePresenceModel * linphone_core_create_presence_model(LinphoneCore *lc) {
|
||||
return linphone_presence_model_new();
|
||||
}
|
||||
|
||||
LinphonePresenceModel * linphone_core_create_presence_model_with_activity(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description) {
|
||||
return linphone_presence_model_new_with_activity(acttype, description);
|
||||
}
|
||||
|
||||
LinphonePresenceModel * linphone_core_create_presence_model_with_activity_and_note(LinphoneCore *lc, LinphonePresenceActivityType acttype, const char *description, const char *note, const char *lang) {
|
||||
return linphone_presence_model_new_with_activity_and_note(acttype, description, note, lang);
|
||||
}
|
||||
|
||||
LinphonePresenceNote * linphone_core_create_presence_note(LinphoneCore *lc, const char *content, const char *lang) {
|
||||
return linphone_presence_note_new(content, lang);
|
||||
}
|
||||
|
||||
LinphonePresencePerson * linphone_core_create_presence_person(LinphoneCore *lc, const char *id) {
|
||||
return linphone_presence_person_new(id);
|
||||
}
|
||||
|
||||
LinphonePresenceService * linphone_core_create_presence_service(LinphoneCore *lc, const char *id, LinphonePresenceBasicStatus basic_status, const char *contact) {
|
||||
return linphone_presence_service_new(id, basic_status, contact);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue