Source

Target

Commits (2)
Showing with 481 additions and 393 deletions
This diff is collapsed.
......@@ -27,6 +27,7 @@ install(FILES rootca.pem
set(GRAMMAR_FILES
cpim_grammar
identity_grammar
)
install(FILES ${GRAMMAR_FILES}
......
File added
......@@ -36,6 +36,10 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
namespace {
string IdentityGrammar("identity_grammar");
}
// -----------------------------------------------------------------------------
class IdentityAddressParserPrivate : public ObjectPrivate {
......@@ -47,24 +51,7 @@ public:
IdentityAddressParser::IdentityAddressParser () : Singleton(*new IdentityAddressParserPrivate) {
L_D();
const char *identityAddressGrammar =
"address = scheme \":\" [user] \"@\" host [ gruu-parameter ] \r\n"
"scheme = \"sip\" / \"sips\" \r\n"
"user = 1*( alphanum / escaped / \"-\" / \"+\" / \"_\" / \"~\" ) \r\n"
"escaped = \"%\" HEXDIG HEXDIG \r\n"
"host = *( domainlabel \".\" ) toplabel [ \".\" ] \r\n"
"domainlabel = alphanum / (alphanum *( alphanum / ( *(\"-\") alphanum) ) ) \r\n"
"toplabel = ALPHA / (ALPHA *( alphanum / (*(\"-\") alphanum ) ) ) \r\n"
"gruu-parameter = \";gr=\" gruu-value \r\n"
"gruu-value = 1*( alphanum / \"-\" / \"_\" / \":\" ) \r\n"
"alphanum = ALPHA / DIGIT \r\n";
belr::ABNFGrammarBuilder builder;
shared_ptr<belr::Grammar> defaultGrammar = make_shared<belr::Grammar>("");
defaultGrammar->include(make_shared<belr::CoreRules>());
shared_ptr<belr::Grammar> grammar = builder.createFromAbnf(identityAddressGrammar, defaultGrammar);
//shared_ptr<belr::Grammar> grammar = belr::GrammarLoader::get().load(IdentityAddressGrammar);
shared_ptr<belr::Grammar> grammar = belr::GrammarLoader::get().load(IdentityGrammar);
if (!grammar)
lFatal() << "Unable to load Identity Address grammar.";
d->parser = make_shared<belr::Parser<shared_ptr<IdentityAddress>>>(grammar);
......
......@@ -122,6 +122,12 @@ IosPlatformHelpers::IosPlatformHelpers (std::shared_ptr<LinphonePrivate::Core> c
else
ms_error("IosPlatformHelpers did not find cpim grammar resource directory...");
string identityPath = getResourceDirPath(Framework, "identity_grammar");
if (!identityPath.empty())
belr::GrammarLoader::get().addPath(identityPath);
else
ms_error("IosPlatformHelpers did not find identity grammar resource directory...");
#ifdef VCARD_ENABLED
string vcardPath = getResourceDirPath("org.linphone.belcard", "vcard_grammar");
if (!vcardPath.empty())
......
......@@ -36,13 +36,13 @@ class SmartTransaction {
public:
SmartTransaction (soci::session *session, const char *name) :
mSession(session), mName(name), mIsCommitted(false) {
lInfo() << "Start transaction " << this << " in MainDb::" << mName << ".";
lDebug() << "Start transaction " << this << " in MainDb::" << mName << ".";
mSession->begin();
}
~SmartTransaction () {
if (!mIsCommitted) {
lInfo() << "Rollback transaction " << this << " in MainDb::" << mName << ".";
lDebug() << "Rollback transaction " << this << " in MainDb::" << mName << ".";
mSession->rollback();
}
}
......@@ -53,7 +53,7 @@ public:
return;
}
lInfo() << "Commit transaction " << this << " in MainDb::" << mName << ".";
lDebug() << "Commit transaction " << this << " in MainDb::" << mName << ".";
mIsCommitted = true;
mSession->commit();
}
......
......@@ -279,9 +279,11 @@ public class AndroidPlatformHelper {
String mPauseSoundFile = basePath + "/share/sounds/linphone/rings/dont_wait_too_long.mkv";
String mErrorToneFile = basePath + "/share/sounds/linphone/incoming_chat.wav";
String mGrammarCpimFile = basePath + "/share/belr/grammars/cpim_grammar";
String mGrammarIdentityFile = basePath + "/share/belr/grammars/identity_grammar";
String mGrammarVcardFile = basePath + "/share/belr/grammars/vcard_grammar";
copyEvenIfExists(getResourceIdentifierFromName("cpim_grammar"), mGrammarCpimFile);
copyEvenIfExists(getResourceIdentifierFromName("identity_grammar"), mGrammarIdentityFile);
copyEvenIfExists(getResourceIdentifierFromName("vcard_grammar"), mGrammarVcardFile);
copyEvenIfExists(getResourceIdentifierFromName("rootca"), mLinphoneRootCaFile);
copyIfNotExist(getResourceIdentifierFromName("notes_of_the_optimistic"), mRingSoundFile);
......