mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 12:36:25 +00:00
Merge branch 'chat-events-cpp' into dev_refactor_cpp
This commit is contained in:
commit
93d9c5101a
17 changed files with 164 additions and 156 deletions
|
|
@ -487,7 +487,6 @@ Sal * sal_init(MSFactory *factory){
|
|||
sal->auto_contacts=TRUE;
|
||||
sal->factory = factory;
|
||||
/*first create the stack, which initializes the belle-sip object's pool for this thread*/
|
||||
belle_sip_set_log_handler(_belle_sip_log_handler); //printf by default
|
||||
sal->stack = belle_sip_stack_new(NULL);
|
||||
|
||||
sal->user_agent=belle_sip_header_user_agent_new();
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ inline OrtpLogLevel operator|=(OrtpLogLevel a, OrtpLogLevel b) {
|
|||
return static_cast<OrtpLogLevel>(ia |= ib);
|
||||
}
|
||||
|
||||
static OrtpLogFunc liblinphone_log_func = NULL;
|
||||
static OrtpLogFunc liblinphone_user_log_func = bctbx_logv_out; /*by default, user log handler = stdout*/
|
||||
static OrtpLogFunc liblinphone_current_log_func = NULL; /*can be either logcolection or user_log*/
|
||||
static LinphoneLogCollectionState liblinphone_log_collection_state = LinphoneLogCollectionDisabled;
|
||||
static char * liblinphone_log_collection_path = NULL;
|
||||
static char * liblinphone_log_collection_prefix = NULL;
|
||||
|
|
@ -467,20 +468,18 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
|
|||
static void linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, const char *fmt, va_list args);
|
||||
|
||||
void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
||||
if (ortp_get_log_handler() == linphone_core_log_collection_handler) {
|
||||
liblinphone_user_log_func = logfunc;
|
||||
if (liblinphone_current_log_func == linphone_core_log_collection_handler) {
|
||||
ms_message("There is already a log collection handler, keep it");
|
||||
liblinphone_log_func = logfunc;
|
||||
} else {
|
||||
ortp_set_log_handler(logfunc);
|
||||
sal_set_log_handler(logfunc);
|
||||
bctbx_set_log_handler(liblinphone_current_log_func=liblinphone_user_log_func);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_core_set_log_file(FILE *file) {
|
||||
if (file == NULL) file = stdout;
|
||||
linphone_core_set_log_handler(NULL);
|
||||
bctbx_set_log_file(file); /*gather everythings*/
|
||||
sal_set_log_handler(NULL); /*disable default log handler*/
|
||||
ortp_set_log_handler(NULL); /*disable default log handler*/
|
||||
}
|
||||
|
||||
void linphone_core_set_log_level(OrtpLogLevel loglevel) {
|
||||
|
|
@ -511,6 +510,7 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) {
|
|||
void linphone_core_set_log_level_mask(unsigned int loglevel) {
|
||||
//we only have 2 domain for now ortp and belle-sip
|
||||
bctbx_set_log_level_mask(ORTP_LOG_DOMAIN, loglevel);
|
||||
bctbx_set_log_level_mask("bzrtp", loglevel); /*need something to set log lvel for all domains*/
|
||||
sal_set_log_level((OrtpLogLevel)loglevel);
|
||||
}
|
||||
unsigned int linphone_core_get_log_level_mask(void) {
|
||||
|
|
@ -579,11 +579,11 @@ static void linphone_core_log_collection_handler(const char *domain, OrtpLogLeve
|
|||
time_t tt;
|
||||
int ret;
|
||||
|
||||
if (liblinphone_log_func != NULL && liblinphone_log_func != linphone_core_log_collection_handler) {
|
||||
if (liblinphone_user_log_func != NULL && liblinphone_user_log_func != linphone_core_log_collection_handler) {
|
||||
#ifndef _WIN32
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
liblinphone_log_func(domain, level, fmt, args_copy);
|
||||
liblinphone_user_log_func(domain, level, fmt, args_copy);
|
||||
va_end(args_copy);
|
||||
#else
|
||||
/* This works on 32 bits, luckily. */
|
||||
|
|
@ -691,24 +691,15 @@ LinphoneLogCollectionState linphone_core_log_collection_enabled(void) {
|
|||
void linphone_core_enable_log_collection(LinphoneLogCollectionState state) {
|
||||
if (liblinphone_log_collection_state == state) return;
|
||||
|
||||
/* at first call of this function, set liblinphone_log_func to the current
|
||||
* ortp log function */
|
||||
if( liblinphone_log_func == NULL ){
|
||||
liblinphone_log_func = ortp_get_log_handler();
|
||||
}
|
||||
liblinphone_log_collection_state = state;
|
||||
if (state != LinphoneLogCollectionDisabled) {
|
||||
ortp_mutex_init(&liblinphone_log_collection_mutex, NULL);
|
||||
if (state == LinphoneLogCollectionEnabledWithoutPreviousLogHandler) {
|
||||
liblinphone_log_func = NULL;
|
||||
} else {
|
||||
liblinphone_log_func = ortp_get_log_handler();
|
||||
liblinphone_user_log_func = NULL; /*remove user log handler*/
|
||||
}
|
||||
ortp_set_log_handler(linphone_core_log_collection_handler);
|
||||
sal_set_log_handler(linphone_core_log_collection_handler);
|
||||
bctbx_set_log_handler(liblinphone_current_log_func = linphone_core_log_collection_handler);
|
||||
} else {
|
||||
ortp_set_log_handler(liblinphone_log_func);
|
||||
sal_set_log_handler(liblinphone_log_func);
|
||||
bctbx_set_log_handler(liblinphone_user_log_func); /*restaure */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2177,7 +2168,11 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
LinphoneCoreCbs *internal_cbs = _linphone_core_cbs_new();
|
||||
const char *msplugins_dir;
|
||||
const char *image_resources_dir;
|
||||
|
||||
|
||||
bctbx_init_logger(FALSE);
|
||||
if (liblinphone_user_log_func && liblinphone_current_log_func == NULL)
|
||||
bctbx_set_log_handler(liblinphone_current_log_func=liblinphone_user_log_func); /*default value*/
|
||||
|
||||
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
|
||||
|
||||
lc->config=lp_config_ref(config);
|
||||
|
|
@ -2205,7 +2200,9 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
|
||||
|
||||
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
|
||||
ortp_set_log_handler(NULL); /*remove ortp default log handler*/
|
||||
ortp_init();
|
||||
|
||||
linphone_core_activate_log_serialization_if_needed();
|
||||
|
||||
msplugins_dir = linphone_factory_get_msplugins_dir(lfactory);
|
||||
|
|
@ -6039,6 +6036,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
|
|||
bctbx_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy);
|
||||
ms_bandwidth_controller_destroy(lc->bw_controller);
|
||||
ms_factory_destroy(lc->factory);
|
||||
bctbx_uninit_logger();
|
||||
}
|
||||
|
||||
static void stop_refreshing_proxy_config(bool_t is_sip_reachable, LinphoneProxyConfig* cfg) {
|
||||
|
|
@ -6404,6 +6402,7 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook
|
|||
}
|
||||
|
||||
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
|
||||
LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(lc);
|
||||
if (lc->zrtp_secrets_cache != NULL) {
|
||||
ms_free(lc->zrtp_secrets_cache);
|
||||
}
|
||||
|
|
@ -6411,7 +6410,7 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
|
|||
lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL;
|
||||
|
||||
/* shall we perform cache migration ? */
|
||||
if (!lp_config_get_int(lc->config,"sip","zrtp_cache_migration_done",FALSE)) {
|
||||
if (proxy && !lp_config_get_int(lc->config,"sip","zrtp_cache_migration_done",FALSE)) {
|
||||
char *tmpFile = reinterpret_cast<char *>(bctbx_malloc(strlen(file)+6));
|
||||
/* check we have a valid xml cache file given in path */
|
||||
FILE *CACHEFD = NULL;
|
||||
|
|
@ -6442,12 +6441,13 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
|
|||
/* migrate */
|
||||
char *bkpFile = reinterpret_cast<char *>(bctbx_malloc(strlen(file)+6));
|
||||
sprintf(bkpFile,"%s.bkp", file);
|
||||
|
||||
if ((ret = ms_zrtp_cache_migration((void *)cacheXml, linphone_core_get_zrtp_cache_db(lc), linphone_core_get_identity(lc))) == 0) {
|
||||
char *selfURI = linphone_address_as_string_uri_only(linphone_proxy_config_get_identity_address(proxy));
|
||||
if ((ret = ms_zrtp_cache_migration((void *)cacheXml, linphone_core_get_zrtp_cache_db(lc), selfURI)) == 0) {
|
||||
ms_message("LIME/ZRTP cache migration successfull, obsolete xml file kept as backup in %s", bkpFile);
|
||||
} else {
|
||||
ms_error("LIME/ZRTP cache migration failed(returned -%x), start with a fresh cache, old one kept as backup in %s", -ret, bkpFile);
|
||||
}
|
||||
ms_free(selfURI);
|
||||
|
||||
/* rename the newly created sqlite3 file in to the given file name */
|
||||
rename(file, bkpFile);
|
||||
|
|
|
|||
|
|
@ -25,27 +25,28 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
address/address.h
|
||||
c-wrapper/c-private-types.h
|
||||
c-wrapper/c-tools.h
|
||||
call/call.h
|
||||
call/call-listener.h
|
||||
call/call-p.h
|
||||
call/call.h
|
||||
chat/chat-message.h
|
||||
chat/chat-room-p.h
|
||||
chat/chat-room.h
|
||||
chat/imdn.h
|
||||
chat/is-composing.h
|
||||
conference/conference.h
|
||||
conference/conference-listener.h
|
||||
conference/conference-p.h
|
||||
conference/conference.h
|
||||
conference/local-conference.h
|
||||
conference/params/call-session-params.h
|
||||
conference/params/call-session-params-p.h
|
||||
conference/params/media-session-params.h
|
||||
conference/params/call-session-params.h
|
||||
conference/params/media-session-params-p.h
|
||||
conference/participant.h
|
||||
conference/params/media-session-params.h
|
||||
conference/participant-p.h
|
||||
conference/participant.h
|
||||
conference/remote-conference.h
|
||||
conference/session/call-session.h
|
||||
conference/session/call-session-listener.h
|
||||
conference/session/call-session-p.h
|
||||
conference/session/call-session.h
|
||||
conference/session/media-session.h
|
||||
conference/session/port-config.h
|
||||
content/content.h
|
||||
|
|
@ -73,7 +74,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
event-log/event-log.h
|
||||
event-log/message-event.h
|
||||
logger/logger.h
|
||||
message/message.h
|
||||
nat/ice-agent.h
|
||||
nat/stun-client.h
|
||||
object/clonable-object-p.h
|
||||
|
|
@ -90,9 +90,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
c-wrapper/api/c-address.cpp
|
||||
c-wrapper/api/c-event-log.cpp
|
||||
call/call.cpp
|
||||
chat/chat-message.cpp
|
||||
chat/chat-room.cpp
|
||||
content/content.cpp
|
||||
core/core.cpp
|
||||
chat/imdn.cpp
|
||||
chat/is-composing.cpp
|
||||
conference/conference.cpp
|
||||
|
|
@ -103,6 +102,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
conference/remote-conference.cpp
|
||||
conference/session/call-session.cpp
|
||||
conference/session/media-session.cpp
|
||||
content/content.cpp
|
||||
core/core.cpp
|
||||
cpim/header/cpim-core-headers.cpp
|
||||
cpim/header/cpim-generic-header.cpp
|
||||
cpim/header/cpim-header.cpp
|
||||
|
|
@ -119,7 +120,6 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
event-log/event-log.cpp
|
||||
event-log/message-event.cpp
|
||||
logger/logger.cpp
|
||||
message/message.cpp
|
||||
nat/ice-agent.cpp
|
||||
nat/stun-client.cpp
|
||||
object/clonable-object.cpp
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
#include <sal/sal.h>
|
||||
#include "sal/sal.h"
|
||||
|
||||
#include "address-p.h"
|
||||
#include "c-wrapper/c-tools.h"
|
||||
|
|
|
|||
|
|
@ -47,15 +47,13 @@ public:
|
|||
|
||||
template<typename T>
|
||||
static inline std::shared_ptr<T> getCppPtrFromC (void *object) {
|
||||
if (!object)
|
||||
return std::shared_ptr<T>();
|
||||
L_ASSERT(object);
|
||||
return static_cast<WrappedObject<T> *>(object)->cppPtr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline std::shared_ptr<const T> getCppPtrFromC (const void *object) {
|
||||
if (!object)
|
||||
return std::shared_ptr<const T>();
|
||||
L_ASSERT(object);
|
||||
return static_cast<const WrappedObject<const T> *>(object)->cppPtr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* message.cpp
|
||||
* chat-message.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "db/events-db.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
#include "message.h"
|
||||
#include "chat-message.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -29,10 +29,10 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
using namespace std;
|
||||
|
||||
class MessagePrivate : public ObjectPrivate {
|
||||
class ChatMessagePrivate : public ObjectPrivate {
|
||||
private:
|
||||
weak_ptr<ChatRoom> chatRoom;
|
||||
Message::Direction direction = Message::Incoming;
|
||||
ChatMessage::Direction direction = ChatMessage::Incoming;
|
||||
// LinphoneAddress *from;
|
||||
// LinphoneAddress *to;
|
||||
shared_ptr<ErrorInfo> errorInfo;
|
||||
|
|
@ -44,18 +44,18 @@ private:
|
|||
string appData;
|
||||
list<shared_ptr<Content> > contents;
|
||||
unordered_map<string, string> customHeaders;
|
||||
Message::State state = Message::Idle;
|
||||
ChatMessage::State state = ChatMessage::Idle;
|
||||
shared_ptr<EventsDb> eventsDb;
|
||||
|
||||
L_DECLARE_PUBLIC(Message);
|
||||
L_DECLARE_PUBLIC(ChatMessage);
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Message::Message (MessagePrivate &p) : Object(p) {}
|
||||
ChatMessage::ChatMessage (ChatMessagePrivate &p) : Object(p) {}
|
||||
|
||||
shared_ptr<ChatRoom> Message::getChatRoom () const {
|
||||
L_D(const Message);
|
||||
shared_ptr<ChatRoom> ChatMessage::getChatRoom () const {
|
||||
L_D(const ChatMessage);
|
||||
shared_ptr<ChatRoom> chatRoom = d->chatRoom.lock();
|
||||
if (!chatRoom) {
|
||||
// TODO.
|
||||
|
|
@ -63,110 +63,110 @@ shared_ptr<ChatRoom> Message::getChatRoom () const {
|
|||
return chatRoom;
|
||||
}
|
||||
|
||||
Message::Direction Message::getDirection () const {
|
||||
L_D(const Message);
|
||||
ChatMessage::Direction ChatMessage::getDirection () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->direction;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> Message::getFromAddress () const {
|
||||
shared_ptr<const Address> ChatMessage::getFromAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> Message::getToAddress () const {
|
||||
shared_ptr<const Address> ChatMessage::getToAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> Message::getLocalAddress () const {
|
||||
shared_ptr<const Address> ChatMessage::getLocalAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> Message::getRemoteAddress () const {
|
||||
shared_ptr<const Address> ChatMessage::getRemoteAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Message::State Message::getState () const {
|
||||
L_D(const Message);
|
||||
ChatMessage::State ChatMessage::getState () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->state;
|
||||
}
|
||||
|
||||
shared_ptr<const ErrorInfo> Message::getErrorInfo () const {
|
||||
L_D(const Message);
|
||||
shared_ptr<const ErrorInfo> ChatMessage::getErrorInfo () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->errorInfo;
|
||||
}
|
||||
|
||||
string Message::getContentType () const {
|
||||
L_D(const Message);
|
||||
string ChatMessage::getContentType () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->contentType;
|
||||
}
|
||||
|
||||
string Message::getText () const {
|
||||
L_D(const Message);
|
||||
string ChatMessage::getText () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->text;
|
||||
}
|
||||
|
||||
void Message::setText (const string &text) {
|
||||
L_D(Message);
|
||||
void ChatMessage::setText (const string &text) {
|
||||
L_D(ChatMessage);
|
||||
d->text = text;
|
||||
}
|
||||
|
||||
void Message::send () const {
|
||||
void ChatMessage::send () const {
|
||||
// TODO.
|
||||
}
|
||||
|
||||
bool Message::containsReadableText () const {
|
||||
bool ChatMessage::containsReadableText () const {
|
||||
// TODO: Check content type.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Message::isSecured () const {
|
||||
L_D(const Message);
|
||||
bool ChatMessage::isSecured () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->isSecured;
|
||||
}
|
||||
|
||||
time_t Message::getTime () const {
|
||||
L_D(const Message);
|
||||
time_t ChatMessage::getTime () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->time;
|
||||
}
|
||||
|
||||
string Message::getId () const {
|
||||
L_D(const Message);
|
||||
string ChatMessage::getId () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->id;
|
||||
}
|
||||
|
||||
string Message::getAppdata () const {
|
||||
L_D(const Message);
|
||||
string ChatMessage::getAppdata () const {
|
||||
L_D(const ChatMessage);
|
||||
return d->appData;
|
||||
}
|
||||
|
||||
void Message::setAppdata (const string &appData) {
|
||||
L_D(Message);
|
||||
void ChatMessage::setAppdata (const string &appData) {
|
||||
L_D(ChatMessage);
|
||||
d->appData = appData;
|
||||
}
|
||||
|
||||
list<shared_ptr<const Content> > Message::getContents () const {
|
||||
L_D(const Message);
|
||||
list<shared_ptr<const Content> > ChatMessage::getContents () const {
|
||||
L_D(const ChatMessage);
|
||||
list<shared_ptr<const Content> > contents;
|
||||
for (const auto &content : d->contents)
|
||||
contents.push_back(content);
|
||||
return contents;
|
||||
}
|
||||
|
||||
void Message::addContent (const shared_ptr<Content> &content) {
|
||||
L_D(Message);
|
||||
void ChatMessage::addContent (const shared_ptr<Content> &content) {
|
||||
L_D(ChatMessage);
|
||||
d->contents.push_back(content);
|
||||
}
|
||||
|
||||
void Message::removeContent (const shared_ptr<const Content> &content) {
|
||||
L_D(Message);
|
||||
void ChatMessage::removeContent (const shared_ptr<const Content> &content) {
|
||||
L_D(ChatMessage);
|
||||
d->contents.remove(const_pointer_cast<Content>(content));
|
||||
}
|
||||
|
||||
string Message::getCustomHeaderValue (const string &headerName) const {
|
||||
L_D(const Message);
|
||||
string ChatMessage::getCustomHeaderValue (const string &headerName) const {
|
||||
L_D(const ChatMessage);
|
||||
try {
|
||||
return d->customHeaders.at(headerName);
|
||||
} catch (const exception &) {
|
||||
|
|
@ -175,13 +175,13 @@ string Message::getCustomHeaderValue (const string &headerName) const {
|
|||
return "";
|
||||
}
|
||||
|
||||
void Message::addCustomHeader (const string &headerName, const string &headerValue) {
|
||||
L_D(Message);
|
||||
void ChatMessage::addCustomHeader (const string &headerName, const string &headerValue) {
|
||||
L_D(ChatMessage);
|
||||
d->customHeaders[headerName] = headerValue;
|
||||
}
|
||||
|
||||
void Message::removeCustomHeader (const string &headerName) {
|
||||
L_D(Message);
|
||||
void ChatMessage::removeCustomHeader (const string &headerName) {
|
||||
L_D(ChatMessage);
|
||||
d->customHeaders.erase(headerName);
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* message.h
|
||||
* chat-message.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,12 +16,11 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MESSAGE_H_
|
||||
#define _MESSAGE_H_
|
||||
#ifndef _CHAT_MESSAGE_H_
|
||||
#define _CHAT_MESSAGE_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "object/object.h"
|
||||
|
||||
|
|
@ -33,9 +32,9 @@ class Address;
|
|||
class ChatRoom;
|
||||
class Content;
|
||||
class ErrorInfo;
|
||||
class MessagePrivate;
|
||||
class ChatMessagePrivate;
|
||||
|
||||
class LINPHONE_PUBLIC Message : public Object {
|
||||
class LINPHONE_PUBLIC ChatMessage : public Object {
|
||||
friend class ChatRoom;
|
||||
|
||||
public:
|
||||
|
|
@ -95,12 +94,12 @@ public:
|
|||
void removeCustomHeader (const std::string &headerName);
|
||||
|
||||
private:
|
||||
Message (MessagePrivate &p);
|
||||
ChatMessage (ChatMessagePrivate &p);
|
||||
|
||||
L_DECLARE_PRIVATE(Message);
|
||||
L_DISABLE_COPY(Message);
|
||||
L_DECLARE_PRIVATE(ChatMessage);
|
||||
L_DISABLE_COPY(ChatMessage);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _MESSAGE_H_
|
||||
#endif // ifndef _CHAT_MESSAGE_H_
|
||||
|
|
@ -21,8 +21,6 @@
|
|||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "chat-room-p.h"
|
||||
|
||||
#include "chat-room.h"
|
||||
#include "imdn.h"
|
||||
#include "logger/logger.h"
|
||||
#include "utils/content-type.h"
|
||||
|
|
@ -35,8 +33,6 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ChatRoomPrivate::ChatRoomPrivate (LinphoneCore *core)
|
||||
: core(core), isComposingHandler(core, this) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "logger/logger.h"
|
||||
|
||||
#include "imdn.h"
|
||||
|
||||
#include "logger/logger.h"
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
|
||||
const string Imdn::imdnPrefix = "/imdn:imdn";
|
||||
|
||||
void Imdn::parse (ChatRoom &cr, const string &text) {
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "is-composing.h"
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "chat-room-p.h"
|
||||
|
||||
#include "logger/logger.h"
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "is-composing.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
|
||||
const string IsComposing::isComposingPrefix = "/xsi:isComposing";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
#endif // ifdef SOCI_ENABLED
|
||||
|
||||
#include "abstract/abstract-db-p.h"
|
||||
#include "chat/chat-message.h"
|
||||
#include "event-log/call-event.h"
|
||||
#include "event-log/message-event.h"
|
||||
#include "logger/logger.h"
|
||||
#include "message/message.h"
|
||||
|
||||
#include "events-db.h"
|
||||
|
||||
|
|
@ -75,25 +75,25 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
);
|
||||
}
|
||||
|
||||
static constexpr EnumToSql<Message::State> messageStateToSql[] = {
|
||||
{ Message::Idle, "1" },
|
||||
{ Message::InProgress, "2" },
|
||||
{ Message::Delivered, "3" },
|
||||
{ Message::NotDelivered, "4" },
|
||||
{ Message::FileTransferError, "5" },
|
||||
{ Message::FileTransferDone, "6" },
|
||||
{ Message::DeliveredToUser, "7" },
|
||||
{ Message::Displayed, "8" }
|
||||
static constexpr EnumToSql<ChatMessage::State> messageStateToSql[] = {
|
||||
{ ChatMessage::Idle, "1" },
|
||||
{ ChatMessage::InProgress, "2" },
|
||||
{ ChatMessage::Delivered, "3" },
|
||||
{ ChatMessage::NotDelivered, "4" },
|
||||
{ ChatMessage::FileTransferError, "5" },
|
||||
{ ChatMessage::FileTransferDone, "6" },
|
||||
{ ChatMessage::DeliveredToUser, "7" },
|
||||
{ ChatMessage::Displayed, "8" }
|
||||
};
|
||||
|
||||
static constexpr const char *mapMessageStateToSql (Message::State state) {
|
||||
static constexpr const char *mapMessageStateToSql (ChatMessage::State state) {
|
||||
return mapEnumToSql(
|
||||
messageStateToSql, sizeof messageStateToSql / sizeof messageStateToSql[0], state
|
||||
);
|
||||
}
|
||||
|
||||
static constexpr const char *mapMessageDirectionToSql (Message::Direction direction) {
|
||||
return direction == Message::Direction::Incoming ? "1" : "2";
|
||||
static constexpr const char *mapMessageDirectionToSql (ChatMessage::Direction direction) {
|
||||
return direction == ChatMessage::Direction::Incoming ? "1" : "2";
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -188,6 +188,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
" dialog_id INT UNSIGNED NOT NULL,"
|
||||
" state_id TINYINT UNSIGNED NOT NULL,"
|
||||
" direction_id TINYINT UNSIGNED NOT NULL,"
|
||||
" sender_sip_address_id INT UNSIGNED NOT NULL,"
|
||||
" imdn_message_id VARCHAR(255) NOT NULL," // See: https://tools.ietf.org/html/rfc5438#section-6.3
|
||||
" is_secured BOOLEAN NOT NULL,"
|
||||
" content_type VARCHAR(255) NOT NULL," // Content type of text. (Html or text for example.)
|
||||
|
|
@ -204,6 +205,9 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
" ON DELETE CASCADE,"
|
||||
" FOREIGN KEY (direction_id)"
|
||||
" REFERENCES message_direction(id)"
|
||||
" ON DELETE CASCADE,"
|
||||
" FOREIGN KEY (sender_sip_address_id)"
|
||||
" REFERENCES sip_address(id)"
|
||||
" ON DELETE CASCADE"
|
||||
")";
|
||||
|
||||
|
|
@ -379,8 +383,8 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
" SELECT id FROM sip_address WHERE value = :remote_address"
|
||||
" )"
|
||||
" )"
|
||||
" AND direction_id = " + string(mapMessageDirectionToSql(Message::Incoming)) +
|
||||
" AND state_id = " + string(mapMessageStateToSql(Message::Displayed));
|
||||
" AND direction_id = " + string(mapMessageDirectionToSql(ChatMessage::Incoming)) +
|
||||
" AND state_id = " + string(mapMessageStateToSql(ChatMessage::Displayed));
|
||||
int count = 0;
|
||||
|
||||
L_BEGIN_LOG_EXCEPTION
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "address/address.h"
|
||||
#include "conference-event-p.h"
|
||||
|
||||
#include "conference-event.h"
|
||||
|
|
@ -31,8 +32,7 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &ad
|
|||
L_D(ConferenceEvent);
|
||||
L_ASSERT(type == TypeConferenceCreated || type == TypeConferenceDestroyed);
|
||||
L_ASSERT(address);
|
||||
// TODO: Duplicate address.
|
||||
d->address = address;
|
||||
d->address = make_shared<Address>(*address);
|
||||
}
|
||||
|
||||
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
|
||||
|
|
@ -41,24 +41,22 @@ ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const sh
|
|||
EventLog(p, type) {
|
||||
L_D(ConferenceEvent);
|
||||
L_ASSERT(address);
|
||||
// TODO: Duplicate address.
|
||||
d->address = address;
|
||||
d->address = make_shared<Address>(*address);
|
||||
}
|
||||
|
||||
ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
|
||||
L_D(ConferenceEvent);
|
||||
if (this != &src) {
|
||||
EventLog::operator=(src);
|
||||
// TODO: Duplicate address.
|
||||
d->address = src.getPrivate()->address;
|
||||
d->address = make_shared<Address>(*src.getPrivate()->address);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> ConferenceEvent::getAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
L_D(const ConferenceEvent);
|
||||
return d->address;
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "address/address.h"
|
||||
#include "conference-event-p.h"
|
||||
|
||||
#include "conference-participant-event.h"
|
||||
|
|
@ -46,8 +47,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
|
|||
type == TypeConferenceParticipantUnsetAdmin
|
||||
);
|
||||
L_ASSERT(participantAddress);
|
||||
// TODO: Duplicate address.
|
||||
d->participantAddress = participantAddress;
|
||||
d->participantAddress = make_shared<Address>(*participantAddress);
|
||||
}
|
||||
|
||||
ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) :
|
||||
|
|
@ -57,16 +57,15 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere
|
|||
L_D(ConferenceParticipantEvent);
|
||||
if (this != &src) {
|
||||
ConferenceEvent::operator=(src);
|
||||
// TODO: Duplicate address.
|
||||
d->participantAddress = src.getPrivate()->participantAddress;
|
||||
d->participantAddress = make_shared<Address>(*src.getPrivate()->participantAddress);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
L_D(const ConferenceParticipantEvent);
|
||||
return d->participantAddress;
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -956,7 +956,7 @@ static void dos_module_trigger(void) {
|
|||
// At this point we should be banned for a minute
|
||||
|
||||
wait_for_until(marie->lc, pauline->lc, &dummy, 1, 65000);; // Wait several seconds to ensure we are not banned anymore
|
||||
BC_ASSERT_LOWER(marie->stat.number_of_LinphoneMessageReceived, number_of_messge_to_send, int, "%d");
|
||||
BC_ASSERT_LOWER_STRICT(marie->stat.number_of_LinphoneMessageReceived, number_of_messge_to_send, int, "%d");
|
||||
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
|
|
|
|||
|
|
@ -1462,6 +1462,13 @@ static void lime_cache_migration(void) {
|
|||
fclose(xmlCacheFD);
|
||||
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(marie->lc);
|
||||
LinphoneAddress *new_identity = linphone_address_clone(linphone_proxy_config_get_identity_address(cfg));
|
||||
linphone_proxy_config_edit(cfg);
|
||||
linphone_address_set_display_name(new_identity,"what about if we have a display name ?");
|
||||
linphone_proxy_config_set_identity_address(cfg, new_identity);
|
||||
|
||||
linphone_proxy_config_done(cfg);
|
||||
|
||||
if (!linphone_core_lime_available(marie->lc)) {
|
||||
ms_warning("Lime not available, skiping");
|
||||
|
|
@ -1476,7 +1483,15 @@ static void lime_cache_migration(void) {
|
|||
|
||||
/* set the cache path, it will trigger the migration function */
|
||||
linphone_core_set_zrtp_secrets_file(marie->lc, xmlCache_filepath);
|
||||
|
||||
/*short check*/
|
||||
limeKey_t associatedKey={0};
|
||||
|
||||
char * selfURI = linphone_address_as_string_uri_only(new_identity);
|
||||
linphone_address_unref(new_identity);
|
||||
bctbx_str_to_uint8(associatedKey.peerZID, (const uint8_t *)"0987654321fedcba5a5a5a5a", (uint16_t)strlen("0987654321fedcba5a5a5a5a"));
|
||||
/* 0987654321fedcba5a5a5a5a is the only one with pvs=1*/
|
||||
BC_ASSERT_FALSE(lime_getCachedRcvKeyByZid(marie->lc->zrtp_cache_db, &associatedKey, selfURI, "sip:bob@sip.linphone.org"));
|
||||
ms_free(selfURI);
|
||||
/* perform checks on the new cache, simple check is ok as deeper ones are performed in the bzrtp migration tester */
|
||||
/* TODO */
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import sys
|
|||
import pystache
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'tools'))
|
||||
print sys.path
|
||||
print(sys.path)
|
||||
import genapixml as CApi
|
||||
import abstractapi as AbsApi
|
||||
import metadoc
|
||||
|
|
@ -604,17 +604,18 @@ def main():
|
|||
|
||||
interfaces = []
|
||||
classes = []
|
||||
for _class in parser.classesIndex.values() + parser.interfacesIndex.values():
|
||||
if _class is not None:
|
||||
try:
|
||||
if type(_class) is AbsApi.Class:
|
||||
impl = ClassImpl(_class, translator)
|
||||
classes.append(impl)
|
||||
else:
|
||||
impl = InterfaceImpl(_class, translator)
|
||||
interfaces.append(impl)
|
||||
except AbsApi.Error as e:
|
||||
print('Could not translate {0}: {1}'.format(_class.name.to_camel_case(fullName=True), e.args[0]))
|
||||
for index in [parser.classesIndex, parser.interfacesIndex]:
|
||||
for _class in index.values():
|
||||
if _class is not None:
|
||||
try:
|
||||
if type(_class) is AbsApi.Class:
|
||||
impl = ClassImpl(_class, translator)
|
||||
classes.append(impl)
|
||||
else:
|
||||
impl = InterfaceImpl(_class, translator)
|
||||
interfaces.append(impl)
|
||||
except AbsApi.Error as e:
|
||||
print('Could not translate {0}: {1}'.format(_class.name.to_camel_case(fullName=True), e.args[0]))
|
||||
|
||||
wrapper = WrapperImpl(enums, interfaces, classes)
|
||||
render(renderer, wrapper, args.outputdir + "/" + args.outputfile)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue