misc: vendor libjamiclient into 'src/libclient/'
This is libjamiclient from the jami-libclient.git repository as of
767c45b8b09806ac05cbada720864df93588c047, with the following changes:
* src/libclient/newaccountmodel.cpp:
(NewAccountModelPimpl::removeFromAccounts): The lock wait inside
'#ifdef CHK_FREEABLE_BEFORE_ERASE_ACCOUNT' was not updated when the
type of 'accounts' was changed over the years from this:
std::map<std::string, account::Info>
to this:
std::map<QString, std::pair<account::Info, std::shared_ptr<Database>>>
Basically we need to get the 'first' of the pair for 'account::Info'.
So we now do that.
* src/libclient/avmodel.cpp:
* src/libclient/callbackshandler.cpp:
* src/libclient/contactmodel.cpp:
* src/libclient/conversationmodel.cpp:
* src/libclient/database.cpp:
* src/libclient/namedirectory.cpp:
* src/libclient/newaccountmodel.cpp:
* src/libclient/newcallmodel.cpp:
* src/libclient/newdevicemodel.cpp:
* src/libclient/peerdiscoverymodel.cpp:
* src/libclient/pluginmodel.cpp:
* src/libclient/smartinfohub.cpp:
* src/libclient/vcard.h:
* src/libclient/authority/storagehelper.cpp: Replace Qt's 'foreach'
with 'Q_FOREACH' and its 'emit' with 'Q_EMIT' because in the client-qt
code base we have '-DQT_NO_KEYWORDS' to avoid conflicts with other
libraries we use.
* cmake/FindLibJami.cmake: Import cmake/FindRing.cmake from the
jami-libclient.git repository. Then, rename RING_BUILD_DIR to
LIBJAMI_BUILD_DIR (though the old name is still supported for now).
Also update other references of Ring to Jami. Further, add additional
calls to 'find_library' to make sure specified local paths for libjami
are checked before system-wide ones (in case of older/obsolete libjami
being available system-wide, which might happen on GNU/Linux systems).
* translations/lrc_*.ts: Import translation files from the libclient
repository. The message location paths were corrected by running
"sed -i 's|../src|&/libclient|g' lrc_*.ts" in 'translations/'.
.tx/config: Add section for the newly-imported libclient translations.
* CMakeLists.txt: Reformat, plus various fixes and cleanups, such as
changing indentation to 2 spaces and wrapping lines at 70 characters,
renaming the parent directory of translations from 'ring' to 'jami',
and using all lowercase function calls. Also add copyright headers.
* src/app/appsettingsmanager.cpp:
(AppSettingsManager::loadTranslations):
* src/app/utilsadapter.cpp (UtilsAdapter::supportedLang): Update to
adapt to the renaming of the parent directory of translations from
'ring' to 'jami'.
GitLab: #748
Change-Id: I86e3b0fb30e554755023e7b858b6a0d132cd59ab
2022-05-06 16:00:16 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 SoapBox Innovations Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
;(function (window, linkify) {
|
|
|
|
var linkifyString = function (linkify) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
Convert strings of text into linkable HTML text
|
|
|
|
*/
|
|
|
|
|
|
|
|
var tokenize = linkify.tokenize;
|
|
|
|
var options = linkify.options;
|
|
|
|
var Options = options.Options;
|
|
|
|
|
|
|
|
|
|
|
|
function escapeText(text) {
|
|
|
|
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
|
|
}
|
|
|
|
|
|
|
|
function escapeAttr(href) {
|
|
|
|
return href.replace(/"/g, '"');
|
|
|
|
}
|
|
|
|
|
|
|
|
function attributesToString(attributes) {
|
|
|
|
if (!attributes) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
var result = [];
|
|
|
|
|
|
|
|
for (var attr in attributes) {
|
|
|
|
var val = attributes[attr] + '';
|
|
|
|
result.push(attr + '="' + escapeAttr(val) + '"');
|
|
|
|
}
|
|
|
|
return result.join(' ');
|
|
|
|
}
|
|
|
|
|
2022-12-06 16:37:22 -05:00
|
|
|
function linkifyStr(str, color='#0645AD') {
|
misc: vendor libjamiclient into 'src/libclient/'
This is libjamiclient from the jami-libclient.git repository as of
767c45b8b09806ac05cbada720864df93588c047, with the following changes:
* src/libclient/newaccountmodel.cpp:
(NewAccountModelPimpl::removeFromAccounts): The lock wait inside
'#ifdef CHK_FREEABLE_BEFORE_ERASE_ACCOUNT' was not updated when the
type of 'accounts' was changed over the years from this:
std::map<std::string, account::Info>
to this:
std::map<QString, std::pair<account::Info, std::shared_ptr<Database>>>
Basically we need to get the 'first' of the pair for 'account::Info'.
So we now do that.
* src/libclient/avmodel.cpp:
* src/libclient/callbackshandler.cpp:
* src/libclient/contactmodel.cpp:
* src/libclient/conversationmodel.cpp:
* src/libclient/database.cpp:
* src/libclient/namedirectory.cpp:
* src/libclient/newaccountmodel.cpp:
* src/libclient/newcallmodel.cpp:
* src/libclient/newdevicemodel.cpp:
* src/libclient/peerdiscoverymodel.cpp:
* src/libclient/pluginmodel.cpp:
* src/libclient/smartinfohub.cpp:
* src/libclient/vcard.h:
* src/libclient/authority/storagehelper.cpp: Replace Qt's 'foreach'
with 'Q_FOREACH' and its 'emit' with 'Q_EMIT' because in the client-qt
code base we have '-DQT_NO_KEYWORDS' to avoid conflicts with other
libraries we use.
* cmake/FindLibJami.cmake: Import cmake/FindRing.cmake from the
jami-libclient.git repository. Then, rename RING_BUILD_DIR to
LIBJAMI_BUILD_DIR (though the old name is still supported for now).
Also update other references of Ring to Jami. Further, add additional
calls to 'find_library' to make sure specified local paths for libjami
are checked before system-wide ones (in case of older/obsolete libjami
being available system-wide, which might happen on GNU/Linux systems).
* translations/lrc_*.ts: Import translation files from the libclient
repository. The message location paths were corrected by running
"sed -i 's|../src|&/libclient|g' lrc_*.ts" in 'translations/'.
.tx/config: Add section for the newly-imported libclient translations.
* CMakeLists.txt: Reformat, plus various fixes and cleanups, such as
changing indentation to 2 spaces and wrapping lines at 70 characters,
renaming the parent directory of translations from 'ring' to 'jami',
and using all lowercase function calls. Also add copyright headers.
* src/app/appsettingsmanager.cpp:
(AppSettingsManager::loadTranslations):
* src/app/utilsadapter.cpp (UtilsAdapter::supportedLang): Update to
adapt to the renaming of the parent directory of translations from
'ring' to 'jami'.
GitLab: #748
Change-Id: I86e3b0fb30e554755023e7b858b6a0d132cd59ab
2022-05-06 16:00:16 -04:00
|
|
|
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
|
|
|
|
|
|
opts = new Options(opts);
|
|
|
|
|
|
|
|
var tokens = tokenize(str);
|
|
|
|
var result = [];
|
|
|
|
|
|
|
|
for (var i = 0; i < tokens.length; i++) {
|
|
|
|
var token = tokens[i];
|
|
|
|
|
|
|
|
if (token.type === 'nl' && opts.nl2br) {
|
|
|
|
result.push('<br>\n');
|
|
|
|
continue;
|
|
|
|
} else if (!token.isLink || !opts.check(token)) {
|
|
|
|
result.push(escapeText(token.toString()));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
var _opts$resolve = opts.resolve(token);
|
|
|
|
|
|
|
|
var formatted = _opts$resolve.formatted;
|
|
|
|
var formattedHref = _opts$resolve.formattedHref;
|
|
|
|
var tagName = _opts$resolve.tagName;
|
|
|
|
var className = _opts$resolve.className;
|
|
|
|
var target = _opts$resolve.target;
|
|
|
|
var attributes = _opts$resolve.attributes;
|
|
|
|
|
|
|
|
|
|
|
|
var link = '<' + tagName + ' href="' + escapeAttr(formattedHref) + '"';
|
|
|
|
|
|
|
|
if (className) {
|
|
|
|
link += ' class="' + escapeAttr(className) + '"';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target) {
|
|
|
|
link += ' target="' + escapeAttr(target) + '"';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (attributes) {
|
|
|
|
link += ' ' + attributesToString(attributes);
|
|
|
|
}
|
|
|
|
|
2022-12-06 16:37:22 -05:00
|
|
|
link += ' style="color: '+color+';">' + escapeText(formatted) + '</' + tagName + '>';
|
misc: vendor libjamiclient into 'src/libclient/'
This is libjamiclient from the jami-libclient.git repository as of
767c45b8b09806ac05cbada720864df93588c047, with the following changes:
* src/libclient/newaccountmodel.cpp:
(NewAccountModelPimpl::removeFromAccounts): The lock wait inside
'#ifdef CHK_FREEABLE_BEFORE_ERASE_ACCOUNT' was not updated when the
type of 'accounts' was changed over the years from this:
std::map<std::string, account::Info>
to this:
std::map<QString, std::pair<account::Info, std::shared_ptr<Database>>>
Basically we need to get the 'first' of the pair for 'account::Info'.
So we now do that.
* src/libclient/avmodel.cpp:
* src/libclient/callbackshandler.cpp:
* src/libclient/contactmodel.cpp:
* src/libclient/conversationmodel.cpp:
* src/libclient/database.cpp:
* src/libclient/namedirectory.cpp:
* src/libclient/newaccountmodel.cpp:
* src/libclient/newcallmodel.cpp:
* src/libclient/newdevicemodel.cpp:
* src/libclient/peerdiscoverymodel.cpp:
* src/libclient/pluginmodel.cpp:
* src/libclient/smartinfohub.cpp:
* src/libclient/vcard.h:
* src/libclient/authority/storagehelper.cpp: Replace Qt's 'foreach'
with 'Q_FOREACH' and its 'emit' with 'Q_EMIT' because in the client-qt
code base we have '-DQT_NO_KEYWORDS' to avoid conflicts with other
libraries we use.
* cmake/FindLibJami.cmake: Import cmake/FindRing.cmake from the
jami-libclient.git repository. Then, rename RING_BUILD_DIR to
LIBJAMI_BUILD_DIR (though the old name is still supported for now).
Also update other references of Ring to Jami. Further, add additional
calls to 'find_library' to make sure specified local paths for libjami
are checked before system-wide ones (in case of older/obsolete libjami
being available system-wide, which might happen on GNU/Linux systems).
* translations/lrc_*.ts: Import translation files from the libclient
repository. The message location paths were corrected by running
"sed -i 's|../src|&/libclient|g' lrc_*.ts" in 'translations/'.
.tx/config: Add section for the newly-imported libclient translations.
* CMakeLists.txt: Reformat, plus various fixes and cleanups, such as
changing indentation to 2 spaces and wrapping lines at 70 characters,
renaming the parent directory of translations from 'ring' to 'jami',
and using all lowercase function calls. Also add copyright headers.
* src/app/appsettingsmanager.cpp:
(AppSettingsManager::loadTranslations):
* src/app/utilsadapter.cpp (UtilsAdapter::supportedLang): Update to
adapt to the renaming of the parent directory of translations from
'ring' to 'jami'.
GitLab: #748
Change-Id: I86e3b0fb30e554755023e7b858b6a0d132cd59ab
2022-05-06 16:00:16 -04:00
|
|
|
result.push(link);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result.join('');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!String.prototype.linkify) {
|
|
|
|
String.prototype.linkify = function (opts) {
|
|
|
|
return linkifyStr(this, opts);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return linkifyStr;
|
|
|
|
}(linkify);
|
|
|
|
window.linkifyStr = linkifyString;
|
|
|
|
})(window, linkify);
|