diff --git a/coreapi/tester_utils.cpp b/coreapi/tester_utils.cpp index c4840777456525e1b1dde0f7ca47b49c1b16db7e..4589778a738ad6dfa235d41226140603e147382c 100644 --- a/coreapi/tester_utils.cpp +++ b/coreapi/tester_utils.cpp @@ -20,6 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "tester_utils.h" #include "private.h" +#include "chat/chat-room/chat-room.h" +#include "core/core.h" +#include "c-wrapper/c-wrapper.h" + LinphoneVcardContext *linphone_core_get_vcard_context(const LinphoneCore *lc) { return lc->vcard_context; } @@ -48,6 +52,14 @@ 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 *addr) { + const LinphonePrivate::Address *cppAddr = L_GET_CPP_PTR_FROM_C_OBJECT(addr); + std::shared_ptr<LinphonePrivate::ChatRoom> cr = lc->cppCore->findChatRoom(*cppAddr); + if (!cr) + return nullptr; + return L_GET_C_BACK_PTR(cr); +} + void linphone_core_cbs_set_auth_info_requested(LinphoneCoreCbs *cbs, LinphoneCoreAuthInfoRequestedCb cb) { cbs->vtable->auth_info_requested = cb; } diff --git a/coreapi/tester_utils.h b/coreapi/tester_utils.h index c486e59f64480f1be09bf45bc50fd59a0371047e..1d6f7f7010caa0b2083cf751d6b0640bcc46824e 100644 --- a/coreapi/tester_utils.h +++ b/coreapi/tester_utils.h @@ -94,6 +94,7 @@ LINPHONE_PUBLIC LinphoneQualityReporting *linphone_call_log_get_quality_reportin LINPHONE_PUBLIC reporting_session_report_t **linphone_quality_reporting_get_reports(LinphoneQualityReporting *qreporting); LINPHONE_PUBLIC bctbx_list_t * linphone_chat_room_get_transient_messages(const LinphoneChatRoom *cr); +LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_find_chat_room (const LinphoneCore *lc, const LinphoneAddress *addr); 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);