Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
d1e9d14c
Commit
d1e9d14c
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
Enable the user to activate or not the url hooks
parent
5dbb1474
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
sflphone-gtk/src/hooks-config.c
+19
-5
19 additions, 5 deletions
sflphone-gtk/src/hooks-config.c
sflphone-gtk/src/hooks-config.h
+3
-3
3 additions, 3 deletions
sflphone-gtk/src/hooks-config.h
src/managerimpl.cpp
+3
-0
3 additions, 0 deletions
src/managerimpl.cpp
src/user_cfg.h
+1
-0
1 addition, 0 deletions
src/user_cfg.h
with
26 additions
and
8 deletions
sflphone-gtk/src/hooks-config.c
+
19
−
5
View file @
d1e9d14c
...
...
@@ -37,10 +37,12 @@ void hooks_load_parameters (URLHook_Config** settings){
if
(
_params
==
NULL
)
{
_settings
->
sip_field
=
DEFAULT_SIP_URL_FIELD
;
_settings
->
command
=
DEFAULT_URL_COMMAND
;
_settings
->
sip_enabled
=
"0"
;
}
else
{
_settings
->
sip_field
=
(
gchar
*
)(
g_hash_table_lookup
(
_params
,
URLHOOK_SIP_FIELD
));
_settings
->
command
=
(
gchar
*
)(
g_hash_table_lookup
(
_params
,
URLHOOK_COMMAND
));
_settings
->
sip_enabled
=
(
gchar
*
)(
g_hash_table_lookup
(
_params
,
URLHOOK_SIP_ENABLED
));
}
*
settings
=
_settings
;
...
...
@@ -56,6 +58,8 @@ void hooks_save_parameters (void){
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
field
))));
g_hash_table_replace
(
params
,
(
gpointer
)
URLHOOK_COMMAND
,
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
command
))));
g_hash_table_replace
(
params
,
(
gpointer
)
URLHOOK_SIP_ENABLED
,
(
gpointer
)
g_strdup
(
_urlhook_config
->
sip_enabled
));
dbus_set_hook_settings
(
params
);
...
...
@@ -64,6 +68,16 @@ void hooks_save_parameters (void){
}
static
void
sip_enabled_cb
(
GtkWidget
*
widget
)
{
guint
check
;
check
=
(
guint
)
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
widget
));
if
(
check
)
_urlhook_config
->
sip_enabled
=
"1"
;
else
_urlhook_config
->
sip_enabled
=
"0"
;
}
GtkWidget
*
create_hooks_settings
(){
...
...
@@ -86,17 +100,17 @@ GtkWidget* create_hooks_settings (){
gtk_container_add
(
GTK_CONTAINER
(
url_frame
)
,
table
);
field
=
gtk_check_button_new_with_mnemonic
(
_
(
"_SIP protocol"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
field
),
TRU
E
);
g_signal_connect
(
G_OBJECT
(
field
)
,
"clicked"
,
NULL
,
NULL
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
field
),
(
g_strcasecmp
(
_urlhook_config
->
sip_enabled
,
"1"
)
==
0
)
?
TRUE
:
FALS
E
);
g_signal_connect
(
G_OBJECT
(
field
)
,
"clicked"
,
G_CALLBACK
(
sip_enabled_cb
)
,
NULL
);
gtk_table_attach
(
GTK_TABLE
(
table
),
field
,
0
,
2
,
1
,
2
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
field
=
gtk_check_button_new_with_mnemonic
(
_
(
"_IAX2 protocol"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
field
),
TRUE
);
g_signal_connect
(
G_OBJECT
(
field
)
,
"clicked"
,
NULL
,
NULL
);
//
g_signal_connect (G_OBJECT(field) , "clicked" , NULL, NULL);
gtk_table_attach
(
GTK_TABLE
(
table
),
field
,
0
,
2
,
2
,
3
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
field
),
FALSE
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"_SIP Field name: "
));
label
=
gtk_label_new_with_mnemonic
(
_
(
"_SIP Header: "
));
gtk_table_attach
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
3
,
4
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
field
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
field
);
...
...
This diff is collapsed.
Click to expand it.
sflphone-gtk/src/hooks-config.h
+
3
−
3
View file @
d1e9d14c
...
...
@@ -27,15 +27,15 @@
G_BEGIN_DECLS
#define DEFAULT_SIP_URL_FIELD "X-
Call-U
rl"
#define DEFAULT_SIP_URL_FIELD "X-
sflphone-u
rl"
#define DEFAULT_URL_COMMAND "x-www-browser"
#define URLHOOK_COMMAND "URLHOOK_COMMAND"
#define URLHOOK_SIP_FIELD "URLHOOK_SIP_FIELD"
#define URLHOOK_SIP_ENABLED "URLHOOK_SIP_ENABLED"
typedef
struct
_URLHook_Config
{
guint
sip_enabled
;
guint
iax2_enabled
;
gchar
*
sip_enabled
;
gchar
*
sip_field
;
gchar
*
command
;
}
URLHook_Config
;
...
...
This diff is collapsed.
Click to expand it.
src/managerimpl.cpp
+
3
−
0
View file @
d1e9d14c
...
...
@@ -1208,6 +1208,7 @@ ManagerImpl::initConfigFile ( bool load_user_value )
section
=
HOOKS
;
fill_config_str
(
URLHOOK_SIP_FIELD
,
HOOK_DEFAULT_SIP_FIELD
);
fill_config_str
(
URLHOOK_COMMAND
,
HOOK_DEFAULT_URL_COMMAND
);
fill_config_str
(
URLHOOK_SIP_ENABLED
,
NO_STR
);
// Loads config from ~/.sflphone/sflphonedrc or so..
if
(
createSettingsPath
()
==
1
&&
load_user_value
)
{
...
...
@@ -2573,6 +2574,7 @@ std::map<std::string, std::string> ManagerImpl::getHookSettings () {
settings
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
"URLHOOK_SIP_FIELD"
,
getConfigString
(
HOOKS
,
URLHOOK_SIP_FIELD
))
);
settings
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
"URLHOOK_COMMAND"
,
getConfigString
(
HOOKS
,
URLHOOK_COMMAND
))
);
settings
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
"URLHOOK_SIP_ENABLED"
,
getConfigString
(
HOOKS
,
URLHOOK_SIP_ENABLED
))
);
return
settings
;
}
...
...
@@ -2581,6 +2583,7 @@ void ManagerImpl::setHookSettings (const std::map<std::string, std::string>& set
setConfig
(
HOOKS
,
URLHOOK_SIP_FIELD
,
(
*
settings
.
find
(
"URLHOOK_SIP_FIELD"
)).
second
);
setConfig
(
HOOKS
,
URLHOOK_COMMAND
,
(
*
settings
.
find
(
"URLHOOK_COMMAND"
)).
second
);
setConfig
(
HOOKS
,
URLHOOK_SIP_ENABLED
,
(
*
settings
.
find
(
"URLHOOK_SIP_ENABLED"
)).
second
);
// Write it to the configuration file
saveConfig
();
...
...
This diff is collapsed.
Click to expand it.
src/user_cfg.h
+
1
−
0
View file @
d1e9d14c
...
...
@@ -81,6 +81,7 @@
#define HOOKS "Hooks"
/** Hooks section */
#define URLHOOK_SIP_FIELD "Hooks.url_sip_field"
#define URLHOOK_COMMAND "Hooks.url_command"
#define URLHOOK_SIP_ENABLED "Hooks.sip_enabled"
#define EMPTY_FIELD ""
/** Default value for empty field */
#define DFT_STUN_SERVER "stun.ekiga.net"
/** Default STUN server address */
...
...
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