+2012-04-01 [colin] 3.8.0cvs36
+
+ * configure.ac
+ * src/.cvsignore
+ * src/Makefile.am
+ * src/addr_compl.c
+ * src/addressadd.c
+ * src/addressadd.h
+ * src/addressbook-dbus.c
+ * src/addressbook-dbus.h
+ * src/addrgather.c
+ * src/addrgather.h
+ * src/addrharvest.c
+ * src/addrharvest.h
+ * src/claws-contacts.xml
+ * src/compose.c
+ * src/compose.h
+ * src/filtering.c
+ * src/headerview.c
+ * src/main.c
+ * src/mainwindow.c
+ * src/messageview.c
+ * src/prefs_common.c
+ * src/prefs_filtering_action.c
+ * src/prefs_matcher.c
+ * src/summaryview.c
+ * src/textview.c
+ * src/toolbar.c
+ * src/plugins/bogofilter/bogofilter_gtk.c
+ * src/plugins/dillo_viewer/dillo_prefs.c
+ * src/plugins/spamassassin/spamassassin_gtk.c
+ * src/plugins/trayicon/trayicon.c
+ Import new addressbook code from the new-contacts branch
+
2012-03-29 [paul] 3.8.0cvs35
* AUTHORS
( cvs diff -u -r 1.94.2.229 -r 1.94.2.230 src/messageview.c; cvs diff -u -r 1.96.2.238 -r 1.96.2.239 src/textview.c; ) > 3.8.0cvs33.patchset
( cvs diff -u -r 1.13.2.43 -r 1.13.2.44 src/common/plugin.c; ) > 3.8.0cvs34.patchset
( cvs diff -u -r 1.100.2.82 -r 1.100.2.83 AUTHORS; cvs diff -u -r 1.1.2.77 -r 1.1.2.78 src/gtk/authors.h; cvs diff -u -r 1.1.2.107 -r 1.1.2.108 src/gtk/quicksearch.c; ) > 3.8.0cvs35.patchset
+( cvs diff -u -r 1.654.2.4430 -r 1.654.2.4431 configure.ac; cvs diff -u -r 1.11.2.2 -r 1.11.2.3 src/.cvsignore; cvs diff -u -r 1.155.2.98 -r 1.155.2.99 src/Makefile.am; cvs diff -u -r 1.27.2.60 -r 1.27.2.61 src/addr_compl.c; cvs diff -u -r 1.9.2.34 -r 1.9.2.35 src/addressadd.c; cvs diff -u -r 1.2.16.8 -r 1.2.16.9 src/addressadd.h; diff -u /dev/null src/addressbook-dbus.c; diff -u /dev/null src/addressbook-dbus.h; cvs diff -u -r 1.5.10.36 -r 1.5.10.37 src/addrgather.c; cvs diff -u -r 1.3.12.7 -r 1.3.12.8 src/addrgather.h; cvs diff -u -r 1.6.10.25 -r 1.6.10.26 src/addrharvest.c; cvs diff -u -r 1.4.12.8 -r 1.4.12.9 src/addrharvest.h; diff -u /dev/null src/claws-contacts.xml; cvs diff -u -r 1.382.2.598 -r 1.382.2.599 src/compose.c; cvs diff -u -r 1.50.2.65 -r 1.50.2.66 src/compose.h; cvs diff -u -r 1.60.2.61 -r 1.60.2.62 src/filtering.c; cvs diff -u -r 1.8.2.34 -r 1.8.2.35 src/headerview.c; cvs diff -u -r 1.115.2.247 -r 1.115.2.248 src/main.c; cvs diff -u -r 1.274.2.343 -r 1.274.2.344 src/mainwindow.c; cvs diff -u -r 1.94.2.230 -r 1.94.2.231 src/messageview.c; cvs diff -u -r 1.204.2.208 -r 1.204.2.209 src/prefs_common.c; cvs diff -u -r 1.1.4.73 -r 1.1.4.74 src/prefs_filtering_action.c; cvs diff -u -r 1.43.2.91 -r 1.43.2.92 src/prefs_matcher.c; cvs diff -u -r 1.395.2.445 -r 1.395.2.446 src/summaryview.c; cvs diff -u -r 1.96.2.239 -r 1.96.2.240 src/textview.c; cvs diff -u -r 1.43.2.126 -r 1.43.2.127 src/toolbar.c; cvs diff -u -r 1.1.2.40 -r 1.1.2.41 src/plugins/bogofilter/bogofilter_gtk.c; cvs diff -u -r 1.5.2.27 -r 1.5.2.28 src/plugins/dillo_viewer/dillo_prefs.c; cvs diff -u -r 1.23.2.57 -r 1.23.2.58 src/plugins/spamassassin/spamassassin_gtk.c; cvs diff -u -r 1.14.2.79 -r 1.14.2.80 src/plugins/trayicon/trayicon.c; ) > 3.8.0cvs36.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=35
+EXTRA_VERSION=36
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
if test "$GCC" = "yes"
then
CFLAGS="$CFLAGS -Wno-unused-function"
+ #CFLAGS="-g -Wall -Wno-unused-function"
fi
AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
AM_CONDITIONAL(GTK3, true)
AM_CONDITIONAL(GTK2, false)
else
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.16)
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18)
dnl --disable-deprecated switch for GTK2 purification
AC_ARG_ENABLE(deprecated, [ --disable-deprecated disable deprecated GTK functions. ],
AC_SUBST(LIBRESOLV)
LIBS="$LIBS $LIBRESOLV"
-
-dnl for LDAP support in addressbook
-dnl no check for libraries; dynamically loaded
-AC_ARG_ENABLE(ldap,
- [ --disable-ldap disable LDAP support],
- [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=yes])
-AC_MSG_CHECKING([whether to use LDAP])
-if test x"$ac_cv_enable_ldap" = xno; then
- AC_MSG_RESULT(no)
-elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
- AC_MSG_RESULT(no - LDAP support needs pthread support)
-
- ac_cv_enable_ldap=no
-elif test x"$platform_win32" = xyes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
- LDAP_LIBS="-lwldap32"
- AC_SUBST(LDAP_LIBS)
-else
- AC_MSG_RESULT(yes)
-
- dnl check for available libraries, and pull them in
- AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
- AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
- AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
- AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
- $LDAP_LIBS)
-
- AC_CHECK_HEADERS(ldap.h lber.h,
- [ ac_cv_enable_ldap=yes ],
- [ ac_cv_enable_ldap=no ])
-
- if test "$ac_cv_enable_ldap" = yes; then
- AC_CHECK_LIB(ldap, ldap_open,
- [ ac_cv_enable_ldap=yes ],
- [ ac_cv_enable_ldap=no ],
- $LDAP_LIBS)
-
- AC_CHECK_LIB(ldap, ldap_start_tls_s,
- [ ac_cv_have_tls=yes ],
- [ ac_cv_have_tls=no ])
-
- fi
-
- AC_MSG_CHECKING([whether ldap library is available])
- AC_MSG_RESULT($ac_cv_enable_ldap)
-
- AC_MSG_CHECKING([whether TLS library is available])
- AC_MSG_RESULT($ac_cv_have_tls)
-
- if test "$ac_cv_enable_ldap" = yes; then
- AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
- LDAP_LIBS="$LDAP_LIBS -lldap"
- AC_SUBST(LDAP_LIBS)
- if test "$ac_cv_have_tls" = yes; then
- AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
- fi
- dnl As of OpenLDAP API version 3000 a number of functions has
- dnl been deprecated. As Claws-mail compiles and runs on many
- dnl platforms and many versions of OpenLDAP we need to be able
- dnl to switch between the old and new API because new API has
- dnl added new functions replacing old ones and at the same time
- dnl old functions has been changed.
- dnl If cross-compiling defaults to enable deprecated features
- dnl for maximum portability
- AC_MSG_CHECKING([The API version of OpenLDAP])
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [#include <ldap.h>],
- [if (LDAP_API_VERSION >= 3000)
- return 1
- ])],
- [AC_MSG_RESULT([version < 3000])
- AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
- [AC_MSG_RESULT([version >= 3000])
- AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
- [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
- AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
- AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
- )
- fi
-fi
-
-dnl for JPilot support in addressbook
-dnl no check for libraries; these are dynamically loaded
-AC_ARG_ENABLE(jpilot,
- [ --disable-jpilot disable JPilot support],
- [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=yes])
-AC_MSG_CHECKING([whether to use JPilot])
-if test "$ac_cv_enable_jpilot" = yes; then
- AC_MSG_RESULT(yes)
- AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
- [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
- [ ac_cv_enable_jpilot=no ])
- if test "$ac_cv_enable_jpilot" = no; then
- AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
- [ ac_cv_enable_jpilot=yes
- AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
- fi
-
- AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
- if test x"$ac_cv_enable_jpilot" = xyes; then
- AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
- else
- AC_MSG_NOTICE([JPilot support not available])
- fi
- AC_SUBST(JPILOT_LIBS)
-else
- AC_MSG_RESULT(no)
-fi
dnl #######################################################################
dnl # Check for startup notification
AC_SUBST(DBUS_LIBS)
fi
+dnl #######################################################################
+dnl # Configure address book support
+dnl #######################################################################
+
+dnl #######################################################################
+dnl # Check for new address book support
+dnl #######################################################################
+AC_MSG_CHECKING([whether DBUS support for new address book is present])
+if test x"$enable_dbus_glib" = xyes; then
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([whether to enable new address book])
+ AC_ARG_ENABLE(new-addrbook, [ --enable-new-addrbook enable new address book],,enable_new_addrbook=no)
+ if test x"$enable_new_addrbook" = xyes; then
+ AC_MSG_RESULT([yes])
+ PKG_CHECK_MODULES(CONTACTS, [claws-contacts],
+ [
+ AC_DEFINE(USE_NEW_ADDRBOOK, 1, [Define if new address book is to be activated.])
+ enable_new_addrbook=yes
+ AC_SUBST(CONTACTS_CFLAGS)
+ AC_SUBST(CONTACTS_LIBS)
+ ],
+ [
+ enable_new_addrbook=no
+ ])
+ else
+ AC_MSG_RESULT([no])
+ enable_new_addrbook=no
+ fi
+else
+ AC_MSG_RESULT([no])
+ enable_new_addrbook=no
+fi
+
+dnl #######################################################################
+dnl # Check for old address book support
+dnl #######################################################################
+if test x"$enable_new_addrbook" = xno; then
+ dnl for LDAP support in addressbook
+ dnl no check for libraries; dynamically loaded
+ AC_ARG_ENABLE(ldap,
+ [ --disable-ldap disable LDAP support],
+ [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=yes])
+ AC_MSG_CHECKING([whether to use LDAP])
+ if test x"$ac_cv_enable_ldap" = xno; then
+ AC_MSG_RESULT(no)
+ elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
+ AC_MSG_RESULT(no - LDAP support needs pthread support)
+
+ ac_cv_enable_ldap=no
+ elif test x"$platform_win32" = xyes; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
+ LDAP_LIBS="-lwldap32"
+ AC_SUBST(LDAP_LIBS)
+ else
+ AC_MSG_RESULT(yes)
+
+ dnl check for available libraries, and pull them in
+ AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
+ AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
+ AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
+ AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
+ $LDAP_LIBS)
+
+ AC_CHECK_HEADERS(ldap.h lber.h,
+ [ ac_cv_enable_ldap=yes ],
+ [ ac_cv_enable_ldap=no ])
+
+ if test "$ac_cv_enable_ldap" = yes; then
+ AC_CHECK_LIB(ldap, ldap_open,
+ [ ac_cv_enable_ldap=yes ],
+ [ ac_cv_enable_ldap=no ],
+ $LDAP_LIBS)
+
+ AC_CHECK_LIB(ldap, ldap_start_tls_s,
+ [ ac_cv_have_tls=yes ],
+ [ ac_cv_have_tls=no ])
+
+ fi
+
+ AC_MSG_CHECKING([whether ldap library is available])
+ AC_MSG_RESULT($ac_cv_enable_ldap)
+
+ AC_MSG_CHECKING([whether TLS library is available])
+ AC_MSG_RESULT($ac_cv_have_tls)
+
+ if test "$ac_cv_enable_ldap" = yes; then
+ AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
+ LDAP_LIBS="$LDAP_LIBS -lldap"
+ AC_SUBST(LDAP_LIBS)
+ if test "$ac_cv_have_tls" = yes; then
+ AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
+ fi
+ dnl As of OpenLDAP API version 3000 a number of functions has
+ dnl been deprecated. As Claws-mail compiles and runs on many
+ dnl platforms and many versions of OpenLDAP we need to be able
+ dnl to switch between the old and new API because new API has
+ dnl added new functions replacing old ones and at the same time
+ dnl old functions has been changed.
+ dnl If cross-compiling defaults to enable deprecated features
+ dnl for maximum portability
+ AC_MSG_CHECKING([The API version of OpenLDAP])
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <ldap.h>],
+ [if (LDAP_API_VERSION >= 3000)
+ return 1
+ ])],
+ [AC_MSG_RESULT([version < 3000])
+ AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
+ [AC_MSG_RESULT([version >= 3000])
+ AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
+ [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
+ AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
+ AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
+ )
+ fi
+ fi
+
+ dnl for JPilot support in addressbook
+ dnl no check for libraries; these are dynamically loaded
+ AC_ARG_ENABLE(jpilot,
+ [ --disable-jpilot disable JPilot support],
+ [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=yes])
+ AC_MSG_CHECKING([whether to use JPilot])
+ if test "$ac_cv_enable_jpilot" = yes; then
+ AC_MSG_RESULT(yes)
+ AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
+ [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
+ [ ac_cv_enable_jpilot=no ])
+ if test "$ac_cv_enable_jpilot" = no; then
+ AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
+ [ ac_cv_enable_jpilot=yes
+ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
+ fi
+
+ AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
+ if test x"$ac_cv_enable_jpilot" = xyes; then
+ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
+ else
+ AC_MSG_NOTICE([JPilot support not available])
+ fi
+ AC_SUBST(JPILOT_LIBS)
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+AM_CONDITIONAL(BUILD_NEWADDRBOOK, test x"$enable_new_addrbook" = x"yes")
+
dnl #######################################################################
dnl # Check for NetworkManager support
dnl #######################################################################
echo ""
echo "$PACKAGE $VERSION"
echo ""
-echo "JPilot : $ac_cv_enable_jpilot"
-echo "LDAP : $ac_cv_enable_ldap"
-echo "gnuTLS : $ac_cv_enable_gnutls"
-echo "iconv : $am_cv_func_iconv"
-echo "compface : $ac_cv_enable_compface"
-echo "IPv6 : $ac_cv_enable_ipv6"
-echo "enchant : $ac_cv_enable_enchant"
-echo "IMAP4 : $ac_cv_enable_libetpan"
-echo "NNTP : $ac_cv_enable_libetpan"
-echo "Crash dialog : $ac_cv_enable_crash_dialog"
-echo "LibSM : $ac_cv_enable_libsm"
-echo "DBUS : $enable_dbus"
-echo "NetworkManager : $enable_networkmanager_support"
-echo "Manual : $ac_cv_enable_manual"
-echo "Plugins : $PLUGINS"
-echo "Generic UMPC code : $ac_cv_enable_generic_umpc"
-echo "Maemo build : $ac_cv_enable_maemo"
-echo "Config dir : $ac_cv_with_config_dir"
+if test x"$enable_new_addrbook" = xyes; then
+ echo "Using Address Book : New experimental interface"
+else
+ echo "Using Address Book : Old stable interface"
+ echo "JPilot : $ac_cv_enable_jpilot"
+ echo "LDAP : $ac_cv_enable_ldap"
+fi
+echo "gnuTLS : $ac_cv_enable_gnutls"
+echo "iconv : $am_cv_func_iconv"
+echo "compface : $ac_cv_enable_compface"
+echo "IPv6 : $ac_cv_enable_ipv6"
+echo "enchant : $ac_cv_enable_enchant"
+echo "IMAP4 : $ac_cv_enable_libetpan"
+echo "NNTP : $ac_cv_enable_libetpan"
+echo "Crash dialog : $ac_cv_enable_crash_dialog"
+echo "LibSM : $ac_cv_enable_libsm"
+echo "DBUS : $enable_dbus"
+echo "NetworkManager : $enable_networkmanager_support"
+echo "Manual : $ac_cv_enable_manual"
+echo "Plugins : $PLUGINS"
+echo "Generic UMPC code : $ac_cv_enable_generic_umpc"
+echo "Maemo build : $ac_cv_enable_maemo"
+echo "Config dir : $ac_cv_with_config_dir"
echo ""
echo "The binary will be installed in $prefix/bin"
echo ""
matcher_parser_parse.c
matcher_parser_parse.h
ylwrap
+client-bindings.h
claws_mail_deps =
endif
-claws_mail_SOURCES = \
- account.c \
- action.c \
+if BUILD_NEWADDRBOOK
+abook_headers = \
+ addressbook-dbus.h
+abook_source = \
+ addressbook-dbus.c
+else
+abook_headers = \
+ addrbook.h \
+ addrclip.h \
+ addrcustomattr.h \
+ addressbook.h \
+ addressbook_foldersel.h \
+ addrindex.h \
+ addrquery.h \
+ addrselect.h \
+ addrduplicates.h \
+ browseldap.h \
+ editaddress.h \
+ editaddress_other_attributes_ldap.h \
+ editbook.h \
+ editgroup.h \
+ editjpilot.h \
+ editldap_basedn.h \
+ editldap.h \
+ editvcard.h \
+ exphtmldlg.h \
+ expldifdlg.h \
+ exporthtml.h \
+ exportldif.h \
+ importldif.h \
+ importmutt.h \
+ importpine.h \
+ jpilot.h \
+ ldapctrl.h \
+ ldaplocate.h \
+ ldapquery.h \
+ ldapserver.h \
+ ldapupdate.h \
+ ldaputil.h \
+ ldif.h \
+ mutt.h \
+ pine.h \
+ vcard.h
+
+abook_source = \
addrbook.c \
- addrcache.c \
addrclip.c \
- addr_compl.c \
addrcustomattr.c \
- addressadd.c \
addressbook.c \
addressbook_foldersel.c \
- addrgather.c \
- addrharvest.c \
addrindex.c \
- addritem.c \
addrquery.c \
addrselect.c \
addrduplicates.c \
- alertpanel.c \
- autofaces.c \
browseldap.c \
- codeconv.c \
- compose.c \
- crash.c \
- customheader.c \
- displayheader.c \
editaddress.c \
editaddress_other_attributes_ldap.c \
editbook.c \
editjpilot.c \
editldap_basedn.c \
editldap.c \
- edittags.c \
editvcard.c \
- enriched.c \
exphtmldlg.c \
expldifdlg.c \
- export.c \
exporthtml.c \
exportldif.c \
+ importldif.c \
+ importmutt.c \
+ importpine.c \
+ jpilot.c \
+ ldapctrl.c \
+ ldaplocate.c \
+ ldapquery.c \
+ ldapserver.c \
+ ldapupdate.c \
+ ldaputil.c \
+ ldif.c \
+ mutt.c \
+ pine.c \
+ vcard.c
+endif
+
+claws_mail_SOURCES = \
+ account.c \
+ action.c \
+ addrcache.c \
+ addr_compl.c \
+ addressadd.c \
+ addrgather.c \
+ addrharvest.c \
+ addritem.c \
+ alertpanel.c \
+ autofaces.c \
+ codeconv.c \
+ compose.c \
+ crash.c \
+ customheader.c \
+ displayheader.c \
+ edittags.c \
+ enriched.c \
+ export.c \
filtering.c \
folder.c \
folder_item_prefs.c \
imap.c \
imap_gtk.c \
import.c \
- importldif.c \
- importmutt.c \
- importpine.c \
inc.c \
- jpilot.c \
- ldapctrl.c \
- ldaplocate.c \
- ldapquery.c \
- ldapserver.c \
- ldapupdate.c \
- ldaputil.c \
- ldif.c \
localfolder.c \
main.c \
mainwindow.c \
mh_gtk.c \
mimeview.c \
msgcache.c \
- mutt.c \
news.c \
news_gtk.c \
noticeview.c \
partial_download.c \
- pine.c \
pop.c \
prefs_account.c \
prefs_actions.c \
undo.c \
unmime.c \
uri_opener.c \
- vcard.c \
- wizard.c
+ wizard.c \
+ $(abook_source)
claws_mailincludedir = $(pkgincludedir)
claws_mailinclude_HEADERS = \
account.h \
action.h \
- adbookbase.h \
- addrbook.h \
addrcache.h \
- addrclip.h \
addr_compl.h \
addrdefs.h \
- addrcustomattr.h \
addressadd.h \
- addressbook.h \
- addressbook_foldersel.h \
+ addritem.h \
addressitem.h \
addrgather.h \
addrharvest.h \
- addrindex.h \
- addritem.h \
- addrquery.h \
- addrselect.h \
- addrduplicates.h \
alertpanel.h \
autofaces.h \
- browseldap.h \
codeconv.h \
compose.h \
crash.h \
customheader.h \
displayheader.h \
- editaddress.h \
- editaddress_other_attributes_ldap.h \
- editbook.h \
- editgroup.h \
- editjpilot.h \
- editldap_basedn.h \
- editldap.h \
edittags.h \
- editvcard.h \
enriched.h \
- exphtmldlg.h \
- expldifdlg.h \
export.h \
- exporthtml.h \
- exportldif.h \
filtering.h \
folder.h \
folder_item_prefs.h \
imap.h \
imap_gtk.h \
import.h \
- importldif.h \
- importmutt.h \
- importpine.h \
inc.h \
- jpilot.h \
- ldapctrl.h \
- ldaplocate.h \
- ldapquery.h \
- ldapserver.h \
- ldapupdate.h \
- ldaputil.h \
- ldif.h \
localfolder.h \
main.h \
mainwindow.h \
mh_gtk.h \
mimeview.h \
msgcache.h \
- mutt.h \
news.h \
news_gtk.h \
noticeview.h \
partial_download.h \
- pine.h \
pop.h \
prefs_account.h \
prefs_actions.h \
undo.h \
unmime.h \
uri_opener.h \
- vcard.h \
- wizard.h
+ wizard.h \
+ $(abook_headers)
BUILT_SOURCES = \
matcher_parser_parse.h \
- quote_fmt_parse.h
+ quote_fmt_parse.h \
+ client-bindings.h
+
+client-bindings.h: claws-contacts.xml
+if BUILD_NEWADDRBOOK
+ dbus-binding-tool --prefix=abook --mode=glib-client --output=$@ claws-contacts.xml
+
+CLEANFILES = \
+ client-bindings.h
+endif
EXTRA_DIST = \
w32-logo.ico w32-resource.rc \
pixmaps/tray_unreadmarkedmail.offline.xpm \
pixmaps/tray_unreadmarkedmail.xpm \
pixmaps/empty.xpm \
- pixmaps/replied_and_forwarded.xpm
+ pixmaps/replied_and_forwarded.xpm \
+ claws-contacts.xml
INCLUDES = \
$(LIBETPAN_LIBS) \
$(MAEMO_LIBS) \
$(CONIC_LIBS) \
- $(DBUS_LIBS)
+ $(DBUS_LIBS) \
+ $(CONTACTS_LIBS)
pixmapdir=$(datadir)/icons/hicolor/48x48/apps
$(CONIC_CFLAGS) \
$(DBUS_CFLAGS) \
$(NETWORKMANAGER_SUPPORT_CFLAGS) \
- $(VALGRIND_CFLAGS)
+ $(VALGRIND_CFLAGS) \
+ $(CONTACTS_CFLAGS)
#no-unused-function is there because of bison stuff
#no-deprecated-declarations because of gpgme_data_rewind, which we have
# include <wctype.h>
#endif
-#include "addrindex.h"
#include "addr_compl.h"
+#include "addritem.h"
#include "utils.h"
#include "prefs_common.h"
#include "claws.h"
#include "gtkutils.h"
#include <pthread.h>
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
+
/*!
*\brief For the GtkListStore
*/
free_all_addresses();
free_completion_list();
+#ifndef USE_NEW_ADDRBOOK
addrindex_load_completion( add_address, folderpath );
-
+#else
+ GError* error = NULL;
+
+ addrcompl_initialize();
+ if (! addrindex_dbus_load_completion(add_address, &error)) {
+ g_warning("Failed to populate address completion list");
+ g_error_free(error);
+ return;
+ }
+#endif
/* plugins may hook in here to modify/extend the completion list */
hooks_invoke(ADDDRESS_COMPLETION_BUILD_ADDRESS_LIST_HOOKLIST, &g_address_list);
*/
static void addrcompl_destroy_window( CompletionWindow *cw ) {
/* Stop all searches currently in progress */
+#ifndef USE_NEW_ADDRBOOK
addrindex_stop_search( _queryID_ );
-
+#endif
/* Remove idler function... or application may not terminate */
if( _completionIdleID_ != 0 ) {
g_source_remove( _completionIdleID_ );
* criteria.
* \param data Query data.
*/
+#ifndef USE_NEW_ADDRBOOK
static gint addrcompl_callback_entry(
gpointer sender, gint queryID, GList *listEMail, gpointer data )
{
return 0;
}
+#endif
/**
* Clear the display queue.
* Start the search.
*/
static void addrcompl_start_search( void ) {
+#ifndef USE_NEW_ADDRBOOK
gchar *searchTerm;
searchTerm = g_strdup( _compWindow_->searchTerm );
_queryID_ = addrindex_setup_search(
searchTerm, NULL, addrcompl_callback_entry );
g_free( searchTerm );
+#endif
/* g_print( "addrcompl_start_search::queryID=%d\n", _queryID_ ); */
/* Load local stuff */
g_idle_add( (GSourceFunc) addrcompl_idle, NULL );
/* g_print( "addrindex_start_search::queryID=%d\n", _queryID_ ); */
+#ifndef USE_NEW_ADDRBOOK
addrindex_start_search( _queryID_ );
+#else
+
+#endif
}
/**
#include "prefs_common.h"
#include "prefs_gtk.h"
#include "addressadd.h"
-#include "addritem.h"
-#include "addrbook.h"
-#include "addrindex.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addritem.h"
+ #include "addrbook.h"
+ #include "addrindex.h"
+ #include "ldapserver.h"
+ #include "ldapupdate.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "manage_window.h"
-#include "ldapserver.h"
-#include "ldapupdate.h"
#include "alertpanel.h"
+#ifndef USE_NEW_ADDRBOOK
typedef struct {
AddressBookFile *book;
ItemFolder *folder;
} FolderInfo;
+#else
+typedef struct {
+ gchar* book;
+} FolderInfo;
+#endif
static struct _AddressAdd_dlg {
GtkWidget *window;
static gboolean addressadd_cancelled;
+#ifndef USE_NEW_ADDRBOOK
static FolderInfo *addressadd_create_folderinfo( AddressBookFile *abf, ItemFolder *folder )
{
FolderInfo *fi = g_new0( FolderInfo, 1 );
fi->folder = folder;
return fi;
}
+#else
+static FolderInfo *addressadd_create_folderinfo(gchar* book) {
+ FolderInfo *fi = g_new0( FolderInfo, 1 );
+ fi->book = book;
+ return fi;
+}
+#endif
+#ifndef USE_NEW_ADDRBOOK
static void addressadd_free_folderinfo( FolderInfo *fi ) {
fi->book = NULL;
fi->folder = NULL;
g_free( fi );
}
+#else
+static void addressadd_free_folderinfo( FolderInfo *fi ) {
+ fi->book = NULL;
+ g_free( fi );
+}
+#endif
static gint addressadd_delete_event( GtkWidget *widget, GdkEventAny *event, gboolean *cancelled ) {
addressadd_cancelled = TRUE;
&folderXpm );
}
+#ifndef USE_NEW_ADDRBOOK
static void addressadd_load_folder( GtkCMCTreeNode *parentNode, ItemFolder *parentFolder,
FolderInfo *fiParent )
{
list = g_list_next( list );
}
}
+#else
+static void addressadd_load_data() {
+ GSList *list;
+ gchar *name;
+ GtkCMCTree *tree = GTK_CMCTREE(addressadd_dlg.tree_folder);
+ GtkCMCTreeNode *node;
+ FolderInfo *fi = NULL;
+ GError* error = NULL;
+
+ gtk_cmclist_clear(GTK_CMCLIST(tree));
+ list = addressbook_dbus_get_books(&error);
+ for (; list; list = g_slist_next(list)) {
+ name = (gchar *) list->data;
+ node = gtk_cmctree_insert_node(tree, NULL, NULL,
+ &name, FOLDER_SPACING, bookXpm,
+ bookXpm, FALSE, TRUE);
+ fi = addressadd_create_folderinfo(name);
+ gtk_cmctree_node_set_row_data_full(tree, node, fi,
+ ( GDestroyNotify ) addressadd_free_folderinfo );
+ }
+}
+#endif
+#ifndef USE_NEW_ADDRBOOK
gboolean addressadd_selection( AddressIndex *addrIndex, const gchar *name,
const gchar *address, const gchar *remarks, GdkPixbuf *picture ) {
+#else
+gboolean addressadd_selection(const gchar *name, const gchar *address,
+ const gchar *remarks, GdkPixbuf *picture ) {
+#endif
gboolean retVal = FALSE;
+#ifndef USE_NEW_ADDRBOOK
ItemPerson *person = NULL;
+#endif
FolderInfo *fi = NULL;
addressadd_cancelled = FALSE;
if( ! addressadd_dlg.window ) addressadd_create();
addressadd_dlg.fiSelected = NULL;
+#ifndef USE_NEW_ADDRBOOK
addressadd_load_data( addrIndex );
+#else
+ addressadd_load_data();
+#endif
gtk_cmclist_select_row( GTK_CMCLIST( addressadd_dlg.tree_folder ), 0, 0 );
gtk_widget_show(addressadd_dlg.window);
gtk_window_set_modal(GTK_WINDOW(addressadd_dlg.window), TRUE);
fi = addressadd_dlg.fiSelected;
+#ifndef USE_NEW_ADDRBOOK
person = addrbook_add_contact( fi->book, fi->folder,
returned_name,
address,
addritem_person_set_picture( person, ADDRITEM_ID(person) ) ;
g_free( name );
}
+#else
+ ContactData* contact = g_new0(ContactData, 1);
+ GError* error = NULL;
+
+ if (returned_name)
+ contact->cn = g_strdup(returned_name);
+ else
+ contact->cn = g_strdup(address);
+
+ contact->name = g_strdup(returned_name);
+ contact->email = g_strdup(address);
+ contact->remarks = g_strdup(returned_remarks);
+ contact->book = g_strdup(fi->book);
+ contact->picture = picture;
+
+ if (addressbook_dbus_add_contact(contact, &error) == 0) {
+ debug_print("Added to addressbook:\n%s\n%s\n%s\n%s\n",
+ returned_name, address, returned_remarks, fi->book);
+ retVal = TRUE;
+ }
+ else {
+ retVal = FALSE;
+ if (error) {
+ GtkWidget* dialog = gtk_message_dialog_new (
+ GTK_WINDOW(addressadd_dlg.window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_error_free(error);
+ }
+ }
+ contact_data_free(&contact);
+#endif
#ifdef USE_LDAP
if (fi->book->type == ADBOOKTYPE_LDAP) {
LdapServer *server = (LdapServer *) fi->book;
#endif
g_free(returned_name);
g_free(returned_remarks);
+#ifndef USE_NEW_ADDRBOOK
if( person ) retVal = TRUE;
+#endif
}
}
#ifndef __ADDRESS_ADD_H__
#define __ADDRESS_ADD_H__
-#include "addrindex.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+#endif
#include "gtk/gtk.h"
+#ifndef USE_NEW_ADDRBOOK
gboolean addressadd_selection( AddressIndex *addrIndex, const gchar *name, const gchar *address, const gchar *remarks,
GdkPixbuf *picture );
+#else
+gboolean addressadd_selection(const gchar *name, const gchar *address, const gchar *remarks,
+ GdkPixbuf *picture );
+#endif
#endif /* __ADDRESS_ADD_H__ */
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-bindings.h>
+#include "dbus-contact.h"
+#include "addrgather.h"
+#include "folder.h"
+#include "compose.h"
+#include "hooks.h"
+
+#include "addressbook-dbus.h"
+#include "client-bindings.h"
+
+static DBusGProxy* proxy = NULL;
+static DBusGConnection* connection = NULL;
+static Compose* compose_instance = NULL;
+
+static GQuark client_object_error_quark() {
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string ("client_object_error");
+
+ return quark;
+}
+
+static gboolean init(GError** error) {
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
+ if (connection == NULL || *error) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Unable to connect to dbus");
+ g_warning("Unable to connect to dbus: %s\n", (*error)->message);
+ return FALSE;
+ }
+
+ proxy = dbus_g_proxy_new_for_name (connection,
+ "org.clawsmail.Contacts",
+ "/org/clawsmail/contacts",
+ "org.clawsmail.Contacts");
+ if (proxy == NULL) {
+ g_warning("Could not get a proxy object\n");
+ g_set_error(error, client_object_error_quark(), 1, "Could not get a proxy object");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void dbus_contact_free(const DBusContact* contact) {
+ g_hash_table_destroy(contact->data);
+ g_ptr_array_free(contact->emails, TRUE);
+}
+
+static GHashTable* hash_table_new(void) {
+ GHashTable* hash_table;
+
+ hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+ return hash_table;
+}
+
+static void g_value_email_free(gpointer data) {
+ GValueArray* email = (GValueArray *) data;
+ GValue* email_member;
+ guint i;
+
+ for (i = 0; i < email->n_values; i++) {
+ email_member = g_value_array_get_nth(email, i);
+ g_value_unset(email_member);
+ }
+}
+
+static GPtrArray* g_value_email_new() {
+ return g_ptr_array_new_with_free_func(g_value_email_free);
+}
+
+static gchar* convert_2_utf8(gchar* locale) {
+ gsize read, write;
+ GError* error = NULL;
+ gchar *current, *utf8;
+ const gchar* charset;
+
+ if (g_get_charset(&charset) || g_utf8_validate(locale, -1, 0))
+ return g_strdup(locale);
+
+ if (strcmp("ANSI_X3.4-1968", charset) == 0)
+ current = g_strdup("ISO-8859-1");
+ else
+ current = g_strdup(charset);
+
+ utf8 = g_convert(locale, -1, "UTF-8", current, &read, &write, &error);
+ if (error) {
+ g_warning("Fail to convert [%s]: %s\n", charset, error->message);
+ g_free(current);
+ return NULL;
+ }
+ g_free(current);
+
+ return utf8;
+}
+
+static void format_contact(DBusContact* contact, ContactData* c) {
+ gchar* firstname;
+ gchar* lastname;
+ GValueArray* email = NULL;
+ GValue email_member = {0};
+ gchar* str;
+ gchar* image = NULL;
+ gsize size;
+
+ contact->data = hash_table_new();
+ contact->emails = g_value_email_new();
+ firstname = lastname = NULL;
+
+ if (c->name) {
+ gchar* pos = strchr(c->name, ' ');
+ if (pos) {
+ firstname = g_strndup(c->name, pos - c->name);
+ lastname = g_strdup(++pos);
+ g_hash_table_replace(contact->data,
+ g_strdup("first-name"), convert_2_utf8(firstname));
+ g_hash_table_replace(contact->data,
+ g_strdup("last-name"), convert_2_utf8(lastname));
+ }
+ else {
+ lastname = g_strdup(c->name);
+ g_hash_table_replace(contact->data,
+ g_strdup("last-name"), convert_2_utf8(lastname));
+ }
+ g_free(firstname);
+ g_free(lastname);
+ }
+ if (c->cn) {
+ g_hash_table_replace(contact->data,
+ g_strdup("cn"), convert_2_utf8(c->cn));
+ }
+
+ if (c->picture) {
+ gdk_pixbuf_save_to_buffer(
+ c->picture, &image, &size, "png", NULL, NULL);
+ g_hash_table_replace(contact->data,
+ g_strdup("image"), g_base64_encode((const guchar *) image, size));
+ }
+
+ email = g_value_array_new(0);
+
+ /* Alias is not available but needed so make an empty string */
+ g_value_init(&email_member, G_TYPE_STRING);
+ g_value_set_string(&email_member, "");
+ g_value_array_append(email, &email_member);
+ g_value_unset(&email_member);
+
+ if (c->email)
+ str = convert_2_utf8(c->email);
+ else
+ str = g_strdup("");
+
+ g_value_init(&email_member, G_TYPE_STRING);
+ g_value_set_string(&email_member, str);
+ g_value_array_append(email, &email_member);
+ g_value_unset(&email_member);
+ g_free(str);
+
+ if (c->remarks)
+ str = convert_2_utf8(c->remarks);
+ else
+ str = g_strdup("");
+
+ g_value_init(&email_member, G_TYPE_STRING);
+ g_value_set_string(&email_member, str);
+ g_value_array_append(email, &email_member);
+ g_value_unset(&email_member);
+ g_free(str);
+
+ g_ptr_array_add(contact->emails, email);
+}
+
+static DBusHandlerResult contact_add_signal(DBusConnection* bus,
+ DBusMessage* message,
+ gpointer data) {
+ DBusError error;
+ gchar *s = NULL;
+
+ if (! compose_instance) {
+ g_message("Missing compose instance\n");
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ dbus_error_init (&error);
+
+ if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailTo")) {
+ if (dbus_message_get_args(
+ message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+ debug_print("ContactMailTo address received: %s\n", s);
+ compose_entry_append(compose_instance, s, COMPOSE_TO, PREF_NONE);
+ }
+ else {
+ debug_print("ContactMailTo received with error: %s\n", error.message);
+ dbus_error_free(&error);
+ }
+ }
+ else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailCc")) {
+ if (dbus_message_get_args(
+ message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+ debug_print("ContactMailTo address received: %s\n", s);
+ compose_entry_append(compose_instance, s, COMPOSE_CC, PREF_NONE);
+ }
+ else {
+ debug_print("ContactMailTo received with error: %s\n", error.message);
+ dbus_error_free(&error);
+ }
+ }
+ else if (dbus_message_is_signal(message, "org.clawsmail.Contacts", "ContactMailBcc")) {
+ if (dbus_message_get_args(
+ message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+ debug_print("ContactMailTo address received: %s\n", s);
+ compose_entry_append(compose_instance, s, COMPOSE_BCC, PREF_NONE);
+ }
+ else {
+ debug_print("ContactMailTo received with error: %s\n", error.message);
+ dbus_error_free(&error);
+ }
+ }
+ else {
+ if (error.message) {
+ g_warning("Reception error: %s", error.message);
+ dbus_error_free(&error);
+ }
+ debug_print("Unhandled signal received\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+gboolean addressbook_start_service(GError** error) {
+ gchar* reply = NULL;
+ gboolean result = FALSE;
+
+ if (! init(error))
+ return result;
+
+ if (!org_clawsmail_Contacts_ping(proxy, &reply, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ }
+ if (reply && strcmp("PONG", reply) == 0)
+ result = TRUE;
+
+ return result;
+}
+
+int addressbook_dbus_add_contact(ContactData* contact, GError** error) {
+ DBusContact dbus_contact;
+
+ if (! init(error))
+ return -1;
+
+ format_contact(&dbus_contact, contact);
+ if (!org_clawsmail_Contacts_add_contact(
+ proxy, contact->book, dbus_contact.data, dbus_contact.emails, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ dbus_contact_free(&dbus_contact);
+ return -1;
+ }
+ dbus_contact_free(&dbus_contact);
+ return 0;
+}
+
+gboolean addrindex_dbus_load_completion(gint (*callBackFunc)
+ (const gchar* name,
+ const gchar* address,
+ const gchar* nick,
+ const gchar* alias,
+ GList* grp_emails),
+ GError** error) {
+ gchar **list = NULL, **contacts;
+ gchar *name, *email;
+
+ if (! init(error))
+ return FALSE;
+
+ if (!org_clawsmail_Contacts_search_addressbook(
+ proxy, "*", NULL, &list, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ g_strfreev(list);
+ return FALSE;
+ }
+ for (contacts = list; *contacts != NULL; contacts += 1) {
+ gchar* tmp = g_strdup(*contacts);
+ gchar* pos = g_strrstr(tmp, "\"");
+ if (pos) {
+ /* Contact has a name as part of email address */
+ *pos = '\0';
+ name = tmp;
+ name += 1;
+ pos += 3;
+ email = pos;
+ pos = g_strrstr(email, ">");
+ if (pos)
+ *pos = '\0';
+ }
+ else {
+ name = "";
+ email = tmp;
+ }
+ debug_print("Adding: %s <%s> to completition\n", name, email);
+ callBackFunc(name, email, NULL, NULL, NULL);
+ g_free(tmp);
+ }
+
+ return TRUE;
+}
+
+void addressbook_dbus_open(gboolean compose, GError** error) {
+ if (! init(error))
+ return;
+
+ if (!org_clawsmail_Contacts_show_addressbook(proxy, compose, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ }
+}
+
+GSList* addressbook_dbus_get_books(GError** error) {
+ gchar **book_names = NULL, **cur;
+ GSList* books = NULL;
+
+ if (! init(error)) {
+ return books;
+ }
+
+ if (!org_clawsmail_Contacts_book_list(proxy, &book_names, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ g_strfreev(book_names);
+ return books;
+ }
+ for (cur = book_names; *cur; cur += 1)
+ books = g_slist_prepend(books, g_strdup(*cur));
+
+ g_strfreev(book_names);
+
+ return books;
+}
+
+void contact_data_free(ContactData** data) {
+ ContactData* contact;
+
+ if (! data && ! *data)
+ return;
+
+ contact = *data;
+ g_free(contact->cn);
+ g_free(contact->email);
+ g_free(contact->remarks);
+ g_free(contact->name);
+ g_free(contact->book);
+ g_free(contact);
+ contact = NULL;
+}
+
+void addressbook_harvest(FolderItem *folderItem,
+ gboolean sourceInd,
+ GList *msgList ) {
+ addrgather_dlg_execute(folderItem, sourceInd, msgList);
+}
+
+void addressbook_connect_signals(Compose* compose) {
+ DBusConnection* bus;
+ DBusError* error = NULL;
+
+ g_return_if_fail(compose != NULL);
+
+ bus = dbus_bus_get (DBUS_BUS_SESSION, error);
+ if (!bus) {
+ g_warning ("Failed to connect to the D-BUS daemon: %s", error->message);
+ dbus_error_free(error);
+ return;
+ }
+
+ debug_print("Compose: %p\n", compose);
+ compose_instance = compose;
+ dbus_bus_add_match(bus, "type='signal',interface='org.clawsmail.Contacts'", error);
+ if (error) {
+ debug_print("Failed to add match to the D-BUS daemon: %s", error->message);
+ dbus_error_free(error);
+ return;
+ }
+ dbus_connection_add_filter(bus, contact_add_signal, NULL, NULL);
+}
+
+gchar* addressbook_get_vcard(const gchar* account, GError** error) {
+ gchar* vcard = NULL;
+
+ g_return_val_if_fail(account != NULL, vcard);
+
+ if (! init(error)) {
+ return vcard;
+ }
+
+ if (!org_clawsmail_Contacts_get_vcard(proxy, account, &vcard, error)) {
+ if (! *error)
+ g_set_error(error, client_object_error_quark(), 1, "Woops remote method failed");
+ g_warning ("Woops remote method failed: %s", (*error)->message);
+ g_free(vcard);
+ vcard = NULL;
+ }
+
+ return vcard;
+}
+
+gboolean addressbook_add_vcard(const gchar* abook, const gchar* vcard, GError** error) {
+ gboolean result = FALSE;
+
+ return result;
+}
+
+static gboolean my_compose_create_hook(gpointer source, gpointer user_data) {
+ Compose *compose = (Compose*) source;
+ GError* error = NULL;
+
+ gchar* vcard = addressbook_get_vcard("test", &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_clear_error(&error);
+ }
+ else {
+ debug_print("test.vcf:\n%s\n", vcard);
+ g_free(vcard);
+ }
+
+ return FALSE;
+}
+
+void addressbook_install_hooks(GError** error) {
+ if ((guint)-1 == hooks_register_hook(
+ COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL)) {
+ g_warning("Could not register hook for adding vCards\n");
+ if (error) {
+ g_set_error(error, client_object_error_quark(), 1,
+ "Could not register hook for adding vCards");
+ }
+ }
+}
--- /dev/null
+/*
+ * $Id$
+ */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+
+/*
+ * Claws-contacts is a proposed new design for the address book feature
+ * in Claws Mail. The goal for this new design was to create a
+ * solution more suitable for the term lightweight and to be more
+ * maintainable than the present implementation.
+ *
+ * More lightweight is achieved by design, in that sence that the whole
+ * structure is based on a plugable design.
+ *
+ * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __ADDRESSBOOK_DBUS_H__
+#define __ADDRESSBOOK_DBUS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#include <gtk/gtk.h>
+#include "folder.h"
+#include "compose.h"
+
+typedef struct {
+ gchar* cn;
+ gchar* email;
+ gchar* remarks;
+ gchar* name;
+ gchar* book;
+ GdkPixbuf* picture;
+} ContactData;
+
+gboolean addressbook_start_service(GError** error);
+void addressbook_install_hooks(GError** error);
+int addressbook_dbus_add_contact(ContactData* contact, GError** error);
+gboolean addrindex_dbus_load_completion(gint (*callBackFunc)
+ (const gchar* name,
+ const gchar* address,
+ const gchar* nick,
+ const gchar* alias,
+ GList* grp_emails),
+ GError** error);
+void addressbook_dbus_open(gboolean compose, GError** error);
+GSList* addressbook_dbus_get_books(GError** error);
+void contact_data_free(ContactData** data);
+void addressbook_harvest(FolderItem *folderItem,
+ gboolean sourceInd,
+ GList *msgList );
+void addressbook_connect_signals(Compose* compose);
+gchar* addressbook_get_vcard(const gchar* account, GError** error);
+gboolean addressbook_add_vcard(const gchar* abook, const gchar* vcard, GError** error);
+
+G_END_DECLS
+
+#endif
#include "prefs_common.h"
#include "addrharvest.h"
-#include "addrindex.h"
-#include "addrbook.h"
-
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+ #include "addrbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#define PAGE_FIELDS 0
#define PAGE_FINISH 1
GtkWidget *labelFolder;
GtkWidget *entryBook;
GtkWidget *checkHeader[ NUM_FIELDS ];
+#ifndef USE_NEW_ADDRBOOK
GtkWidget *spinbtnFolder;
+#endif
GtkWidget *checkRecurse;
GtkWidget *btnOk;
GtkWidget *btnCancel;
GtkWidget *clistCount;
} addrgather_dlg;
+#ifndef USE_NEW_ADDRBOOK
static AddressIndex *_harv_addressIndex_;
static AddressBookFile *_harv_addressBook_;
+#endif
static gchar *_harv_headerNames_[] = {
HEADER_FROM,
HEADER_REPLY_TO,
GtkCMCList *clist;
gchar *text[ FIELDS_N_COLS ];
AddressHarvester *harvester;
- AddressBookFile *abf;
gchar *name;
+#ifndef USE_NEW_ADDRBOOK
+ AddressBookFile *abf;
gchar *newFile;
+#else
+ GList* list;
+ ContactData* contact;
+ GError* error = NULL;
+#endif
gchar str[ FMT_BUFSIZE ];
gint cnt;
gint i;
+#ifndef USE_NEW_ADDRBOOK
gint sz;
name = gtk_editable_get_chars( GTK_EDITABLE(addrgather_dlg.entryBook), 0, -1 );
_( "Please specify name for address book." ) );
g_free( name );
return FALSE;
+#else
+ name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(addrgather_dlg.entryBook));
+ if( name == NULL || strlen( name ) < 1 ) {
+ addrgather_dlg_status_show(
+ _("No available address book."));
+ g_free( name );
+ return FALSE;
+#endif
}
/* Create harvest helper */
/* Go fer it */
addrgather_dlg_status_show( _( "Collecting addresses..." ) );
GTK_EVENTS_FLUSH();
+#ifndef USE_NEW_ADDRBOOK
sz = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( addrgather_dlg.spinbtnFolder ) );
addrharvest_set_folder_size( harvester, sz );
+#endif
+#ifndef USE_NEW_ADDRBOOK
/* Create address book */
abf = addrbook_create_book();
addrbook_set_path( abf, _harv_addressIndex_->filePath );
addrbook_set_name( abf, name );
g_free( newFile );
g_free( name );
+#endif
/* Harvest addresses */
+#ifndef USE_NEW_ADDRBOOK
addrharvest_harvest(
harvester, abf->addressCache, _harv_messageList_ );
+ /* save address book */
addrbook_save_data( abf );
_harv_addressBook_ = abf;
+#else
+ addrharvest_harvest(
+ harvester, NULL, _harv_messageList_ );
+ list = g_hash_table_get_values(harvester->dupTable);
+ for (; list; list = g_list_next(list)) {
+ contact = g_new0(ContactData, 1);
+ ContactEntry* person = (ContactEntry *) list->data;
+ if (person->first_name)
+ contact->name = g_strconcat(
+ person->first_name, " ", person->last_name, NULL);
+ else
+ contact->name = g_strdup(person->last_name);
+ if (! contact->name || strlen(contact->name) < 1)
+ contact->name = g_strdup(person->email);
+ contact->remarks = g_strdup(N_("address added by claws-mail"));
+ contact->email = g_strdup(person->email);
+ contact->book = g_strdup(name);
+ addressbook_dbus_add_contact(contact, &error);
+ contact_data_free(&contact);
+ }
+ g_list_free(list);
+ g_free(name);
+#endif
/* Update summary count */
clist = GTK_CMCLIST(addrgather_dlg.clistCount);
{
GtkWidget *vbox;
GtkWidget *vboxf;
- GtkWidget *hboxs;
GtkWidget *table;
GtkWidget *label;
GtkWidget *labelFolder;
GtkWidget *entryBook;
GtkWidget *frameHeader;
GtkWidget *checkHeader[NUM_FIELDS];
+#ifndef USE_NEW_ADDRBOOK
+ GtkWidget *hboxs;
GtkWidget *spinbtnFolder;
- GtkAdjustment *adjFolder;
+ GtkObject *adjFolder;
+#endif
GtkWidget *checkRecurse;
gint top;
gint i;
+#ifdef USE_NEW_ADDRBOOK
+ GError* error = NULL;
+ GSList *books, *cur;
+#endif
/* Container */
vbox = gtk_vbox_new(FALSE, 6);
gtk_table_attach( GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0 );
gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
+#ifndef USE_NEW_ADDRBOOK
entryBook = gtk_entry_new();
+#else
+ books = addressbook_dbus_get_books(&error);
+ entryBook = gtk_combo_box_new_text();
+ if (books) {
+ for (cur = books; cur; cur = g_slist_next(cur)) {
+ gchar* book = (gchar *) cur->data;
+ gtk_combo_box_prepend_text(GTK_COMBO_BOX(entryBook), book);
+ g_free(book);
+ }
+ g_slist_free(books);
+ }
+ else
+ gtk_combo_box_prepend_text(GTK_COMBO_BOX(entryBook), "");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(entryBook), 0);
+#endif
gtk_table_attach( GTK_TABLE(table), entryBook, 1, 2, top, (top + 1),
GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0 );
+#ifndef USE_NEW_ADDRBOOK
/* Third row */
top = 2;
label = gtk_label_new(_("Address book folder size:"));
gtk_table_attach(GTK_TABLE(table), hboxs, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0);
CLAWS_SET_TIP(spinbtnFolder,
_("Maximum amount of entries per folder within the newly created address book"));
-
+#endif
/* Fourth row */
top = 3;
frameHeader = gtk_frame_new(_("Process these mail header fields"));
addrgather_dlg.labelFolder = labelFolder;
addrgather_dlg.entryBook = entryBook;
+#ifndef USE_NEW_ADDRBOOK
addrgather_dlg.spinbtnFolder = spinbtnFolder;
+#endif
addrgather_dlg.checkRecurse = checkRecurse;
}
GtkWidget *clistCount;
gchar *titles[ FIELDS_N_COLS ];
gint i;
-
titles[ FIELD_COL_HEADER ] = _("Header Name");
titles[ FIELD_COL_COUNT ] = _("Address Count");
* msgList List of message numbers, or NULL to process folder.
* Return: Populated address book file, or NULL if none created.
*/
+#ifndef USE_NEW_ADDRBOOK
AddressBookFile *addrgather_dlg_execute(FolderItem *folderItem, AddressIndex *addrIndex,
gboolean sourceInd, GList *msgList)
+#else
+void addrgather_dlg_execute(FolderItem *folderItem, gboolean sourceInd, GList *msgList)
+#endif
{
gint i;
+#ifndef USE_NEW_ADDRBOOK
_harv_addressIndex_ = addrIndex;
_harv_addressBook_ = NULL;
+#endif
_harv_messageList_ = msgList;
/* Create dialog */
addrgather_dlg.folderPath = folder_item_get_path(folderItem);
/* Setup some default values */
+
gtk_label_set_text(GTK_LABEL(addrgather_dlg.labelFolder), folderItem->path);
+#ifndef USE_NEW_ADDRBOOK
gtk_entry_set_text(GTK_ENTRY(addrgather_dlg.entryBook), folderItem->path);
+#endif
for (i = 0; i < NUM_FIELDS; i++) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(addrgather_dlg.checkHeader[i]),
addrgather_dlg.folderPath = NULL;
gtk_widget_hide(addrgather_dlg.window);
gtk_window_set_modal(GTK_WINDOW(addrgather_dlg.window), FALSE);
+#ifndef USE_NEW_ADDRBOOK
_harv_addressIndex_ = NULL;
if (addrgather_dlg.cancelled == TRUE)
return NULL;
return _harv_addressBook_;
+#endif
}
-
/*
* End of Source.
*/
#define __ADDR_GATHER_H__
/* Function prototypes */
+#include "folder.h"
+
+#ifndef USE_NEW_ADDRBOOK
+#include "addrbook.h"
+
AddressBookFile *addrgather_dlg_execute( FolderItem *folderItem,
AddressIndex *addrIndex,
gboolean sourceInd,
GList *msgList );
-
+#else
+void addrgather_dlg_execute( FolderItem *folderItem,
+ gboolean sourceInd,
+ GList *msgList );
+#endif
#endif /* __ADDR_GATHER_H__ */
/*
#include "addrharvest.h"
#include "codeconv.h"
#include "addritem.h"
+#ifdef USE_NEW_ADDRBOOK
+ #include "addressbook-dbus.h"
+#endif
/* Mail header names of interest */
static gchar *_headerFrom_ = HEADER_FROM;
gint count;
};
+#ifdef USE_NEW_ADDRBOOK
+typedef enum {
+ FIRST = 0,
+ LAST,
+} Namepart;
+
+#endif
+
/*
* Build header table entry.
* Enter: harvester Harvester object.
g_free( harvester );
}
+#ifdef USE_NEW_ADDRBOOK
+static gchar* get_namepart(const gchar* name, Namepart namepart) {
+ gchar *pos, *part = NULL;
+ gchar *token = g_strdup(name);
+
+ pos = g_strrstr(token, " ");
+ if (namepart == FIRST) {
+ if (pos) {
+ *pos = '\0';
+ part = g_strdup(token);
+ *pos = ' ';
+ }
+ }
+ else {
+ if (! pos)
+ part = g_strdup(token);
+ else {
+ pos +=1;
+ part = g_strdup(pos);
+ }
+ }
+ g_free(token);
+ return part;
+}
+#endif
+
/*
* Insert address into cache.
* Enter: harvester Harvester object.
AddressCache *cache, const gchar *name,
const gchar *address )
{
+#ifndef USE_NEW_ADDRBOOK
ItemPerson *person;
ItemFolder *folder;
gchar *folderName;
if( entry->count % harvester->folderSize == 0 ) {
newFolder = TRUE; /* Folder is full */
}
+#else
+ ContactEntry* person;
+ gchar* key;
+#endif
/* Insert address */
key = g_utf8_strdown( address, -1 );
person = g_hash_table_lookup( harvester->dupTable, key );
+#ifndef USE_NEW_ADDRBOOK
if( person ) {
/* Update existing person to use longest name */
value = ADDRITEM_NAME(person);
entry->count++;
}
addritem_parse_first_last( person );
+#else
+ if (! person) {
+ person = g_new0(ContactEntry, 1);
+ person->first_name = get_namepart(name, FIRST);
+ person->last_name = get_namepart(name, LAST);
+ person->email = g_strdup(address);
+ g_hash_table_insert(harvester->dupTable, key, person);
+ entry->count++;
+ }
+#endif
}
/*
}
/* Insert into address book */
+#ifndef USE_NEW_ADDRBOOK
addrharvest_insert_cache(
harvester, entry, cache, name, email );
+#else
+ addrharvest_insert_cache(
+ harvester, entry, NULL, name, email);
+#endif
g_free( email );
g_free( name );
}
retVal = MGU_BAD_ARGS;
cm_return_val_if_fail( harvester != NULL, retVal );
+#ifndef USE_NEW_ADDRBOOK
cm_return_val_if_fail( cache != NULL, retVal );
+#endif
cm_return_val_if_fail( harvester->path != NULL, retVal );
+#ifndef USE_NEW_ADDRBOOK
/* Clear cache */
addrcache_clear( cache );
cache->dataRead = FALSE;
-
+#endif
/* Build list of headers of interest */
listHdr = NULL;
node = harvester->headerTable;
}
mgu_free_dlist( listHdr );
+#ifndef USE_NEW_ADDRBOOK
/* Mark cache */
cache->modified = FALSE;
cache->dataRead = TRUE;
-
+#endif
return retVal;
}
gboolean folderRecurse;
};
+#ifdef USE_NEW_ADDRBOOK
+typedef struct {
+ gchar* first_name;
+ gchar* last_name;
+ gchar* email;
+} ContactEntry;
+#endif
+
/* Function prototypes */
AddressHarvester *addrharvest_create ( void );
void addrharvest_free ( AddressHarvester *harvester );
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC
+ "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
+ "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
+<!--
+# $Id$
+-->
+<node name="/org/clawsmail/contacts/service">
+
+<interface name="org.clawsmail.Contacts">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="abook"/>
+
+ <method name="ShowAddressbook">
+ <arg type="b" name="compose" direction="in" />
+ </method>
+
+ <method name="Ping">
+ <arg type="s" name="reply" direction="out" />
+ </method>
+
+ <method name="Commit">
+ <arg type="s" name="addressbook" direction="in" />
+ <arg type="b" name="succes" direction="out" />
+ </method>
+
+ <method name="BookList">
+ <arg type="as" name="books" direction="out" />
+ </method>
+
+ <method name="SearchAddressbook">
+ <arg type="s" name="token" direction="in" />
+ <!-- if addressbook is NULL search all available books -->
+ <arg type="s" name="addressbook" direction="in" />
+ <arg type="as" name="emails" direction="out" />
+ </method>
+
+ <method name="AddContact">
+ <arg type="s" name="addressbook" direction="in" />
+ <arg type="a{ss}" name="contact_data" direction="in" />
+ <arg type="a(sss)" name="contact_emails" direction="in" />
+ </method>
+
+ <method name="AddVCard">
+ <!-- if addressbook is NULL add to default address book -->
+ <arg type="s" name="addressbook" direction="in" />
+ <arg type="s" name="vcard" direction="in" />
+ </method>
+
+ <method name="GetVCard">
+ <arg type="s" name="acount" direction="in" />
+ <arg type="s" name="vcard" direction="out" />
+ </method>
+
+ <signal name="ContactMailTo">
+ <arg type="s" name="contact_add_to" direction="out" />
+ </signal>
+
+ <signal name="ContactMailCc">
+ <arg type="s" name="contact_add_cc" direction="out" />
+ </signal>
+
+ <signal name="ContactMailBcc">
+ <arg type="s" name="contact_add_bcc" direction="out" />
+ </signal>
+
+</interface>
+
+</node>
#include "main.h"
#include "mainwindow.h"
#include "compose.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "folderview.h"
#include "procmsg.h"
#include "menu.h"
compose_allow_user_actions (compose, FALSE);
compose->sending = TRUE;
- if (compose_check_entries(compose, TRUE) == FALSE) {
+ if ((compose, TRUE) == FALSE) {
if (compose->batch) {
gtk_widget_show_all(compose->window);
}
if (*address != '\0') {
gchar *name = procheader_get_fromname(address);
extract_address(address);
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(name, address, NULL, NULL);
+#else
+ debug_print("%s: %s\n", name, address);
+ if (addressadd_selection(name, address, NULL, NULL)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
}
g_free(address);
}
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((compose->header_last->combo)))),
prefs_common_translated_header_name("Newsgroups:"));
+#ifndef USE_NEW_ADDRBOOK
addressbook_set_target_compose(compose);
-
+#endif
if (mode != COMPOSE_REDIRECT)
compose_set_template_menu(compose);
else {
g_free(compose->privacy_system);
+#ifndef USE_NEW_ADDRBOOK
if (addressbook_get_target_compose() == compose)
addressbook_set_target_compose(NULL);
-
+#endif
#if USE_ENCHANT
if (compose->gtkaspell) {
gtkaspell_delete(compose->gtkaspell);
{
Compose *compose = (Compose *)data;
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(compose);
+#else
+ GError* error = NULL;
+ addressbook_connect_signals(compose);
+ addressbook_dbus_open(TRUE, &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void about_show_cb(GtkAction *action, gpointer data)
#include "procmsg.h"
#include "procmime.h"
+#ifndef USE_NEW_ADDRBOOK
#include "addressbook.h"
+#endif
#include "prefs_account.h"
#include "undo.h"
#include "toolbar.h"
#include "prefs_gtk.h"
#include "compose.h"
#include "prefs_common.h"
-#include "addrbook.h"
+#include "addritem.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "addr_compl.h"
#include "tags.h"
#include "log.h"
case MATCHACTION_ADD_TO_ADDRESSBOOK:
{
+#ifndef USE_NEW_ADDRBOOK
AddressDataSource *book = NULL;
AddressBookFile *abf = NULL;
ItemFolder *folder = NULL;
+#endif
gchar buf[BUFFSIZE];
Header *header;
gint errors = 0;
+#ifndef USE_NEW_ADDRBOOK
if (!addressbook_peek_folder_exists(action->destination, &book, &folder)) {
g_warning("addressbook folder not found '%s'\n", action->destination?action->destination:"(null)");
return FALSE;
}
abf = book->rawDataSource;
-
+#endif
/* get the header */
procheader_get_header_from_msginfo(info, buf, sizeof(buf), action->header);
header = procheader_parse_header(buf);
if (complete_matches_found(walk->data) == 0) {
debug_print("adding address '%s' to addressbook '%s'\n",
stripped_addr, action->destination);
+#ifndef USE_NEW_ADDRBOOK
if (!addrbook_add_contact(abf, folder, stripped_addr, stripped_addr, NULL)) {
+#else
+ if (!addressadd_selection(NULL, stripped_addr, NULL, NULL)) {
+#endif
g_warning("contact could not been added\n");
errors++;
}
}
return (errors == 0);
}
-
default:
break;
}
static void headerview_save_contact_pic (HeaderView *headerview, MsgInfo *msginfo)
{
+#ifndef USE_NEW_ADDRBOOK
gchar *filename = NULL;
GError *error = NULL;
GdkPixbuf *picture = NULL;
}
}
g_free(filename);
+#else
+ /* new address book */
+#endif
}
static gint headerview_show_contact_pic (HeaderView *headerview, MsgInfo *msginfo)
{
+#ifndef USE_NEW_ADDRBOOK
GtkWidget *hbox = headerview->hbox;
GtkWidget *image;
gchar *filename = NULL;
return -1;
else
return 0;
+#else
+ /* new address book */
+ return -1;
+#endif
}
void headerview_clear(HeaderView *headerview)
#include "manage_window.h"
#include "alertpanel.h"
#include "statusbar.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "compose.h"
#include "folder.h"
#include "setup.h"
prefs_actions_read_config();
prefs_display_header_read_config();
/* prefs_filtering_read_config(); */
+#ifndef USE_NEW_ADDRBOOK
addressbook_read_file();
-
+#else
+ g_clear_error(&error);
+ if (! addressbook_start_service(&error)) {
+ g_warning("%s", error->message);
+ g_clear_error(&error);
+ }
+ else {
+ addressbook_install_hooks(&error);
+ }
+#endif
gtkut_widget_init();
stock_pixbuf_gdk(NULL, STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon);
gtk_window_set_default_icon(icon);
prefs_common_write_config();
account_write_config_all();
+#ifndef USE_NEW_ADDRBOOK
addressbook_export_to_file();
-
+#endif
filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
gtk_accel_map_save(filename);
g_free(filename);
prefs_toolbar_done();
+#ifndef USE_NEW_ADDRBOOK
addressbook_destroy();
-
+#endif
prefs_themes_done();
prefs_fonts_done();
prefs_ext_prog_done();
#include "prefs_template.h"
#include "action.h"
#include "account.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "logwindow.h"
#include "manage_window.h"
#include "alertpanel.h"
folderview_reinit_fonts(mainwin->folderview);
summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
foldersel_reflect_prefs_pixmap_theme();
+#ifndef USE_NEW_ADDRBOOK
addressbook_reflect_prefs_pixmap_theme();
+#endif
#ifndef GENERIC_UMPC
pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
static void addressbook_open_cb(GtkAction *action, gpointer data)
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("Failed to open address book");
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void log_window_show_cb(GtkAction *action, gpointer data)
static void addr_harvest_cb( GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+
addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
}
#include "filesel.h"
#include "foldersel.h"
#include "sourcewindow.h"
-#include "addressbook.h"
#include "alertpanel.h"
#include "inputdialog.h"
#include "mainwindow.h"
#include "quoted-printable.h"
#include "version.h"
#include "statusbar.h"
-
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressadd.h"
+ #include "addressbook-dbus.h"
+#endif
static GList *messageview_list = NULL;
static gint messageview_delete_cb (GtkWidget *widget,
static void addressbook_open_cb(GtkAction *action, gpointer data)
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("Failed to open address book");
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void add_address_cb(GtkAction *action, gpointer data)
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(msginfo->fromname, from, NULL, picture);
-
+#else
+ if (addressadd_selection(msginfo->fromname, from, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
if (image)
gtk_widget_destroy(image);
}
}
}
+#ifndef USE_NEW_ADDRBOOK
static void bogofilter_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
{
struct BogofilterPage *page = (struct BogofilterPage *) data;
g_free(new_path);
}
}
+#endif
static void bogofilter_create_widget_func(PrefsPage * _page,
GtkWindow * window,
SET_TOGGLE_SENSITIVITY(save_unsure_checkbtn, save_unsure_folder_entry);
SET_TOGGLE_SENSITIVITY(save_unsure_checkbtn, save_unsure_folder_select);
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
+#ifndef USE_NEW_ADDRBOOK
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
+#endif
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, learn_from_whitelist_chkbtn);
SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
G_CALLBACK(foldersel_cb), save_spam_folder_entry);
g_signal_connect(G_OBJECT(save_unsure_folder_select), "clicked",
G_CALLBACK(foldersel_cb), save_unsure_folder_entry);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
G_CALLBACK(bogofilter_whitelist_ab_select_cb), page);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
+#endif
gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(process_emails_checkbtn), config->process_emails);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
static void destroy_dillo_prefs_page (PrefsPage *page);
static void save_dillo_prefs (PrefsPage *page);
+#ifndef USE_NEW_ADDRBOOK
static void dillo_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
{
DilloBrowserPage *page = (DilloBrowserPage *) data;
g_free(new_path);
}
}
+#endif
static void local_checkbox_toggled(GtkToggleButton *button,
gpointer user_data)
gtk_widget_set_sensitive(prefs_page->whitelist_ab, active);
gtk_widget_set_sensitive(prefs_page->whitelist_ab_folder_combo, active &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->whitelist_ab)));
+#ifndef USE_NEW_ADDRBOOK
gtk_widget_set_sensitive(prefs_page->whitelist_ab_select_btn, active &&
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs_page->whitelist_ab)));
+#endif
}
static void whitelist_checkbox_toggled(GtkToggleButton *button,
G_CALLBACK(whitelist_checkbox_toggled),
prefs_page);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
G_CALLBACK(dillo_whitelist_ab_select_cb), prefs_page);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
+#endif
gtk_widget_set_sensitive(whitelist_ab_checkbtn, !dillo_prefs.local);
gtk_widget_set_sensitive(whitelist_ab_folder_combo, !dillo_prefs.local && dillo_prefs.whitelist_ab);
gtk_widget_set_sensitive(whitelist_ab_select_btn, !dillo_prefs.local && dillo_prefs.whitelist_ab);
{ N_("Unix Socket"), SPAMASSASSIN_TRANSPORT_UNIX, PAGE_UNIX, 0 },
};
+#ifndef USE_NEW_ADDRBOOK
static void spamassassin_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
{
struct SpamAssassinPage *page = (struct SpamAssassinPage *) data;
g_free(new_path);
}
}
+#endif
static void foldersel_cb(GtkWidget *widget, gpointer data)
{
SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_process_emails);
SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
+#ifndef USE_NEW_ADDRBOOK
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
-
+#endif
config = spamassassin_get_config();
g_signal_connect(G_OBJECT(save_spam_folder_select), "clicked",
G_CALLBACK(foldersel_cb), page);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
G_CALLBACK(spamassassin_whitelist_ab_select_cb), page);
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
+#endif
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_sa_checkbtn), config->enable);
if (config->username != NULL)
#include "alertpanel.h"
#include "account.h"
#include "gtk/manage_window.h"
+#ifdef USE_NEW_ADDRBOOK
+ #include "addressbook-dbus.h"
+#endif
#include "trayicon_prefs.h"
static void trayicon_addressbook_cb( GtkAction *action, gpointer data )
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void trayicon_toggle_offline_cb( GtkAction *action, gpointer data )
#include "stock_pixmap.h"
#include "prefswindow.h"
#include "colorlabel.h"
-#include "addrcustomattr.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrcustomattr.h"
+#endif
enum {
DATEFMT_FMT,
prefs_common_read_history(MESSAGE_SEARCH_HISTORY);
prefs_common.compose_save_to_history =
prefs_common_read_history(COMPOSE_SAVE_TO_HISTORY);
-
+#ifndef USE_NEW_ADDRBOOK
prefs_common.addressbook_custom_attributes = addressbook_update_custom_attr_from_prefs();
-
+#endif
colorlabel_update_colortable_from_prefs();
}
prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY,
prefs_common.compose_save_to_history);
- prefs_common_save_history_to_dir(ADDRBOOK_DIR,
+#ifndef USE_NEW_ADDRBOOK
+ prefs_common_save_history_to_dir(ADDRBOOK_DIR,
ADDRESSBOOK_CUSTOM_ATTRIBUTES,
prefs_common.addressbook_custom_attributes);
+#endif
}
/* make a copy of string 'in' into buffer 'out'. un-escape \ sequences.
static void prefs_filtering_action_type_selection_changed(GtkWidget *widget,
gpointer user_data);
static void prefs_filtering_action_select_dest(void);
+#ifndef USE_NEW_ADDRBOOK
static void prefs_filtering_action_select_addressbook(void);
+#endif
static void prefs_filtering_action_up(void);
static void prefs_filtering_action_down(void);
static void prefs_filtering_action_set_dialog(GSList *action_list);
addressbook_btn = gtk_button_new_with_label (_("Select ..."));
gtk_box_pack_start (GTK_BOX (hbox1), addressbook_btn, FALSE, FALSE, 0);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect (G_OBJECT (addressbook_btn), "clicked",
G_CALLBACK(prefs_filtering_action_select_addressbook),
NULL);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(addressbook_btn), FALSE);
+#endif
exec_btn = gtk_button_new_from_stock(GTK_STOCK_INFO);
gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (exec_btn), "clicked",
filtering_action.score_entry = score_entry;
filtering_action.header_combo = header_combo;
filtering_action.header_entry = header_entry;
+#ifndef USE_NEW_ADDRBOOK
filtering_action.addressbook_btn = addressbook_btn;
+#endif
filtering_action.ok_btn = ok_btn;
filtering_action.action_list_view = action_list_view;
g_free(path);
}
+#ifndef USE_NEW_ADDRBOOK
static void prefs_filtering_action_select_addressbook(void)
{
const gchar *folderpath = NULL;
g_free(new_path);
}
}
+#endif
static void prefs_filtering_action_enable_widget(GtkWidget* widget, const gboolean enable)
{
#include "colorlabel.h"
#include "tags.h"
+#ifndef USE_NEW_ADDRBOOK
static void prefs_matcher_addressbook_select(void);
+#endif
static void prefs_matcher_test_info(GtkWidget *widget, GtkWidget *parent);
enum {
GtkWidget *test_btn;
GtkWidget *addressbook_select_btn;
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
GtkWidget *color_optmenu;
-#endif
static GdkGeometry geometry;
GtkSizeGroup *size_group;
addressbook_select_btn = gtk_button_new_with_label(_("Select ..."));
gtk_box_pack_start(GTK_BOX(upper_hbox), addressbook_select_btn, FALSE, FALSE, 0);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (addressbook_select_btn), "clicked",
G_CALLBACK(prefs_matcher_addressbook_select),
NULL);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(addressbook_select_btn), FALSE);
+#endif
match_label = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(match_label), 1, 0.5);
gtk_table_attach(GTK_TABLE(table), match_label, 0, 1, 1, 2,
#endif
matcher.bool_op_combo = bool_op_combo;
matcher.test_btn = test_btn;
+#ifndef USE_NEW_ADDRBOOK
matcher.addressbook_select_btn = addressbook_select_btn;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- matcher.color_optmenu = color_optmenu;
#endif
+ matcher.color_optmenu = color_optmenu;
matcher.match_label = match_label;
matcher.criteria_label2 = criteria_label2;
matcher.headers_combo = headers_combo;
description_window_create(&test_desc_win);
}
+#ifndef USE_NEW_ADDRBOOK
static void prefs_matcher_addressbook_select(void)
{
const gchar *folderpath = NULL;
g_free(new_path);
}
}
-
+#endif
/*
* list view
#include "colorlabel.h"
#include "inc.h"
#include "imap.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "addr_compl.h"
#include "folder_item_prefs.h"
#include "filtering.h"
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(msginfo->fromname, from, NULL, picture);
-
+#else
+ if (addressadd_selection(msginfo->fromname, from, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
if (image)
gtk_widget_destroy(image);
}
continue;
msgList = g_list_append( msgList, GUINT_TO_POINTER( msginfo->msgnum ) );
}
+
addressbook_harvest( summaryview->folder_item, TRUE, msgList );
+
g_list_free( msgList );
}
#include "html.h"
#include "enriched.h"
#include "compose.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+ #include "addrindex.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "displayheader.h"
#include "account.h"
#include "mimeview.h"
#include "inputdialog.h"
#include "timing.h"
#include "tags.h"
-#include "addrindex.h"
static GdkColor quote_colors[3] = {
{(gulong)0, (gushort)0, (gushort)0, (gushort)0},
#if HAVE_LIBCOMPFACE
static void textview_show_xface(TextView *textview)
{
+ GtkAllocation allocation;
MsgInfo *msginfo = textview->messageview->msginfo;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
int x = 0;
gtk_widget_show(textview->image);
- x = textview->text->allocation.width - WIDTH -5;
+ gtk_widget_get_allocation(textview->text, &allocation);
+ x = allocation.width - WIDTH -5;
gtk_text_view_add_child_in_window(text, textview->image,
GTK_TEXT_WINDOW_TEXT, x, 5);
static void textview_save_contact_pic(TextView *textview)
{
+#ifndef USE_NEW_ADDRBOOK
MsgInfo *msginfo = textview->messageview->msginfo;
gchar *filename = NULL;
GError *error = NULL;
}
}
g_free(filename);
+#else
+ /* new address book */
+#endif
}
static void textview_show_contact_pic(TextView *textview)
{
- GtkAllocation allocation;
+#ifndef USE_NEW_ADDRBOOK
MsgInfo *msginfo = textview->messageview->msginfo;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
int x = 0;
gtk_widget_show(textview->image);
- gtk_widget_get_allocation(textview->text, &allocation);
- x = allocation.width - WIDTH -5;
+ x = textview->text->allocation.width - WIDTH -5;
gtk_text_view_add_child_in_window(text, textview->image,
GTK_TEXT_WINDOW_TEXT, x, 5);
if (textview->image)
gtk_widget_destroy(textview->image);
textview->image = NULL;
-
+#else
+ /* new address book */
+#endif
}
static gint textview_tag_cmp_list(gconstpointer a, gconstpointer b)
GtkWidget *image = NULL;
GdkPixbuf *picture = NULL;
gboolean use_picture = FALSE;
+
if (uri == NULL)
return;
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact( fromname, fromaddress, NULL, picture);
+#else
+ if (addressadd_selection(fromname, fromaddress, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
g_free(fromaddress);
g_free(fromname);
#include "prefs_toolbar.h"
#include "alertpanel.h"
#include "imap.h"
+#ifdef USE_NEW_ADDRBOOK
+ #include "addressbook-dbus.h"
+#endif
/* elements */
#define TOOLBAR_TAG_INDEX "toolbar"
default:
return;
}
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(compose);
+#else
+ GError* error = NULL;
+ addressbook_connect_signals(compose);
+ addressbook_dbus_open(TRUE, &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}