Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblinphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
liblinphone
Commits
84585852
Commit
84585852
authored
Nov 13, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GruuAddress and use it in ParticipantDevice.
parent
2ad1f461
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
103 additions
and
30 deletions
+103
-30
address.cpp
src/address/address.cpp
+14
-0
address.h
src/address/address.h
+2
-0
gruu-address.cpp
src/address/gruu-address.cpp
+18
-4
gruu-address.h
src/address/gruu-address.h
+3
-0
simple-address.cpp
src/address/simple-address.cpp
+10
-1
simple-address.h
src/address/simple-address.h
+4
-0
local-conference-event-handler.cpp
src/conference/local-conference-event-handler.cpp
+2
-2
participant-device.cpp
src/conference/participant-device.cpp
+3
-1
participant-device.h
src/conference/participant-device.h
+13
-6
participant-p.h
src/conference/participant-p.h
+6
-5
participant.cpp
src/conference/participant.cpp
+28
-11
No files found.
src/address/address.cpp
View file @
84585852
...
...
@@ -22,6 +22,7 @@
#include "address-p.h"
#include "c-wrapper/c-wrapper.h"
#include "logger/logger.h"
#include "address/gruu-address.h"
#include "address/simple-address.h"
// =============================================================================
...
...
@@ -46,6 +47,19 @@ Address::Address (const Address &src) : ClonableObject(*new AddressPrivate) {
d
->
internalAddress
=
sal_address_clone
(
salAddress
);
}
Address
::
Address
(
const
GruuAddress
&
src
)
:
ClonableObject
(
*
new
AddressPrivate
)
{
L_D
();
string
uri
=
src
.
getScheme
()
+
":"
+
src
.
getUsername
()
+
"@"
;
if
(
src
.
getDomain
().
find
(
':'
)
!=
string
::
npos
)
uri
+=
"["
+
src
.
getDomain
()
+
"]"
;
else
uri
+=
src
.
getDomain
();
uri
+=
"?gr="
+
src
.
getUrn
();
if
(
!
(
d
->
internalAddress
=
sal_address_new
(
L_STRING_TO_C
(
uri
))))
{
lWarning
()
<<
"Cannot create Address, bad GruuAddress source"
;
}
}
Address
::
Address
(
const
SimpleAddress
&
src
)
:
ClonableObject
(
*
new
AddressPrivate
)
{
L_D
();
string
uri
=
src
.
getScheme
()
+
":"
+
src
.
getUsername
()
+
"@"
;
...
...
src/address/address.h
View file @
84585852
...
...
@@ -28,6 +28,7 @@
LINPHONE_BEGIN_NAMESPACE
class
AddressPrivate
;
class
GruuAddress
;
class
SimpleAddress
;
class
LINPHONE_PUBLIC
Address
:
public
ClonableObject
{
...
...
@@ -42,6 +43,7 @@ class LINPHONE_PUBLIC Address : public ClonableObject {
public
:
explicit
Address
(
const
std
::
string
&
address
=
""
);
Address
(
const
Address
&
src
);
Address
(
const
GruuAddress
&
src
);
Address
(
const
SimpleAddress
&
src
);
~
Address
();
...
...
src/address/gruu-address.cpp
View file @
84585852
...
...
@@ -31,28 +31,32 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
GruuAddress
::
GruuAddress
(
const
string
&
address
)
:
SimpleAddress
(
address
)
{
GruuAddress
::
GruuAddress
(
const
string
&
address
)
:
SimpleAddress
(
*
new
GruuAddressPrivate
)
{
L_D
();
Address
tmpAddress
(
address
);
if
(
tmpAddress
.
isValid
())
{
if
(
!
tmpAddress
.
hasUriParam
(
"gr"
))
return
;
SimpleAddress
base
(
address
);
SimpleAddress
::
clone
(
base
);
d
->
urn
=
tmpAddress
.
getUriParamValue
(
"gr"
);
d
->
valid
=
true
;
}
}
GruuAddress
::
GruuAddress
(
const
GruuAddress
&
src
)
:
SimpleAddress
(
src
)
{
GruuAddress
::
GruuAddress
(
const
GruuAddress
&
src
)
:
SimpleAddress
(
*
new
GruuAddressPrivate
)
{
L_D
();
SimpleAddress
::
clone
(
src
);
d
->
urn
=
src
.
getPrivate
()
->
urn
;
d
->
valid
=
src
.
getPrivate
()
->
valid
;
}
GruuAddress
::
GruuAddress
(
const
Address
&
src
)
:
SimpleAddress
(
src
)
{
GruuAddress
::
GruuAddress
(
const
Address
&
src
)
:
SimpleAddress
(
*
new
GruuAddressPrivate
)
{
L_D
();
if
(
src
.
isValid
())
{
if
(
!
src
.
hasUriParam
(
"gr"
))
return
;
SimpleAddress
::
clone
(
SimpleAddress
(
src
));
d
->
urn
=
src
.
getUriParamValue
(
"gr"
);
d
->
valid
=
true
;
}
...
...
@@ -85,9 +89,19 @@ bool GruuAddress::isValid () const {
return
d
->
valid
;
}
string
GruuAddress
::
getUrn
()
const
{
L_D
();
return
d
->
urn
;
}
void
GruuAddress
::
setUrn
(
const
string
&
urn
)
{
L_D
();
d
->
urn
=
urn
;
}
string
GruuAddress
::
asString
()
const
{
Address
tmpAddress
(
*
this
);
return
tmpAddress
.
asString
();
return
tmpAddress
.
asString
UriOnly
();
}
LINPHONE_END_NAMESPACE
src/address/gruu-address.h
View file @
84585852
...
...
@@ -45,6 +45,9 @@ public:
bool
isValid
()
const
;
std
::
string
getUrn
()
const
;
void
setUrn
(
const
std
::
string
&
urn
);
std
::
string
asString
()
const
override
;
private
:
...
...
src/address/simple-address.cpp
View file @
84585852
...
...
@@ -55,6 +55,8 @@ SimpleAddress::SimpleAddress (const Address &src) : ClonableObject(*new SimpleAd
d
->
domain
=
src
.
getDomain
();
}
SimpleAddress
::
SimpleAddress
(
SimpleAddressPrivate
&
p
)
:
ClonableObject
(
p
)
{}
SimpleAddress
&
SimpleAddress
::
operator
=
(
const
SimpleAddress
&
src
)
{
L_D
();
if
(
this
!=
&
src
)
{
...
...
@@ -106,7 +108,14 @@ bool SimpleAddress::setDomain (const string &domain) {
string
SimpleAddress
::
asString
()
const
{
Address
tmpAddress
(
*
this
);
return
tmpAddress
.
asString
();
return
tmpAddress
.
asStringUriOnly
();
}
void
SimpleAddress
::
clone
(
const
SimpleAddress
&
src
)
{
L_D
();
d
->
scheme
=
src
.
getPrivate
()
->
scheme
;
d
->
username
=
src
.
getPrivate
()
->
username
;
d
->
domain
=
src
.
getPrivate
()
->
domain
;
}
LINPHONE_END_NAMESPACE
src/address/simple-address.h
View file @
84585852
...
...
@@ -55,6 +55,10 @@ public:
virtual
std
::
string
asString
()
const
;
protected
:
explicit
SimpleAddress
(
SimpleAddressPrivate
&
p
);
void
clone
(
const
SimpleAddress
&
src
);
private
:
L_DECLARE_PRIVATE
(
SimpleAddress
);
};
...
...
src/conference/local-conference-event-handler.cpp
View file @
84585852
...
...
@@ -102,7 +102,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId)
user
.
setState
(
StateType
::
full
);
for
(
const
auto
&
device
:
participant
->
getPrivate
()
->
getDevices
())
{
const
string
&
gruu
=
device
.
getGruu
().
asStringUriOnly
();
const
string
&
gruu
=
device
->
getGruu
().
asString
();
EndpointType
endpoint
=
EndpointType
();
endpoint
.
setEntity
(
gruu
);
endpoint
.
setState
(
StateType
::
full
);
...
...
@@ -127,7 +127,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
shared_ptr
<
Participant
>
p
=
conf
->
findParticipant
(
addr
);
if
(
p
)
{
for
(
const
auto
&
device
:
p
->
getPrivate
()
->
getDevices
())
{
const
string
&
gruu
=
device
.
getGruu
().
asStringUriOnly
();
const
string
&
gruu
=
device
->
getGruu
().
asString
();
EndpointType
endpoint
=
EndpointType
();
endpoint
.
setEntity
(
gruu
);
endpoint
.
setState
(
StateType
::
full
);
...
...
src/conference/participant-device.cpp
View file @
84585852
...
...
@@ -25,7 +25,9 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
ParticipantDevice
::
ParticipantDevice
(
const
Address
&
gruu
)
{
ParticipantDevice
::
ParticipantDevice
()
{}
ParticipantDevice
::
ParticipantDevice
(
const
GruuAddress
&
gruu
)
{
mGruu
=
gruu
;
}
...
...
src/conference/participant-device.h
View file @
84585852
...
...
@@ -20,27 +20,34 @@
#ifndef _PARTICIPANT_DEVICE_H_
#define _PARTICIPANT_DEVICE_H_
#include <memory>
#include <string>
#include "address/address.h"
#include "address/
gruu-
address.h"
#include "linphone/utils/general.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
CallSession
;
class
ParticipantDevice
{
public
:
explicit
ParticipantDevice
(
const
Address
&
gruu
);
ParticipantDevice
();
explicit
ParticipantDevice
(
const
GruuAddress
&
gruu
);
bool
operator
==
(
const
ParticipantDevice
&
device
)
const
;
inline
const
Address
&
getGruu
()
const
{
return
mGruu
;
};
inline
const
GruuAddress
&
getGruu
()
const
{
return
mGruu
;
}
inline
std
::
shared_ptr
<
CallSession
>
getSession
()
const
{
return
mSession
;
}
inline
void
setSession
(
std
::
shared_ptr
<
CallSession
>
session
)
{
mSession
=
session
;
}
bool
isValid
()
const
{
return
mGruu
.
isValid
();
}
private
:
Address
mGruu
;
GruuAddress
mGruu
;
std
::
shared_ptr
<
CallSession
>
mSession
;
};
LINPHONE_END_NAMESPACE
...
...
src/conference/participant-p.h
View file @
84585852
...
...
@@ -48,10 +48,11 @@ public:
inline
void
setAddress
(
const
SimpleAddress
&
newAddr
)
{
addr
=
newAddr
;
}
inline
void
setAdmin
(
bool
isAdmin
)
{
this
->
isAdmin
=
isAdmin
;
}
inline
void
setContactAddress
(
const
Address
&
contactAddr
)
{
this
->
contactAddr
=
contactAddr
;
}
const
std
::
list
<
ParticipantDevice
>::
const_iterator
findDevice
(
const
Address
&
gruu
)
const
;
const
std
::
list
<
ParticipantDevice
>
&
getDevices
()
const
;
void
addDevice
(
const
Address
&
gruu
);
void
removeDevice
(
const
Address
&
gruu
);
std
::
shared_ptr
<
ParticipantDevice
>
findDevice
(
const
GruuAddress
&
gruu
)
const
;
std
::
shared_ptr
<
ParticipantDevice
>
findDevice
(
const
std
::
shared_ptr
<
const
CallSession
>
&
session
);
const
std
::
list
<
std
::
shared_ptr
<
ParticipantDevice
>>
&
getDevices
()
const
;
std
::
shared_ptr
<
ParticipantDevice
>
addDevice
(
const
GruuAddress
&
gruu
);
void
removeDevice
(
const
GruuAddress
&
gruu
);
private
:
SimpleAddress
addr
;
...
...
@@ -59,7 +60,7 @@ private:
bool
isAdmin
=
false
;
LinphoneEvent
*
conferenceSubscribeEvent
=
nullptr
;
std
::
shared_ptr
<
CallSession
>
session
;
std
::
list
<
ParticipantDevice
>
devices
;
std
::
list
<
std
::
shared_ptr
<
ParticipantDevice
>
>
devices
;
L_DECLARE_PUBLIC
(
Participant
);
};
...
...
src/conference/participant.cpp
View file @
84585852
...
...
@@ -62,25 +62,42 @@ void ParticipantPrivate::setConferenceSubscribeEvent (LinphoneEvent *ev) {
// -----------------------------------------------------------------------------
const
list
<
ParticipantDevice
>::
const_iterator
ParticipantPrivate
::
findDevice
(
const
Address
&
gruu
)
const
{
ParticipantDevice
device
(
gruu
);
return
find
(
devices
.
cbegin
(),
devices
.
cend
(),
device
);
shared_ptr
<
ParticipantDevice
>
ParticipantPrivate
::
findDevice
(
const
GruuAddress
&
gruu
)
const
{
for
(
const
auto
&
device
:
devices
)
{
if
(
device
->
getGruu
()
==
gruu
)
return
device
;
}
return
nullptr
;
}
shared_ptr
<
ParticipantDevice
>
ParticipantPrivate
::
findDevice
(
const
shared_ptr
<
const
CallSession
>
&
session
)
{
for
(
const
auto
&
device
:
devices
)
{
if
(
device
->
getSession
()
==
session
)
return
device
;
}
return
nullptr
;
}
const
list
<
ParticipantDevice
>
&
ParticipantPrivate
::
getDevices
()
const
{
const
list
<
shared_ptr
<
ParticipantDevice
>
>
&
ParticipantPrivate
::
getDevices
()
const
{
return
devices
;
}
void
ParticipantPrivate
::
addDevice
(
const
Address
&
gruu
)
{
ParticipantDevice
device
(
gruu
);
if
(
findDevice
(
gruu
)
==
devices
.
cend
())
shared_ptr
<
ParticipantDevice
>
ParticipantPrivate
::
addDevice
(
const
Gruu
Address
&
gruu
)
{
if
(
!
findDevice
(
gruu
))
{
shared_ptr
<
ParticipantDevice
>
device
=
make_shared
<
ParticipantDevice
>
(
gruu
);
devices
.
push_back
(
device
);
return
device
;
}
return
nullptr
;
}
void
ParticipantPrivate
::
removeDevice
(
const
Address
&
gruu
)
{
ParticipantDevice
device
(
gruu
);
if
(
findDevice
(
gruu
)
!=
devices
.
cend
())
devices
.
remove
(
device
);
void
ParticipantPrivate
::
removeDevice
(
const
GruuAddress
&
gruu
)
{
for
(
auto
it
=
devices
.
begin
();
it
!=
devices
.
end
();
it
++
)
{
if
((
*
it
)
->
getGruu
()
==
gruu
)
{
devices
.
erase
(
it
);
return
;
}
}
}
// =============================================================================
...
...
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