mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
misc: clean warnings
Change-Id: I749159077ac20da0862dcfc774729bff4a356404
This commit is contained in:
parent
b34b373d2f
commit
932fbae84b
5 changed files with 59 additions and 28 deletions
|
@ -238,6 +238,7 @@ endif()
|
||||||
set(LIBCLIENT_SOURCES
|
set(LIBCLIENT_SOURCES
|
||||||
# data objects
|
# data objects
|
||||||
uri.cpp
|
uri.cpp
|
||||||
|
vcard.cpp
|
||||||
|
|
||||||
# models
|
# models
|
||||||
contactmodel.cpp
|
contactmodel.cpp
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#ifdef ENABLE_LIBWRAP
|
#ifdef ENABLE_LIBWRAP
|
||||||
// For the debugMessageReceived connection that queues const std::string refs
|
// For the debugMessageReceived connection that queues const std::string refs
|
||||||
// when not using dbus
|
// when not using dbus
|
||||||
Q_DECLARE_METATYPE(std::string);
|
Q_DECLARE_METATYPE(std::string)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace lrc {
|
namespace lrc {
|
||||||
|
|
|
@ -101,7 +101,7 @@ CallParticipants::removeParticipant(int index)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(participantsMtx_);
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
auto it = participants_.begin() + index;
|
auto it = std::next(participants_.begin(), index);
|
||||||
participants_.erase(it);
|
participants_.erase(it);
|
||||||
}
|
}
|
||||||
Q_EMIT linked_.participantRemoved(callId_, idx_);
|
Q_EMIT linked_.participantRemoved(callId_, idx_);
|
||||||
|
@ -115,7 +115,7 @@ CallParticipants::addParticipant(const ParticipantInfos& participant)
|
||||||
std::lock_guard<std::mutex> lk(participantsMtx_);
|
std::lock_guard<std::mutex> lk(participantsMtx_);
|
||||||
auto it = participants_.find(participant.sinkId);
|
auto it = participants_.find(participant.sinkId);
|
||||||
if (it == participants_.end()) {
|
if (it == participants_.end()) {
|
||||||
participants_.insert(participants_.begin() + idx_, participant.sinkId, participant);
|
participants_.insert(std::next(participants_.begin(), idx_), participant.sinkId, participant);
|
||||||
added = true;
|
added = true;
|
||||||
} else {
|
} else {
|
||||||
if (participant == (*it))
|
if (participant == (*it))
|
||||||
|
@ -179,7 +179,7 @@ CallParticipants::toQJsonObject(uint index) const
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
QJsonObject ret;
|
QJsonObject ret;
|
||||||
const auto& participant = participants_.begin() + index;
|
const auto& participant = std::next(participants_.begin(), index);
|
||||||
|
|
||||||
ret[ParticipantsInfosStrings::URI] = participant->uri;
|
ret[ParticipantsInfosStrings::URI] = participant->uri;
|
||||||
ret[ParticipantsInfosStrings::DEVICE] = participant->device;
|
ret[ParticipantsInfosStrings::DEVICE] = participant->device;
|
||||||
|
|
53
src/libclient/vcard.cpp
Normal file
53
src/libclient/vcard.cpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018-2022 Savoir-faire Linux Inc.
|
||||||
|
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vcard.h"
|
||||||
|
|
||||||
|
namespace lrc {
|
||||||
|
namespace vCard {
|
||||||
|
namespace utils {
|
||||||
|
|
||||||
|
QHash<QByteArray, QByteArray>
|
||||||
|
toHashMap(const QByteArray& content)
|
||||||
|
{
|
||||||
|
// TODO without Qt
|
||||||
|
QHash<QByteArray, QByteArray> vCard;
|
||||||
|
QByteArray previousKey, previousValue;
|
||||||
|
const QList<QByteArray> lines = content.split('\n');
|
||||||
|
|
||||||
|
Q_FOREACH (const QByteArray& property, lines) {
|
||||||
|
// Ignore empty lines
|
||||||
|
if (property.size()) {
|
||||||
|
// Some properties are over multiple lines
|
||||||
|
if (property[0] == ' ' && previousKey.size()) {
|
||||||
|
previousValue += property.right(property.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not use split, URIs can have : in them
|
||||||
|
const int dblptPos = property.indexOf(':');
|
||||||
|
const QByteArray k(property.left(dblptPos)),
|
||||||
|
v(property.right(property.size() - dblptPos - 1));
|
||||||
|
vCard[k] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace utils
|
||||||
|
} // namespace vCard
|
||||||
|
} // namespace lrc
|
|
@ -79,31 +79,8 @@ namespace utils {
|
||||||
* @param content payload
|
* @param content payload
|
||||||
* @return the vCard representation
|
* @return the vCard representation
|
||||||
*/
|
*/
|
||||||
static QHash<QByteArray, QByteArray>
|
QHash<QByteArray, QByteArray> toHashMap(const QByteArray& content);
|
||||||
toHashMap(const QByteArray& content)
|
|
||||||
{
|
|
||||||
// TODO without Qt
|
|
||||||
QHash<QByteArray, QByteArray> vCard;
|
|
||||||
QByteArray previousKey, previousValue;
|
|
||||||
const QList<QByteArray> lines = content.split('\n');
|
|
||||||
|
|
||||||
Q_FOREACH (const QByteArray& property, lines) {
|
|
||||||
// Ignore empty lines
|
|
||||||
if (property.size()) {
|
|
||||||
// Some properties are over multiple lines
|
|
||||||
if (property[0] == ' ' && previousKey.size()) {
|
|
||||||
previousValue += property.right(property.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not use split, URIs can have : in them
|
|
||||||
const int dblptPos = property.indexOf(':');
|
|
||||||
const QByteArray k(property.left(dblptPos)),
|
|
||||||
v(property.right(property.size() - dblptPos - 1));
|
|
||||||
vCard[k] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return vCard;
|
|
||||||
}
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
} // namespace vCard
|
} // namespace vCard
|
||||||
} // namespace lrc
|
} // namespace lrc
|
||||||
|
|
Loading…
Add table
Reference in a new issue