Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
7af0cb82
Unverified
Commit
7af0cb82
authored
4 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
contactModel: use profileReceived signal
Change-Id: I91c3a81b78a4b2faad0979b59139f46594d1005a
parent
d44a6567
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/contactmodel.cpp
+41
-0
41 additions, 0 deletions
src/contactmodel.cpp
src/qtwrapper/configurationmanager_wrap.h
+5
-0
5 additions, 0 deletions
src/qtwrapper/configurationmanager_wrap.h
with
46 additions
and
0 deletions
src/contactmodel.cpp
+
41
−
0
View file @
7af0cb82
...
...
@@ -181,6 +181,14 @@ public Q_SLOTS:
* @param transferInfo DataTransferInfo structure from daemon
*/
void
slotNewAccountTransfer
(
long
long
dringId
,
datatransfer
::
Info
info
);
/**
* Listen from daemon to know when a VCard is received
* @param accountId
* @param peer
* @param vCard
*/
void
slotProfileReceived
(
const
QString
&
accountId
,
const
QString
&
peer
,
const
QString
&
vCard
);
};
using
namespace
authority
;
...
...
@@ -484,6 +492,8 @@ ContactModelPimpl::ContactModelPimpl(const ContactModel& linked,
this
,
&
ContactModelPimpl
::
slotNewAccountMessage
);
connect
(
&
callbacksHandler
,
&
CallbacksHandler
::
transferStatusCreated
,
this
,
&
ContactModelPimpl
::
slotNewAccountTransfer
);
connect
(
&
ConfigurationManager
::
instance
(),
&
ConfigurationManagerInterface
::
profileReceived
,
this
,
&
ContactModelPimpl
::
slotProfileReceived
);
}
ContactModelPimpl
::~
ContactModelPimpl
()
...
...
@@ -504,6 +514,8 @@ ContactModelPimpl::~ContactModelPimpl()
this
,
&
ContactModelPimpl
::
slotNewAccountMessage
);
disconnect
(
&
callbacksHandler
,
&
CallbacksHandler
::
transferStatusCreated
,
this
,
&
ContactModelPimpl
::
slotNewAccountTransfer
);
disconnect
(
&
ConfigurationManager
::
instance
(),
&
ConfigurationManagerInterface
::
profileReceived
,
this
,
&
ContactModelPimpl
::
slotProfileReceived
);
}
bool
...
...
@@ -969,6 +981,35 @@ ContactModelPimpl::slotNewAccountTransfer(long long dringId, datatransfer::Info
emit
linked
.
newAccountTransfer
(
dringId
,
info
);
}
void
ContactModelPimpl
::
slotProfileReceived
(
const
QString
&
accountId
,
const
QString
&
peer
,
const
QString
&
path
)
{
if
(
accountId
!=
linked
.
owner
.
id
)
return
;
QFile
vCardFile
(
path
);
if
(
!
vCardFile
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
return
;
QTextStream
in
(
&
vCardFile
);
auto
vCard
=
in
.
readAll
();
vCardFile
.
remove
();
profile
::
Info
profileInfo
;
profileInfo
.
uri
=
peer
;
profileInfo
.
type
=
profile
::
Type
::
RING
;
for
(
auto
&
e
:
QString
(
vCard
).
split
(
"
\n
"
))
if
(
e
.
contains
(
"PHOTO"
))
profileInfo
.
avatar
=
e
.
split
(
":"
)[
1
];
else
if
(
e
.
contains
(
"FN"
))
profileInfo
.
alias
=
e
.
split
(
":"
)[
1
];
contact
::
Info
contactInfo
;
contactInfo
.
profileInfo
=
profileInfo
;
linked
.
owner
.
contactModel
->
addContact
(
contactInfo
);
}
}
// namespace lrc
#include
"api/moc_contactmodel.cpp"
...
...
This diff is collapsed.
Click to expand it.
src/qtwrapper/configurationmanager_wrap.h
+
5
−
0
View file @
7af0cb82
...
...
@@ -168,6 +168,10 @@ public:
[
this
]
(
const
std
::
string
&
account_id
,
const
std
::
string
&
uri
,
const
bool
&
confirmed
)
{
Q_EMIT
this
->
contactAdded
(
QString
(
account_id
.
c_str
()),
QString
(
uri
.
c_str
()),
confirmed
);
}),
exportable_callback
<
ConfigurationSignal
::
ProfileReceived
>
(
[
this
]
(
const
std
::
string
&
accountID
,
const
std
::
string
&
peer
,
const
std
::
string
&
vCard
)
{
Q_EMIT
this
->
profileReceived
(
QString
(
accountID
.
c_str
()),
QString
(
peer
.
c_str
()),
QString
(
vCard
.
c_str
()));
}),
exportable_callback
<
ConfigurationSignal
::
ContactRemoved
>
(
[
this
]
(
const
std
::
string
&
account_id
,
const
std
::
string
&
uri
,
const
bool
&
banned
)
{
Q_EMIT
this
->
contactRemoved
(
QString
(
account_id
.
c_str
()),
QString
(
uri
.
c_str
()),
banned
);
...
...
@@ -748,6 +752,7 @@ Q_SIGNALS: // SIGNALS
void
migrationEnded
(
const
QString
&
accountID
,
const
QString
&
result
);
void
contactAdded
(
const
QString
&
accountID
,
const
QString
&
uri
,
bool
banned
);
void
contactRemoved
(
const
QString
&
accountID
,
const
QString
&
uri
,
bool
banned
);
void
profileReceived
(
const
QString
&
accountID
,
const
QString
&
peer
,
const
QString
&
vCard
);
void
dataTransferEvent
(
qulonglong
transfer_id
,
uint
code
);
void
deviceRevocationEnded
(
const
QString
&
accountId
,
const
QString
&
deviceId
,
int
status
);
void
accountAvatarReceived
(
const
QString
&
accountId
,
const
QString
&
userPhoto
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment