From 45c3679308eb5440eb01c8a6e1b0bb5bdc9533e9 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <asavard@asavard.(none)> Date: Tue, 7 Jun 2011 15:28:26 -0400 Subject: [PATCH] #6027: Add sflphone-plugins folder at project's root level --- sflphone-client-gnome/Makefile.am | 2 +- sflphone-client-gnome/configure.ac | 5 - sflphone-client-gnome/globals.mak | 1 - sflphone-client-gnome/src/Makefile.am | 4 +- sflphone-client-gnome/src/config/Makefile.am | 9 +- .../src/contacts/Makefile.am | 6 +- sflphone-client-gnome/src/dbus/Makefile.am | 6 +- sflphone-client-gnome/src/icons/Makefile.am | 6 +- sflphone-client-gnome/src/widget/Makefile.am | 6 +- sflphone-plugins/AUTHORS | 0 sflphone-plugins/COPYING | 340 ++++++++ sflphone-plugins/ChangeLog | 0 sflphone-plugins/INSTALL | 365 ++++++++ sflphone-plugins/Makefile.am | 7 + sflphone-plugins/README | 5 + sflphone-plugins/VERSION | 1 + sflphone-plugins/configure.ac | 57 ++ sflphone-plugins/globals.mak | 34 + sflphone-plugins/plugin/Makefile.am | 1 + .../plugin/addressbook/Makefile.am | 21 + .../plugin/addressbook/addressbook.c | 249 ++++++ .../plugin/addressbook/addressbook.h | 134 +++ sflphone-plugins/plugin/addressbook/eds.c | 811 ++++++++++++++++++ sflphone-plugins/plugin/addressbook/eds.h | 186 ++++ 24 files changed, 2225 insertions(+), 31 deletions(-) create mode 100644 sflphone-plugins/AUTHORS create mode 100644 sflphone-plugins/COPYING create mode 100644 sflphone-plugins/ChangeLog create mode 100644 sflphone-plugins/INSTALL create mode 100644 sflphone-plugins/Makefile.am create mode 100644 sflphone-plugins/README create mode 100644 sflphone-plugins/VERSION create mode 100644 sflphone-plugins/configure.ac create mode 100644 sflphone-plugins/globals.mak create mode 100644 sflphone-plugins/plugin/Makefile.am create mode 100644 sflphone-plugins/plugin/addressbook/Makefile.am create mode 100644 sflphone-plugins/plugin/addressbook/addressbook.c create mode 100644 sflphone-plugins/plugin/addressbook/addressbook.h create mode 100644 sflphone-plugins/plugin/addressbook/eds.c create mode 100644 sflphone-plugins/plugin/addressbook/eds.h diff --git a/sflphone-client-gnome/Makefile.am b/sflphone-client-gnome/Makefile.am index 766c3fca11..e738c4d160 100644 --- a/sflphone-client-gnome/Makefile.am +++ b/sflphone-client-gnome/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src pixmaps webkit tests man po doc plugin +SUBDIRS = src pixmaps webkit tests man po doc CFLAGS=-Wall -Werror -Wextra diff --git a/sflphone-client-gnome/configure.ac b/sflphone-client-gnome/configure.ac index f2196c13ac..635c4c05e9 100644 --- a/sflphone-client-gnome/configure.ac +++ b/sflphone-client-gnome/configure.ac @@ -55,9 +55,6 @@ PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= 0.7.2], [AC_DEFINE([LIBNOTIFY_VERSI PKG_CHECK_MODULES(SFLGTK, gtk+-2.0 > 2.2) PKG_CHECK_MODULES(SFLGLIB, glib-2.0 >= 2.2) PKG_CHECK_MODULES(WEBKIT, webkit-1.0) -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])]) -#PKG_CHECK_MODULES(LIBEDATASERVERUI, libedataserverui-1.2) PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0) PKG_CHECK_MODULES(GNOMEDOCUTILS, gnome-doc-utils) @@ -88,8 +85,6 @@ src/widget/Makefile src/icons/Makefile pixmaps/Makefile webkit/Makefile -plugin/addressbook/Makefile -plugin/Makefile sflphone.desktop tests/Makefile man/Makefile diff --git a/sflphone-client-gnome/globals.mak b/sflphone-client-gnome/globals.mak index 28dbc46727..68db0f0454 100644 --- a/sflphone-client-gnome/globals.mak +++ b/sflphone-client-gnome/globals.mak @@ -14,7 +14,6 @@ AM_CPPFLAGS = $(DEPS_CFLAGS) \ -I$(src)/src/config \ -I$(src)/src/dbus \ -I$(src)/src/contacts \ - -I$(src)/src/addressbook \ -DDATA_DIR=\""$(prefix)/share/sflphone"\" \ -DICONS_DIR=\""$(prefix)/share/sflphone"\" \ -DCODECS_DIR=\""$(prefix)/lib/sflphone/codecs"\" \ diff --git a/sflphone-client-gnome/src/Makefile.am b/sflphone-client-gnome/src/Makefile.am index 27c24652e7..190c3ecec8 100644 --- a/sflphone-client-gnome/src/Makefile.am +++ b/sflphone-client-gnome/src/Makefile.am @@ -35,10 +35,10 @@ noinst_HEADERS = actions.h sflnotify.h mainwindow.h dialpad.h codeclist.h \ shortcuts.h eel-gconf-extensions.h logger.h sflphone_client_gnome_LDADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) $(NOTIFY_LIBS) $(SFLPHONEGTK_LIBS) $(LIBSEXY_LIBS) $(X11_LIBS) \ - $(GTK_LIBS) $(GLIB_LIBS) $(WEBKIT_LIBS) $(LIBEBOOK_LIBS) $(LIBEDATASERVER_LIBS) $(LIBEDATASERVERUI_LIBS) $(LIBGNOMEUI_LIBS) $(GNOMEDOCUTILS_LIBS) + $(GTK_LIBS) $(GLIB_LIBS) $(WEBKIT_LIBS) $(LIBGNOMEUI_LIBS) $(GNOMEDOCUTILS_LIBS) sflphone_client_gnome_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) $(NOTIFY_CFLAGS) $(SFLPHONEGTK_CFLAGS) $(LIBSEXY_CFLAGS) $(X11_CFLAGS) \ - $(GTK_CFLAGS) $(GLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) $(GNOMEDOCUTILS_CFLAGS) + $(GTK_CFLAGS) $(GLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGNOMEUI_CFLAGS) $(GNOMEDOCUTILS_CFLAGS) # add symbolic link install-exec-local: diff --git a/sflphone-client-gnome/src/config/Makefile.am b/sflphone-client-gnome/src/config/Makefile.am index 1df0702954..f015079850 100644 --- a/sflphone-client-gnome/src/config/Makefile.am +++ b/sflphone-client-gnome/src/config/Makefile.am @@ -16,16 +16,13 @@ libconfig_la_SOURCES = \ utils.c libconfig_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \ - $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \ - $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ + $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ $(GNOMEDOCUTILS_LDFLAGS) libconfig_la_LIBADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBSI) \ - $(SFLGTK_LIBS) $(SFLGLIB_LIBS) $(WEBKIT_LIBS) $(LIBEBOOK_LIBS) \ - $(LIBEDATASERVER_LIBS) $(LIBEDATASERVERUI_LIBS) $(LIBGNOMEUI_LIBS) \ + $(SFLGTK_LIBS) $(SFLGLIB_LIBS) $(WEBKIT_LIBS) $(LIBGNOMEUI_LIBS) \ $(GNOMEDOCUTILS_LIBS) libconfig_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \ - $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \ - $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ + $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ $(GNOMEDOCUTILS_CFLAGS) diff --git a/sflphone-client-gnome/src/contacts/Makefile.am b/sflphone-client-gnome/src/contacts/Makefile.am index 42d337906b..cbaf218b5e 100644 --- a/sflphone-client-gnome/src/contacts/Makefile.am +++ b/sflphone-client-gnome/src/contacts/Makefile.am @@ -12,12 +12,10 @@ libcontacts_la_SOURCES = \ conferencelist.c libcontacts_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \ - $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \ - $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ + $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ $(GNOMEDOCUTILS_LDFLAGS) libcontacts_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \ - $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \ - $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ + $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ $(GNOMEDOCUTILS_CFLAGS) diff --git a/sflphone-client-gnome/src/dbus/Makefile.am b/sflphone-client-gnome/src/dbus/Makefile.am index 2fbd96d1da..8f4fd290da 100644 --- a/sflphone-client-gnome/src/dbus/Makefile.am +++ b/sflphone-client-gnome/src/dbus/Makefile.am @@ -25,13 +25,11 @@ libdbus_la_SOURCES= \ $(BUILT_SOURCES) libdbus_la_LDFLAGS= $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \ - $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \ - $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ + $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ $(GNOMEDOCUTILS_LDFLAGS) libdbus_la_CFLAGS= $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \ - $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \ - $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ + $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ $(GNOMEDOCUTILS_CFLAGS) EXTRA_DIST= \ diff --git a/sflphone-client-gnome/src/icons/Makefile.am b/sflphone-client-gnome/src/icons/Makefile.am index 5b5c75fe19..d639fb7506 100644 --- a/sflphone-client-gnome/src/icons/Makefile.am +++ b/sflphone-client-gnome/src/icons/Makefile.am @@ -10,11 +10,9 @@ noinst_libicons_la_HEADER= \ pixmaps_data.h libicons_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \ - $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \ - $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ + $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ $(GNOMEDOCUTILS_LDFLAGS) libicons_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \ - $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \ - $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ + $(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBGNOMEUI_CFLAGS) \ $(GNOMEDOCUTILS_CFLAGS) diff --git a/sflphone-client-gnome/src/widget/Makefile.am b/sflphone-client-gnome/src/widget/Makefile.am index 9fd6d7d290..ebc7eaa85f 100644 --- a/sflphone-client-gnome/src/widget/Makefile.am +++ b/sflphone-client-gnome/src/widget/Makefile.am @@ -8,13 +8,11 @@ libwidget_la_SOURCES = \ imwidget.c libwidget_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \ - $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \ - $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ + $(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \ $(GNOMEDOCUTILS_LDFLAGS) libwidget_la_LIBADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) - $(SFLGTK_LIBS) $(SFLGLIB_LIBS) $(WEBKIT_LIBS) $(LIBEBOOK_LIBS) \ - $(LIBEDATASERVER_LIBS) $(LIBEDATASERVERUI_LIBS) $(LIBGNOMEUI_LIBS) \ + $(SFLGTK_LIBS) $(SFLGLIB_LIBS) $(WEBKIT_LIBS) $(LIBGNOMEUI_LIBS) \ $(GNOMEDOCUTILS_LIBS) libwidget_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \ diff --git a/sflphone-plugins/AUTHORS b/sflphone-plugins/AUTHORS new file mode 100644 index 0000000000..e69de29bb2 diff --git a/sflphone-plugins/COPYING b/sflphone-plugins/COPYING new file mode 100644 index 0000000000..623b6258a1 --- /dev/null +++ b/sflphone-plugins/COPYING @@ -0,0 +1,340 @@ + 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. diff --git a/sflphone-plugins/ChangeLog b/sflphone-plugins/ChangeLog new file mode 100644 index 0000000000..e69de29bb2 diff --git a/sflphone-plugins/INSTALL b/sflphone-plugins/INSTALL new file mode 100644 index 0000000000..7d1c323bea --- /dev/null +++ b/sflphone-plugins/INSTALL @@ -0,0 +1,365 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/sflphone-plugins/Makefile.am b/sflphone-plugins/Makefile.am new file mode 100644 index 0000000000..2bea10c78a --- /dev/null +++ b/sflphone-plugins/Makefile.am @@ -0,0 +1,7 @@ +SUBDIRS = plugin + +CFLAGS=-Wall -Werror -Wextra + +ACLOCAL_AMFLAGS = -I m4 + +GCONFTOOL=gconftool-2 diff --git a/sflphone-plugins/README b/sflphone-plugins/README new file mode 100644 index 0000000000..cdba125509 --- /dev/null +++ b/sflphone-plugins/README @@ -0,0 +1,5 @@ +Welcome to SFLphone! + +Refer to the development site for further information: https://projects.savoirfairelinux.com/projects/show/sflphone + +Thank you diff --git a/sflphone-plugins/VERSION b/sflphone-plugins/VERSION new file mode 100644 index 0000000000..62ea259095 --- /dev/null +++ b/sflphone-plugins/VERSION @@ -0,0 +1 @@ +0.9.13 diff --git a/sflphone-plugins/configure.ac b/sflphone-plugins/configure.ac new file mode 100644 index 0000000000..9374130145 --- /dev/null +++ b/sflphone-plugins/configure.ac @@ -0,0 +1,57 @@ +AC_INIT([SFLphone],[0.9.13],[sflphoneteam@savoirfairelinux.com],[sflphone-plugins]) +AC_CONFIG_HEADERS([config.h]) + +GNOME_DOC_INIT + +PACKAGE=SFLphone +VERSION=`cat VERSION` + +AM_INIT_AUTOMAKE($PACKAGE,$VERSION) +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([no])]) + +AC_ARG_WITH(debug, + AS_HELP_STRING( + [--with-debug], + [Set 'full' to enable debugging information @<:@default=no@:>@] + ), + [with_debug=${withval}], + [with_debug=no] + ) +if test "x$with_debug" = "xfull" -o "x$with_debug" = "xyes"; then + CFLAGS="-g -O0 -DDEBUG -Wall -Wextra" +else + CFLAGS="$CFLAGS -Wall -Wextra" +fi + +AC_PROG_CC +AC_PROG_INSTALL +AC_HEADER_STDC +LT_INIT + +dnl GCONF utilities +AM_GCONF_SOURCE_2 + +dnl uninstalled gsr ui dir +AC_DEFINE_UNQUOTED(SFLPHONE_UIDIR_UNINSTALLED, "`pwd`/src/", + [path to uninstalled SFLphone UI dir]) + +PKG_CHECK_MODULES(SFLGTK, gtk+-2.0 > 2.2) +PKG_CHECK_MODULES(SFLGLIB, 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_SUBST(SFLGTK_LIBS) +AC_SUBST(SFLGLIB_LIBS) +AC_SUBST(LIBEBOOK_LIBS) +AC_SUBST(LIBEDATASERVER_LIBS) + +AC_CONFIG_FILES([ +Makefile +plugin/addressbook/Makefile +plugin/Makefile +]) +AC_OUTPUT + diff --git a/sflphone-plugins/globals.mak b/sflphone-plugins/globals.mak new file mode 100644 index 0000000000..28dbc46727 --- /dev/null +++ b/sflphone-plugins/globals.mak @@ -0,0 +1,34 @@ +# Global variables +src = $(top_srcdir) + +ASTYLERC="$(top_srcdir)/../astylerc" +indent="/usr/bin/astyle" + +sfllibdir=$(DESTDIR)$(libdir)/sflphone +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/sflphone"\" \ + -DICONS_DIR=\""$(prefix)/share/sflphone"\" \ + -DCODECS_DIR=\""$(prefix)/lib/sflphone/codecs"\" \ + -DPREFIX=\"$(prefix)\" \ + -DENABLE_TRACE \ + -DPREFIX=\""$(prefix)"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DLOCALEDIR=\""$(localedir)"\" \ + -DSFLPHONE_UIDIR=\""$(datadir)/sflphone/ui"\" \ + -DPLUGINS_DIR=\""$(sflplugindir)"\" +indent: + @echo "Indenting code:" + if [ -f $(ASTYLERC) ] ; then \ + find $(top_srcdir)/src/ -regex ".*\.\(h\|c\)" -exec $(indent) --options=$(ASTYLERC) {} \; ; \ + fi diff --git a/sflphone-plugins/plugin/Makefile.am b/sflphone-plugins/plugin/Makefile.am new file mode 100644 index 0000000000..da9185efbb --- /dev/null +++ b/sflphone-plugins/plugin/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=addressbook diff --git a/sflphone-plugins/plugin/addressbook/Makefile.am b/sflphone-plugins/plugin/addressbook/Makefile.am new file mode 100644 index 0000000000..74cd4a88f8 --- /dev/null +++ b/sflphone-plugins/plugin/addressbook/Makefile.am @@ -0,0 +1,21 @@ +include ../../globals.mak + +noinst_PROGRAMS = libevladdrbook.so + +libevladdrbook_so_SOURCES = eds.c addressbook.c + +libevladdrbook_so_LDFLAGS = --shared $(SFLGLIB_LDFLAGS) $(SFLGTK_LDFLAGS) $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBEBOOK_LDFLAGS) + +libevladdrbook_so_LDADD = $(SFLGLIB_LIBS) $(SFLGTK_LIBS) $(LIBEDATASERVER_LIBS) $(LIBEDATASERVERUI_LIBS) $(LIBEBOOK_LIBS) + +libevladdrbook_so_CFLAGS = -fPIC -g -Wall $(SFLGTK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBEBOOK_CFLAGS) + +install-exec-local: install-libplugin_libevladdrbook_so + +uninstall-local: uninstall-libplugin_libevladdrbook_so + +install-libplugin_libevladdrbook_so: libevladdrbook.so + $(INSTALL_PROGRAM) libevladdrbook.so $(sflplugindir) + +uninstall-libplugin_libevladdrbook_so: + rm -f $(sflplugindir)/libevladdrbook.so diff --git a/sflphone-plugins/plugin/addressbook/addressbook.c b/sflphone-plugins/plugin/addressbook/addressbook.c new file mode 100644 index 0000000000..57556e5fe4 --- /dev/null +++ b/sflphone-plugins/plugin/addressbook/addressbook.c @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 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 <string.h> +#include <stdio.h> + +#include "eds.h" +#include "addressbook.h" +//#include "searchbar.h" +// #include "addressbook-config.h" + +// static void +// handler_async_search (GList *, gpointer); + +/** + * Perform a search on address book + */ +void +addressbook_search (AddrBookHandle *handle, GtkEntry* entry, AddressBook_Config *addressbook_config) +{ + printf("Addressbook: Search"); + + const gchar* query = gtk_entry_get_text (GTK_ENTRY (entry)); + printf("Addressbook: Search %s\n", query); + + // AddressBook_Config *addressbook_config; + + // activateWaitingLayer(); + + // addressbook_config_load_parameters (&addressbook_config); + + search_async_by_contacts (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, handle->search_cb, addressbook_config); + +} + +/** + * Return addressbook state + */ +gboolean +addressbook_is_enabled() +{ + AddressBook_Config *addressbook_config; + + printf("Addresbook: is enabled\n"); + + // Load the address book parameters + // addressbook_config_load_parameters (&addressbook_config); + + return (guint) addressbook_config->enable; +} + +/** + * Return addressbook state + */ +gboolean +addressbook_is_ready() +{ + printf("Addressbook: is ready\n"); + + return books_ready(); +} + +/** + * Return TRUE if at least one addressbook is active + */ +gboolean +addressbook_is_active() +{ + printf("Addressbook: is active\n"); + return books_active(); +} + +/** + * Get active addressbook from config. + */ +static void +addressbook_config_books(gchar **book_list) +{ + gchar **config_book_uid; + book_data_t *book_data; + gchar **list; + + // Retrieve list of books + // list = (gchar **) dbus_get_addressbook_list(); + + list = NULL; + + if (list == NULL) + return; + + for (config_book_uid = list; *config_book_uid; config_book_uid++) { + + // Get corresponding book data + book_data = books_get_book_data_by_uid (*config_book_uid); + + // If book_data exists + if (book_data == NULL) { + printf("Addressbook: Error: Could not open book (%s:%d)\n", __FILE__, __LINE__); + } else { + book_data->active = TRUE; + } + } + + g_strfreev (list); +} + +/** + * Good method to get books_data + */ +GSList * +addressbook_get_books_data(gchar **book_list) +{ + printf("Addressbook: Get books data\n"); + + // fill_books_data(); + addressbook_config_books(book_list); + 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(gchar **book_list) +{ + printf("Addressbook: Initialize addressbook\n"); + + init_eds_mutex(); + + fill_books_data(); + addressbook_config_books(book_list); + determine_default_addressbook(); + + // Call books initialization + init_eds(); +} + +/** + * Callback called after all book have been processed + */ +/* +static void +handler_async_search (GList *hits, gpointer user_data) +{ + + GList *i; + GdkPixbuf *photo = NULL; + AddressBook_Config *addressbook_config; + callable_obj_t *j; + + printf("Addressbook: callback async search\n"); + + // freeing calls + while ( (j = (callable_obj_t *) g_queue_pop_tail (contacts->callQueue)) != NULL) { + free_callable_obj_t (j); + } + + // Retrieve the address book parameters + addressbook_config = (AddressBook_Config*) user_data; + + // reset previous results + calltree_reset (contacts); + calllist_reset (contacts); + + for (i = hits; i != NULL; i = i->next) { + + Hit *entry; + entry = i->data; + + if (entry) { + // Get the photo + if (addressbook_display (addressbook_config, + ADDRESSBOOK_DISPLAY_CONTACT_PHOTO)) + photo = entry->photo; + + // Create entry for business phone information + if (addressbook_display (addressbook_config, + ADDRESSBOOK_DISPLAY_PHONE_BUSINESS)) + calllist_add_contact (entry->name, entry->phone_business, + CONTACT_PHONE_BUSINESS, photo); + + // Create entry for home phone information + if (addressbook_display (addressbook_config, + ADDRESSBOOK_DISPLAY_PHONE_HOME)) + calllist_add_contact (entry->name, entry->phone_home, + CONTACT_PHONE_HOME, photo); + + // Create entry for mobile phone iddnformation + if (addressbook_display (addressbook_config, + ADDRESSBOOK_DISPLAY_PHONE_MOBILE)) + calllist_add_contact (entry->name, entry->phone_mobile, + CONTACT_PHONE_MOBILE, photo); + } + + free_hit (entry); + } + + g_list_free (hits); + + // Deactivate waiting image + // deactivateWaitingLayer(); + + + gtk_widget_grab_focus (GTK_WIDGET (contacts->view)); +} +*/ + +void addressbook_set_search_type(AddrbookSearchType searchType) { + +} + +void addressbook_set_current_book(gchar *current) { + +} diff --git a/sflphone-plugins/plugin/addressbook/addressbook.h b/sflphone-plugins/plugin/addressbook/addressbook.h new file mode 100644 index 0000000000..54322c300a --- /dev/null +++ b/sflphone-plugins/plugin/addressbook/addressbook.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 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> +// #include <addressbook/eds.h> + + +#define EMPTY_ENTRY "empty" + +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; + gboolean isdefault; +} 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; + +typedef struct AddrBookHandle AddrBookHandle; + +struct AddrBookHandle { + void (*init) (gchar **); + gboolean (*is_ready) (void); + gboolean (*is_enabled) (void); + gboolean (*is_active) (void); + void (*search) (AddrBookHandle *, GtkEntry *, AddressBook_Config *); + book_data_t *(*get_books_data)(gchar **); + GSList *(*get_book_data_by_uid)(gchar *); + void (*set_current_book)(gchar *); + void (*set_search_type)(AddrbookSearchType); + void (*search_cb)(GList *, gpointer); +}; + +/** + * Initialize addressbook + */ +void addressbook_init(gchar **book_list); + +/** + * 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 (AddrBookHandle *, GtkEntry *, AddressBook_Config *); + +/** + * Get a list of addressbook book + */ +GSList *addressbook_get_books_data(gchar **book_list); + +book_data_t *addressbook_get_book_data_by_uid(gchar *); + +void addressbook_set_current_book(gchar *); + +void addressbook_set_search_type(AddrbookSearchType); + +#endif diff --git a/sflphone-plugins/plugin/addressbook/eds.c b/sflphone-plugins/plugin/addressbook/eds.c new file mode 100644 index 0000000000..222f30c151 --- /dev/null +++ b/sflphone-plugins/plugin/addressbook/eds.c @@ -0,0 +1,811 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 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. + *e_book + * 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 <glib.h> +#include <glib/gstring.h> +#include <string.h> +#include <pango/pango.h> +#include "eds.h" +//#include <addressbook-config.h> +#include <libedataserver/e-source.h> + +#include "config.h" + +/** + * 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; + +static void +authenticate_source (EBook *); + +/** + * The global addressbook list + */ +GSList *books_data = NULL; +GMutex *books_data_mutex = NULL; + +/** + * Size of image that will be displayed in contact list + */ +static const int pixbuf_size = 32; + +/** + * Current selected addressbook's uri and uid, initialized with default + */ +static gchar *current_uri = NULL; +static gchar *current_uid = NULL; +static gchar *current_name = "Default"; + +static EBookQueryTest current_test = E_BOOK_QUERY_BEGINS_WITH; + + +/** + * Prototypes + */ +void empty_books_data(); + + +/** + * Free a book data + */ +void +free_book_data (book_data_t *data) +{ + g_free (data->name); + g_free (data->uid); + g_free (data->uri); +} + +/** + * Public way to know if we can perform a search + */ +gboolean +books_ready() +{ + gboolean returnValue; + + g_mutex_lock(books_data_mutex); + + if (books_data == NULL) { + g_mutex_unlock(books_data_mutex); + return FALSE; + } + + returnValue = (g_slist_length (books_data) > 0); + g_mutex_unlock(books_data_mutex); + + return returnValue; +} + +/** + * Public way to know if we enable at least one address book + */ +gboolean +books_active() +{ + GSList *book_list_iterator; + book_data_t *book_data; + + g_mutex_lock(books_data_mutex); + + if (books_data == NULL) { + printf("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__); + g_mutex_unlock(books_data_mutex); + return FALSE; + } + + // Iterate throw the list + for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator + = book_list_iterator->next) { + book_data = (book_data_t *) book_list_iterator->data; + + if (book_data->active) { + g_mutex_unlock(books_data_mutex); + return TRUE; + } + } + + g_mutex_unlock(books_data_mutex); + + // If no result + return FALSE; +} +/** + * Get a specific book data by UID + */ +book_data_t * +books_get_book_data_by_uid (gchar *uid) +{ + GSList *book_list_iterator; + book_data_t *book_data; + + g_mutex_lock(books_data_mutex); + + if (books_data == NULL) { + printf("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__); + g_mutex_unlock(books_data_mutex); + return NULL; + } + + printf("Addressbook: Get book data by uid: %s\n", uid); + + // Iterate throw the list + for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator + = book_list_iterator->next) { + book_data = (book_data_t *) book_list_iterator->data; + + if (strcmp (book_data->uid, uid) == 0) { + printf("Addressbook: Book %s found\n", uid); + g_mutex_unlock(books_data_mutex); + return book_data; + } + } + + g_mutex_unlock(books_data_mutex); + + printf("Addressbook: Could not found Book %s\n", uid); + // If no result + return NULL; +} + + +/** + * 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 *equery; + EBookQuery *queries[4]; + + // Create the query + int cpt = 0; + + // We could also use E_BOOK_QUERY_IS or E_BOOK_QUERY_BEGINS_WITH instead of E_BOOK_QUERY_CONTAINS + queries[cpt++] = e_book_query_field_test (E_CONTACT_FULL_NAME, test, s); + + if (conf->search_phone_home) { + queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_HOME, test, s); + } + + if (conf->search_phone_business) { + queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_BUSINESS, test, s); + } + + if (conf->search_phone_mobile) { + queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_MOBILE, test, s); + } + + equery = e_book_query_or (cpt, queries, TRUE); + + return equery; +} + +/** + * 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) { + GdkPixbufLoader *loader; + + loader = gdk_pixbuf_loader_new(); + + if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) { + if (gdk_pixbuf_loader_write (loader, (guchar *) photo->data.inlined.data, photo->data.inlined.length, NULL)) { + pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); + } + } + + // If pixbuf has been found, check size and resize if needed + if (pixbuf) { + GdkPixbuf *tmp; + gint width = gdk_pixbuf_get_width (pixbuf); + gint height = gdk_pixbuf_get_height (pixbuf); + double scale = 1.0; + + if (height > width) { + scale = pixbuf_size / (double) height; + } else { + scale = pixbuf_size / (double) width; + } + + if (scale < 1.0) { + tmp = gdk_pixbuf_scale_simple (pixbuf, width * scale, height + * scale, GDK_INTERP_BILINEAR); + g_object_unref (pixbuf); + pixbuf = tmp; + } + } + + e_contact_photo_free (photo); + } + + return pixbuf; +} + +/** + * Final callback after all books have been processed. + */ +static void +view_finish_callback (EBookView *book_view, 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); + + printf("Addressbook: View finish, all book have beem processed\n"); + + if (book_view != NULL) + g_object_unref (book_view); + + // 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. + */ +#ifdef LIBEDATASERVER_VERSION_2_32 +void +eds_query_result_cb (EBook *book, const GError *error, GList *contacts, gpointer user_data) +{ + printf("Addressbook: Search Result callback called\n"); + if (error) { + printf("Addressbook: Error: %s\n", error->message); + return; + } +#else +static void +eds_query_result_cb (EBook *book, EBookStatus status, GList *contacts, gpointer user_data) +{ + printf("Addressbook: Search Result callback called\n"); + + if (status != E_BOOK_ERROR_OK) { + printf("Addressbook: Error: "); + return; + } +#endif + + Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data; + + if (contacts == NULL) { + printf("Addressbook: No contact found\n"); + had->search_handler (NULL, user_data); + return; + } + + GList *l = NULL; + + // make sure we have a new list of hits + had->hits = NULL; + + l = contacts; + + while (l) { + + Hit *hit = g_new (Hit, 1); + + if (hit) { + + // Get the photo contact + hit->photo = pixbuf_from_contact (E_CONTACT (l->data)); + fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_BUSINESS, &hit->phone_business); + fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_HOME, &hit->phone_home); + fetch_information_from_contact (E_CONTACT (l->data), E_CONTACT_PHONE_MOBILE, &hit->phone_mobile); + hit->name = g_strdup ( (char *) e_contact_get_const (E_CONTACT (l->data), E_CONTACT_NAME_OR_ORG)); + + if (!hit->name) { + hit->name = ""; + } + + if (hit) { + had->hits = g_list_append (had->hits, hit); + } + + had->max_results_remaining--; + if (had->max_results_remaining <= 0) { + break; + } + } + + l = g_list_next (l); + + } + + view_finish_callback (NULL, had); + + g_object_unref (book); +} + + + +/** + * Callback for asynchronous open of books + */ +#ifdef LIBEDATASERVER_VERSION_2_32 +void +eds_async_open_callback (EBook *book, const GError *error, gpointer closure) +{ + printf("Addressbook: Open book callback\n"); + + ESource *source; + const gchar *uri; + + if(error) { + printf("Addressbook: Error: %s\n", error->message); + return; + } +#else +static void +eds_async_open_callback (EBook *book, EBookStatus status, gpointer closure) +{ + ESource *source; + const gchar *uri; + + if(status == E_BOOK_ERROR_OK) { + printf("Addressbook: Error\n"); + return; + } + +#endif + + Search_Handler_And_Data *had = (Search_Handler_And_Data *) closure; + + if (! (source = e_book_get_source (book))) { + printf("Addressbook: Error: while getting source\n"); + } + + if (! (uri = e_book_get_uri (book))) { + printf("Addressbook: Error while getting URI\n"); + } + + authenticate_source (book); + + if (!e_book_is_opened (book)) { + // We must open the addressbook + e_book_open (book, FALSE, NULL); + } + +#ifdef LIBEDATASERVER_VERSION_2_32 + if (!e_book_get_contacts_async (book, had->equery, eds_query_result_cb, had)) + printf("Addressbook: Error: While querying addressbook\n"); +#else + if (e_book_async_get_contacts (book, had->equery, eds_query_result_cb, had)) + printf("Addressbook: Error: While querying addressbook\n"); +#endif + +} + +/** + * Initialize address book + */ +void +init_eds () +{ + GSList *book_list_iterator; + book_data_t *book_data; + + printf ("Addressbook: Init evolution data server\n"); + + g_mutex_lock(books_data_mutex); + + if (books_data == NULL) { + printf ("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__); + g_mutex_unlock(books_data_mutex); + return; + } + + // init current with first addressbook if no default addressbook set + book_list_iterator = books_data; + book_data = (book_data_t *) book_list_iterator->data; + current_uri = book_data->uri; + current_uid = book_data->uid; + current_name = book_data->name; + + // Iterate through list to find default addressbook + for (book_list_iterator = books_data; book_list_iterator != NULL; + book_list_iterator = book_list_iterator->next) { + book_data = (book_data_t *) book_list_iterator->data; + + if (book_data->isdefault) { + current_uri = book_data->uri; + current_uid = book_data->uid; + current_name = book_data->name; + } + } + + printf("END EVOLUTION INIT %s, %s, %s\n", current_uri, current_uid, current_name); + + g_mutex_unlock(books_data_mutex); +} + +void +init_eds_mutex() { + + books_data_mutex = g_mutex_new(); +} + +/** + * Authenticate this addressbook + */ +static void +authenticate_source (EBook *book) +{ + (void) book; /* unused */ + /* + const gchar *auth_domain; + const gchar *password = NULL; + const gchar *component_name; + const gchar *user = NULL; + const gchar *auth; + GError *err = NULL; + const gchar *uri; + ESource *source; + + if ((source = e_book_get_source (book)) == NULL) { + DEBUG ("Addressbook: Error while getting source"); + } + + if ((uri = e_book_get_uri (book)) == NULL) { + DEBUG ("Addressbook: Error while getting URI"); + } + + auth_domain = e_source_get_property (source, "auth-domain"); + + auth = e_source_get_property (source, "auth"); + + if (auth && !strcmp ("ldap/simple-binddn", auth)) { + user = e_source_get_property (source, "binddn"); + } + else if (auth && !strcmp ("plain/password", auth)) { + user = e_source_get_property (source, "user"); + + if (!user) { + user = e_source_get_property (source, "username"); + } + } else { + user = e_source_get_property (source, "email_addr"); + } + + if (!user) { + user = ""; + } + + if (auth) { + component_name = auth_domain ? auth_domain : "Addressbook"; + + password = e_passwords_get_password (component_name, uri); + + if (e_book_authenticate_user (book, user, password, auth, &err)) { + DEBUG ("Addressbook: authentication successfull"); + } + else { + ERROR ("Addressbook: authentication error"); + } + + } +*/ +} + +/** + * Fill book data + */ +void +fill_books_data () +{ + GSList *list, *l; + ESourceList *source_list = NULL; + + printf ("Addressbook: Fill books data\n"); + + source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources"); + + if (source_list == NULL) { + printf ("Addressbook: Error could not initialize source list for addressbook (%s:%d)\n", __FILE__, __LINE__); + return; + } + + list = e_source_list_peek_groups (source_list); + + if (list == NULL) { + printf ("Addressbook: Address Book source groups are missing (%s:%d)! Check your GConf setup.\n", __FILE__, __LINE__); + return; + } + + g_mutex_lock(books_data_mutex); + + if (books_data != NULL) { + empty_books_data(); + books_data = NULL; + } + + for (l = list; l != NULL; l = l->next) { + + ESourceGroup *group = l->data; + GSList *sources = NULL, *m; + gchar *absuri = g_strdup (e_source_group_peek_base_uri (group)); + + sources = e_source_group_peek_sources (group); + + for (m = sources; m != NULL; m = m->next) { + + ESource *source = m->data; + + book_data_t *book_data = g_new (book_data_t, 1); + book_data->active = FALSE; + book_data->name = g_strdup (e_source_peek_name (source)); + book_data->uid = g_strdup (e_source_peek_uid (source)); + + const gchar *property_name = "default"; + const gchar *prop = e_source_get_property (source, property_name); + + if (prop) { + if (strcmp (prop, "true") == 0) { + book_data->isdefault = TRUE; + } else { + book_data->isdefault = FALSE; + } + } else { + book_data->isdefault = FALSE; + } + + book_data->uri = g_strjoin ("", absuri, e_source_peek_relative_uri (source), NULL); + + // authenticate_source (book_data, source); + + books_data = g_slist_prepend (books_data, book_data); + + } + + g_free (absuri); + } + + g_mutex_unlock(books_data_mutex); + + g_object_unref (source_list); +} + +void +determine_default_addressbook() +{ + g_mutex_lock(books_data_mutex); + + GSList *list_element = books_data; + gboolean default_found = FALSE; + + while (list_element && !default_found) { + book_data_t *book_data = list_element->data; + + if (book_data->isdefault) { + default_found = TRUE; + current_uri = book_data->uri; + current_uid = book_data->uid; + current_name = book_data->name; + } + + list_element = g_slist_next (list_element); + } + + // reset loop + list_element = books_data; + + while (list_element && !default_found) { + book_data_t *book_data = list_element->data; + + if (book_data->active) { + default_found = TRUE; + book_data->isdefault = TRUE; + current_uri = book_data->uri; + current_uid = book_data->uid; + current_name = book_data->name; + printf ("Addressbook: No default addressbook found, using %s addressbook as default\n", book_data->name); + } + + list_element = g_slist_next (list_element); + } + + g_mutex_unlock(books_data_mutex); +} + +void +empty_books_data() +{ + GSList *book_list_iterator; + book_data_t *book_data; + + if (books_data == NULL) { + printf ("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__); + return; + } + + // Iterate throw the list + for (book_list_iterator = books_data; book_list_iterator != NULL; + book_list_iterator = book_list_iterator->next) { + book_data = (book_data_t *) book_list_iterator->data; + + free_book_data (book_data); + } +} + +void +search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler handler, gpointer user_data) +{ + GError *err = NULL; + EBook *book = NULL; + + printf ("Addressbook: New search by contacts: %s, max_results %d\n", query, max_results); + + if (strlen (query) < 1) { + printf ("Addressbook: Query is empty\n"); + handler (NULL, user_data); + return; + } + + Search_Handler_And_Data *had = g_new (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; + had->equery = create_query (query, current_test, (AddressBook_Config *) (user_data)); + + if (!current_uri) { + printf ("Addressbook: Error: Current addressbook uri not specified\n"); + } + + printf ("Addressbook: Opening addressbook: uri: %s\n", current_uri); + printf ("Addressbook: Opening addressbook: name: %s\n", current_name); + + book = e_book_new_from_uri(current_uri, &err); + + if (err) { + printf ("Addressbook: Error: Could not open new book: %s\n", err->message); + } + + if (book) { + printf ("Addressbook: Created empty book successfully\n"); + +#ifdef LIBEDATASERVER_VERSION_2_32 + e_book_open_async (book, TRUE, eds_async_open_callback, had); +#else + // Asynchronous open + e_book_async_open(book, TRUE, eds_async_open_callback, had); +#endif + + } else { + printf ("Addressbook: Error: No book available\n"); + } + +} + +/** + * Fetch information for a specific contact + */ +void +fetch_information_from_contact (EContact *contact, EContactField field, gchar **info) +{ + gchar *to_fetch; + + to_fetch = g_strdup ( (char*) e_contact_get_const (contact, field)); + + if (!to_fetch) { + to_fetch = g_strdup (EMPTY_ENTRY); + } + + *info = g_strdup (to_fetch); +} + +void +set_current_addressbook (const gchar *name) +{ + + GSList *book_list_iterator; + book_data_t *book_data; + + if(name == NULL) + return; + + g_mutex_lock(books_data_mutex); + + if (!books_data) { + printf ("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__); + g_mutex_unlock(books_data_mutex); + return; + } + + // Iterate throw the list + for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator + = book_list_iterator->next) { + book_data = (book_data_t *) book_list_iterator->data; + + if (strcmp (book_data->name, name) == 0) { + current_uri = book_data->uri; + current_uid = book_data->uid; + current_name = book_data->name; + } + } + + printf("Addressbook: Set current addressbook %s, %s, %s\n", current_uri, current_uid, current_name); + + g_mutex_unlock(books_data_mutex); +} + + +const gchar * +get_current_addressbook (void) +{ + return current_name; +} + + +void +set_current_addressbook_test (EBookQueryTest test) +{ + current_test = test; +} + +EBookQueryTest +get_current_addressbook_test (void) +{ + return current_test; +} + +GSList * +get_books_data() +{ + return books_data; +} diff --git a/sflphone-plugins/plugin/addressbook/eds.h b/sflphone-plugins/plugin/addressbook/eds.h new file mode 100644 index 0000000000..bedde3ee91 --- /dev/null +++ b/sflphone-plugins/plugin/addressbook/eds.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 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/gtypes.h> +#include <gdk-pixbuf/gdk-pixbuf.h> +#include <libebook/e-book.h> + +#include "addressbook.h" +// #include "sflphone_const.h" + + +#define EMPTY_ENTRY "empty" + +G_BEGIN_DECLS + +/** + * Current search id used to prevent processing + * of previous search + */ +int current_search_id; + +/** + * 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; + gboolean isdefault; +} book_data_t; +*/ + +/** + * Free a contact entry + */ +void +free_hit (Hit *h); + +/** + * Template callback function for the asynchronous search + */ +typedef void +(* SearchAsyncHandler) (GList *hits, gpointer user_data); + +/** + * Template callback function for the asynchronous open + */ +typedef void +(* OpenAsyncHandler) (); + +/** + * Initialize the address book. + * Connection to evolution data server + */ +void +init_eds (); + +/** + * We need to initialize multi-threading capabilities + * due to asynchronous callbacks + */ +void +init_eds_mutex(void); + +/** + * 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); + +/** + * Retrieve the specified information from the contact + */ +void +fetch_information_from_contact (EContact *contact, EContactField field, + gchar **info); + +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); + +/** + * Return current addressbook name + */ +const gchar * +get_current_addressbook (void); + +void +set_current_addressbook_test (EBookQueryTest test); + +EBookQueryTest +get_current_addressbook_test (void); + +GSList * +get_books_data(); + +void +determine_default_addressbook(); + + +G_END_DECLS + +#endif /* __EDS_H__ */ -- GitLab