Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
33c9ce5d
Commit
33c9ce5d
authored
Sep 06, 2013
by
Emmanuel Lepage Vallee
Browse files
* #29696: presence: move enable/disable to account settings
parent
556db131
Changes
9
Hide whitespace changes
Inline
Side-by-side
daemon/src/account_schema.h
View file @
33c9ce5d
...
...
@@ -55,10 +55,12 @@ static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfT
static
const
char
*
const
CONFIG_RINGTONE_PATH
=
"Account.ringtonePath"
;
static
const
char
*
const
CONFIG_RINGTONE_ENABLED
=
"Account.ringtoneEnabled"
;
static
const
char
*
const
CONFIG_KEEP_ALIVE_ENABLED
=
"Account.keepAliveEnabled"
;
static
const
char
*
const
CONFIG_PRESENCE_ENABLED
=
"Account.presenceModuleEnabled"
;
static
const
char
*
const
CONFIG_DEFAULT_REGISTRATION_EXPIRE
=
"60"
;
static
const
char
*
const
CONFIG_DEFAULT_RINGTONE_ENABLED
=
"true"
;
static
const
char
*
const
CONFIG_DEFAULT_PRESENCE_ENABLED
=
"true"
;
static
const
char
*
const
CONFIG_ACCOUNT_HOSTNAME
=
"Account.hostname"
;
static
const
char
*
const
CONFIG_ACCOUNT_USERNAME
=
"Account.username"
;
...
...
daemon/src/client/dbus/configurationmanager.cpp
View file @
33c9ce5d
...
...
@@ -147,12 +147,13 @@ void ConfigurationManager::registerAllAccounts()
std
::
map
<
std
::
string
,
std
::
string
>
ConfigurationManager
::
getAccountTemplate
()
{
std
::
map
<
std
::
string
,
std
::
string
>
accTemplate
;
accTemplate
[
CONFIG_LOCAL_PORT
]
=
CONFIG_DEFAULT_LOCAL_PORT
;
accTemplate
[
CONFIG_PUBLISHED_PORT
]
=
CONFIG_DEFAULT_PUBLISHED_PORT
;
accTemplate
[
CONFIG_LOCAL_PORT
]
=
CONFIG_DEFAULT_LOCAL_PORT
;
accTemplate
[
CONFIG_PUBLISHED_PORT
]
=
CONFIG_DEFAULT_PUBLISHED_PORT
;
accTemplate
[
CONFIG_PUBLISHED_SAMEAS_LOCAL
]
=
CONFIG_DEFAULT_PUBLISHED_SAMEAS_LOCAL
;
accTemplate
[
CONFIG_INTERFACE
]
=
CONFIG_DEFAULT_INTERFACE
;
accTemplate
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
=
CONFIG_DEFAULT_REGISTRATION_EXPIRE
;
accTemplate
[
CONFIG_RINGTONE_ENABLED
]
=
CONFIG_DEFAULT_RINGTONE_ENABLED
;
accTemplate
[
CONFIG_INTERFACE
]
=
CONFIG_DEFAULT_INTERFACE
;
accTemplate
[
CONFIG_ACCOUNT_REGISTRATION_EXPIRE
]
=
CONFIG_DEFAULT_REGISTRATION_EXPIRE
;
accTemplate
[
CONFIG_RINGTONE_ENABLED
]
=
CONFIG_DEFAULT_RINGTONE_ENABLED
;
accTemplate
[
CONFIG_PRESENCE_ENABLED
]
=
CONFIG_DEFAULT_PRESENCE_ENABLED
;
return
accTemplate
;
}
...
...
daemon/src/client/dbus/presencemanager-introspec.xml
View file @
33c9ce5d
...
...
@@ -3,11 +3,6 @@
<node
name=
"/presencemanager-introspec"
xmlns:tp=
"http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
>
<interface
name=
"org.sflphone.SFLphone.PresenceManager"
>
<!-- METHODS !-->
<method
name=
"enablePresence"
tp:name-for-bindings=
"enablePresence"
>
<tp:added
version=
"1.3.0"
/>
<arg
type=
"s"
name=
"accountID"
direction=
"in"
/>
<arg
type=
"b"
name=
"flag"
direction=
"in"
/>
</method>
<method
name=
"sendPresence"
tp:name-for-bindings=
"sendPresence"
>
<tp:added
version=
"1.3.0"
/>
<arg
type=
"s"
name=
"accountID"
direction=
"in"
/>
...
...
daemon/src/client/dbus/presencemanager.cpp
View file @
33c9ce5d
...
...
@@ -66,20 +66,6 @@ PresenceManager::subscribePresSubClient(const std::string& accountID, const std:
}
}
/**
* Enable the presence module (PUBLISH/SUBSCRIBE)
*/
void
PresenceManager
::
enablePresence
(
const
std
::
string
&
accountID
,
const
bool
&
flag
){
SIPAccount
*
sipaccount
=
Manager
::
instance
().
getSipAccount
(
accountID
);
if
(
!
sipaccount
)
ERROR
(
"Could not find account %s"
,
accountID
.
c_str
());
else
{
DEBUG
(
"Enable Presence (acc:%s : %s)"
,
accountID
.
c_str
(),
flag
?
"yes"
:
"no"
);
sipaccount
->
getPresence
()
->
enable
(
flag
);
}
}
/**
* push a presence for a account
* Notify for IP2IP account and publish for PBX account
...
...
daemon/src/client/presencemanager.h
View file @
33c9ce5d
...
...
@@ -82,7 +82,6 @@ class PresenceManager
#endif //__ANDROID__
/* Presence subscription/Notification. */
void
enablePresence
(
const
std
::
string
&
accountID
,
const
bool
&
flag
);
void
sendPresence
(
const
std
::
string
&
accountID
,
const
bool
&
status
,
const
std
::
string
&
note
);
void
approvePresSubServer
(
const
std
::
string
&
uri
,
const
bool
&
flag
);
void
subscribePresSubClient
(
const
std
::
string
&
accountID
,
const
std
::
string
&
uri
,
const
bool
&
flag
);
...
...
daemon/src/sip/sipaccount.cpp
View file @
33c9ce5d
...
...
@@ -603,6 +603,8 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
updateRange
(
tmpMin
,
tmpMax
,
videoPortRange_
);
#endif
enablePresence
(
details
[
CONFIG_PRESENCE_ENABLED
]
==
TRUE_STR
);
// srtp settings
srtpEnabled_
=
details
[
CONFIG_SRTP_ENABLE
]
==
TRUE_STR
;
srtpFallback_
=
details
[
CONFIG_SRTP_RTP_FALLBACK
]
==
TRUE_STR
;
...
...
@@ -698,6 +700,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
a
[
CONFIG_RINGTONE_PATH
]
=
ringtonePath_
;
a
[
CONFIG_RINGTONE_ENABLED
]
=
ringtoneEnabled_
?
TRUE_STR
:
FALSE_STR
;
a
[
CONFIG_ACCOUNT_MAILBOX
]
=
mailBox_
;
a
[
CONFIG_PRESENCE_ENABLED
]
=
getPresence
()
->
isEnabled
()
?
TRUE_STR
:
FALSE_STR
;
RegistrationState
state
=
UNREGISTERED
;
std
::
string
registrationStateCode
;
...
...
@@ -1381,10 +1384,19 @@ bool SIPAccount::isIP2IP() const{
return
accountID_
==
IP2IP_PROFILE
;
}
SIPPresence
*
SIPAccount
::
getPresence
(){
SIPPresence
*
SIPAccount
::
getPresence
()
const
{
return
presence_
;
}
/**
* Enable the presence module (PUBLISH/SUBSCRIBE)
*/
void
SIPAccount
::
enablePresence
(
const
bool
&
flag
){
DEBUG
(
"Enable Presence (acc:%s : %s)"
,
accountID_
.
c_str
(),
flag
?
"yes"
:
"no"
);
getPresence
()
->
enable
(
flag
);
}
bool
SIPAccount
::
matches
(
const
std
::
string
&
userName
,
const
std
::
string
&
server
,
pjsip_endpoint
*
endpt
,
pj_pool_t
*
pool
)
const
{
...
...
daemon/src/sip/sipaccount.h
View file @
33c9ce5d
...
...
@@ -534,7 +534,9 @@ class SIPAccount : public Account {
/**
* Presence management
*/
SIPPresence
*
getPresence
();
SIPPresence
*
getPresence
()
const
;
void
enablePresence
(
const
bool
&
flag
);
// unsigned generateAudioPort() const;
uint16_t
generateAudioPort
()
const
;
...
...
daemon/src/sip/sippresence.cpp
View file @
33c9ce5d
...
...
@@ -79,19 +79,19 @@ SIPPresence::~SIPPresence(){
removePresSubServer
(
s
);
}
SIPAccount
*
SIPPresence
::
getAccount
(){
SIPAccount
*
SIPPresence
::
getAccount
()
const
{
return
acc_
;
}
pjsip_pres_status
*
SIPPresence
::
getStatus
(){
pjsip_pres_status
*
SIPPresence
::
getStatus
()
{
return
&
pres_status_data
;
}
int
SIPPresence
::
getModId
(){
int
SIPPresence
::
getModId
()
const
{
return
((
SIPVoIPLink
*
)
(
acc_
->
getVoIPLink
()))
->
getModId
();
}
pj_pool_t
*
SIPPresence
::
getPool
(){
pj_pool_t
*
SIPPresence
::
getPool
()
const
{
return
pool_
;
}
...
...
daemon/src/sip/sippresence.h
View file @
33c9ce5d
...
...
@@ -118,7 +118,7 @@ public:
/**
* Return associated sipaccount
*/
SIPAccount
*
getAccount
();
SIPAccount
*
getAccount
()
const
;
/**
* Return presence data.
*/
...
...
@@ -126,11 +126,11 @@ public:
/**
* Return presence module ID which is actually the same as the VOIP link
*/
int
getModId
();
int
getModId
()
const
;
/**
* Return a pool for generic functions.
*/
pj_pool_t
*
getPool
();
pj_pool_t
*
getPool
()
const
;
/**
* Activate the module (PUBLISH/SUBSCRIBE)
*/
...
...
@@ -200,6 +200,10 @@ public:
* Iterate through the subscriber list and send NOTIFY to each.
*/
void
notifyPresSubServer
();
bool
isEnabled
()
const
{
return
enabled
;
}
/**
* Lock methods
...
...
Write
Preview
Supports
Markdown
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