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-daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
130
Issues
130
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-daemon
Commits
53c38347
Commit
53c38347
authored
Mar 18, 2009
by
Emmanuel Milou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hooks squeleton on daemon side
parent
fb946454
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
134 additions
and
108 deletions
+134
-108
configure.ac
configure.ac
+2
-1
sflphone-gtk/src/historyfilter.c
sflphone-gtk/src/historyfilter.c
+0
-89
sflphone-gtk/src/main.c
sflphone-gtk/src/main.c
+1
-1
src/Makefile.am
src/Makefile.am
+2
-1
src/global.h
src/global.h
+1
-1
src/hooks/Makefile.am
src/hooks/Makefile.am
+6
-0
src/hooks/urlhook.cpp
src/hooks/urlhook.cpp
+8
-15
src/hooks/urlhook.h
src/hooks/urlhook.h
+46
-0
test/hooksTest.h
test/hooksTest.h
+68
-0
No files found.
configure.ac
View file @
53c38347
...
...
@@ -39,7 +39,8 @@ AC_CONFIG_FILES([src/Makefile \
src/dbus/Makefile \
src/plug-in/audiorecorder/Makefile \
src/plug-in/Makefile \
src/plug-in/test/Makefile])
src/plug-in/test/Makefile \
src/hooks/Makefile])
dnl Unitary test section
AC_CONFIG_FILES([test/Makefile])
...
...
sflphone-gtk/src/historyfilter.c
deleted
100644 → 0
View file @
fb946454
/*
* Copyright (C) 2008 Savoir-Faire Linux inc.
* Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include <historyfilter.h>
#include <calltree.h>
GtkWidget
*
filter_entry
;
GtkTreeModel
*
create_filter
(
GtkTreeModel
*
child
)
{
GtkTreeModel
*
ret
=
gtk_tree_model_filter_new
(
child
,
NULL
);
gtk_tree_model_filter_set_visible_func
(
GTK_TREE_MODEL_FILTER
(
ret
),
is_visible
,
NULL
,
NULL
);
return
GTK_TREE_MODEL
(
ret
);
}
gboolean
is_visible
(
GtkTreeModel
*
model
,
GtkTreeIter
*
iter
,
gpointer
data
UNUSED
)
{
if
(
SHOW_SEARCHBAR
)
{
GValue
val
;
gchar
*
text
=
NULL
;
gchar
*
search
=
(
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
filter_entry
));
memset
(
&
val
,
0
,
sizeof
(
val
));
gtk_tree_model_get_value
(
GTK_TREE_MODEL
(
model
),
iter
,
1
,
&
val
);
if
(
G_VALUE_HOLDS_STRING
(
&
val
)){
text
=
(
gchar
*
)
g_value_get_string
(
&
val
);
}
if
(
text
!=
NULL
&&
g_ascii_strncasecmp
(
search
,
_
(
"Search"
),
6
)
!=
0
){
return
g_regex_match_simple
(
search
,
text
,
G_REGEX_CASELESS
,
0
);
}
g_value_unset
(
&
val
);
return
TRUE
;
}
return
TRUE
;
}
void
filter_entry_changed
(
GtkEntry
*
entry
UNUSED
,
gchar
*
arg1
UNUSED
,
gpointer
data
UNUSED
)
{
gtk_toggle_tool_button_set_active
(
GTK_TOGGLE_TOOL_BUTTON
(
historyButton
),
TRUE
);
gtk_tree_model_filter_refilter
(
GTK_TREE_MODEL_FILTER
(
histfilter
));
}
void
clear_filter_entry_if_default
(
GtkWidget
*
widget
UNUSED
,
gpointer
user_data
UNUSED
)
{
if
(
g_ascii_strncasecmp
(
gtk_entry_get_text
(
GTK_ENTRY
(
filter_entry
)),
_
(
"Search"
),
6
)
==
0
)
gtk_entry_set_text
(
GTK_ENTRY
(
filter_entry
),
""
);
}
GtkWidget
*
create_filter_entry
()
{
GtkWidget
*
image
;
GtkWidget
*
ret
=
gtk_hbox_new
(
FALSE
,
0
);
filter_entry
=
sexy_icon_entry_new
();
//filter_entry = gtk_entry_new();
image
=
gtk_image_new_from_stock
(
GTK_STOCK_FIND
,
GTK_ICON_SIZE_SMALL_TOOLBAR
);
sexy_icon_entry_set_icon
(
SEXY_ICON_ENTRY
(
filter_entry
),
SEXY_ICON_ENTRY_PRIMARY
,
GTK_IMAGE
(
image
)
);
sexy_icon_entry_add_clear_button
(
SEXY_ICON_ENTRY
(
filter_entry
)
);
gtk_entry_set_text
(
GTK_ENTRY
(
filter_entry
),
_
(
"Search"
));
g_signal_connect
(
GTK_ENTRY
(
filter_entry
),
"changed"
,
G_CALLBACK
(
filter_entry_changed
),
NULL
);
g_signal_connect
(
GTK_ENTRY
(
filter_entry
),
"grab-focus"
,
G_CALLBACK
(
clear_filter_entry_if_default
),
NULL
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
filter_entry
,
TRUE
,
TRUE
,
0
);
return
ret
;
}
sflphone-gtk/src/main.c
View file @
53c38347
...
...
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
gtk_init
(
&
argc
,
&
argv
);
g_print
(
"%s
\n
"
,
PACKAGE_STRING
);
g_print
(
"Copyright (c) 2005 2006 2007 2008 Savoir-faire Linux Inc.
\n
"
);
g_print
(
"Copyright (c) 2005 2006 2007 2008
2009
Savoir-faire Linux Inc.
\n
"
);
g_print
(
"This is free software. You may redistribute copies of it under the terms of
\n
\
the GNU General Public License Version 3 <http://www.gnu.org/licenses/gpl.html>.
\n
\
There is NO WARRANTY, to the extent permitted by law.
\n\n
"
);
...
...
src/Makefile.am
View file @
53c38347
...
...
@@ -13,7 +13,7 @@ IAXSOURCES =
IAXHEADERS
=
endif
SUBDIRS
=
audio config dbus plug-in
SUBDIRS
=
audio config dbus plug-in
hooks
# Add here the cpp files to be build with sflphone
sflphoned_SOURCES
=
\
...
...
@@ -84,6 +84,7 @@ libsflphone_la_LIBADD = \
./config/libconfig.la
\
./plug-in/libplugin.la
\
./plug-in/audiorecorder/libaudiorecorder.la
\
./hooks/libhooks.la
\
$(IAX_LIBS)
libsflphone_la_SOURCES
=
src/global.h
View file @
53c38347
...
...
@@ -135,7 +135,7 @@ static const SOUND_FORMAT INT32 = 0x8;
#define DEFAULT_SIP_PORT 5060
#define HOOK_DEFAULT_SIP_FIELD "X-Call-
u
rl"
#define HOOK_DEFAULT_SIP_FIELD "X-Call-
U
rl"
#define HOOK_DEFAULT_URL_COMMAND "x-www-browser"
...
...
src/hooks/Makefile.am
0 → 100644
View file @
53c38347
SUBDIRS
=
noinst_LTLIBRARIES
=
libhooks.la
libhooks_la_SOURCES
=
\
urlhook.cpp urlhook.h
s
flphone-gtk/src/historyfilter.h
→
s
rc/hooks/urlhook.cpp
View file @
53c38347
/*
* Copyright (C) 200
7
Savoir-Faire Linux inc.
* Author:
Antoine Reversat <antoine.reversat
@savoirfairelinux.com>
*
* Copyright (C) 200
9
Savoir-Faire Linux inc.
* Author:
Emmanuel Milou <emmanuel.milou
@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __HFILTER_H__
#define __HFILTER_H__
#include <calllist.h>
#include <gtk/gtk.h>
#include <libsexy/sexy-icon-entry.h>
#include "urlhook.h"
GtkTreeModel
*
create_filter
(
GtkTreeModel
*
child
);
UrlHook
::
UrlHook
()
:
_command
(
""
),
_field
(
""
)
{
}
gboolean
is_visible
(
GtkTreeModel
*
model
,
GtkTreeIter
*
iter
,
gpointer
data
);
GtkWidget
*
create_filter_entry
();
#endif
UrlHook
::~
UrlHook
()
{
}
src/hooks/urlhook.h
0 → 100644
View file @
53c38347
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef URL_HOOK_H
#define URL_HOOK_H
#include <string>
class
UrlHook
{
public:
/**
* Constructor
*/
UrlHook
();
/**
* Destructor
*/
~
UrlHook
();
private:
/* The command to execute when receiving the URL */
std
::
string
_command
;
/* The field to look for in the header */
std
::
string
_field
;
};
#endif // URL_HOOK_H
test/hooksTest.h
0 → 100644
View file @
53c38347
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Cppunit import
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCaller.h>
#include <cppunit/TestCase.h>
#include <cppunit/TestSuite.h>
#include <assert.h>
/*
* @file hooksTest.cpp
* @brief Regroups unitary tests related to the hooks.
*/
#ifndef _HOOKS_TEST_
#define _HOOKS_TEST_
class
HooksTest
:
public
CppUnit
::
TestCase
{
/**
* Use cppunit library macros to add unit test the factory
*/
CPPUNIT_TEST_SUITE
(
HooksTest
);
CPPUNIT_TEST
();
CPPUNIT_TEST_SUITE_END
();
public:
HooksTest
()
:
CppUnit
::
TestCase
(
"Hooks implementation Tests"
)
{}
/*
* Code factoring - Common resources can be initialized here.
* This method is called by unitcpp before each test
*/
void
setUp
();
/*
* Code factoring - Common resources can be released here.
* This method is called by unitcpp after each test
*/
inline
void
tearDown
();
void
testUnloadPlugins
();
private:
};
/* Register our test module */
CPPUNIT_TEST_SUITE_REGISTRATION
(
HooksTest
);
#
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