Commit d111d78f authored by Ronan's avatar Ronan

feat(core-c): provide a way to find chat room

parent af709ad4
......@@ -104,6 +104,17 @@ LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const c
return L_GET_C_BACK_PTR(lc->cppCore->getOrCreateBasicChatRoomFromUri(L_C_TO_STRING(to)));
}
LinphoneChatRoom *linphone_core_find_chat_room(
const LinphoneCore *lc,
const LinphoneAddress *peerAddr,
const LinphoneAddress *localAddr
) {
return L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr))
)));
}
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason reason = LinphoneReasonNotAcceptable;
const char *peerAddress;
......
......@@ -56,17 +56,6 @@ bctbx_list_t **linphone_core_get_call_logs_attribute(LinphoneCore *lc) {
return &lc->call_logs;
}
LinphoneChatRoom * linphone_core_find_chat_room (const LinphoneCore *lc, const LinphoneAddress *peerAddr, const LinphoneAddress *localAddr) {
shared_ptr<ChatRoom> chatRoom = lc->cppCore->findChatRoom(ChatRoomId(
IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)),
IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr))
));
if (chatRoom)
return L_GET_C_BACK_PTR(chatRoom);
return nullptr;
}
void linphone_core_cbs_set_auth_info_requested(LinphoneCoreCbs *cbs, LinphoneCoreAuthInfoRequestedCb cb) {
cbs->vtable->auth_info_requested = cb;
}
......
......@@ -93,8 +93,6 @@ LINPHONE_PUBLIC mblk_t *_linphone_call_stats_get_received_rtcp (const LinphoneCa
LINPHONE_PUBLIC LinphoneQualityReporting *linphone_call_log_get_quality_reporting(LinphoneCallLog *call_log);
LINPHONE_PUBLIC reporting_session_report_t **linphone_quality_reporting_get_reports(LinphoneQualityReporting *qreporting);
LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_find_chat_room (const LinphoneCore *lc, const LinphoneAddress *peerAddr, const LinphoneAddress *localAddr);
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list);
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_friend_invalidate_subscription(LinphoneFriend *lf);
......
......@@ -3448,7 +3448,7 @@ LINPHONE_PUBLIC void linphone_core_set_preview_video_definition(LinphoneCore *lc
/**
* @biref Sets the video size for the captured (preview) video.
*
*
* This method is for advanced usage where a video capture must be set independently of the size of the stream actually sent through the call.
* This allows for example to have the preview window with HD resolution even if due to bandwidth constraint the sent video size is small.
* Using this feature increases the CPU consumption, since a rescaling will be done internally.
......@@ -3501,7 +3501,7 @@ LINPHONE_PUBLIC LinphoneVideoDefinition * linphone_core_get_current_preview_vide
/**
* @brief Returns the effective video size for the captured video as provided by the camera.
*
*
* When preview is disabled or not yet started, this function returns a zeroed video size.
* @see #linphone_core_set_preview_video_size()
* @ingroup media_parameters
......@@ -4725,7 +4725,7 @@ LINPHONE_PUBLIC bool_t linphone_core_video_multicast_enabled(const LinphoneCore
/**
* @brief Set the network simulator parameters.
*
*
* Liblinphone has the capabability of simulating the effects of a network (latency, lost packets, jitter, max bandwidth).
* Please refer to the oRTP documentation for the meaning of the parameters of the OrtpNetworkSimulatorParams structure.
* This function has effect for future calls, but not for currently running calls, though this behavior may be changed in future versions.
......@@ -4941,7 +4941,7 @@ LINPHONE_PUBLIC const char *linphone_core_get_chat_database_path(const LinphoneC
LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, const char *subject);
/**
* Get a chat room whose peer is the supplied address. If it does not exist yet, it will be created.
* Get a basic chat room whose peer is the supplied address. If it does not exist yet, it will be created.
* No reference is transfered to the application. The LinphoneCore keeps a reference on the chat room.
* @param lc the linphone core
* @param addr a linphone address.
......@@ -4950,7 +4950,7 @@ LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_create_client_group_chat_room(L
LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr);
/**
* Get a chat room for messaging from a sip uri like sip:joe@sip.linphone.org. If it does not exist yet, it will be created.
* Get a basic chat room for messaging from a sip uri like sip:joe@sip.linphone.org. If it does not exist yet, it will be created.
* No reference is transfered to the application. The LinphoneCore keeps a reference on the chat room.
* @param lc A #LinphoneCore object
* @param to The destination address for messages.
......@@ -4958,6 +4958,20 @@ LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc,
**/
LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const char *to);
/**
* Find a chat room.
* No reference is transfered to the application. The LinphoneCore keeps a reference on the chat room.
* @param lc the linphone core
* @param peerAddr a linphone address.
* @param localAddr a linphone address.
* @return #LinphoneChatRoom where messaging can take place.
**/
LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_find_chat_room (
const LinphoneCore *lc,
const LinphoneAddress *peerAddr,
const LinphoneAddress *localAddr
);
/**
* Removes a chatroom including all message history from the LinphoneCore.
* @param lc A #LinphoneCore object
......
......@@ -52,8 +52,8 @@ bool AbstractDb::connect (Backend backend, const string &parameters) {
d->backend = backend;
d->dbSession = DbSessionProvider::getInstance()->getSession(
(backend == Mysql ? "mysql://" : "sqlite3://") + parameters
);
(backend == Mysql ? "mysql://" : "sqlite3://") + parameters
);
if (d->dbSession) {
try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment