mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
daemon: remove plugins dir
Refs #69286 Change-Id: I317c222ba8e34977917c3bf0b791b53a2e4bd784
This commit is contained in:

committed by
Gerrit Code Review

parent
89809ab779
commit
b3c30a5304
21
plugins/.gitignore
vendored
21
plugins/.gitignore
vendored
@ -1,21 +0,0 @@
|
||||
m4
|
||||
aclocal.m4
|
||||
.cproject
|
||||
.project
|
||||
.settings/*
|
||||
active
|
||||
autom4te.cache/*
|
||||
compile
|
||||
config.guess
|
||||
config.*
|
||||
configure
|
||||
depcomp
|
||||
gnome-doc-utils.make
|
||||
install-sh
|
||||
ltmain.sh
|
||||
missing
|
||||
gnome.schemas
|
||||
ring.desktop
|
||||
ring.desktop.*
|
||||
stamp-h.in
|
||||
stamp-h1
|
340
plugins/COPYING
340
plugins/COPYING
@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -1,5 +0,0 @@
|
||||
SUBDIRS = addressbook
|
||||
|
||||
CFLAGS=-Wall -Werror -Wextra
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
@ -1,5 +0,0 @@
|
||||
Welcome to Ring!
|
||||
|
||||
Refer to the development site for further information: https://projects.savoirfairelinux.com/projects/show/sflphone
|
||||
|
||||
Thank you
|
@ -1 +0,0 @@
|
||||
SUBDIRS=evolution test
|
@ -1,23 +0,0 @@
|
||||
include ../../globals.mak
|
||||
|
||||
noinst_PROGRAMS = libevladdrbook.so
|
||||
|
||||
libevladdrbook_so_SOURCES = eds.c eds.h addressbook.c addressbook.h
|
||||
|
||||
libevladdrbook_so_LDFLAGS = --shared $(GLIB_LDFLAGS) $(GTK_LDFLAGS) $(LIBEDATASERVER_LDFLAGS) $(LIBEBOOK_LDFLAGS)
|
||||
|
||||
libevladdrbook_so_LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(LIBEDATASERVER_LIBS) $(LIBEBOOK_LIBS)
|
||||
|
||||
libevladdrbook_so_CFLAGS = -fPIC -g -Wall $(GTK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEBOOK_CFLAGS)
|
||||
|
||||
install-exec-local: install-libplugin_libevladdrbook_so
|
||||
|
||||
uninstall-local: uninstall-libplugin_libevladdrbook_so
|
||||
|
||||
install-libplugin_libevladdrbook_so: libevladdrbook.so
|
||||
mkdir -p $(sflplugindir)
|
||||
$(INSTALL_PROGRAM) libevladdrbook.so $(sflplugindir)
|
||||
|
||||
uninstall-libplugin_libevladdrbook_so:
|
||||
rm -f $(sflplugindir)/libevladdrbook.so
|
||||
rmdir $(sflplugindir)
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
|
||||
* Author: Julien Bonjean <julien.bonjean@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.
|
||||
*
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#include "eds.h"
|
||||
#include "addressbook.h"
|
||||
|
||||
/**
|
||||
* Perform a search on address book
|
||||
*/
|
||||
void
|
||||
addressbook_search (void (*search_cb)(GList *, gpointer), GtkEntry* entry, AddressBook_Config *addressbook_config)
|
||||
{
|
||||
const gint max_results = addressbook_config ? addressbook_config->max_results : 10;
|
||||
search_async_by_contacts (gtk_entry_get_text(entry),
|
||||
max_results,
|
||||
search_cb,
|
||||
addressbook_config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return addressbook state
|
||||
*/
|
||||
gboolean
|
||||
addressbook_is_ready()
|
||||
{
|
||||
return books_ready();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return TRUE if at least one addressbook is active
|
||||
*/
|
||||
gboolean
|
||||
addressbook_is_active()
|
||||
{
|
||||
return books_active();
|
||||
}
|
||||
|
||||
/**
|
||||
* Good method to get books_data
|
||||
*/
|
||||
GSList *
|
||||
addressbook_get_books_data()
|
||||
{
|
||||
determine_default_addressbook();
|
||||
|
||||
return get_books_data();
|
||||
}
|
||||
|
||||
book_data_t *
|
||||
addressbook_get_book_data_by_uid(gchar *uid)
|
||||
{
|
||||
return books_get_book_data_by_uid(uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize books.
|
||||
* Set active/inactive status depending on config.
|
||||
*/
|
||||
void
|
||||
addressbook_init()
|
||||
{
|
||||
fill_books_data();
|
||||
determine_default_addressbook();
|
||||
|
||||
// Call books initialization
|
||||
init_eds();
|
||||
}
|
||||
|
||||
void addressbook_set_search_type(AddrbookSearchType searchType) {
|
||||
if (searchType > ABOOK_QUERY_CONTAINS)
|
||||
return;
|
||||
|
||||
static const EBookQueryTest map[] = {
|
||||
[ABOOK_QUERY_IS] = E_BOOK_QUERY_IS,
|
||||
[ABOOK_QUERY_BEGINS_WITH] = E_BOOK_QUERY_BEGINS_WITH,
|
||||
[ABOOK_QUERY_CONTAINS] = E_BOOK_QUERY_CONTAINS
|
||||
};
|
||||
|
||||
set_current_addressbook_test(map[searchType]);
|
||||
}
|
||||
|
||||
void addressbook_set_current_book(const gchar *current) {
|
||||
set_current_addressbook(current);
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
|
||||
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
|
||||
* Author: Alexandre Savard <alexandre.savard@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.
|
||||
*
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file contains functions specific for addressbook.
|
||||
* It is used as a "mapping" between real search implementation
|
||||
* and search bar.
|
||||
*/
|
||||
|
||||
#ifndef __ADDRESSBOOK_H__
|
||||
#define __ADDRESSBOOK_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef enum {
|
||||
ABOOK_QUERY_IS,
|
||||
ABOOK_QUERY_BEGINS_WITH,
|
||||
ABOOK_QUERY_CONTAINS
|
||||
} AddrbookSearchType;
|
||||
|
||||
/**
|
||||
* Represent a contact entry
|
||||
*/
|
||||
typedef struct _Hit {
|
||||
gchar *name;
|
||||
GdkPixbuf *photo;
|
||||
gchar *phone_business;
|
||||
gchar *phone_home;
|
||||
gchar *phone_mobile;
|
||||
} Hit;
|
||||
|
||||
/**
|
||||
* Book structure for "outside world"
|
||||
*/
|
||||
typedef struct {
|
||||
gchar *uid;
|
||||
gchar *uri;
|
||||
gchar *name;
|
||||
gboolean active;
|
||||
} book_data_t;
|
||||
|
||||
typedef struct _AddressBook_Config {
|
||||
// gint64: a signed integer guaranteed to be 64 bits on all platforms
|
||||
// To print or scan values of this type, use G_GINT64_MODIFIER and/or G_GINT64_FORMAT
|
||||
gint enable;
|
||||
gint max_results;
|
||||
gint display_contact_photo;
|
||||
gint search_phone_home;
|
||||
gint search_phone_business;
|
||||
gint search_phone_mobile;
|
||||
} AddressBook_Config;
|
||||
|
||||
/**
|
||||
* Initialize addressbook
|
||||
*/
|
||||
void addressbook_init();
|
||||
|
||||
/**
|
||||
* Return addressbook state
|
||||
*/
|
||||
gboolean addressbook_is_ready();
|
||||
|
||||
/**
|
||||
* Return addressbook state
|
||||
*/
|
||||
gboolean addressbook_is_enabled();
|
||||
|
||||
/**
|
||||
* Return if at least one addressbook is active
|
||||
*/
|
||||
gboolean addressbook_is_active();
|
||||
|
||||
|
||||
/**
|
||||
* Perform a search in addressbook
|
||||
*/
|
||||
void addressbook_search(void (*search_cb)(GList *, gpointer), GtkEntry *, AddressBook_Config *);
|
||||
|
||||
/**
|
||||
* Get a list of addressbook book
|
||||
*/
|
||||
GSList *addressbook_get_books_data();
|
||||
|
||||
book_data_t *addressbook_get_book_data_by_uid(gchar *);
|
||||
|
||||
void addressbook_set_current_book(const gchar *);
|
||||
|
||||
void addressbook_set_search_type(AddrbookSearchType);
|
||||
|
||||
#endif
|
@ -1,544 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
|
||||
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
|
||||
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
|
||||
*
|
||||
* File originally copied from evolution module of deskbar-applet 2.24.1
|
||||
* Authors :
|
||||
* Nigel Tao <nigel.tao@myrealbox.com>
|
||||
* Raphaël Slinckx <raphael@slinckx.net>
|
||||
* Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk>
|
||||
* Sebastian Pölsterl <marduk@k-d-w.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <pango/pango.h>
|
||||
#include "eds.h"
|
||||
#if EDS_CHECK_VERSION(3,5,3)
|
||||
#include <libedataserver/libedataserver.h>
|
||||
#else /* < EDS 3.5.3 */
|
||||
#include <libedataserver/e-source.h>
|
||||
#include <libebook/e-book-client.h>
|
||||
#endif
|
||||
|
||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ __GNUC_MINOR__ * 100 \
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
/* Test for GCC < 4.7.0 */
|
||||
#if GCC_VERSION < 40700
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Structure used to store search callback and data
|
||||
*/
|
||||
typedef struct _Search_Handler_And_Data {
|
||||
SearchAsyncHandler search_handler;
|
||||
gpointer user_data;
|
||||
GList *hits;
|
||||
int max_results_remaining;
|
||||
EBookQuery *equery;
|
||||
} Search_Handler_And_Data;
|
||||
|
||||
/**
|
||||
* The global addressbook list
|
||||
*/
|
||||
static GSList *books_data = NULL;
|
||||
static GMutex books_data_mutex;
|
||||
|
||||
/**
|
||||
* Current selected addressbook's uri and uid, initialized with default
|
||||
*/
|
||||
#if !EDS_CHECK_VERSION(3,5,3)
|
||||
static gchar *current_uri = NULL;
|
||||
#endif
|
||||
static gchar *current_uid = NULL;
|
||||
|
||||
static EBookQueryTest current_test = E_BOOK_QUERY_BEGINS_WITH;
|
||||
|
||||
/**
|
||||
* Public way to know if we can perform a search
|
||||
*/
|
||||
gboolean
|
||||
books_ready()
|
||||
{
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
gboolean ret = books_data && g_slist_length(books_data) > 0;
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public way to know if we enable at least one address book
|
||||
*/
|
||||
gboolean
|
||||
books_active()
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
for (GSList *iter = books_data; iter; iter = iter->next)
|
||||
if (((book_data_t *) iter->data)->active) {
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* Get a specific book data by UID
|
||||
*/
|
||||
book_data_t *
|
||||
books_get_book_data_by_uid(gchar *uid)
|
||||
{
|
||||
book_data_t *ret = NULL;
|
||||
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
for (GSList *iter = books_data; iter != NULL; iter = iter->next)
|
||||
if (!strcmp(((book_data_t *)iter->data)->uid, uid) ) {
|
||||
ret = iter->data;
|
||||
break;
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a query which looks for the specified string in a contact's full name, email addresses and
|
||||
* nick name.
|
||||
*/
|
||||
static EBookQuery*
|
||||
create_query(const char* s, EBookQueryTest test, AddressBook_Config *conf)
|
||||
{
|
||||
EBookQuery *queries[4];
|
||||
int cpt = 0;
|
||||
|
||||
queries[cpt++] = e_book_query_field_test(E_CONTACT_FULL_NAME, test, s);
|
||||
|
||||
if (!conf || conf->search_phone_home)
|
||||
queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_HOME, test, s);
|
||||
|
||||
if (!conf || conf->search_phone_business)
|
||||
queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_BUSINESS, test, s);
|
||||
|
||||
if (!conf || conf->search_phone_mobile)
|
||||
queries[cpt++] = e_book_query_field_test(E_CONTACT_PHONE_MOBILE, test, s);
|
||||
|
||||
return e_book_query_or(cpt, queries, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a query which looks any contact with a phone number
|
||||
*/
|
||||
static EBookQuery*
|
||||
create_query_all_phones(AddressBook_Config *conf)
|
||||
{
|
||||
EBookQuery *queries[3];
|
||||
int cpt = 0;
|
||||
|
||||
if (!conf || conf->search_phone_home)
|
||||
queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_HOME);
|
||||
|
||||
if (!conf || conf->search_phone_business)
|
||||
queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_BUSINESS);
|
||||
|
||||
if (!conf || conf->search_phone_mobile)
|
||||
queries[cpt++] = e_book_query_field_exists(E_CONTACT_PHONE_MOBILE);
|
||||
|
||||
return e_book_query_or(cpt, queries, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the contact's picture
|
||||
*/
|
||||
static GdkPixbuf*
|
||||
pixbuf_from_contact(EContact *contact)
|
||||
{
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
EContactPhoto *photo = e_contact_get(contact, E_CONTACT_PHOTO);
|
||||
|
||||
if (!photo)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
|
||||
GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
|
||||
if (gdk_pixbuf_loader_write(loader, (guchar *) photo->data.inlined.data, photo->data.inlined.length, NULL)) {
|
||||
/* Force remaining parse operations to complete */
|
||||
gdk_pixbuf_loader_close(loader, NULL);
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
|
||||
/* Ensure that pixbuf isn't destroyed with loader */
|
||||
g_object_ref(pixbuf);
|
||||
}
|
||||
g_object_unref(loader);
|
||||
} else if (photo->type == E_CONTACT_PHOTO_TYPE_URI) {
|
||||
gchar *filename = g_filename_from_uri(photo->data.uri, NULL, NULL);
|
||||
if (filename) {
|
||||
pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
|
||||
g_free(filename);
|
||||
}
|
||||
}
|
||||
|
||||
e_contact_photo_free(photo);
|
||||
|
||||
if (!pixbuf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// check size and resize if needed
|
||||
gint width = gdk_pixbuf_get_width(pixbuf);
|
||||
gint height = gdk_pixbuf_get_height(pixbuf);
|
||||
double scale = 32 / (double) ((height > width) ? height : width);
|
||||
|
||||
if (scale < 1.0) {
|
||||
GdkPixbuf *tmp = gdk_pixbuf_scale_simple(pixbuf, width * scale, height
|
||||
* scale, GDK_INTERP_BILINEAR);
|
||||
g_object_unref(pixbuf);
|
||||
pixbuf = tmp;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Final callback after all books have been processed.
|
||||
*/
|
||||
static void
|
||||
view_finish_callback(Search_Handler_And_Data *had)
|
||||
{
|
||||
SearchAsyncHandler had_handler = had->search_handler;
|
||||
GList *had_hits = had->hits;
|
||||
gpointer had_user_data = had->user_data;
|
||||
|
||||
g_free(had);
|
||||
|
||||
// Call display callback
|
||||
had_handler(had_hits, had_user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback called after a contact have been found in EDS by search_async_by_contacts.
|
||||
*/
|
||||
|
||||
static void
|
||||
eds_query_result_cb(GObject *object, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
EBookClient *book_client = E_BOOK_CLIENT(object);
|
||||
if (!book_client)
|
||||
return;
|
||||
GSList *contacts;
|
||||
if (!e_book_client_get_contacts_finish(book_client, result, &contacts, NULL))
|
||||
return;
|
||||
Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
|
||||
|
||||
// make sure we have a new list of hits
|
||||
had->hits = NULL;
|
||||
|
||||
for (GSList *l = contacts; l; l = l->next) {
|
||||
Hit *hit = g_new0(Hit, 1);
|
||||
EContact *contact = E_CONTACT(l->data);
|
||||
|
||||
hit->photo = pixbuf_from_contact(contact);
|
||||
hit->phone_business = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_BUSINESS));
|
||||
hit->phone_home = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_HOME));
|
||||
hit->phone_mobile = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_PHONE_MOBILE));
|
||||
hit->name = g_strdup((char*)e_contact_get_const(contact, E_CONTACT_NAME_OR_ORG));
|
||||
|
||||
had->hits = g_list_append(had->hits, hit);
|
||||
|
||||
if (--had->max_results_remaining <= 0)
|
||||
break;
|
||||
}
|
||||
g_slist_foreach(contacts, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free(contacts);
|
||||
|
||||
view_finish_callback(had);
|
||||
|
||||
g_object_unref(object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback for asynchronous opening of book client
|
||||
*/
|
||||
static void
|
||||
client_open_async_callback(GObject *client, GAsyncResult *result, gpointer closure)
|
||||
{
|
||||
if (!client)
|
||||
return;
|
||||
if (!e_client_open_finish(E_CLIENT(client), result, NULL))
|
||||
return;
|
||||
|
||||
Search_Handler_And_Data *had = (Search_Handler_And_Data *) closure;
|
||||
gchar *query_str = e_book_query_to_string(had->equery);
|
||||
e_book_client_get_contacts(E_BOOK_CLIENT(client), query_str, NULL, eds_query_result_cb, closure);
|
||||
g_free(query_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize address book
|
||||
*/
|
||||
void
|
||||
init_eds()
|
||||
{
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
for (GSList *iter = books_data; iter != NULL; iter = iter->next) {
|
||||
book_data_t *book_data = (book_data_t *) iter->data;
|
||||
|
||||
#if !EDS_CHECK_VERSION(3,5,3)
|
||||
current_uri = book_data->uri;
|
||||
#endif
|
||||
current_uid = book_data->uid;
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
}
|
||||
|
||||
static GSList *
|
||||
free_books_data(GSList *list)
|
||||
{
|
||||
for (GSList *iter = list; iter != NULL; iter = iter->next) {
|
||||
book_data_t *book_data = (book_data_t *) iter->data;
|
||||
|
||||
g_free(book_data->name);
|
||||
g_free(book_data->uid);
|
||||
g_free(book_data->uri);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill books data
|
||||
*/
|
||||
#if EDS_CHECK_VERSION(3,5,3)
|
||||
|
||||
static book_data_t *
|
||||
create_book_data_from_source(ESource *source)
|
||||
{
|
||||
book_data_t *book_data = g_new0(book_data_t, 1);
|
||||
book_data->active = e_source_get_enabled(source);
|
||||
book_data->name = g_strdup(e_source_get_display_name(source));
|
||||
book_data->uri = g_strdup(""); // No longer used
|
||||
book_data->uid = g_strdup(e_source_get_uid(source));
|
||||
return book_data;
|
||||
}
|
||||
|
||||
static ESourceRegistry *
|
||||
get_registry()
|
||||
{
|
||||
static ESourceRegistry * registry;
|
||||
if (registry == NULL)
|
||||
registry = e_source_registry_new_sync(NULL, NULL);
|
||||
return registry;
|
||||
}
|
||||
|
||||
void
|
||||
fill_books_data()
|
||||
{
|
||||
// FIXME: add error handling
|
||||
ESourceRegistry *registry = get_registry();
|
||||
const gchar *extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
|
||||
GList *list = e_source_registry_list_sources(registry, extension_name);
|
||||
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
books_data = free_books_data(books_data);
|
||||
|
||||
for (GList *l = list; l != NULL; l = l->next) {
|
||||
if (l->data) {
|
||||
ESource *source = l->data;
|
||||
book_data_t *book_data = create_book_data_from_source(source);
|
||||
books_data = g_slist_prepend(books_data, book_data);
|
||||
}
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
|
||||
/* Free each source in the list and the list itself */
|
||||
g_list_free_full(list, g_object_unref);
|
||||
}
|
||||
|
||||
#else /* EDS < 3.5.3 */
|
||||
|
||||
static book_data_t *
|
||||
create_book_data_from_source(ESource *source, ESourceGroup *group)
|
||||
{
|
||||
book_data_t *book_data = g_new0(book_data_t, 1);
|
||||
book_data->active = TRUE;
|
||||
book_data->name = g_strdup(e_source_peek_name(source));
|
||||
book_data->uid = g_strdup(e_source_peek_uid(source));
|
||||
|
||||
book_data->uri = g_strconcat(e_source_group_peek_base_uri(group), e_source_peek_relative_uri(source), NULL);
|
||||
return book_data;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fill_books_data()
|
||||
{
|
||||
ESourceList *source_list = e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources");
|
||||
|
||||
if (source_list == NULL)
|
||||
return;
|
||||
|
||||
GSList *list = e_source_list_peek_groups(source_list);
|
||||
|
||||
if (list == NULL) {
|
||||
g_object_unref(source_list);
|
||||
return;
|
||||
}
|
||||
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
books_data = free_books_data(books_data);
|
||||
|
||||
for (GSList *l = list; l != NULL; l = l->next) {
|
||||
ESourceGroup *group = l->data;
|
||||
|
||||
for (GSList *m = e_source_group_peek_sources(group); m != NULL; m = m->next) {
|
||||
ESource *source = m->data;
|
||||
book_data_t *book_data = create_book_data_from_source(source, group);
|
||||
books_data = g_slist_prepend(books_data, book_data);
|
||||
}
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
|
||||
g_object_unref(source_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: should be obtained by e_source_registry_ref_default_address_book ()
|
||||
void
|
||||
determine_default_addressbook()
|
||||
{
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
/* Just grabbing first addressbook as default */
|
||||
for (GSList *elm = books_data; elm ; elm = g_slist_next(elm)) {
|
||||
book_data_t *book_data = elm->data;
|
||||
|
||||
#if !EDS_CHECK_VERSION(3,5,3)
|
||||
current_uri = book_data->uri;
|
||||
#endif
|
||||
current_uid = book_data->uid;
|
||||
break;
|
||||
}
|
||||
|
||||
for (GSList *elm = books_data; elm ; elm = g_slist_next(elm)) {
|
||||
book_data_t *book_data = elm->data;
|
||||
|
||||
if (book_data->active) {
|
||||
#if !EDS_CHECK_VERSION(3,5,3)
|
||||
current_uri = book_data->uri;
|
||||
#endif
|
||||
current_uid = book_data->uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
search_async_by_contacts(const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data)
|
||||
{
|
||||
Search_Handler_And_Data *had = g_new0(Search_Handler_And_Data, 1);
|
||||
|
||||
// initialize search data
|
||||
had->search_handler = handler;
|
||||
had->user_data = user_data;
|
||||
had->hits = NULL;
|
||||
had->max_results_remaining = max_results;
|
||||
if (!g_strcmp0(query, ""))
|
||||
had->equery = create_query_all_phones(user_data);
|
||||
else
|
||||
had->equery = create_query(query, current_test, user_data);
|
||||
|
||||
|
||||
#if EDS_CHECK_VERSION(3,5,3)
|
||||
ESourceRegistry *registry = get_registry();
|
||||
ESource *source = e_source_registry_ref_source(registry, current_uid);
|
||||
EBookClient *book_client = e_book_client_new(source, NULL);
|
||||
g_object_unref(source);
|
||||
#else /* < EDS 3.5.3 */
|
||||
EBookClient *book_client = e_book_client_new_from_uri(current_uri, NULL);
|
||||
#endif
|
||||
if (!book_client)
|
||||
return;
|
||||
e_client_open(E_CLIENT(book_client), TRUE, NULL, client_open_async_callback, had);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
set_current_addressbook(const gchar *name)
|
||||
{
|
||||
if(name == NULL)
|
||||
return;
|
||||
|
||||
g_mutex_lock(&books_data_mutex);
|
||||
|
||||
for (GSList *iter = books_data; iter != NULL; iter = iter->next) {
|
||||
book_data_t *book_data = (book_data_t *) iter->data;
|
||||
if (g_strcmp0(book_data->name, name) == 0) {
|
||||
#if !EDS_CHECK_VERSION(3,5,3)
|
||||
current_uri = book_data->uri;
|
||||
#endif
|
||||
current_uid = book_data->uid;
|
||||
}
|
||||
}
|
||||
|
||||
g_mutex_unlock(&books_data_mutex);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
set_current_addressbook_test(EBookQueryTest test)
|
||||
{
|
||||
current_test = test;
|
||||
}
|
||||
|
||||
GSList *
|
||||
get_books_data()
|
||||
{
|
||||
return books_data;
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
|
||||
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
|
||||
*
|
||||
* File originally copied from evolution module of deskbar-applet 2.24.1
|
||||
* Authors :
|
||||
* Nigel Tao <nigel.tao@myrealbox.com>
|
||||
* Raphaël Slinckx <raphael@slinckx.net>
|
||||
* Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk>
|
||||
* Sebastian Pölsterl <marduk@k-d-w.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#ifndef __EDS_H__
|
||||
#define __EDS_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include <libedataserver/eds-version.h>
|
||||
|
||||
#if EDS_CHECK_VERSION(3,5,3)
|
||||
#include <libebook/libebook.h>
|
||||
#else
|
||||
#include <libebook/e-book.h>
|
||||
#include <libebook/e-book-query.h>
|
||||
#endif
|
||||
|
||||
#include "addressbook.h"
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Template callback function for the asynchronous search
|
||||
*/
|
||||
typedef void
|
||||
(* SearchAsyncHandler)(GList *hits, gpointer user_data);
|
||||
|
||||
/**
|
||||
* Initialize the address book.
|
||||
* Connection to evolution data server
|
||||
*/
|
||||
void
|
||||
init_eds();
|
||||
|
||||
/**
|
||||
* Fill list of addressbooks
|
||||
*/
|
||||
void
|
||||
fill_books_data(void);
|
||||
|
||||
/**
|
||||
* Asynchronous query to EDS using get contact method.
|
||||
*/
|
||||
void
|
||||
search_async_by_contacts(const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data);
|
||||
|
||||
GSList*
|
||||
get_books(void);
|
||||
|
||||
book_data_t *
|
||||
books_get_book_data_by_uid(gchar *uid);
|
||||
|
||||
/**
|
||||
* Public way to know if we can perform a search
|
||||
*/
|
||||
gboolean
|
||||
books_ready();
|
||||
|
||||
/**
|
||||
* Public way to know if we enabled an address book
|
||||
*/
|
||||
gboolean
|
||||
books_active();
|
||||
|
||||
/**
|
||||
* Good method to retrieve books_data (handle async)
|
||||
*/
|
||||
GSList *
|
||||
addressbook_get_books_data();
|
||||
|
||||
/**
|
||||
* Set the current address book
|
||||
*/
|
||||
void
|
||||
set_current_addressbook(const gchar *name);
|
||||
|
||||
void
|
||||
set_current_addressbook_test(EBookQueryTest test);
|
||||
|
||||
GSList *
|
||||
get_books_data();
|
||||
|
||||
void
|
||||
determine_default_addressbook();
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __EDS_H__ */
|
@ -1,4 +0,0 @@
|
||||
check_PROGRAMS=test_addressbook
|
||||
|
||||
test_addressbook_CFLAGS=-g @GTK_CFLAGS@ -I../evolution/
|
||||
test_addressbook_LDADD=@GTK_LIBS@ $(top_builddir)/addressbook/evolution/libevladdrbook.so
|
@ -1,115 +0,0 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "addressbook.h"
|
||||
|
||||
/**
|
||||
* Callback called after all book have been processed
|
||||
*/
|
||||
|
||||
enum {
|
||||
COLUMN_NAME,
|
||||
COLUMN_PHONE,
|
||||
COLUMN_PIXBUF,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
// Evil!
|
||||
static GtkListStore *list_store;
|
||||
|
||||
|
||||
static void
|
||||
add_contact(const gchar *name, const char *phone, GdkPixbuf *photo)
|
||||
{
|
||||
if (g_strcmp0(phone, "") == 0)
|
||||
return;
|
||||
|
||||
g_print("name: %s, phone: %s, photo: %p\n", name, phone, photo);
|
||||
GtkTreeIter iter;
|
||||
// Add a new row to the model
|
||||
gtk_list_store_append(list_store, &iter);
|
||||
gtk_list_store_set(list_store, &iter,
|
||||
COLUMN_NAME, name,
|
||||
COLUMN_PHONE, phone,
|
||||
COLUMN_PIXBUF, photo,
|
||||
-1);
|
||||
}
|
||||
|
||||
static void
|
||||
handler_async_search(GList *hits, G_GNUC_UNUSED gpointer data)
|
||||
{
|
||||
for (GList *i = hits; i != NULL; i = i->next) {
|
||||
Hit *hit = i->data;
|
||||
|
||||
if (!hit)
|
||||
continue;
|
||||
|
||||
const gchar *phone = hit->phone_business ? hit->phone_business :
|
||||
hit->phone_mobile ? hit->phone_mobile :
|
||||
hit->phone_home ? hit->phone_home : "";
|
||||
add_contact(hit->name, phone, hit->photo);
|
||||
|
||||
g_free(hit->name);
|
||||
g_free(hit->phone_home);
|
||||
g_free(hit->phone_mobile);
|
||||
g_free(hit->phone_business);
|
||||
g_free(hit);
|
||||
}
|
||||
|
||||
g_list_free(hits);
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed_cb(GtkEntry *entry)
|
||||
{
|
||||
g_print("Text changed to %s\n", gtk_entry_get_text(entry));
|
||||
gtk_list_store_clear(list_store);
|
||||
addressbook_search(handler_async_search, entry, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
list_store = gtk_list_store_new(N_COLUMNS,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
GDK_TYPE_PIXBUF);
|
||||
GtkWidget *tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store));
|
||||
|
||||
GtkCellRenderer *text_renderer = gtk_cell_renderer_text_new();
|
||||
GtkCellRenderer *pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
|
||||
GtkCellRenderer *renderers[] = {text_renderer, text_renderer, pixbuf_renderer};
|
||||
const char *column_header[]= {"Name", "Phone", "Photo"};
|
||||
const char *column_type[]= {"text", "text", "pixbuf"};
|
||||
|
||||
for (gint col = 0; col < N_COLUMNS; ++col) {
|
||||
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(column_header[col],
|
||||
renderers[col], column_type[col],
|
||||
col,
|
||||
NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
|
||||
}
|
||||
|
||||
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
||||
|
||||
addressbook_init();
|
||||
addressbook_set_current_book("Contacts");
|
||||
|
||||
GtkWidget *entry = gtk_entry_new();
|
||||
gtk_container_add(GTK_CONTAINER(vbox), tree_view);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), entry);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
|
||||
addressbook_search(handler_async_search, GTK_ENTRY(entry), NULL);
|
||||
g_signal_connect(entry, "notify::text", G_CALLBACK(text_changed_cb), NULL);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565663
|
||||
[ ! -e m4 ] && mkdir m4
|
||||
|
||||
autoreconf --force --install --verbose -Wall -I m4
|
@ -1,50 +0,0 @@
|
||||
AC_INIT([Ring],[2.0.0],[sflphoneteam@savoirfairelinux.com],[ring-plugins])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl Silent build by default. Use make V=1 to increase verbosity
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
AC_ARG_WITH(debug,
|
||||
AS_HELP_STRING(
|
||||
[--with-debug],
|
||||
[Set 'full' to enable debugging information @<:@default=no@:>@]
|
||||
),
|
||||
[with_debug=${withval}],
|
||||
[with_debug=no]
|
||||
)
|
||||
|
||||
AC_PROG_CC_C99
|
||||
dnl For target specific flags
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
AC_HEADER_STDC
|
||||
LT_PREREQ([2.2])
|
||||
LT_INIT
|
||||
|
||||
MIGRATION_FLAGS="-DE_BOOK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
|
||||
if test "x$with_debug" = "xfull" -o "x$with_debug" = "xyes"; then
|
||||
CFLAGS="-g -O0 -DDEBUG -Wall -Wextra $MIGRATION_FLAGS"
|
||||
else
|
||||
CFLAGS="$CFLAGS -g -Wall -Wextra -Wshadow $MIGRATION_FLAGS"
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(GTK, gtk+-3.0)
|
||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2)
|
||||
PKG_CHECK_MODULES(LIBEBOOK, libebook-1.2 >= 1.4)
|
||||
PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 2.32],
|
||||
[AC_DEFINE([LIBEDATASERVER_VERSION_2_32], [], [Using libedataserver-1.2 version 2.32 or higher])],
|
||||
[PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 1.4])]
|
||||
)
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
addressbook/evolution/Makefile
|
||||
addressbook/Makefile
|
||||
addressbook/test/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
@ -1,34 +0,0 @@
|
||||
# Global variables
|
||||
src = $(top_srcdir)
|
||||
|
||||
ASTYLERC="$(top_srcdir)/../astylerc"
|
||||
indent="/usr/bin/astyle"
|
||||
|
||||
sfllibdir=$(DESTDIR)$(libdir)/ring
|
||||
sflplugindir=$(sfllibdir)/plugins
|
||||
|
||||
# Preprocessor flags
|
||||
AM_CPPFLAGS = $(DEPS_CFLAGS) \
|
||||
$(LIBSEXY_CFLAGS) \
|
||||
-I$(src)/src \
|
||||
-I$(src)/src/config \
|
||||
-I$(src)/src/dbus \
|
||||
-I$(src)/src/contacts \
|
||||
-I$(src)/src/addressbook \
|
||||
-DDATA_DIR=\""$(prefix)/share/ring"\" \
|
||||
-DICONS_DIR=\""$(prefix)/share/ring"\" \
|
||||
-DCODECS_DIR=\""$(prefix)/lib/ring/codecs"\" \
|
||||
-DPREFIX=\"$(prefix)\" \
|
||||
-DENABLE_TRACE \
|
||||
-DPREFIX=\""$(prefix)"\" \
|
||||
-DSYSCONFDIR=\""$(sysconfdir)"\" \
|
||||
-DDATADIR=\""$(datadir)"\" \
|
||||
-DLIBDIR=\""$(libdir)"\" \
|
||||
-DLOCALEDIR=\""$(localedir)"\" \
|
||||
-DRING_UIDIR=\""$(datadir)/ring/ui"\" \
|
||||
-DPLUGINS_DIR=\""$(sflplugindir)"\"
|
||||
indent:
|
||||
@echo "Indenting code:"
|
||||
if [ -f $(ASTYLERC) ] ; then \
|
||||
find $(top_srcdir)/src/ -regex ".*\.\(h\|c\)" -exec $(indent) --options=$(ASTYLERC) {} \; ; \
|
||||
fi
|
Reference in New Issue
Block a user