mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 10:19:23 +00:00
feat(core): many fixes
This commit is contained in:
parent
0feb3684f5
commit
1f46a5677f
7 changed files with 66 additions and 20 deletions
|
|
@ -33,7 +33,7 @@ SalAddress * sal_address_new(const char *uri){
|
|||
}
|
||||
|
||||
SalAddress * sal_address_clone(const SalAddress *addr){
|
||||
return (SalAddress *) belle_sip_object_ref(belle_sip_object_clone(BELLE_SIP_OBJECT(addr)));
|
||||
return (SalAddress *) belle_sip_object_ref(belle_sip_header_address_clone(BELLE_SIP_HEADER_ADDRESS(addr)));
|
||||
}
|
||||
|
||||
const char *sal_address_get_scheme(const SalAddress *addr){
|
||||
|
|
@ -277,4 +277,3 @@ bool_t sal_address_is_ipv6(const SalAddress *addr){
|
|||
void sal_address_destroy(SalAddress *addr){
|
||||
sal_address_unref(addr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
#include "chat-room.h"
|
||||
#include "utils/general.h"
|
||||
|
||||
#include "private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef _IS_COMPOSING_LISTENER_H_
|
||||
#define _IS_COMPOSING_LISTENER_H_
|
||||
|
||||
#include "utils/general.h"
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
#include "is-composing-listener.h"
|
||||
#include "utils/general.h"
|
||||
|
||||
#include "private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -250,6 +250,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
|
||||
bool EventsDb::addEvent (const EventLog &eventLog) {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to add event. Not connected.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO.
|
||||
switch (eventLog.getType()) {
|
||||
case EventLog::TypeNone:
|
||||
|
|
@ -270,12 +275,22 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
|
||||
bool EventsDb::deleteEvent (const EventLog &eventLog) {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to delete event. Not connected.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO.
|
||||
(void)eventLog;
|
||||
return true;
|
||||
}
|
||||
|
||||
void EventsDb::cleanEvents (FilterMask mask) {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to clean events. Not connected.";
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO.
|
||||
(void)mask;
|
||||
}
|
||||
|
|
@ -283,6 +298,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
int EventsDb::getEventsCount (FilterMask mask) const {
|
||||
L_D(const EventsDb);
|
||||
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get events count. Not connected.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
string query = "SELECT COUNT(*) FROM event" +
|
||||
buildSqlEventFilter({ MessageFilter, CallFilter, ConferenceFilter }, mask);
|
||||
int count = 0;
|
||||
|
|
@ -300,6 +320,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
int EventsDb::getMessagesCount (const string &remoteAddress) const {
|
||||
L_D(const EventsDb);
|
||||
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get messages count. Not connected.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
string query = "SELECT COUNT(*) FROM message_event";
|
||||
if (!remoteAddress.empty())
|
||||
query += " WHERE dialog_id = ("
|
||||
|
|
@ -322,6 +347,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
int EventsDb::getUnreadMessagesCount (const string &remoteAddress) const {
|
||||
L_D(const EventsDb);
|
||||
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get unread messages count. Not connected.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
string query = "SELECT COUNT(*) FROM message_event";
|
||||
if (!remoteAddress.empty())
|
||||
query += " WHERE dialog_id = ("
|
||||
|
|
@ -344,6 +374,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &remoteAddress, int nLast, FilterMask mask) const {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get history. Not connected.";
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
// TODO.
|
||||
(void)remoteAddress;
|
||||
(void)nLast;
|
||||
|
|
@ -352,6 +387,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
|
||||
list<shared_ptr<EventLog>> EventsDb::getHistory (const string &remoteAddress, int begin, int end, FilterMask mask) const {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get history. Not connected.";
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
// TODO.
|
||||
(void)remoteAddress;
|
||||
(void)begin;
|
||||
|
|
@ -361,6 +401,11 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
}
|
||||
|
||||
void EventsDb::cleanHistory (const string &remoteAddress) {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to clean history. Not connected.";
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO.
|
||||
(void)remoteAddress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ set(SOURCE_FILES_C
|
|||
)
|
||||
|
||||
set(SOURCE_FILES_CXX
|
||||
cpim_tester.cpp
|
||||
cpim-tester.cpp
|
||||
)
|
||||
|
||||
set(SOURCE_FILES_OBJC )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* liblinphone_tester - liblinphone test suite
|
||||
* cpim-tester.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace LinphonePrivate;
|
||||
|
||||
// =============================================================================
|
||||
|
||||
static void parse_minimal_message (void) {
|
||||
using namespace std;
|
||||
|
||||
using namespace LINPHONE_NAMESPACE;
|
||||
|
||||
static void parse_minimal_message () {
|
||||
const string str = "Content-type: Message/CPIM\r\n"
|
||||
"\r\n"
|
||||
"Content-Type: text/plain; charset=utf-8\r\n"
|
||||
|
|
@ -39,7 +39,7 @@ static void parse_minimal_message (void) {
|
|||
BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
|
||||
}
|
||||
|
||||
static void set_generic_header_name (void) {
|
||||
static void set_generic_header_name () {
|
||||
const list<pair<string, bool> > entries = {
|
||||
{ "toto", true },
|
||||
{ "george.abitbol", true },
|
||||
|
|
@ -82,7 +82,7 @@ static void set_generic_header_name (void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void set_generic_header_value (void) {
|
||||
static void set_generic_header_value () {
|
||||
const list<pair<string, bool> > entries = {
|
||||
{ "MyFeatures <mid:MessageFeatures@id.foo.com>", true },
|
||||
{ "2000-12-13T13:40:00-08:00", true },
|
||||
|
|
@ -106,7 +106,7 @@ static void set_generic_header_value (void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void check_core_header_names (void) {
|
||||
static void check_core_header_names () {
|
||||
const list<pair<shared_ptr<Cpim::CoreHeader>, string> > entries = {
|
||||
{ make_shared<Cpim::FromHeader>(), "From" },
|
||||
{ make_shared<Cpim::ToHeader>(), "To" },
|
||||
|
|
@ -123,7 +123,7 @@ static void check_core_header_names (void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void set_core_header_values (void) {
|
||||
static void set_core_header_values () {
|
||||
const list<pair<shared_ptr<Cpim::Header>, list<pair<string, bool> > > > entries = {
|
||||
{ make_shared<Cpim::FromHeader>(), {
|
||||
{ "Winnie the Pooh <im:pooh@100akerwood.com>", true },
|
||||
|
|
@ -196,7 +196,7 @@ static void set_core_header_values (void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void check_subject_header_language (void) {
|
||||
static void check_subject_header_language () {
|
||||
Cpim::SubjectHeader subjectHeader;
|
||||
|
||||
// Check for not defined language.
|
||||
|
|
@ -226,7 +226,7 @@ static void check_subject_header_language (void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void parse_rfc_example (void) {
|
||||
static void parse_rfc_example () {
|
||||
const string str = "Content-type: Message/CPIM\r\n"
|
||||
"\r\n"
|
||||
"From: MR SANDERS <im:piglet@100akerwood.com>\r\n"
|
||||
|
|
@ -253,7 +253,7 @@ static void parse_rfc_example (void) {
|
|||
BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
|
||||
}
|
||||
|
||||
static void parse_message_with_generic_header_parameters (void) {
|
||||
static void parse_message_with_generic_header_parameters () {
|
||||
const string str = "Content-type: Message/CPIM\r\n"
|
||||
"\r\n"
|
||||
"From: MR SANDERS <im:piglet@100akerwood.com>\r\n"
|
||||
|
|
@ -275,7 +275,7 @@ static void parse_message_with_generic_header_parameters (void) {
|
|||
BC_ASSERT_STRING_EQUAL(str2.c_str(), str.c_str());
|
||||
}
|
||||
|
||||
static void build_message (void) {
|
||||
static void build_message () {
|
||||
Cpim::Message message;
|
||||
if (!BC_ASSERT_FALSE(message.isValid()))
|
||||
return;
|
||||
Loading…
Add table
Reference in a new issue