Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-lrc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
20
Issues
20
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-lrc
Commits
db54e18b
Unverified
Commit
db54e18b
authored
Jan 07, 2020
by
Ming Rui Zhang
Committed by
Sébastien Blin
Jan 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
displayname: add display name into alias for an incoming call
Change-Id: Ic7c9301f586e0af174e230badd952fbb0ef8bc61
parent
9354ee2c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
20 deletions
+41
-20
src/api/newcallmodel.h
src/api/newcallmodel.h
+2
-1
src/callbackshandler.cpp
src/callbackshandler.cpp
+9
-3
src/callbackshandler.h
src/callbackshandler.h
+3
-1
src/contactmodel.cpp
src/contactmodel.cpp
+23
-12
src/newcallmodel.cpp
src/newcallmodel.cpp
+4
-3
No files found.
src/api/newcallmodel.h
View file @
db54e18b
...
...
@@ -251,8 +251,9 @@ Q_SIGNALS:
* Emitted when a call is incoming
* @param callId
* @param fromId the peer uri
* @param displayname
*/
void
newIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
)
const
;
void
newIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
,
const
std
::
string
&
displayname
)
const
;
/**
* Emitted when a call is added to a conference
* @param callId
...
...
src/callbackshandler.cpp
View file @
db54e18b
...
...
@@ -323,16 +323,22 @@ CallbacksHandler::slotIncomingContactRequest(const QString& accountId,
void
CallbacksHandler
::
slotIncomingCall
(
const
QString
&
accountId
,
const
QString
&
callId
,
const
QString
&
fromUri
)
{
std
::
string
displayname
;
if
(
fromUri
.
contains
(
"ring.dht"
))
{
auto
qDisplayname
=
fromUri
.
left
(
fromUri
.
indexOf
(
"<"
)
+
1
);
if
(
qDisplayname
.
size
()
>
2
)
{
displayname
=
qDisplayname
.
left
(
qDisplayname
.
indexOf
(
"<"
)
-
1
).
toStdString
();
}
auto
fromQString
=
fromUri
.
right
(
50
);
fromQString
=
fromQString
.
left
(
40
);
emit
incomingCall
(
accountId
.
toStdString
(),
callId
.
toStdString
(),
fromQString
.
toStdString
());
emit
incomingCall
(
accountId
.
toStdString
(),
callId
.
toStdString
(),
fromQString
.
toStdString
()
,
displayname
);
}
else
{
auto
left
=
fromUri
.
indexOf
(
"<"
)
+
1
;
auto
left
=
fromUri
.
indexOf
(
"<"
)
+
1
;
auto
right
=
fromUri
.
indexOf
(
"@"
);
auto
fromQString
=
fromUri
.
mid
(
left
,
right
-
left
);
displayname
=
fromUri
.
left
(
fromUri
.
indexOf
(
"<"
)
-
1
).
toStdString
();
emit
incomingCall
(
accountId
.
toStdString
(),
callId
.
toStdString
(),
fromQString
.
toStdString
());
emit
incomingCall
(
accountId
.
toStdString
(),
callId
.
toStdString
(),
fromQString
.
toStdString
()
,
displayname
);
}
}
...
...
src/callbackshandler.h
View file @
db54e18b
...
...
@@ -103,10 +103,12 @@ Q_SIGNALS:
* @param accountId the one who receives the call
* @param callId the call id
* @param fromUri the caller uri
* @param displayName the display name of incoming call
*/
void
incomingCall
(
const
std
::
string
&
accountId
,
const
std
::
string
&
callId
,
const
std
::
string
&
fromUri
);
const
std
::
string
&
fromUri
,
const
std
::
string
&
displayName
);
/**
* Connect this signal to know when a call is updated
* @param callId the call id
...
...
src/contactmodel.cpp
View file @
db54e18b
...
...
@@ -82,9 +82,10 @@ public:
* @note: the contactId must corresponds to a profile in the database.
* @param contactId
* @param type
* @param displayName
* @param banned whether contact is banned or not
*/
void
addToContacts
(
const
std
::
string
&
contactId
,
const
profile
::
Type
&
type
,
bool
banned
=
false
);
void
addToContacts
(
const
std
::
string
&
contactId
,
const
profile
::
Type
&
type
,
const
std
::
string
&
displayName
=
""
,
bool
banned
=
false
);
/**
* Helpers for searchContact. Search for a given RING or SIP contact.
*/
...
...
@@ -158,8 +159,9 @@ public Q_SLOTS:
* Listen from callModel when an incoming call arrives.
* @param fromId
* @param callId
* @param displayName
*/
void
slotIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
);
void
slotIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
,
const
std
::
string
&
displayname
);
/**
* Listen from callbacksHandler for new account interaction and add pending contact if not present
...
...
@@ -530,7 +532,7 @@ ContactModelPimpl::fillWithJamiContacts() {
for
(
auto
contact_info
:
contacts_vector
)
{
std
::
lock_guard
<
std
::
mutex
>
lk
(
contactsMtx_
);
bool
banned
=
contact_info
[
"banned"
]
==
"true"
?
true
:
false
;
addToContacts
(
contact_info
[
"id"
].
toStdString
(),
linked
.
owner
.
profileInfo
.
type
,
banned
);
addToContacts
(
contact_info
[
"id"
].
toStdString
(),
linked
.
owner
.
profileInfo
.
type
,
""
,
banned
);
}
// Add pending contacts
...
...
@@ -637,7 +639,7 @@ ContactModelPimpl::slotContactAdded(const std::string& accountId, const std::str
bannedContacts
.
erase
(
it
);
}
addToContacts
(
contactUri
,
linked
.
owner
.
profileInfo
.
type
,
false
);
addToContacts
(
contactUri
,
linked
.
owner
.
profileInfo
.
type
,
""
,
false
);
}
}
...
...
@@ -701,10 +703,10 @@ ContactModelPimpl::slotContactRemoved(const std::string& accountId, const std::s
}
void
ContactModelPimpl
::
addToContacts
(
const
std
::
string
&
contactUri
,
const
profile
::
Type
&
type
,
bool
banned
)
ContactModelPimpl
::
addToContacts
(
const
std
::
string
&
contactUri
,
const
profile
::
Type
&
type
,
const
std
::
string
&
displayName
,
bool
banned
)
{
// create a vcard if necessary
profile
::
Info
profileInfo
{
contactUri
,
{}
,
{},
linked
.
owner
.
profileInfo
.
type
};
profile
::
Info
profileInfo
{
contactUri
,
displayName
,
{},
linked
.
owner
.
profileInfo
.
type
};
storage
::
createOrUpdateProfile
(
linked
.
owner
.
id
,
profileInfo
,
true
);
auto
contactInfo
=
storage
::
buildContactFromProfile
(
linked
.
owner
.
id
,
contactUri
,
type
);
...
...
@@ -715,6 +717,8 @@ ContactModelPimpl::addToContacts(const std::string& contactUri, const profile::T
ConfigurationManager
::
instance
().
lookupAddress
(
QString
::
fromStdString
(
linked
.
owner
.
id
),
""
,
QString
::
fromStdString
(
contactUri
));
PresenceManager
::
instance
().
subscribeBuddy
(
linked
.
owner
.
id
.
c_str
(),
contactUri
.
c_str
(),
!
banned
);
}
else
{
contactInfo
.
profileInfo
.
alias
=
displayName
;
}
contactInfo
.
profileInfo
.
type
=
type
;
// Because PENDING should not be stored in the database
...
...
@@ -811,17 +815,24 @@ ContactModelPimpl::slotIncomingContactRequest(const std::string& accountId,
}
void
ContactModelPimpl
::
slotIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
)
ContactModelPimpl
::
slotIncomingCall
(
const
std
::
string
&
fromId
,
const
std
::
string
&
callId
,
const
std
::
string
&
displayname
)
{
bool
emitContactAdded
=
false
;
{
std
::
lock_guard
<
std
::
mutex
>
lk
(
contactsMtx_
);
if
(
contacts
.
find
(
fromId
)
==
contacts
.
end
())
{
auto
it
=
contacts
.
find
(
fromId
);
if
(
it
==
contacts
.
end
())
{
// Contact not found, load profile from database.
// The conversation model will create an entry and link the incomingCall.
auto
type
=
(
linked
.
owner
.
profileInfo
.
type
==
profile
::
Type
::
RING
)
?
profile
::
Type
::
PENDING
:
profile
::
Type
::
SIP
;
addToContacts
(
fromId
,
type
,
false
);
addToContacts
(
fromId
,
type
,
displayname
,
false
);
emitContactAdded
=
true
;
}
else
{
// Update the display name
if
(
!
displayname
.
empty
())
{
it
->
second
.
profileInfo
.
alias
=
displayname
;
storage
::
createOrUpdateProfile
(
linked
.
owner
.
id
,
it
->
second
.
profileInfo
,
true
);
}
}
}
if
(
emitContactAdded
)
{
...
...
@@ -851,13 +862,13 @@ ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
if
(
linked
.
owner
.
profileInfo
.
type
==
profile
::
Type
::
SIP
)
{
std
::
string
potentialContact
=
sipUriReceivedFilter
(
from
);
if
(
potentialContact
.
empty
())
{
addToContacts
(
from
,
profile
::
Type
::
SIP
,
false
);
addToContacts
(
from
,
profile
::
Type
::
SIP
,
""
,
false
);
}
else
{
// equivalent uri exist, use that uri
from
=
potentialContact
;
}
}
else
{
addToContacts
(
from
,
profile
::
Type
::
PENDING
,
false
);
addToContacts
(
from
,
profile
::
Type
::
PENDING
,
""
,
false
);
emitNewTrust
=
true
;
}
}
...
...
@@ -937,7 +948,7 @@ ContactModelPimpl::slotNewAccountTransfer(long long dringId, datatransfer::Info
auto
type
=
(
linked
.
owner
.
profileInfo
.
type
==
profile
::
Type
::
RING
)
?
profile
::
Type
::
PENDING
:
profile
::
Type
::
SIP
;
addToContacts
(
info
.
peerUri
,
type
,
false
);
addToContacts
(
info
.
peerUri
,
type
,
""
,
false
);
emitNewTrust
=
(
linked
.
owner
.
profileInfo
.
type
==
profile
::
Type
::
RING
);
}
}
...
...
src/newcallmodel.cpp
View file @
db54e18b
...
...
@@ -149,8 +149,9 @@ public Q_SLOTS:
* @param accountId account which receives the call
* @param callId
* @param fromId peer uri
* @param displayname
*/
void
slotIncomingCall
(
const
std
::
string
&
accountId
,
const
std
::
string
&
callId
,
const
std
::
string
&
fromId
);
void
slotIncomingCall
(
const
std
::
string
&
accountId
,
const
std
::
string
&
callId
,
const
std
::
string
&
fromId
,
const
std
::
string
&
displayname
);
/**
* Listen from CallbacksHandler when a call got a new state
* @param callId
...
...
@@ -649,7 +650,7 @@ NewCallModel::hangupCallsAndConferences()
}
void
NewCallModelPimpl
::
slotIncomingCall
(
const
std
::
string
&
accountId
,
const
std
::
string
&
callId
,
const
std
::
string
&
fromId
)
NewCallModelPimpl
::
slotIncomingCall
(
const
std
::
string
&
accountId
,
const
std
::
string
&
callId
,
const
std
::
string
&
fromId
,
const
std
::
string
&
displayname
)
{
if
(
linked
.
owner
.
id
!=
accountId
)
{
return
;
...
...
@@ -674,7 +675,7 @@ NewCallModelPimpl::slotIncomingCall(const std::string& accountId, const std::str
return
;
}
emit
linked
.
newIncomingCall
(
fromId
,
callId
);
emit
linked
.
newIncomingCall
(
fromId
,
callId
,
displayname
);
// HACK. BECAUSE THE DAEMON DOESN'T HANDLE THIS CASE!
if
(
linked
.
owner
.
confProperties
.
autoAnswer
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment