Implement filter for .7z files. Based on rclzip and rcltar

This commit is contained in:
Francois Botha 2015-04-06 09:57:00 +02:00
commit d802e87e5a
908 changed files with 379473 additions and 0 deletions

137
.hgignore Normal file
View file

@ -0,0 +1,137 @@
syntax: glob
*.dep
*.dep.stamp
*.o
*~
\#*
ptrans
src/Makefile
src/autom4te.cache
src/bincimapmime/alldeps
src/common/alldeps
src/common/autoconfig.h
src/common/rclversion.h
src/config.log
src/config.status
src/configure
src/desktop/unity-lens-recoll/Makefile
src/desktop/unity-lens-recoll/autom4te.cache
src/desktop/unity-lens-recoll/bin/unity-recoll-daemon
src/desktop/unity-lens-recoll/config.log
src/desktop/unity-lens-recoll/config.status
src/desktop/unity-lens-recoll/data/recoll.lens
src/desktop/unity-lens-recoll/data/unity-lens-recoll.service
src/doc/user/HTML.manifest
src/doc/user/RCL.INDEXING.CONFIG.html
src/doc/user/RCL.INDEXING.EXTATTR.html
src/doc/user/RCL.INDEXING.EXTTAGS.html
src/doc/user/RCL.INDEXING.MONITOR.html
src/doc/user/RCL.INDEXING.PERIODIC.html
src/doc/user/RCL.INDEXING.STORAGE.html
src/doc/user/RCL.INDEXING.WEBQUEUE.html
src/doc/user/RCL.INDEXING.html
src/doc/user/RCL.INSTALL.BUILDING.html
src/doc/user/RCL.INSTALL.CONFIG.html
src/doc/user/RCL.INSTALL.EXTERNAL.html
src/doc/user/RCL.INSTALL.html
src/doc/user/RCL.INTRODUCTION.RECOLL.html
src/doc/user/RCL.INTRODUCTION.SEARCH.html
src/doc/user/RCL.INTRODUCTION.html
src/doc/user/RCL.KICKER-APPLET.html
src/doc/user/RCL.PROGRAM.API.html
src/doc/user/RCL.PROGRAM.FIELDS.html
src/doc/user/RCL.PROGRAM.html
src/doc/user/RCL.SEARCH.ANCHORWILD.html
src/doc/user/RCL.SEARCH.CASEDIAC.html
src/doc/user/RCL.SEARCH.COMMANDLINE.html
src/doc/user/RCL.SEARCH.COMPLEX.html
src/doc/user/RCL.SEARCH.CUSTOM.html
src/doc/user/RCL.SEARCH.DESKTOP.html
src/doc/user/RCL.SEARCH.HISTORY.html
src/doc/user/RCL.SEARCH.KIO.html
src/doc/user/RCL.SEARCH.LANG.html
src/doc/user/RCL.SEARCH.MULTIDB.html
src/doc/user/RCL.SEARCH.PREVIEW.html
src/doc/user/RCL.SEARCH.PTRANS.html
src/doc/user/RCL.SEARCH.RESLIST.html
src/doc/user/RCL.SEARCH.SORT.html
src/doc/user/RCL.SEARCH.TERMEXPLORER.html
src/doc/user/RCL.SEARCH.TIPS.html
src/doc/user/RCL.SEARCH.WILDCARDS.html
src/doc/user/RCL.SEARCH.html
src/doc/user/RCL.SEARCHKCL.html
src/doc/user/RCL.SEARCHKIO.SEARCHABLEDOCS.html
src/doc/user/RCL.SEARCHKIO.html
src/doc/user/index.html
src/doc/user/usermanual-xml.html
src/doc/user/usermanual.aux
src/doc/user/usermanual.html
src/doc/user/usermanual.html-text
src/doc/user/usermanual.log
src/doc/user/usermanual.out
src/doc/user/usermanual.pdf
src/doc/user/usermanual.tex-pdf
src/doc/user/usermanual.tex-pdf-tmp
src/doc/user/usermanual.txt
src/filters/rclexecm.pyc
src/filters/rcllatinclass.pyc
src/index/alldeps
src/index/alldeps.stamp
src/index/recollindex
src/internfile/alldeps
src/kde/kioslave/kio_recoll/builddir
src/lib/Makefile
src/lib/alldeps
src/lib/librecoll.a
src/lib/librecoll.so*
src/lib/mkMake
src/mk/localdefs
src/mk/sysconf
src/python/recoll/build
src/python/recoll/recoll/__init__.pyc
src/python/recoll/setup.py
src/python/samples/recollgui/rclmain.py
src/python/samples/recollgui/rclmain.pyc
src/qtgui/.moc/*
src/qtgui/.obj/*
src/qtgui/.ui/*
src/qtgui/Makefile
src/qtgui/qrc_recoll.cpp
src/qtgui/recoll
src/qtgui/recoll.app
src/qtgui/recoll.pro
src/query/alldeps
src/query/location.hh
src/query/position.hh
src/query/recollq
src/query/stack.hh
src/query/wasaparse.output
src/query/wasaparse.tab.cpp
src/query/wasaparse.tab.h
src/query/xadump
src/recollinstall
src/sampleconf/rclmon.sh
src/sampleconf/recoll.conf
src/utils/alldeps
tests/casediac/aspdict.en.rws
tests/casediac/idxstatus.txt
tests/casediac/index.pid
tests/casediac/mimeview
tests/casediac/missing
tests/casediac/recoll.conf
tests/casediac/xapiandb
tests/config/aspdict.en.rws
tests/config/history
tests/config/idxstatus.txt
tests/config/index.pid
tests/config/missing
tests/config/xapiandb
tests/indexedmimetypes/aspdict.en.rws
tests/indexedmimetypes/idxstatus.txt
tests/indexedmimetypes/index.pid
tests/indexedmimetypes/mimeview
tests/indexedmimetypes/missing
tests/indexedmimetypes/recoll.conf
tests/indexedmimetypes/xapiandb
tests/xattr/mimeview
website/usermanual/*

View file

@ -0,0 +1,34 @@
# New ports collection makefile for: recoll
# Date created: 5 December 2005
# Whom: J.F. Dockes <jean-francois.dockes@wanadoo.fr>
#
# $FreeBSD: ports/deskutils/recoll/Makefile,v 1.44 2010/10/09 17:52:42 makc Exp $
#
PORTNAME= recoll
PORTVERSION= 1.16.2
CATEGORIES= deskutils
MASTER_SITES= http://www.lesbonscomptes.com/recoll/
MAINTAINER= jf@dockes.org
COMMENT= A personal full text search package, based on QT and Xapian
BUILD_DEPENDS= xapian-core>=1.0.12:${PORTSDIR}/databases/xapian-core
RUN_DEPENDS:= ${BUILD_DEPENDS}
USE_QT_VER= 4
QT_COMPONENTS= gui qmake_build uic_build moc_build rcc_build
GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_ICONV= yes
INSTALLS_ICONS= yes
USE_FAM= yes
MAN1= recoll.1 recollindex.1
MAN5= recoll.conf.5
post-patch:
${REINPLACE_CMD} -e 's/^CXXFLAGS =/CXXFLAGS ?=/' \
${WRKSRC}/mk/localdefs.in
.include <bsd.port.mk>

View file

@ -0,0 +1,2 @@
SHA256 (recoll-1.16.2.tar.gz) = f0f29dff2d82ef8541c51963870f31daf28472f3c8822c81c17c346769b77355
SIZE (recoll-1.16.2.tar.gz) = 1422148

View file

@ -0,0 +1,24 @@
Recoll is a personal full text search package with a QT graphical
interface. It is based on a very strong backend (Xapian), for which it
provides an easy to use and feature-rich interface.
Features:
* Free, GPL license.
* QT-based GUI.
* Supports the following document types (and their compressed versions):
- Natively: text, html, OpenOffice files, maildir and mailbox
(Mozilla and Thunderbird mail ok) with attachments, gaim log files.
- With external helpers: pdf (pdftotext), postscript (ghostscript),
msword (antiword), excel, ppt (catdoc), rtf (unrtf),
* Powerful query facilities, with boolean searches, phrases, filter on
file types and directory tree.
* Support for multiple charsets. Internal processing and storage uses
Unicode UTF-8.
* Stemming performed at query time (can switch stemming language after
indexing)
* Easy installation. No database daemon, web server or exotic language
necessary.
* An indexer which runs either as a thread inside the GUI or as an
external, cron'able program.
WWW: http://www.lesbonscomptes.com/recoll/

View file

@ -0,0 +1,100 @@
bin/recoll
bin/recollindex
share/applications/recoll-searchgui.desktop
share/icons/hicolor/48x48/apps/recoll.png
share/pixmaps/recoll.png
%%DATADIR%%/doc/docbook.css
%%DATADIR%%/doc/usermanual.html
%%DATADIR%%/examples/fields
%%DATADIR%%/examples/mimeconf
%%DATADIR%%/examples/mimemap
%%DATADIR%%/examples/mimeview
%%DATADIR%%/examples/rclmon.sh
%%DATADIR%%/examples/recoll.conf
%%DATADIR%%/filters/hotrecoll.py
%%DATADIR%%/filters/rclabw
%%DATADIR%%/filters/rclaptosidman
%%DATADIR%%/filters/rclaudio
%%DATADIR%%/filters/rclchm
%%DATADIR%%/filters/rcldjvu
%%DATADIR%%/filters/rcldoc
%%DATADIR%%/filters/rcldvi
%%DATADIR%%/filters/rclexecm.py
%%DATADIR%%/filters/rclfb2
%%DATADIR%%/filters/rclflac
%%DATADIR%%/filters/rclgaim
%%DATADIR%%/filters/rclics
%%DATADIR%%/filters/rclid3
%%DATADIR%%/filters/rclimg
%%DATADIR%%/filters/rclinfo
%%DATADIR%%/filters/rclkar
%%DATADIR%%/filters/rclkwd
%%DATADIR%%/filters/rcllatinclass.py
%%DATADIR%%/filters/rcllatinstops.zip
%%DATADIR%%/filters/rcllyx
%%DATADIR%%/filters/rclman
%%DATADIR%%/filters/rclnull
%%DATADIR%%/filters/rclogg
%%DATADIR%%/filters/rclopxml
%%DATADIR%%/filters/rclpdf
%%DATADIR%%/filters/rclppt
%%DATADIR%%/filters/rclps
%%DATADIR%%/filters/rclpurple
%%DATADIR%%/filters/rclpython
%%DATADIR%%/filters/rclrar
%%DATADIR%%/filters/rclrtf
%%DATADIR%%/filters/rclscribus
%%DATADIR%%/filters/rclshowinfo
%%DATADIR%%/filters/rclsiduxman
%%DATADIR%%/filters/rclsoff
%%DATADIR%%/filters/rclsvg
%%DATADIR%%/filters/rcltex
%%DATADIR%%/filters/rcltext
%%DATADIR%%/filters/rcluncomp
%%DATADIR%%/filters/rclwar
%%DATADIR%%/filters/rclwpd
%%DATADIR%%/filters/rclxls
%%DATADIR%%/filters/rclzip
%%DATADIR%%/filters/rcl7z
%%DATADIR%%/filters/xdg-open
%%DATADIR%%/images/aptosid-book.png
%%DATADIR%%/images/aptosid-manual.png
%%DATADIR%%/images/document.png
%%DATADIR%%/images/drawing.png
%%DATADIR%%/images/folder.png
%%DATADIR%%/images/html.png
%%DATADIR%%/images/image.png
%%DATADIR%%/images/message.png
%%DATADIR%%/images/mozilla_doc.png
%%DATADIR%%/images/pdf.png
%%DATADIR%%/images/pidgin.png
%%DATADIR%%/images/postscript.png
%%DATADIR%%/images/presentation.png
%%DATADIR%%/images/sidux-book.png
%%DATADIR%%/images/source.png
%%DATADIR%%/images/sownd.png
%%DATADIR%%/images/soffice.png
%%DATADIR%%/images/spreadsheet.png
%%DATADIR%%/images/text-x-python.png
%%DATADIR%%/images/txt.png
%%DATADIR%%/images/wordprocessing.png
%%DATADIR%%/translations/recoll_cs.qm
%%DATADIR%%/translations/recoll_fr.qm
%%DATADIR%%/translations/recoll_it.qm
%%DATADIR%%/translations/recoll_lt.qm
%%DATADIR%%/translations/recoll_de.qm
%%DATADIR%%/translations/recoll_uk.qm
%%DATADIR%%/translations/recoll_ru.qm
%%DATADIR%%/translations/recoll_tr.qm
%%DATADIR%%/translations/recoll_xx.qm
@dirrm %%DATADIR%%/doc
@dirrm %%DATADIR%%/examples
@dirrm %%DATADIR%%/filters
@dirrm %%DATADIR%%/images
@dirrm %%DATADIR%%/translations
@dirrm %%DATADIR%%
@dirrmtry share/applications
@dirrmtry share/icons/hicolor/48x48/apps
@dirrmtry share/icons/hicolor/48x48
@dirrmtry share/icons/hicolor
@dirrmtry share/icons

View file

@ -0,0 +1,180 @@
#!/bin/sh
# Packages needed
# sudo apt-get install g++ gnupg dput lintian mini-dinstall yaclc bzr devscripts
# For the kio: (and kdesdk?)
# sudo apt-get install pkg-kde-tools cdbs
RCLVERS=1.20.4
LENSVERS=1.19.10.3543
SCOPEVERS=1.20.2.4
PPAVERS=1
#
RCLSRC=/y/home/dockes/projets/fulltext/recoll/src
SCOPESRC=/y/home/dockes/projets/fulltext/unity-scope-recoll
RCLDOWNLOAD=/y/home/dockes/projets/lesbonscomptes/recoll
case $RCLVERS in
[23]*) PPANAME=recollexp-ppa;;
1.14*) PPANAME=recoll-ppa;;
*) PPANAME=recoll15-ppa;;
esac
#PPANAME=recollexp-ppa
echo "PPA: $PPANAME. Type CR if Ok, else ^C"
read rep
fatal()
{
echo $*; exit 1
}
check_recoll_orig()
{
if test ! -f recoll_${RCLVERS}.orig.tar.gz ; then
cp -p $RCLDOWNLOAD/recoll-${RCLVERS}.tar.gz \
recoll_${RCLVERS}.orig.tar.gz || \
fatal "Can find neither recoll_${RCLVERS}.orig.tar.gz nor " \
"recoll-${RCLVERS}.tar.gz"
fi
}
####### QT4
debdir=debian
# Note: no new releases for lucid: no webkit. Or use old debianrclqt4 dir.
series="precise trusty utopic vivid"
#series=precise
if test "X$series" != X ; then
check_recoll_orig
test -d recoll-${RCLVERS} || tar xvzf recoll_${RCLVERS}.orig.tar.gz
fi
for series in $series ; do
rm -rf recoll-${RCLVERS}/debian
cp -rp ${debdir}/ recoll-${RCLVERS}/debian || exit 1
if test -f $debdir/control-$series ; then
cp -f -p $debdir/control-$series recoll-${RCLVERS}/debian/control
else
cp -f -p $debdir/control recoll-${RCLVERS}/debian/control
fi
sed -e s/SERIES/${series}/g \
-e s/PPAVERS/${PPAVERS}/g \
< ${debdir}/changelog > recoll-${RCLVERS}/debian/changelog
(cd recoll-${RCLVERS};debuild -S -sa) || break
dput $PPANAME recoll_${RCLVERS}-1~ppa${PPAVERS}~${series}1_source.changes
done
### KIO
series="precise trusty utopic"
series=
debdir=debiankio
topdir=kio-recoll-${RCLVERS}
if test "X$series" != X ; then
check_recoll_orig
if test ! -f kio-recoll_${RCLVERS}.orig.tar.gz ; then
cp -p recoll_${RCLVERS}.orig.tar.gz \
kio-recoll_${RCLVERS}.orig.tar.gz || exit 1
fi
if test ! -d $topdir ; then
mkdir temp
cd temp
tar xvzf ../recoll_${RCLVERS}.orig.tar.gz || exit 1
mv recoll-${RCLVERS} ../$topdir || exit 1
cd ..
fi
fi
for series in $series ; do
rm -rf $topdir/debian
cp -rp ${debdir}/ $topdir/debian || exit 1
sed -e s/SERIES/$series/g \
-e s/PPAVERS/${PPAVERS}/g \
< ${debdir}/changelog > $topdir/debian/changelog ;
(cd $topdir;debuild -S -sa) || exit 1
dput $PPANAME kio-recoll_${RCLVERS}-0~ppa${PPAVERS}~${series}1_source.changes
done
### Unity Lens
series="precise"
series=
debdir=debianunitylens
topdir=recoll-lens-${LENSVERS}
if test "X$series" != X ; then
if test ! -f recoll-lens_${LENSVERS}.orig.tar.gz ; then
if test -f recoll-lens-${LENSVERS}.tar.gz ; then
mv recoll-lens-${LENSVERS}.tar.gz \
recoll-lens_${LENSVERS}.orig.tar.gz
else
fatal "Can find neither recoll-lens_${LENSVERS}.orig.tar.gz nor " \
"recoll-lens-${LENSVERS}.tar.gz"
fi
fi
test -d $topdir || tar xvzf recoll-lens_${LENSVERS}.orig.tar.gz || exit 1
fi
for series in $series ; do
rm -rf $topdir/debian
cp -rp ${debdir}/ $topdir/debian || exit 1
sed -e s/SERIES/$series/g \
-e s/PPAVERS/${PPAVERS}/g \
< ${debdir}/changelog > $topdir/debian/changelog ;
(cd $topdir;debuild -S -sa) || break
dput $PPANAME \
recoll-lens_${LENSVERS}-1~ppa${PPAVERS}~${series}1_source.changes
done
### Unity Scope
series="trusty utopic vivid"
series=
debdir=debianunityscope
if test ! -d ${debdir}/ ; then
rm -f ${debdir}
ln -s ${SCOPESRC}/debian $debdir
fi
topdir=unity-scope-recoll-${SCOPEVERS}
if test "X$series" != X ; then
if test ! -f unity-scope-recoll_${SCOPEVERS}.orig.tar.gz ; then
if test -f unity-scope-recoll-${SCOPEVERS}.tar.gz ; then
mv unity-scope-recoll-${SCOPEVERS}.tar.gz \
unity-scope-recoll_${SCOPEVERS}.orig.tar.gz
else
fatal "Can find neither " \
"unity-scope-recoll_${SCOPEVERS}.orig.tar.gz nor " \
"unity-scope-recoll-${SCOPEVERS}.tar.gz"
fi
fi
test -d $topdir || tar xvzf unity-scope-recoll_${SCOPEVERS}.orig.tar.gz \
|| exit 1
fi
for series in $series ; do
rm -rf $topdir/debian
cp -rp ${debdir}/ $topdir/debian || exit 1
sed -e s/SERIES/$series/g \
-e s/PPAVERS/${PPAVERS}/g \
< ${debdir}/changelog > $topdir/debian/changelog ;
(cd $topdir;debuild -S -sa) || break
dput $PPANAME \
unity-scope-recoll_${SCOPEVERS}-1~ppa${PPAVERS}~${series}1_source.changes
done

View file

@ -0,0 +1,23 @@
README for Debian
-----------------
Installing over an older version: 1.18 introduces significant index formats
changes to support optional character case and diacritics sensitivity, and it
will be advisable to reset the index in most cases. This will be best done by
destroying the index directory (rm -rf ~/.recoll/xapiandb).
If 1.18 is not configured for case and diacritics sensitivity, it is mostly
compatible with 1.17 indexes.
-- Kartik Mistry <kartik@debian.org> Tue, 13 Nov 2012 12:33:00 +0530
Installing over an older version: 1.16 is mostly compatible with 1.15 indexes,
except for a few differences for weird terms containing punctuation signs.
Perform a full index pass if installing over an older version. The simplest
way to do this is to quit all recoll programs and just delete the index
directory (rm -rf ~/.recoll/xapiandb), then start recoll or recollindex.
recollindex -z will do the same in most cases.
Also, using the anchored search feature requires a full reindex.
-- Kartik Mistry <kartik@debian.org> Thu, 22 Sep 2011 21:30:05 +0530

View file

@ -0,0 +1,558 @@
recoll (1.20.4-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Should have been in 1.20.3: skip compressed fs image files like xxx.img.gz
by default (mimemap:recoll_noindex).
-- Jean-Francois Dockes <jf@dockes.org> Mon, 30 Mar 2015 10:06:00 +0200
recoll (1.20.3-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* fixes a bug where the real time indexer did not process the web queue
* miscellaneous usability improvements in the GUI.
* Copy sample fragbuts.xml file if it does not exist
-- Jean-Francois Dockes <jf@dockes.org> Sat, 28 Mar 2015 09:40:00 +0200
recoll (1.20.1-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.20.1 brings improved indexing of compound words like email addresses
and miscellaneous usability improvements in the GUI.
-- Jean-Francois Dockes <jf@dockes.org> Fri, 19 Dec 2014 08:14:00 +0200
recoll (1.19.14p2-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.14p2 fixes Bengali diacritics processing, a memory leak in the
Python module, and a few minor issues in the filters.
-- Jean-Francois Dockes <jf@dockes.org> Thu, 11 Sep 2014 07:47:00 +0200
recoll (1.19.14p1-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.14p1 fixes a descriptor and memory leak in the Python module. The
main programs and library are unchanged.
-- Jean-Francois Dockes <jf@dockes.org> Thu, 26 Jun 2014 13:14:00 +0200
recoll (1.19.14-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.14 fixes two relatively minor but ennoying issues in indexing:
- The use of a separate readonly Database object for querying the index
while indexing would trigger Xapian errors, (bad block reads), and
subsequent up-to-date check failures (leading to unnecessary
reindexing). The jury is out as to the cause, but using the same
object for reading and writing seems to eliminate the problem.
- A spurious log message in the child process between forking and
executing the filter could block on a mutex, and lead to a 20 mn
timeout for the affected father process thread (happened only in
multithread mode).
-- Jean-Francois Dockes <jf@dockes.org> Sat, 07 Jun 2014 18:56:00 +0200
recoll (1.19.13-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.13 hopefully fixes the multithreaded indexing crashes and silences
the noisy ppt extractor failures.
-- Jean-Francois Dockes <jf@dockes.org> Thu, 06 May 2014 14:22:00 +0200
recoll (1.19.12p2-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.12 p1 + restable doubleclick
-- Jean-Francois Dockes <jf@dockes.org> Sun, 07 Apr 2014 16:17:00 +0200
recoll (1.19.12p1-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* 1.19.12 install forgot the xls filter
-- Jean-Francois Dockes <jf@dockes.org> Sun, 06 Apr 2014 06:57:00 +0200
recoll (1.19.12-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Minor fixes to 1.19.11. Make metadata stored length a parameter.
* New xls dumper based on mso-dumper removes catdoc dependancy
* Move out the code for the Ubuntu Unity lens and scope
-- Jean-Francois Dockes <jf@dockes.org> Mon, 02 Apr 2014 15:12:00 +0200
recoll (1.19.11p1-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* minor fixes to 1.19.10
-- Jean-Francois Dockes <jf@dockes.org> Mon, 27 Nov 2013 09:54:00 +0200
recoll (1.19.10-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Support for saucy in 1.19. Separate python and python3 packages
-- Jean-Francois Dockes <jf@dockes.org> Sat, 23 Nov 2013 16:01:46 +0100
recoll (1.18.1-1) experimental; urgency=low
* New upstream version:
+ Please read README.Debian for changes in index db format.
* debian/patches/txtcsvopen.diff:
+ Dropped. Merged upstream.
* debian/patches/fix-manpage-typos.patch:
+ Added patch to fix manpage typos and groff errors.
* debian/control:
+ Added VCS-* fields.
-- Kartik Mistry <kartik@debian.org> Tue, 13 Nov 2012 12:29:46 +0530
recoll (1.17.3-2) unstable; urgency=medium
* debian/rules:
+ Call dh_python2 for python-recoll. (Closes: #681586)
* debian/control:
+ Added X-Python-Version field for correct Python version dependency.
-- Kartik Mistry <kartik@debian.org> Sat, 14 Jul 2012 20:20:56 +0530
recoll (1.17.3-1) unstable; urgency=low
* New upstream release.
* debian/patches/txtcsvopen.diff:
+ Added patch to fix opening of compressed text-files with gnumeric.
(Closes: #674756)
-- Kartik Mistry <kartik@debian.org> Fri, 08 Jun 2012 11:46:57 +0530
recoll (1.17.2-1) unstable; urgency=low
* New upstream release:
+ Dropped patches: fix-kFreeBSD-ftbfs.patch, recoll_ionice_getpid.patch.
These are merged with upstream.
+ Refreshed patch: fix-python-install.patch.
* debian/rules, debian/control:
+ Added hardening support.
* debian/copyright:
+ Fixed duplicate Copyright sections.
-- Kartik Mistry <kartik@debian.org> Fri, 18 May 2012 10:59:21 +0530
recoll (1.17.1-2) unstable; urgency=low
* debian/patches:
+ fix-kFreeBSD-ftbfs.patch: Added patch to fix FTBFS on kFreeBSD from
upstream (Closes: #667083)
+ recoll_ionice_getpid.patch: Added patch to fix FTBFS with gcc-4.7 from
upstream (Closes: #667352)
-- Kartik Mistry <kartik@debian.org> Wed, 04 Apr 2012 12:16:48 +0530
recoll (1.17.1-1) unstable; urgency=low
* New upstream release.
* Enable Python module resulting into new binary: python-recoll.
* debian/control:
+ Updated Build-Deps: libqtwebkit-dev, python-all-dev.
+ Added python-recoll binary.
+ Updated Standards-Version to 3.9.3
* debian/rules:
+ Build Python module by default.
* debian/recoll.menu, debian/python-recoll.install, debian/recoll.install:
+ Changes for new binary package.
* debian/copyright:
+ Updated to copyright-format 1.0
+ Updated upstream and Debian copyright.
+ Fixed unicode.org/copyright.html URL.
-- Kartik Mistry <kartik@debian.org> Tue, 27 Mar 2012 12:15:51 +0530
recoll (1.16.2-1) unstable; urgency=low
* New upstream release.
* debian/copyright:
+ Updated as per DEP-5 format, simplying copyright file.
* debian/control:
+ Dropped: flac, vorbis-tools and libid3-tools from Suggests, as
python-mutagen handles audio now.
+ Dropped: lyx from Suggests, as it will be too heavy for most of users as
discussed with upstream.
* debian/rules:
+ Use STRIP variable to strip during install phase. This makes patch
01_nostrip_final_binaries_437901.diff obsolete, removed this patch.
-- Kartik Mistry <kartik@debian.org> Wed, 09 Nov 2011 20:35:16 +0530
recoll (1.16.1-1) unstable; urgency=low
* New upstream release.
* debian/copyright:
+ Added missing GPL-3 URL in debian/* copyright section.
-- Kartik Mistry <kartik@debian.org> Thu, 29 Sep 2011 10:06:54 +0530
recoll (1.16.0-1) unstable; urgency=low
* New upstream release:
+ See README.Debian for upgrade note and information.
* debian/copyright:
+ Updated as per latest DEP-5 format.
* debian/control:
+ Recommends: xdg-utils now.
* debian/rules:
+ Added recommends build targets.
-- Kartik Mistry <kartik@debian.org> Thu, 22 Sep 2011 21:30:25 +0530
recoll (1.15.9-1) unstable; urgency=low
* New upstream release:
+ Dropped patch 02_recoll_staticfix_626882.diff, merged upstream
-- Kartik Mistry <kartik@debian.org> Wed, 15 Jun 2011 09:20:20 +0530
recoll (1.15.8-2) unstable; urgency=low
* debian/patches/02_recoll_staticfix_626882.diff:
+ Added patch to fix segfault in 1.15.8. Patch from Jean-Francois Dockes
<jf@dockes.org> (Closes: #626882)
-- Kartik Mistry <kartik@debian.org> Tue, 17 May 2011 09:57:50 +0530
recoll (1.15.8-1) unstable; urgency=low
* New upstream release.
* debian/patches/02_kfreebsd-ftbfs.diff:
+ Removed. Merged with upstream.
* debian/control:
+ Updated to Standards-Version 3.9.2 (no changes needed)
-- Kartik Mistry <kartik@debian.org> Thu, 12 May 2011 09:47:21 +0530
recoll (1.15.7-2) unstable; urgency=low
* Applied patch 02_kfreebsd-ftbfs.diff from upstream to fix FTBFS
on kFreeBSD-* (Closes: #618796)
* debian/copyright:
+ Updated to latest DEP-5 specification
-- Kartik Mistry <kartik@debian.org> Fri, 15 Apr 2011 18:38:54 +0530
recoll (1.15.7-1) unstable; urgency=low
* New upstream release:
+ Fixed: Segmentation fault when file type radio button clicked.
(Closes: #617353)
* debian/patches/02_manpage_fix.diff:
+ Removed. Merged with upstream.
-- Kartik Mistry <kartik@debian.org> Sun, 13 Mar 2011 09:07:57 +0530
recoll (1.15.2-1) unstable; urgency=low
* Upload to unstable
* New upstream release
* debian/patches:
+ Refreshed 01_nostrip_final_binaries_437901.diff
+ Added 02_manpage_fix.diff to fix manpage groff issues
-- Kartik Mistry <kartik@debian.org> Tue, 15 Feb 2011 11:25:58 +0530
recoll (1.14.4-1) experimental; urgency=low
* New upstream release
* debian/copyright:
+ Updated for DEP-5 format specification
-- Kartik Mistry <kartik@debian.org> Thu, 02 Dec 2010 00:29:06 +0530
recoll (1.14.2-1) experimental; urgency=low
* New upstream release
* debian/control:
+ Added xlstproc as Recommends (Closes: #587684)
+ Added python-mutagen as Suggests
* debian/patches:
+ Refreshed 01_nostrip_final_binaries_437901.diff
+ Removed 02_recoll-prepare-for-xapian-1.2.diff, merged with upstream
-- Kartik Mistry <kartik@debian.org> Mon, 27 Sep 2010 17:52:17 +0530
recoll (1.13.04-3) unstable; urgency=low
* Added patch for xapian 1.2 compatibility from Olly Betts <olly@survex.com>
(Closes: #579929)
-- Kartik Mistry <kartik@debian.org> Mon, 03 May 2010 09:47:16 +0530
recoll (1.13.04-2) unstable; urgency=low
* debian/control:
+ Added missing packages to Suggests: flac, libid3-tools, lyx, pstotext,
python-chm, untex, vorbis-tools Thanks to Ivan Vilata i Balaguer
<ivan@selidor.net> (Closes: #578441)
-- Kartik Mistry <kartik@debian.org> Fri, 23 Apr 2010 11:07:00 +0530
recoll (1.13.04-1) unstable; urgency=low
* New upstream release
-- Kartik Mistry <kartik@debian.org> Fri, 16 Apr 2010 10:39:02 +0530
recoll (1.13.02-2) unstable; urgency=low
* debian/control:
+ Don't suggest xpdf (Closes: #569333)
* debian/copyright:
+ Updated Debian package copyright year
* Removed unused README.source file
-- Kartik Mistry <kartik@debian.org> Fri, 19 Feb 2010 10:42:53 +0530
recoll (1.13.02-1) unstable; urgency=low
* New upstream release
* debian/control:
+ Updated to Standards-Version 3.8.4 (no changes needed)
-- Kartik Mistry <kartik@debian.org> Wed, 03 Feb 2010 11:00:53 +0530
recoll (1.13.01-1) unstable; urgency=low
* New upstream release
+ Fixed bug that causes field values ignored for Capitalized words and
phrases
-- Kartik Mistry <kartik@debian.org> Fri, 08 Jan 2010 10:09:15 +0530
recoll (1.13.00-1) unstable; urgency=low
* New upstream release
* debian/control:
+ Fixed package descriptions, replaced QT->Qt (Closes: #563725)
* debian/patches/01_nostrip_final_binaries_437901.diff:
+ Refreshed patch for upstream changes
* Converted package to new source format '3.0 (quilt)'
-- Kartik Mistry <kartik@debian.org> Tue, 05 Jan 2010 23:23:30 +0530
recoll (1.12.4-1) unstable; urgency=low
* New upstream release:
+ Fixed FTBFS with binutils-gold (Closes: #556315)
-- Kartik Mistry <kartik@debian.org> Fri, 11 Dec 2009 00:08:37 +0530
recoll (1.12.3-1) unstable; urgency=low
* New upstream release
* debian/control:
+ Updated Build-Depends on libqt4-dev as we are building Qt4 ui now
* debian/rules:
+ Make sure that we call qmake-qt4
-- Kartik Mistry <kartik@debian.org> Thu, 29 Oct 2009 22:44:50 +0530
recoll (1.12.2-1) unstable; urgency=low
* New upstream release:
+ Dropped patch 02_manpage_fixes.diff, merged with upstream
* Added debian/README.source file to confirm with latest policy
* Removed debian/docs, we are using dh_installdocs in debian/rules
* debian/control:
+ Wrapped up Build-Depends
+ Depends on quilt, since patch system is using quilt now
+ Updated to Standards-Version 3.8.3
+ Updated dependency on libxapian-dev (>= 1.0.15)
* debian/rules:
+ Changes for quilt migration
-- Kartik Mistry <kartik@debian.org> Fri, 23 Oct 2009 10:14:05 +0530
recoll (1.12.1-1) unstable; urgency=low
* New upstream release
* debian/control:
+ Updated to Standards-Version 3.8.2 (no changes needed)
* debian/copyright:
+ [Lintian] Removed licenses URL links to symlink
-- Kartik Mistry <kartik@debian.org> Sat, 27 Jun 2009 20:08:28 +0530
recoll (1.12.0-1) unstable; urgency=low
* New upstream release
* debian/copyright:
+ [Lintian] Updated for use of correct copyright symbol © instead of (C)
+ Updated Debian packaging copyright year
* debian/rules:
+ Used dh_prep instead of deprecated dh_clean -k
* debian/control:
+ Updated debhelper dependency to 7
* debian/patches:
+ Dropped 02_gcc-snapshot-missing-headers-fix.dpatch, merged with upstream
+ Added patch 02_manpage_fixes.dpatch for groff warnings
-- Kartik Mistry <kartik@debian.org> Sat, 28 Feb 2009 14:33:53 +0530
recoll (1.11.0-2) unstable; urgency=low
* debian/control:
+ Added versioned build-dep on libxapian-dev, Thanks to Brad Sawatzky
<brad+debian@swatter.net> for catch (Closes: #507473)
+ Add libimage-exiftool-perl as Suggests in which I forgot in
previous upload
* debian/changelog:
+ Fixed typo from previous upload entry
-- Kartik Mistry <kartik@debian.org> Wed, 03 Dec 2008 15:05:55 +0530
recoll (1.11.0-1) unstable; urgency=low
* New upstream release:
+ Remembers missing filters in first run (Closes: #500690)
* debian/control:
+ Added libimage-exiftool-perl as Suggests (Closes: #502427)
+ Added Python as recommaded due to filters/rclpython script
although, its not necessary as it will be installed only
when Python is present
* debian/patches:
+ Refreshed patch for gcc 4.4 FTBFS (Closes: #505376)
* debian/copyright:
+ Updated for newly added filter and image files
-- Kartik Mistry <kartik@debian.org> Thu, 13 Nov 2008 21:18:15 +0530
recoll (1.10.6-1) unstable; urgency=low
* New upstream release
+ Fixed typo in tooltip in indexing configuration (Closes: #486689)
+ Dropped patch 03_manpage_fixes.dpatch, merged with upstream
* debian/control:
+ Updated to Standards-Version 3.8.0 (no changes needed)
+ Updated my maintainer email address
* debian/copyright:
+ Updated my maintainer email address
+ Updated license text to proposed license format
+ Updated upstream copyright year
-- Kartik Mistry <kartik@debian.org> Thu, 11 Sep 2008 16:06:48 +0530
recoll (1.10.2-1) unstable; urgency=low
* New upstream release
+ Updated patch debian/patches/02_gcc-snapshot-missing-headers-fix.dpatch
Some portions are now merged with upstream
* debian/copyright:
+ Fixed indentation to 80 characters
+ Updated Debian package copyright year
-- Kartik Mistry <kartik.mistry@gmail.com> Thu, 29 May 2008 23:25:40 +0530
recoll (1.10.1-1) unstable; urgency=low
* New upstream release
+ Updated debian/patches/02_gcc-snapshot-missing-headers-fix.dpatch
Some portions are merged with upstream
* debian/control:
+ Fixed short description, Thanks to Mohammed Adnène Trojette
<adn+deb@diwi.org>
* debian/patches/03_manpage_fixes.dpatch:
+ Added patch to fix manpage groff warnings
-- Kartik Mistry <kartik.mistry@gmail.com> Wed, 27 Feb 2008 18:41:25 +0530
recoll (1.10.0-5) unstable; urgency=low
* debian/patches/02_gcc-snapshot-missing-headers-fix.dpatch:
+ Really fixed the FTBFS with gcc-4.3/g++-4.3 (Closes: #455652)
-- Kartik Mistry <kartik.mistry@gmail.com> Sun, 27 Jan 2008 14:37:53 +0530
recoll (1.10.0-4) unstable; urgency=low
* debian/patches/02_gcc-snapshot-missing-headers-fix.dpatch:
+ Updated patch to fix missing include header in qtgui/main.cpp
(Closes: #455652)
* debian/copyright:
+ Updated missing license for qtgui/q3richtext_p.h
+ Moved other copyright holders for GPL above license
to make it readable
-- Kartik Mistry <kartik.mistry@gmail.com> Wed, 23 Jan 2008 10:42:20 +0530
recoll (1.10.0-3) unstable; urgency=low
* debian/control:
+ Added external helper programs and utilities to Suggests field
(Closes: #441629, #457033)
-- Kartik Mistry <kartik.mistry@gmail.com> Fri, 28 Dec 2007 08:12:52 +0530
recoll (1.10.0-2) unstable; urgency=low
* debian/control:
+ Updated Standards-Version to 3.7.3
* debian/patches/02_gcc-snapshot-missing-headers-fix.dpatch:
+ Added patch to fix compilation with gcc-snapshot due to
missing headers (Closes: #455652)
* debian/rules:
+ Fixed clean target
-- Kartik Mistry <kartik.mistry@gmail.com> Tue, 11 Dec 2007 14:42:47 +0530
recoll (1.10.0-1) unstable; urgency=low
* New upstream release
* debian/control:
+ Moved Homepage: entry to control field
+ Dropped unnecessary dependency on qt3-dev-tools
-- Kartik Mistry <kartik.mistry@gmail.com> Wed, 28 Nov 2007 19:54:58 +0530
recoll (1.9.0-1) unstable; urgency=low
* New upstream release
* debian/patches: dropped 02_desktop_entry_fixes.dpatch, merged with
upstream, rewrote 01_nostrip_final_binary_437901.dpatch after upstream
changes
* debian/menu: used Data Management since it is better and appropriate
* debian/copyright: added missing copyright from index/csguess.cpp
-- Kartik Mistry <kartik.mistry@gmail.com> Wed, 12 Sep 2007 14:05:39 +0530
recoll (1.8.2-3) unstable; urgency=low
* debian/rules: added better clean target, better configure flags,
separated LDFLAGS
* Added dpatch support
* debian/patches/01_nostrip_final_binary_437901.dpatch: added patch to not
strip binary from upstream (Closes: #437901)
* debian/patches/02_desktop_entry_fixes.dpatch: added patch to fix desktop
menu entry according to freedesktop standards
* debian/menu: fixed according to latest menu policy, changed subsection to
Tools from Databases (hint taken from beagle)
* debian/copyright: moved copyright out of license section, adjusted
copyrights portions under proper license
-- Kartik Mistry <kartik.mistry@gmail.com> Sat, 18 Aug 2007 20:28:49 +0530
recoll (1.8.2-2) unstable; urgency=low
* debian/rules: xapian is dynamically linked now, Thanks to
Jean-Francois Dockes <jean-francois.dockes@wanadoo.fr> (Closes: #427783)
* Fixed debian/watch file, Thanks to Vincent Fourmond <fourmond@debian.org>
-- Kartik Mistry <kartik.mistry@gmail.com> Fri, 08 Jun 2007 10:51:01 +0530
recoll (1.8.2-1) unstable; urgency=low
* New upstream release
* debian/watch: fixed now
* debian/control: fixed long descriptions
-- Kartik Mistry <kartik.mistry@gmail.com> Tue, 22 May 2007 15:24:54 +0530
recoll (1.8.1-1) unstable; urgency=low
* Initial release (Closes: #422039)
* Based on package prepared by Jean-Francois Dockes <jean-francois.dockes@wanadoo.fr>
-- Kartik Mistry <kartik.mistry@gmail.com> Thu, 3 May 2007 12:15:02 +0530

View file

@ -0,0 +1 @@
5

View file

@ -0,0 +1,84 @@
Source: recoll
Section: x11
Priority: optional
Maintainer: Jean-Francois Dockes <jfd@recoll.org>
Build-Depends: autotools-dev,
debhelper (>= 7),
hardening-wrapper,
libqt4-dev,
libqtwebkit-dev,
libx11-dev,
libxapian-dev (>= 1.2.0),
libz-dev,
python-all-dev (>= 2.6.6-3~),
python3-all-dev,
Standards-Version: 3.9.4
X-Python-Version: >= 2.7
Homepage: http://www.lesbonscomptes.com/recoll
Vcs-Git: git://anonscm.debian.org/collab-maint/recoll.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/recoll.git;a=summary
Package: recoll
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Recommends: python-recoll, aspell, python, xdg-utils, xsltproc
Suggests: antiword,
catdoc,
ghostscript,
libimage-exiftool-perl,
poppler-utils,
pstotext,
python-chm,
python-mutagen,
unrtf,
untex
Description: Personal full text search package with a Qt GUI
This package is a personal full text search package is based on a very strong
backend (Xapian), for which it provides an easy to use and feature-rich
interface.
.
Features:
* Qt-based GUI
* Supports the following document types (and their compressed versions)
- Natively: text, html, OpenOffice files, maildir and mailbox (Mozilla and
IceDove mail) with attachments, pidgin log files
- With external helpers: pdf (pdftotext), postscript (ghostscript), msword
(antiword), excel, ppt (catdoc), rtf (unrtf)
* Powerful query facilities, with boolean searches, phrases, filter on file
types and directory tree
* Support for multiple charsets, Internal processing and storage uses Unicode
UTF-8
* Stemming performed at query time (can switch stemming language after
indexing)
* Easy installation. No database daemon, web server or exotic language
necessary
* An indexer which runs either as a thread inside the GUI or as an external,
cron'able program
Package: python-recoll
Architecture: any
Section: python
Depends: recoll (= ${binary:Version}),
${misc:Depends},
${python:Depends},
${shlibs:Depends}
Description: Python extension for recoll
Personal full text search package which is based on a very strong backend
(Xapian), for which it provides an easy to use and feature-rich interface.
.
This package provides Python extension module for recoll which can be use to
extend recoll such as an Ubuntu Unity Lens.
Package: python3-recoll
Architecture: any
Section: python
Depends: recoll (= ${binary:Version}),
${misc:Depends},
${python3:Depends},
${shlibs:Depends}
Description: Python extension for recoll
Personal full text search package which is based on a very strong backend
(Xapian), for which it provides an easy to use and feature-rich interface.
.
This package provides Python extension module for recoll which can be use to
extend recoll such as an Ubuntu Unity Lens.

View file

@ -0,0 +1,219 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: recoll
Upstream-Contact: Jean-Francois Dockes <jean-francois.dockes@wanadoo.fr>
Source: http://www.lesbonscomptes.com/recoll/
Files: *
Copyright: 2005-2012, Jean-Francois Dockes <jean-francois.dockes@wanadoo.fr>
License: GPL-2+
Files: Binc IMAP project (bincimapmime/*)
Copyright: 2002-2005, Andreas Aardal Hanssen <andreas-binc@bincimap.org>
License: GPL-2+
Files: filters/rcl* files index/csguess.cpp internfile/htmlparse.cpp
Copyright: 2000-2004, Mikio Hirabayashi
License: GPL-2+
Files: filters/rclpython
Copyright: J\xfcrgen Hermann, Mike Brown, Christopher Arndt
<http://chrisarndt.de/en/software/python/colorize.html>
License: GPL-2+
Files: internfile/htmlparse.cpp mh_html.cpp
Copyright: 1999-2001, BrightStation PLC,
2001, Ananova Ltd,
2002-2004, Olly Betts.
License: GPL-2+
Files: unac/*
Copyright: 2000-2002, Loic Dachary <loic@senga.org>
License: GPL-2+
Files: common/*
Copyright: 2004-2005, J.F.Dockes
License: GPL-2+
Files: debian/*
Copyright: 2007-2012, Kartik Mistry <kartik@debian.org>
License: GPL-2+
License: GPL-2+
This package 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 package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License can be
found in `/usr/share/common-licenses/GPL-2' and
`/usr/share/common-licenses/GPL-3'.
Files: aspell/*
Copyright: 2001-2002, by Kevin Atkinson
License: LGPL-2+
Files: images/text-x-python.png
Copyright: David Vignoni <http://www.oxygen-icons.org/>
License: LGPL-2+
License: LGPL-2+
This package is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
.
This package 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 Lesser General Public License for more
details.
.
You should have received a copy of the GNU Lesser General Public License along
with this package; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU Lesser General Public License
can be found in `/usr/share/common-licenses/LGPL-2' and
`/usr/share/common-licenses/LGPL-2.1' and `/usr/share/common-licenses/LGPL-3'.
Files: qtgui/q3richtext_p.h
Copyright: 1992-2007, Trolltech ASA. All rights reserved
License:
This file is part of the Qt3Support module of the Qt Toolkit.
.
This file may be used under the terms of the GNU General Public License
version 2.0 as published by the Free Software Foundation and appearing in the
file LICENSE.GPL included in the packaging of this file. Please review the
following information to ensure GNU General Public Licensing requirements will
be met: http://trolltech.com/products/qt/licenses/licensing/opensource/
.
If you are unsure which license is appropriate for your use, please review the
following information:
http://trolltech.com/products/qt/licenses/licensing/licensingoverview
or contact the sales department at sales@trolltech.com.
.
In addition, as a special exception, Trolltech gives you certain additional
rights. These rights are described in the Trolltech GPL Exception version 1.0,
which can be found at http://www.trolltech.com/products/qt/gplexception/
and in the file GPL_EXCEPTION.txt in this package.
.
In addition, as a special exception, Trolltech, as the sole copyright
holder for Qt Designer, grants users of the Qt/Eclipse Integration
plug-in the right for the Qt/Eclipse Integration to link to
functionality provided by Qt Designer and its related libraries.
.
Trolltech reserves all rights not expressly granted herein.
.
Trolltech ASA (c) 2007
.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Files: common/uproplist.h
Copyright: 1991-2006, Unicode, Inc.
License:
All rights reserved. Distributed under the Terms of Use in
http://www.unicode.org/copyright.html
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the Unicode data files and any associated documentation (the "Data Files")
or Unicode software and any associated documentation (the "Software") to deal
in the Data Files or Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, and/or
sell copies of the Data Files or Software, and to permit persons to whom the
Data Files or Software are furnished to do so, provided that (a) the above
copyright notice(s) and this permission notice appear with all copies of the
Data Files or Software, (b) both the above copyright notice(s) and this
permission notice appear in associated documentation, and (c) there is clear
notice in each modified Data File or in the Software as well as in the
documentation associated with the Data File(s) or Software that the data or
software has been modified.
.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
DATA FILES OR SOFTWARE.
.
Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in these Data Files or Software without prior written authorization of the
copyright holder.
Files: utils/md5.*
Copyright: 1991-1992, RSA Data Security, Inc. All rights reserved.
License:
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
.
License to copy and use this software is granted provided that it is
identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in
all material mentioning or referencing this software or this function.
.
License is also granted to make and use derivative works provided that such
works are identified as "derived from the RSA Data Security, Inc. MD5
Message-Digest Algorithm" in all material mentioning or referencing the
derived work.
.
RSA Data Security, Inc. makes no representations concerning either the
merchantability of this software or the suitability of this software for any
particular purpose. It is provided "as is" without express or implied warranty
of any kind.
.
These notices must be retained in any copies of any part of this documentation
and/or software.
Files: desktop/xdg-utils-1.0.1/*
Copyright: 2006, Kevin Krammer <kevin.krammer@gmx.at>,
Jeremy White <jwhite@codeweavers.com>.
License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: index/csguess.cpp
Copyright: 2000-2004, Mikio Hirabayashi
License: LGPL-2.1+
This file is part of QDBM, Quick Database Manager.
.
QDBM is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License or any later
version.
.
QDBM 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 Lesser General Public
License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with QDBM; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU Lesser General Public License
can be found in `/usr/share/common-licenses/LGPL-2.1' and
`/usr/share/common-licenses/LGPL-3'.

View file

@ -0,0 +1,10 @@
--- a/recollinstall.in
+++ b/recollinstall.in
@@ -149,5 +149,5 @@
${datadir}/recoll/translations/recoll_zh.qm || exit 1
-@NOPYTHON@(cd python/recoll;python setup.py install \
-@NOPYTHON@ --prefix=${REALPREFIX} ${ROOTFORPYTHON} ${OPTSFORPYTHON})
+#@NOPYTHON@(cd python/recoll;python setup.py install \
+#@NOPYTHON@ --prefix=${REALPREFIX} ${ROOTFORPYTHON} ${OPTSFORPYTHON})

View file

@ -0,0 +1 @@
fix-python-install.patch

View file

@ -0,0 +1,2 @@
usr/lib/python2*/*-packages/*.egg-info
usr/lib/python2*/*-packages/recoll/*

View file

@ -0,0 +1,2 @@
usr/lib/python3*/*-packages/*.egg-info
usr/lib/python3*/*-packages/recoll/*

View file

@ -0,0 +1,12 @@
usr/bin
usr/lib/recoll
usr/share/applications
usr/share/icons
usr/share/man
usr/share/pixmaps
usr/share/recoll/doc
usr/share/recoll/examples
usr/share/recoll/filters
usr/share/recoll/filters
usr/share/recoll/images
usr/share/recoll/translations

View file

@ -0,0 +1,2 @@
?package(recoll):needs="X11" section="Applications/Data Management" \
title="Personal Search Tool" command="/usr/bin/recoll"

86
packaging/debian/debian/rules Executable file
View file

@ -0,0 +1,86 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_HARDENING=1
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall -g
#LDFLAGS = -Wl,-z,defs
#build qt4 UI only
export QMAKE=qmake-qt4
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
config.status: configure
dh_testdir
./configure CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--mandir=\$${prefix}/share/man \
--prefix=/usr
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: config.status
dh_testdir
$(MAKE)
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp config.log
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean Makefile
install:
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) STRIP=ls prefix=$(CURDIR)/debian/tmp/usr install
# Work around recollinstall forgetting the PPT text-extract utility
install -m 0444 filters/msodump.zip $(CURDIR)/debian/tmp/usr/share/recoll/filters
install -m 0555 filters/ppt-dump.py $(CURDIR)/debian/tmp/usr/share/recoll/filters
(cd python/recoll; python setup.py install \
--install-layout=deb \
--prefix=$(CURDIR)/debian/tmp/usr )
(cd python/recoll; python3 setup.py install \
--install-layout=deb \
--prefix=$(CURDIR)/debian/tmp/usr )
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs ChangeLog
dh_installdocs README
dh_installmenu
dh_installman
dh_install --sourcedir=debian/tmp
dh_makeshlibs
dh_python2 -p python-recoll
dh_python3 -p python3-recoll
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary-indep: build install
binary: binary-indep binary-arch
.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install

View file

@ -0,0 +1 @@
3.0 (quilt)

View file

@ -0,0 +1,2 @@
version=3
http://www.lesbonscomptes.com/recoll/download.html recoll-(.*)\.tar\.gz

View file

@ -0,0 +1,76 @@
kio-recoll (1.20.1-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to version 1.20.1
-- Jean-Francois Dockes <jf@dockes.org> Fri, 19 Dec 2014 08:14:00 +0200
kio-recoll (1.19.14p2-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* No changes, build for Ubuntu Utopic
-- Jean-Francois Dockes <jf@dockes.org> Sat, 06 Dec 2014 08:44:00 +0200
kio-recoll (1.19.12-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.19.12
-- Jean-Francois Dockes <jf@dockes.org> Wed, 02 Apr 2014 15:50:00 +0200
kio-recoll (1.19.10-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.19.10
-- Jean-Francois Dockes <jf@dockes.org> Sat, 25 Nov 2013 18:00:00 +0100
kio-recoll (1.19.2-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.19.2
-- Jean-Francois Dockes <jf@dockes.org> Mon, 13 May 2013 12:09:00 +0100
kio-recoll (1.18.2-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.18.2
-- Jean-Francois Dockes <jf@dockes.org> Mon, 18 Apr 2013 18:05:00 +0100
kio-recoll (1.18.1-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.18.1
-- Jean-Francois Dockes <jf@dockes.org> Mon, 05 Nov 2012 13:25:00 +0100
kio-recoll (1.17.0-0~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.17.0
-- Jean-Francois Dockes <jf@dockes.org> Sun, 25 Mar 2012 18:05:00 +0200
kio-recoll (1.16.2-0~ppa1~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.16.2
-- Jean-Francois Dockes <jf@dockes.org> Mon, 07 Nov 2011 17:57:00 +0200
kio-recoll (1.16.1-0~ppa1~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.16.1
-- Jean-Francois Dockes <jf@dockes.org> Wed, 28 Sep 2011 15:07:00 +0200
kio-recoll (1.16.0-0~ppa1~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.16.0
-- Jean-Francois Dockes <jf@dockes.org> Wed, 07 Sep 2011 18:30:00 +0200
kio-recoll (1.15.8-0~ppa1~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.15.8
-- Jean-Francois Dockes <jf@dockes.org> Mon, 02 May 2011 17:27:00 +0200
kio-recoll (1.15.5-0~ppa1~SERIES1) SERIES; urgency=low
* Update to recoll version 1.15.5
-- Jean-Francois Dockes <jf@dockes.org> Fri, 04 Mar 2011 13:54:00 +0200
kio-recoll (1.15.2-0~ppa1~SERIES1) SERIES; urgency=low
* Update to recoll version 1.15.2
-- Jean-Francois Dockes <jf@dockes.org> Thu, 15 Feb 2011 08:43:00 +0200
kio-recoll (1.15.0-0~ppa1~SERIES1) SERIES; urgency=low
* Update to recoll version 1.15.0
-- Jean-Francois Dockes <jf@dockes.org> Wed, 02 Feb 2011 09:48:00 +0200
kio-recoll (1.14.3-0~ppa1~SERIES1) SERIES; urgency=low
* Update to recoll version 1.14.3
-- Jean-Francois Dockes <jf@dockes.org> Thu, 25 Nov 2010 10:25:00 +0200
kio-recoll (1.14.2-0~ppa1~SERIES1) SERIES; urgency=low
* Update to recoll version 1.14.2
-- Jean-Francois Dockes <jf@dockes.org> Sat, 25 Sep 2010 09:37:20 +0200
kio-recoll (1.13.01-0~ppa4~SERIES1) SERIES; urgency=low
* Update to recoll version 1.13.01
-- Jean-Francois Dockes <jf@dockes.org> Thu, 07 Jan 2010 11:26:00 +0100
kio-recoll (1.12.3-0~ppa4~jaunty1) jaunty; urgency=low
* Initial release
-- Jean-Francois Dockes <jf@dockes.org> Tue, 24 Nov 2009 08:55:00 +0100

View file

@ -0,0 +1 @@
7

View file

@ -0,0 +1,25 @@
Source: kio-recoll
Section: kde
Priority: extra
Maintainer: Jean-Francois Dockes <jfd@recoll.org>
Build-Depends: cdbs, cmake, debhelper (>= 7), kdelibs5-dev (>= 4:4.2.2), pkg-kde-tools (>= 0.4.0), libxapian-dev, libz-dev
Standards-Version: 3.9.5
Homepage: http://www.recoll.org/
Package: kio-recoll
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, recoll
Description: A Recoll KIO slave for KDE 4
A Recoll KIO slave for KDE 4, allows performing a Recoll search by
entering an appropriate URL in a KDE open dialog, or with an HTML-based
interface displayed in Konqueror.
The HTML-based interface is similar to the Recoll GUI QT-based interface,
slightly less powerful. It allows performing a search while staying fully
within the KDE framework: drag and drop from the result list works
normally and you have your normal choice of applications for opening files.
An alternative interface uses a directory view of search results. Due to
limitations in the current KIO slave interface, it is currently not
obviously useful.
The interface is described in more detail inside a help file which you can
access by entering recoll:/ inside the konqueror URL line (this works only
if the recoll KIO slave has been previously installed).

View file

@ -0,0 +1,113 @@
This package was debianized by Jean-Francois Dockes <jfd@recoll.org> on
Wed, 10 Jan 2007 16:04:13 +0100.
It was downloaded from http://www.recoll.org
Upstream Author: Jean-Francois Dockes <jfd@recoll.org>
Copyright: (C) 2005,2006, Jean-Francois Dockes <jfd@recoll.org>
License:
This package 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 package 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 package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
The Debian packaging is (C) 2007, Jean-Francois Dockes <jfd@recoll.org> and
is licensed under the GPL, see above.
Portions of the software are:
Copyright (C) 2001-2002 by Kevin Atkinson under the GNU LGPL:
/* This file is part of The New Aspell
* Copyright (C) 2001-2002 by Kevin Atkinson under the GNU LGPL
* license version 2.0 or 2.1. You should have received a copy of the
* LGPL license along with this library if you did not you can find it
* at http://www.gnu.org/.
On Debian systems, the complete text of the GNU LGPL
can be found in `/usr/share/common-licenses/LGPL-2'.
Copyright 2002-2005 Andreas Aardal Hanssen
Copyright (C) 2000-2004 Mikio Hirabayashi
Copyright 1999,2000,2001 BrightStation PLC
Copyright 2001 Ananova Ltd
Copyright 2002 Olly Betts
Copyright (C) 2000, 2001, 2002 Loic Dachary <loic@senga.org>
- GPL V2 or later, same license text as above
Copyright (c) 1991-2004 Unicode, Inc.
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2006 Unicode, Inc. All rights reserved. Distributed under
the Terms of Use in http://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Unicode data files and any associated documentation (the "Data
Files") or Unicode software and any associated documentation (the
"Software") to deal in the Data Files or Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, and/or sell copies of the Data Files or Software, and
to permit persons to whom the Data Files or Software are furnished to do
so, provided that (a) the above copyright notice(s) and this permission
notice appear with all copies of the Data Files or Software, (b) both the
above copyright notice(s) and this permission notice appear in associated
documentation, and (c) there is clear notice in each modified Data File or
in the Software as well as in the documentation associated with the Data
File(s) or Software that the data or software has been modified.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in these Data Files or Software without prior written
authorization of the copyright holder.
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
/*
* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD5 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD5 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/

View file

@ -0,0 +1,2 @@
usr/lib/kde4
usr/share/kde4/services

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,6 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/pkg-kde-tools/makefiles/1/cdbs/kde.mk
DEB_SRCDIR = kde/kioslave/kio_recoll

View file

@ -0,0 +1,4 @@
version=3
http://www.recoll.org/download.html recoll-(.*)\.tar\.gz

View file

@ -0,0 +1,30 @@
recoll-lens (1.19.10.3543-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to release 1.19.10
-- Jean-Francois Dockes <jf@dockes.org> Sat, 23 Nov 2013 18:00:00 +0100
recoll-lens (1.19.2.3328-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to release 1.19.2, for consistency, same as 1.19.0 in fact
-- Jean-Francois Dockes <jf@dockes.org> Mon, 14 May 2013 08:22:00 +0100
recoll-lens (1.19.0.3315-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.19.0
-- Jean-Francois Dockes <jf@dockes.org> Sun, 12 May 2013 14:43:00 +0100
recoll-lens (1.18.1.2997-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.18.1
-- Jean-Francois Dockes <jf@dockes.org> Mon, 05 Nov 2012 13:31:00 +0100
recoll-lens (1.17.2.2697-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.17.1.2697 : display thumbnails when they exist
-- Jean-Francois Dockes <jf@dockes.org> Tue, 15 May 2012 13:51:00 +0200
recoll-lens (1.17.1.2654-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.17.1.2654 : display/open results for embedded files
-- Jean-Francois Dockes <jf@dockes.org> Tue, 27 Mar 2012 16:22:00 +0200
recoll-lens (1.17.0.2648-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.17.0.2648 : don't use app shortcut 'a'
-- Jean-Francois Dockes <jf@dockes.org> Mon, 26 Mar 2012 22:05:00 +0200
recoll-lens (1.17.0.2646-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated lens to vers. 1.17.0.2646 : Unity 5.0/Ubuntu 12.04 compatibility
-- Jean-Francois Dockes <jf@dockes.org> Sun, 25 Mar 2012 16:42:00 +0200
recoll-lens (1.17.0.2645-1~ppaPPAVERS~SERIES1) SERIES; urgency=low
* Updated package to recoll version 1.17.0
-- Jean-Francois Dockes <jf@dockes.org> Sun, 25 Mar 2012 16:42:00 +0200

View file

@ -0,0 +1 @@
5

View file

@ -0,0 +1,18 @@
Source: recoll-lens
Section: x11
Priority: optional
Maintainer: Jean-Francois Dockes <jfd@recoll.org>
Build-Depends: debhelper (>= 7),
autotools-dev,
recoll,
python-recoll,
python
Standards-Version: 3.9.3
Package: recoll-lens
Architecture: all
Depends: ${misc:Depends}, python, recoll, unity
Description:Unity Lens for searching the Recoll index.
Allows querying the Recoll index from the Unity Dash, optionally
filtering on file category.
Homepage: http://www.recoll.org

View file

@ -0,0 +1,20 @@
This package was debianized by Jean-Francois Dockes <jfd@recoll.org> on
Sun, 25 Mar 2012 16:31:00 +0200.
It was downloaded from http://www.recoll.org
Upstream Author: Jean-Francois Dockes <jfd@recoll.org>
Copyright: (C) 2012 Jean-Francois Dockes <jfd@recoll.org>
License: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
Debian packaging is (C) 2012, Jean-Francois Dockes, same license.
Derived from Original bliss apps lens by Mikkel Kamstrup Erlandsen:
Copyright 2011, Canonical Ltd
Authored by Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
Distribute under the terms of the GNU General Public License v3

View file

@ -0,0 +1 @@
README

View file

@ -0,0 +1,52 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
config.status: configure
dh_testdir
./configure --host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--mandir=\$${prefix}/share/man \
--prefix=/usr \
--sysconfdir=/etc
build: build-stamp
build-stamp: config.status
dh_testdir
$(MAKE)
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp config.log
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean Makefile
install:
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) prefix=$(CURDIR)/debian/recoll-lens/usr install
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs ChangeLog
dh_installdocs README
dh_python2
dh_link
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep
.PHONY: build clean binary-indep binary-arch binary install

View file

@ -0,0 +1,12 @@
# Example watch control file for uscan
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# See uscan(1) for format
# Compulsory line, this is a version 3 file
version=3
# Uncomment to examine a Webpage
# <Webpage URL> <string match>
http://www.recoll.org/download.html recoll-lens-(.*)\.tar\.gz

View file

@ -0,0 +1,10 @@
Package building file for Mac homebrew: http://brew.sh/
Install homebrew following the instructions on the home page, then copy
recoll.rb to /usr/local/Library/Formula/, then "brew install recoll" should
just work.
Also see: https://github.com/medoc92/homebrew/tree/recoll

View file

@ -0,0 +1,35 @@
require 'formula'
class Recoll < Formula
homepage 'http://www.recoll.org'
url 'http://www.recoll.org/recoll-1.19.11p1.tar.gz'
sha1 'f4259c21faff9f30882d0bf1e8f952c19ed9936b'
depends_on 'xapian'
depends_on 'qt'
def patches
DATA
end
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/recollindex", "-h"
end
end
__END__
--- a/configure.orig 2014-01-07 12:39:40.606718201 +0100
+++ b/configure 2014-01-07 12:39:58.574599715 +0100
@@ -5120,7 +5120,7 @@
# basically to enable using a Macbook for development
if test X$sys = XDarwin ; then
# The default is xcode
- QMAKE="${QMAKE} -spec macx-g++"
+ QMAKE="${QMAKE}"
fi
# Discriminate qt3/4. Qt3 qmake prints its version on stderr but we don't

View file

@ -0,0 +1,24 @@
To use/test the port out of the official macports tree:
- Edit sources.conf /opt/local/etc/macports/sources.conf, and insert a URL
pointing to your local repository before the rsync one:
file:///Users/dockes/projets/fulltext/recoll/packaging/macports
rsync://rsync.macports.org/release/ports [default]
(inserting before ensures it's used before the macports one)
- The port should live under category/portname (ie: textproc/
- After you create or update your Portfile, use the MacPorts portindex
command in the local repository's directory to create or update the index
of the ports in your local repository.
%% cd ~/path/to/macports
%% portindex
Once the local port is added to the PortIndex, it becomes available for
searching or installation as with any other Portfile in the MacPorts
tree
http://guide.macports.org/#development.local-repositories

View file

@ -0,0 +1,45 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 111989 2013-10-08 17:10:55Z ryandesign@macports.org $
PortSystem 1.0
PortGroup app 1.0
name recoll
version 1.19.11p1
categories textproc
platforms darwin
license GPL-2+
maintainers dockes.org:jf openmaintainer
description Desktop full text search
long_description Recoll is a desktop search tool based on Xapian
homepage http://www.recoll.org/
master_sites ${homepage}
checksums rmd160 de98039d80174a5da6e3cdbcc8b7bc0f4407e44a \
sha256 8d1d040b8de1f65f01bc0a56053a6df7677360031bf9a6779d3496ced4a61186
depends_lib port:xapian-core \
port:qt4-mac \
port:aspell \
port:libiconv \
port:zlib
depends_run port:antiword \
port:catdoc \
port:libxslt \
port:poppler \
port:unrtf \
port:unzip
patchfiles patch-sampleconf-mimeview.diff
configure.args --without-x \
--disable-x11mon
build.args CC=${configure.cc} CXX=${configure.cxx}
# g++-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
universal_variant no

View file

@ -0,0 +1,147 @@
--- sampleconf/mimeview 2013-09-30 18:45:06.000000000 +0200
+++ sampleconf/mimeview.mac 2013-09-30 18:45:06.000000000 +0200
@@ -2,7 +2,8 @@
## ##########################################
# External viewers, launched by the recoll GUI when you click on a result
-# 'edit' link
+# 'Open' link - MAC version
+# On the MAC, we use "open" for everything...
# Mime types which we should not uncompress if they are found gzipped or
# bzipped because the native viewer knows how to handle. These would be
@@ -16,20 +17,17 @@
# search string
# - For pages of CHM and EPUB documents where we can choose to open the
# parent document instead of a temporary html file.
-xallexcepts = application/pdf application/postscript application/x-dvi \
- text/html|gnuinfo text/html|chm text/html|epub \
- application/x-fsdirectory|parentopen inode/directory|parentopen
+#xallexcepts = application/pdf application/postscript application/x-dvi \
+# text/html|gnuinfo text/html|chm text/html|epub
[view]
# Pseudo entry used if the 'use desktop' preference is set in the GUI
-application/x-all = xdg-open %u
+application/x-all = open %f
application/epub+zip = ebook-viewer %f
-# Open the parent epub document for epub parts instead of opening them as
-# html documents. This is almost always what we want.
-text/html|epub = ebook-viewer %F;ignoreipath=1
-
-application/x-gnote = gnote %f
+# If you want to open the parent epub document for epub parts instead of
+# opening them as html documents:
+#text/html|epub = ebook-viewer %F;ignoreipath=1
application/x-mobipocket-ebook = ebook-viewer %f
@@ -76,13 +74,9 @@
application/vnd.wordperfect = libreoffice %f
text/rtf = libreoffice %f
+application/x-chm = kchmviewer %f
application/x-dia-diagram = dia %f
-
application/x-fsdirectory = dolphin %f
-inode/directory = dolphin %f
-application/x-fsdirectory|parentopen = dolphin --select %(childurl) %f
-inode/directory|parentopen = dolphin --select %(childurl) %f
-
application/x-gnuinfo = xterm -e "info -f %f"
application/x-gnumeric = gnumeric %f
@@ -102,11 +96,6 @@
image/x-ms-bmp = gwenview %f
image/x-xpmi = gwenview %f
-# Opening mail messages not always works.
-# - Thunderbird will only open a single-message file if it has an .emf
-# extension
-# - "sylpheed %f" seems to work ok as of version 3.3
-# - "kmail --view %u" works
message/rfc822 = thunderbird -file %f
text/x-mail = thunderbird -file %f
application/x-mimehtml = thunderbird -file %f
@@ -119,11 +108,11 @@
application/x-tar = ark %f
application/zip = ark %f
-application/x-awk = emacsclient --no-wait %f
-application/x-perl = emacsclient --no-wait %f
-text/x-perl = emacsclient --no-wait %f
-application/x-shellscript = emacsclient --no-wait %f
-text/x-shellscript = emacsclient --no-wait %f
+application/x-awk = emacsclient %f
+application/x-perl = emacsclient %f
+text/x-perl = emacsclient %f
+application/x-shellscript = emacsclient %f
+text/x-shellscript = emacsclient %f
# Or firefox -remote "openFile(%u)"
text/html = firefox %u
@@ -135,41 +124,39 @@
application/x-webarchive = konqueror %f
text/x-fictionbook = ebook-viewer %f
-application/x-tex = emacsclient --no-wait %f
-application/xml = emacsclient --no-wait %f
-text/xml = emacsclient --no-wait %f
-text/x-tex = emacsclient --no-wait %f
-text/plain = emacsclient --no-wait %f
-text/x-awk = emacsclient --no-wait %f
-text/x-c = emacsclient --no-wait %f
-text/x-c+ = emacsclient --no-wait %f
-text/x-c++ = emacsclient --no-wait %f
+application/x-tex = emacsclient %f
+application/xml = emacsclient %f
+text/xml = emacsclient %f
+text/x-tex = emacsclient %f
+text/plain = emacsclient %f
+text/x-awk = emacsclient %f
+text/x-c = emacsclient %f
+text/x-c+ = emacsclient %f
+text/x-c++ = emacsclient %f
text/x-csv = libreoffice %f
text/x-html-sidux-man = konqueror %f
text/x-html-aptosid-man = iceweasel %f
-application/x-chm = kchmviewer %f
# Html pages inside a chm have a chm rclaptg set by the filter. Kchmviewer
# knows how to use the ipath (which is the internal chm path) to open the
# file at the right place
text/html|chm = kchmviewer --url %i %F
-text/x-ini = emacsclient --no-wait %f
+text/x-ini = emacsclient %f
text/x-man = xterm -u8 -e "groff -T ascii -man %f | more"
text/x-python = idle %f
-text/x-gaim-log = emacsclient --no-wait %f
-text/x-purple-html-log = emacsclient --no-wait %f
-text/x-purple-log = emacsclient --no-wait %f
+text/x-gaim-log = emacsclient %f
+text/x-purple-html-log = emacsclient %f
+text/x-purple-log = emacsclient %f
# The video types will usually be handled by the desktop default, but they
# need entries here to get an "Open" link
-video/3gpp = vlc %f
-video/mp2p = vlc %f
-video/mp2t = vlc %f
-video/mp4 = vlc %f
-video/mpeg = vlc %f
-video/quicktime = vlc %f
-video/x-matroska = vlc %f
-video/x-ms-asf = vlc %f
-video/x-msvideo = vlc %f
-
+video/3gpp = open %f
+video/mp2p = open %f
+video/mp2t = open %f
+video/mp4 = open %f
+video/mpeg = open %f
+video/quicktime = open %f
+video/x-matroska = open %f
+video/x-ms-asf = open %f
+video/x-msvideo = open %f

View file

@ -0,0 +1,77 @@
%define name kio_recoll
%define version 1.17.0
%define release 0
Name: %{name}
Version: %{version}
Release: %{release}
Summary: KIO slave for the Recoll full text search tool
Source0: http://www.recoll.org/recoll-%{version}.tar.gz
URL: http://www.recoll.org/
Group: Applications/Databases
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
License: GPL
BuildRequires: libkde4-devel zlib-devel xapian-core-devel libuuid-devel
Requires: recoll
%description
Recoll is a personal full text search package for Linux, FreeBSD and
other Unix systems. It is based on a very strong backend (Xapian), for
which it provides an easy to use, feature-rich, easy administration
interface.
# ---------------------------------------------------------------------------
%prep
%setup -q -n recoll-%{version}
# ---------------------------------------------------------------------------
%build
%cmake_kde4 kde/kioslave/kio_recoll
pwd
make %{?_smp_mflags}
# ---------------------------------------------------------------------------
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
# ---------------------------------------------------------------------------
%clean
rm -rf $RPM_BUILD_ROOT
# ---------------------------------------------------------------------------
%files
%defattr(-,root,root,-)
%{_libdir}/kde4/kio_recoll.so
%{_datadir}/kde4/apps/kio_recoll
%{_datadir}/kde4/apps/kio_recoll/help.html
%{_datadir}/kde4/apps/kio_recoll/welcome.html
%{_datadir}/kde4/services/recoll.protocol
%{_datadir}/kde4/services/recollf.protocol
%if 0%{?suse_version} > 1120
%dir %{_datadir}/kde4/apps
%dir %{_datadir}/kde4/services
%dir %{_libdir}/kde4
%endif
# ---------------------------------------------------------------------------
%changelog
* Sun Mar 18 2012 Jean-Francois Dockes <jfd@recoll.org> 1.17.0-0
- 1.17.0
* Mon May 02 2011 Jean-Francois Dockes <jfd@recoll.org> 1.16.2-0
- 1.16.2
* Mon May 02 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.8-0
- 1.15.8
* Sun Mar 06 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.5-0
- Initial spec file for kio

View file

@ -0,0 +1,75 @@
Name: recoll
Version: 1.19.9
Release: %mkrel 1
Summary: Desktop full text search tool with a Qt GUI
URL: http://www.lesbonscomptes.com/recoll/
Group: Databases
License: GPLv2
Source0: http://www.lesbonscomptes.com/recoll/%{name}-%{version}.tar.gz
BuildRequires: xapian-devel
BuildRequires: pkgconfig(QtCore)
BuildRequires: pkgconfig(QtWebKit)
Requires: xapian
%description
Recoll is a personal full text search package for Linux, FreeBSD and
other Unix systems. It is based on a very strong backend (Xapian), for
which it provides an easy to use, feature-rich, easy administration
interface.
%package -n kio-%{name}
Summary: Kioslave for %{name}
Group: Graphical desktop/KDE
BuildRequires: cmake
BuildRequires: kdelibs4-devel
Requires: %{name} = %{version}-%{release}
Requires: kdebase4-workspace
%description -n kio-%{name}
Kioslave for %{name}. Enables to perform querries and extract
results in konqueror and dolphin.
%prep
%setup -q
%build
%configure2_5x --disable-python-module
%make
%install
%makeinstall_std
rm lib/librecoll.so*
pushd kde/kioslave/kio_recoll
%cmake_kde4
%make
%makeinstall_std
popd
%files
%doc README
%{_bindir}/*
%{_datadir}/applications/recoll-searchgui.desktop
%{_datadir}/icons/hicolor/48x48/apps/recoll.png
%{_datadir}/pixmaps/recoll.png
%{_datadir}/%{name}
%{_mandir}/man1/recoll*
%{_mandir}/man5/recoll*
%{_kde_libdir}/%name/librecoll.so.%version
%files -n kio-%{name}
%{_kde_libdir}/kde4/kio_recoll.so
%{_kde_datadir}/apps/kio_recoll/help.html
%{_kde_datadir}/apps/kio_recoll/welcome.html
%{_kde_datadir}/kde4/services/recoll.protocol
%{_kde_datadir}/kde4/services/recollf.protocol

136
packaging/rpm/recoll.spec Normal file
View file

@ -0,0 +1,136 @@
%define name recoll
%define version 3152
%define release 0
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Desktop Full Text Search Tool with a QT Gui
Source0: http://www.recoll.org/%{name}-%{version}.tar.gz
URL: http://www.recoll.org/
Group: Applications/Databases
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
License: GPL
# libxapian-devel or xapian-core-devel?
BuildRequires: libqt4-devel zlib-devel libxapian-devel libuuid-devel python-devel
%description
Recoll is a personal full text search package for Linux, FreeBSD and
other Unix systems. It is based on a very strong backend (Xapian), for
which it provides an easy to use, feature-rich, easy administration
interface.
# ---------------------------------------------------------------------------
%prep
%setup -q
# ---------------------------------------------------------------------------
%build
%configure
make %{?_smp_mflags}
# ---------------------------------------------------------------------------
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
%{__chmod} 0755 $RPM_BUILD_ROOT/%{_libdir}/%{name}/lib%{name}.so.%{version}
# ---------------------------------------------------------------------------
%clean
rm -rf $RPM_BUILD_ROOT
# ---------------------------------------------------------------------------
%files
%defattr(-,root,root,-)
%{_bindir}/*
%{python_sitearch}/
%{_libdir}/%{name}
%{_libdir}/%{name}/lib%{name}.so.%{version}
%{_datadir}/%{name}
%{_datadir}/applications/recoll-searchgui.desktop
%{_datadir}/icons/hicolor/48x48/apps/recoll.png
%{_datadir}/pixmaps/recoll.png
%{_mandir}/man1/recoll*
%{_mandir}/man5/recoll*
%if 0%{?suse_version} > 1120
%dir %{_datadir}/applications
%dir %{_datadir}/pixmaps
%endif
%dir %{_datadir}/icons/hicolor/48x48/apps
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor
# ---------------------------------------------------------------------------
%changelog
* Thu May 17 2012 Jean-Francois Dockes <jfd@recoll.org> 1.17.2-0
- Update to release 1.17.2
* Sun Mar 18 2012 Jean-Francois Dockes <jfd@recoll.org> 1.17.0-0
- Update to release 1.17.0
* Mon Nov 07 2011 Jean-Francois Dockes <jfd@recoll.org> 1.16.2-0
- Update to release 1.16.2
* Mon May 02 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.8-0
- Update to release 1.15.8
* Fri Mar 04 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.5-0
- Update to release 1.15.2
* Thu Feb 15 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.2-0
- Update to release 1.15.2
* Thu Feb 2 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.0-0
- Update to release 1.15.0
* Thu Oct 28 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.3-1
- Update to release 1.14.3
* Thu Oct 28 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.2-1
- Rebuilt with a Xapian built with --disable-sse
* Sat Sep 24 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.2-0
- Update to release 1.14.2
* Thu Apr 14 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.04-1
- Update to release 1.13.04
* Thu Jan 07 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.01-1
- Update to release 1.13.01
* Thu Dec 10 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.4-1
- Update to release 1.12.4
* Wed Oct 28 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.3-1
- Update to release 1.12.3
* Tue Sep 20 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.2-1
- Update to release 1.12.0
* Thu Jan 29 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.0-1
- Update to release 1.12.0
* Mon Oct 13 2008 Jean-Francois Dockes <jfd@recoll.org> 1.11.0-1
- Update to release 1.11.0
* Thu Sep 11 2008 Jean-Francois Dockes <jfd@recoll.org> 1.10.6-1
- Update to release 1.10.6
* Thu May 27 2008 Jean-Francois Dockes <jfd@recoll.org> 1.10.2-1
- Update to release 1.10.2
* Thu Jan 31 2008 Jean-Francois Dockes <jfd@recoll.org> 1.10.1-1
- Update to release 1.10.1
* Wed Nov 21 2007 Jean-Francois Dockes <jfd@recoll.org> 1.10.0-1
- Update to release 1.10.0
* Tue Sep 11 2007 Jean-Francois Dockes <jfd@recoll.org> 1.9.0-1
- Update to release 1.9.0
* Tue Mar 6 2007 Jean-Francois Dockes <jfd@recoll.org> 1.8.1-1
- Update to release 1.8.1
* Mon Jan 15 2007 Jean-Francois Dockes <jfd@recoll.org> 1.7.5-1
- Update to release 1.7.5
* Mon Jan 08 2007 Jean-Francois Dockes <jfd@recoll.org> 1.7.3-1
- Update to release 1.7.3
* Tue Nov 28 2006 Jean-Francois Dockes <jfd@recoll.org> 1.6.1-1
- Update to release 1.6.1
* Mon Oct 2 2006 Jean-Francois Dockes <jfd@recoll.org> 1.4.3-1
- Update to release 1.5.3
* Sun May 7 2006 Jean-Francois Dockes <jfd@recoll.org> 1.4.3-1
- Update to release 1.4.3
* Fri Mar 31 2006 Jean-Francois Dockes <jfd@recoll.org> 1.3.3-1
- Update to release 1.3.3
* Thu Feb 2 2006 Jean-Francois Dockes <jfd@recoll.org> 1.2.2-1
- Update to release 1.2.2
* Thu Jan 10 2006 Jean-Francois Dockes <jfd@recoll.org> 1.1.0-1
- Initial packaging

View file

@ -0,0 +1,88 @@
Summary: Desktop full text search tool with a qt gui
Name: recoll
Version: 1.12.0
Release: %mkrel 1
License: GPL
Group: Databases
URL: http://www.recoll.org/
Source0: http://www.lesbonscomptes.com/recoll/%{name}-%{version}.tar.bz2
Patch1: %{name}-configure.patch
BuildRequires: libxapian-devel
BuildRequires: libfam-devel
BuildRequires: libqt-devel >= 3.3.7
BuildRequires: libaspell-devel
Requires: xapian
BuildRoot: %{_tmppath}/%{name}-%{version}--buildroot
%description
Recoll is a personal full text search tool for Unix/Linux.
It is based on the very strong Xapian backend, for which
it provides an easy to use, feature-rich, easy administration,
QT graphical interface.
%prep
%setup -q
%patch1 -p0
%build
%configure2_5x \
--with-fam \
--with-aspell
%make
%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%makeinstall_std
desktop-file-install --vendor="" \
--add-category="X-MandrivaLinux-MoreApplications-Databases" \
--dir %{buildroot}%{_datadir}/applications %{buildroot}%{_datadir}/applications/*
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(644,root,root,755)
%doc %{_datadir}/%{name}/doc
%attr(755,root,root) %{_bindir}/%{name}*
%{_datadir}/applications/recoll-searchgui.desktop
%{_datadir}/icons/hicolor/48x48/apps/recoll-searchgui.png
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/examples
%dir %{_datadir}/%{name}/filters
%dir %{_datadir}/%{name}/images
%dir %{_datadir}/%{name}/translations
%{_datadir}/%{name}/examples/mime*
%{_datadir}/%{name}/examples/*.conf
%attr(755,root,root) %{_datadir}/%{name}/examples/rclmon.sh
%attr(755,root,root) %{_datadir}/%{name}/filters/rc*
%{_datadir}/%{name}/filters/xdg-open
%{_datadir}/%{name}/images/*png
%{_mandir}/man1/recoll*
%{_mandir}/man5/recoll*
%{_datadir}/%{name}/translations/*.qm
%changelog
* Fri Apr 20 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.12.1-1mdv2008.0
+ Revision: 16093
- new version
- drop P0
+ Mandriva <devel@mandriva.com>
* Tue Mar 06 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.7.5-2mdv2007.0
+ Revision: 134128
- rebuild
* Tue Jan 30 2007 Tomasz Pawel Gajc <tpg@mandriva.org> 1.7.5-1mdv2007.1
+ Revision: 115423
- add patch 1 - fix build on x86_64
- add patch 0 - fix menu entry
- fix group
- add buildrequires
- set correct bits on files
- Import recoll

View file

@ -0,0 +1,221 @@
Summary: Desktop full text search tool with Qt GUI
Name: recoll
Version: 1.20.1
Release: 1%{?dist}
Group: Applications/Databases
License: GPLv2+
URL: http://www.lesbonscomptes.com/recoll/
Source0: http://www.lesbonscomptes.com/recoll/recoll-%{version}.tar.gz
BuildRequires: qt-devel
BuildRequires: qtwebkit-devel
BuildRequires: python-devel
BuildRequires: zlib-devel
BuildRequires: aspell-devel
BuildRequires: xapian-core-devel
BuildRequires: desktop-file-utils
Requires: xdg-utils
%description
Recoll is a personal full text search package for Linux, FreeBSD and
other Unix systems. It is based on a very strong back end (Xapian), for
which it provides an easy to use, feature-rich, easy administration
interface.
%global __provides_exclude_from ^%{_libdir}/recoll/librecoll\\.so.*$
%global __requires_exclude ^librecoll\\.so.*$
%prep
%setup -q -n %{name}-%{version}
chmod 0644 utils/{conftree.cpp,conftree.h,debuglog.cpp,debuglog.h}
%build
export QMAKE=qmake-qt4
%configure
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} STRIP=/bin/true INSTALL='install -p'
desktop-file-install --delete-original \
--dir=%{buildroot}/%{_datadir}/applications \
%{buildroot}/%{_datadir}/applications/%{name}-searchgui.desktop
# use /usr/bin/xdg-open
rm -f %{buildroot}/usr/share/recoll/filters/xdg-open
# fix perms
chmod 0755 %{buildroot}/usr/share/recoll/filters/rclexecm.py
chmod 0755 %{buildroot}%{_libdir}/recoll/librecoll.so.*
%post
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
if [ -x %{_bindir}/update-desktop-database ] ; then
%{_bindir}/update-desktop-database &> /dev/null
fi
exit 0
%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
if [ -x %{_bindir}/update-desktop-database ] ; then
%{_bindir}/update-desktop-database &> /dev/null
fi
exit 0
%files
%doc COPYING ChangeLog README
%{_bindir}/%{name}
%{_bindir}/%{name}index
%{_datadir}/%{name}
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}-searchgui.desktop
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/pixmaps/%{name}.png
%{_libdir}/recoll
%{python_sitearch}/recoll
%{python_sitearch}/Recoll*.egg-info
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/recollq.1*
%{_mandir}/man1/%{name}index.1*
%{_mandir}/man5/%{name}.conf.5*
%changelog
* Fri Dec 19 2014 Jean-Francois Dockes <jf@dockes.org> - 1.20.1-1
- 1.20.1
* Sun Nov 09 2014 Jean-Francois Dockes <jf@dockes.org> - 1.19.14p2-1
- 1.19.14p2
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.19.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.19.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue May 06 2014 Terje Rosten <terje.rosten@ntnu.no> - 1.19.13-1
- 1.19.13
* Mon Jan 20 2014 Terje Rosten <terje.rosten@ntnu.no> - 1.19.11-1
- 1.19.11
* Mon Nov 11 2013 Terje Rosten <terje.rosten@ntnu.no> - 1.19.9-1
- 1.19.9
* Tue Nov 05 2013 Terje Rosten <terje.rosten@ntnu.no> - 1.19.8-1
- 1.19.8
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.19.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Jun 12 2013 Terje Rosten <terje.rosten@ntnu.no> - 1.19.4-2
- Fix filter setup
* Mon Jun 10 2013 Terje Rosten <terje.rosten@ntnu.no> - 1.19.4-1
- 1.19.4
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.18.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Nov 19 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.18.1-1
- 1.18.1
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.17.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed May 30 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.17.3-1
- 1.17.3
* Sat Mar 31 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.17.1-1
- 1.17.1
* Sun Mar 25 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.17-1
- 1.17
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.16.2-3
- Rebuilt for c++ ABI breakage
* Wed Feb 15 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.16.2-2
- Add patch to build with gcc 4.7
* Wed Feb 01 2012 Terje Rosten <terje.rosten@ntnu.no> - 1.16.2-1
- 1.16.2
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.16.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Oct 24 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.16.1-2
- Add patch to fix crash (bz #747472)
* Tue Oct 18 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.16.1-1
- 1.16.1
* Tue May 24 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.15.8-2
- add patch from upstream to fix crash.
* Sun May 08 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.15.8-1
- 1.15.8
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.14.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Jan 28 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.14.4-1
- 1.14.4
* Mon Nov 15 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.14.2-2
- Add patch to fix #631704
* Sun Nov 7 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.14.2-1
- 1.14.2
* Thu Jul 15 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.13.04-6
- add patch to build with xapian 1.2 (from J.F. Dockes, thanks)
* Sat Jul 10 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.13.04-5
- use system xdg-open
- trim chagenlog
* Fri Jul 9 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.13.04-4
- fix some review comments
* Mon May 10 2010 Terje Rosten <terje.rosten@ntnu.no> - 1.13.04-3
- use version macro in source url
- don't strip bins, giving non empty debuginfo package
- more explicit file listing
- try to preserve timestamps
- use proper name for spec file
- fix changelog
- license seems to be GPLv2+
- include some %%doc files
- add buildroot tag
- some source add execute bit set
- explicit enable inotify
- add aspell-devel to bulldreq
- make with _smp_mflags seems to work
- add post scripts
- add patch to build gui with correct flags (ref: 338791)
* Sun May 9 2010 J.F. Dockes <jfd@recoll.org> 1.13.04-2
- bumped the release number to issue new rpms for fc10
* Sun May 9 2010 J.F. Dockes 1.13.04
- updated to recoll release 1.13.04
* Fri Feb 12 2010 Terry Duell 1.13.02
- updated to release 1.13.02
* Tue Jan 12 2010 Terry Duell 1.13.01-3
- updated to fix Fedora desktop-file-install and install icon
* Sun Jan 10 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.01-2
- updated for recent fedoras: depend on xapian packages, use qt4
* Thu Jan 07 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.01-1
- update to release 1.13.01
* Wed Feb 1 2006 Jean-Francois Dockes <jfd@recoll.org> 1.2.0-1
- initial packaging

View file

@ -0,0 +1,130 @@
%define name recoll
%define version 1.18.1
%define release %mkrel 1
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Desktop full text search tool with a qt gui
Source0: http://www.recoll.org/%{name}-%{version}.tar.gz
URL: http://www.recoll.org/
Group: Applications/Databases
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
License: GPL
BuildRequires: libqt4-devel
BuildRequires: libqtwebkit2.2-devel
BuildRequires: libpython-devel
BuildRequires: libxapian-devel
%description
Recoll is a personal full text search package for Linux, FreeBSD and
other Unix systems. It is based on a very strong backend (Xapian), for
which it provides an easy to use, feature-rich, easy administration
interface.
# ---------------------------------------------------------------------------
%prep
%setup -q
# ---------------------------------------------------------------------------
%build
[ -n "$QTDIR" ] || . %{_sysconfdir}/profile.d/60qt4.sh
%configure
make %{?_smp_mflags}
# ---------------------------------------------------------------------------
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
# ---------------------------------------------------------------------------
%clean
rm -rf $RPM_BUILD_ROOT
# ---------------------------------------------------------------------------
%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_datadir}/applications/recoll-searchgui.desktop
%{_datadir}/icons/hicolor/48x48/apps/recoll.png
%{_datadir}/pixmaps/recoll.png
%{_datadir}/%{name}
%{_mandir}/man1/recoll*
%{_mandir}/man5/recoll*
%{python_sitearch}/Recoll*.egg-info
%{python_sitearch}/recoll.so
# ---------------------------------------------------------------------------
%changelog
* Mon Nov 05 2012 Jean-Francois Dockes <jfd@recoll.org> 1.18.1-1
- Update to release 1.18.1
* Thu May 17 2012 Jean-Francois Dockes <jfd@recoll.org> 1.17.2-1
- Update to release 1.17.2
* Mon Nov 07 2011 Jean-Francois Dockes <jfd@recoll.org> 1.16.2-1
- Update to release 1.16.2
* Wed Sep 28 2011 Jean-Francois Dockes <jfd@recoll.org> 1.16.1-1
- Update to release 1.16.1
* Wed Sep 21 2011 Jean-Francois Dockes <jfd@recoll.org> 1.16.0-1
- Update to release 1.16.0
* Tue May 03 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.8-1
- Update to release 1.15.8
* Fri Mar 04 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.5-1
- Update to release 1.15.5
* Thu Feb 15 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.2-1
- Update to release 1.15.2
* Wed Feb 02 2011 Jean-Francois Dockes <jfd@recoll.org> 1.15.0-1
- Update to release 1.15.0
* Thu Nov 25 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.3-1
- Update to release 1.14.2
* Sat Sep 24 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.2-1
- Update to release 1.14.2
* Mon Sep 13 2010 Jean-Francois Dockes <jfd@recoll.org> 1.14.0-1
- Update to release 1.14.0
* Thu Apr 14 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.04-1
- Update to release 1.13.01
* Thu Jan 07 2010 Jean-Francois Dockes <jfd@recoll.org> 1.13.01-1
- Update to release 1.13.01
* Thu Dec 10 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.4-1
- Update to release 1.12.2
* Mon Oct 19 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.2-1
- Update to release 1.12.2
* Thu Jan 29 2009 Jean-Francois Dockes <jfd@recoll.org> 1.12.0-1
- Update to release 1.12.0
* Mon Oct 13 2008 Jean-Francois Dockes <jfd@recoll.org> 1.11.0-1
- Update to release 1.11.0
* Thu May 27 2008 Jean-Francois Dockes <jfd@recoll.org> 1.10.2-1
- Update to release 1.10.2
* Thu Jan 31 2008 Jean-Francois Dockes <jfd@recoll.org> 1.10.1-1
- Update to release 1.10.1
* Wed Nov 21 2007 Jean-Francois Dockes <jfd@recoll.org> 1.10.0-1
- Update to release 1.10.0
* Tue Sep 11 2007 Jean-Francois Dockes <jfd@recoll.org> 1.9.0-1
- Update to release 1.9.0
* Tue Mar 6 2007 Jean-Francois Dockes <jfd@recoll.org> 1.8.1-1
- Update to release 1.8.1
* Mon Jan 15 2007 Jean-Francois Dockes <jfd@recoll.org> 1.7.5-1
- Update to release 1.7.5
* Mon Jan 08 2007 Jean-Francois Dockes <jfd@recoll.org> 1.7.3-1
- Update to release 1.7.3
* Tue Nov 28 2006 Jean-Francois Dockes <jfd@recoll.org> 1.6.1-1
- Update to release 1.6.1
* Mon Nov 20 2006 Jean-Francois Dockes <jfd@recoll.org> 1.5.11-1
- Update to release 1.5.11
* Mon Oct 2 2006 Jean-Francois Dockes <jfd@recoll.org> 1.5.2-1
- Update to release 1.5.2
* Sun May 7 2006 Jean-Francois Dockes <jfd@recoll.org> 1.4.3-1
- Update to release 1.4.3
* Fri Mar 31 2006 Jean-Francois Dockes <jfd@recoll.org> 1.3.3-1
- Update to release 1.3.3
* Thu Feb 2 2006 Jean-Francois Dockes <jfd@recoll.org> 1.2.2-1
- Update to release 1.2.2
* Thu Jan 10 2006 Jean-Francois Dockes <jfd@recoll.org> 1.1.0-1
- Initial packaging

340
src/COPYING Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.

10552
src/ChangeLog Normal file

File diff suppressed because it is too large Load diff

1293
src/INSTALL Normal file

File diff suppressed because it is too large Load diff

92
src/Makefile.in Normal file
View file

@ -0,0 +1,92 @@
# Copyright (C) 2005 J.F.Dockes
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
datadir = @datadir@
datarootdir = @datarootdir@
mandir = @mandir@
QMAKE = @QMAKE@
QTGUI = @QTGUI@
RCLLIBVERSION=@RCLLIBVERSION@
all: configure mk/sysconf
${MAKE} -C query wasaparse.tab.cpp
(cd lib; sh mkMake)
${MAKE} -C lib
${MAKE} -C index depend recollindex
@NOQTMAKE@(cd $(QTGUI); ${QMAKE} recoll.pro)
@NOQTMAKE@${MAKE} -C $(QTGUI) LFLAGS="$(LDFLAGS)" depth=.. prefix=$(prefix) exec_prefix=$(exec_prefix) libdir=$(libdir)
@NOPYTHON@${MAKE} -C python/recoll libdir=$(libdir)
${MAKE} -C query recollq xadump
mk/sysconf:
@echo "You need to run configure first" ; exit 1
static: mk/sysconf
${MAKE} -C lib
rm -f index/recollindex
${MAKE} -C index BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic \
LIBXAPIANSTATICEXTRA="@LIBXAPIANSTATICEXTRA@" \
recollindex
@NOQTMAKE@(cd $(QTGUI); $(QMAKE) recoll.pro)
@NOQTMAKE@rm -f $(QTGUI)/recoll
@NOQTMAKE@${MAKE} -C $(QTGUI) BSTATIC=-Wl,-Bstatic \
@NOQTMAKE@ BDYNAMIC=-Wl,-Bdynamic depth=.. \
@NOQTMAKE@ LIBXAPIANSTATICEXTRA="@LIBXAPIANSTATICEXTRA@"
clean:
${MAKE} -C common clean
${MAKE} -C index clean
${MAKE} -C internfile clean
${MAKE} -C query clean
${MAKE} -C utils clean
-${MAKE} -C lib clean
-${MAKE} -C python/recoll clean
@NOQTMAKE@@-${MAKE} -C $(QTGUI) clean
rm -f qtgui/Makefile qtgui/confgui/Makefile qtgui/recoll
rm -f filters/rclexecm.pyc
rm -rf qtgui/.moc qtgui/.ui qtgui/confgui/.moc qtgui/confgui/.ui
rm -rf qtgui/.obj qtgui/.moc qtgui/.ui
rm -rf python/recoll/build
rm -rf php/recoll/build php/recoll/include php/recoll/modules
rm -rf $(QTGUI)/recoll.app
# Note: we don't remove the top Makefile, to keep the "clean" targets
# available but a "Make" won't work without a configure anyway
distclean: clean
${MAKE} -C query distclean
-${MAKE} -C python/recoll distclean
rm -f mk/sysconf mk/localdefs sampleconf/recoll.conf \
qtgui/recoll.pro \
config.log config.status \
recollinstall \
lib/*.dep lib/mkMake lib/Makefile common/autoconfig.h
rm -f common/rclversion.h
rm -f index/alldeps lib/alldeps query/alldeps \
bincimapmime/alldeps common/alldeps internfile/alldeps utils/alldeps
rm -rf autom4te.cache
maintainer-clean: distclean
rm -f doc/user/*.html* doc/user/*.txt doc/user/HTML.manifest
rm -f qtgui/i18n/*.qm
# recollinstall can be executed by the user and will compute 'normal'
# values for bindir etc., relative to the prefix argument. When executed
# here, we pass a bunch of variables in the environment, the values will
# override the computed defaults.
install: all
DESTDIR=${DESTDIR} bindir=${bindir} datadir=${datadir} \
libdir=${libdir} mandir=${mandir} \
/bin/sh ./recollinstall ${prefix}
configure: VERSION configure.ac
rm -f configure
autoconf
@echo run configure and make again
exit 1
.PHONY: all static clean distclean install

4480
src/README Normal file

File diff suppressed because it is too large Load diff

1
src/VERSION Normal file
View file

@ -0,0 +1 @@
1.21.0

19
src/aspell/Makefile Normal file
View file

@ -0,0 +1,19 @@
depth = ..
include $(depth)/mk/sysconf
PROGS = rclaspell
SRCS = rclaspell.cpp
all: depend $(PROGS) librecoll
RCLASPELL_OBJS= trrclaspell.o
rclaspell : $(RCLASPELL_OBJS)
$(CXX) $(ALL_CXXFLAGS) -o rclaspell $(RCLASPELL_OBJS) \
$(LIBRECOLL) $(LIBXAPIAN) $(LIBICONV)
trrclaspell.o : rclaspell.cpp
$(CXX) $(ALL_CXXFLAGS) -DTEST_RCLASPELL -c -o trrclaspell.o \
rclaspell.cpp
include $(depth)/mk/commontargets
include alldeps

729
src/aspell/aspell-local.h Normal file
View file

@ -0,0 +1,729 @@
/* Automatically generated file. Do not edit directly. */
/* This file is part of The New Aspell
* Copyright (C) 2001-2002 by Kevin Atkinson under the GNU LGPL
* license version 2.0 or 2.1. You should have received a copy of the
* LGPL license along with this library if you did not you can find it
* at http://www.gnu.org/. */
#ifndef ASPELL_ASPELL__H
#define ASPELL_ASPELL__H
#ifdef __cplusplus
extern "C" {
#endif
/******************************* type id *******************************/
union AspellTypeId {
unsigned int num;
char str[4];
};
typedef union AspellTypeId AspellTypeId;
/************************** mutable container **************************/
typedef struct AspellMutableContainer AspellMutableContainer;
int aspell_mutable_container_add(struct AspellMutableContainer * ths, const char * to_add);
int aspell_mutable_container_remove(struct AspellMutableContainer * ths, const char * to_rem);
void aspell_mutable_container_clear(struct AspellMutableContainer * ths);
struct AspellMutableContainer * aspell_mutable_container_to_mutable_container(struct AspellMutableContainer * ths);
/******************************* key info *******************************/
enum AspellKeyInfoType {AspellKeyInfoString, AspellKeyInfoInt, AspellKeyInfoBool, AspellKeyInfoList};
typedef enum AspellKeyInfoType AspellKeyInfoType;
struct AspellKeyInfo {
/* The name of the key. */
const char * name;
/* The key type. */
enum AspellKeyInfoType type;
/* The default value of the key. */
const char * def;
/* A brief description of the key or NULL if internal value. */
const char * desc;
int flags;
int other_data;
};
typedef struct AspellKeyInfo AspellKeyInfo;
/******************************** config ********************************/
typedef struct AspellKeyInfoEnumeration AspellKeyInfoEnumeration;
int aspell_key_info_enumeration_at_end(const struct AspellKeyInfoEnumeration * ths);
const struct AspellKeyInfo * aspell_key_info_enumeration_next(struct AspellKeyInfoEnumeration * ths);
void delete_aspell_key_info_enumeration(struct AspellKeyInfoEnumeration * ths);
struct AspellKeyInfoEnumeration * aspell_key_info_enumeration_clone(const struct AspellKeyInfoEnumeration * ths);
void aspell_key_info_enumeration_assign(struct AspellKeyInfoEnumeration * ths, const struct AspellKeyInfoEnumeration * other);
typedef struct AspellConfig AspellConfig;
struct AspellConfig * new_aspell_config();
void delete_aspell_config(struct AspellConfig * ths);
struct AspellConfig * aspell_config_clone(const struct AspellConfig * ths);
void aspell_config_assign(struct AspellConfig * ths, const struct AspellConfig * other);
unsigned int aspell_config_error_number(const struct AspellConfig * ths);
const char * aspell_config_error_message(const struct AspellConfig * ths);
const struct AspellError * aspell_config_error(const struct AspellConfig * ths);
/* Sets extra keys which this config class should
* accept. begin and end are expected to point to
* the beginning and ending of an array of Aspell
* Key Info. */
void aspell_config_set_extra(struct AspellConfig * ths, const struct AspellKeyInfo * begin, const struct AspellKeyInfo * end);
/* Returns the KeyInfo object for the
* corresponding key or returns NULL and sets
* error_num to PERROR_UNKNOWN_KEY if the key is
* not valid. The pointer returned is valid for
* the lifetime of the object. */
const struct AspellKeyInfo * aspell_config_keyinfo(struct AspellConfig * ths, const char * key);
/* Returns a newly allocated enumeration of all
* the possible objects this config class uses. */
struct AspellKeyInfoEnumeration * aspell_config_possible_elements(struct AspellConfig * ths, int include_extra);
/* Returns the default value for given key which
* may involve substituting variables, thus it is
* not the same as keyinfo(key)->def returns NULL
* and sets error_num to PERROR_UNKNOWN_KEY if
* the key is not valid. Uses the temporary
* string. */
const char * aspell_config_get_default(struct AspellConfig * ths, const char * key);
/* Returns a newly allocated enumeration of all
* the key/value pairs. This DOES not include ones
* which are set to their default values. */
struct AspellStringPairEnumeration * aspell_config_elements(struct AspellConfig * ths);
/* Inserts an item, if the item already exists it
* will be replaced. Returns TRUE if it succeeded
* or FALSE on error. If the key in not valid it
* sets error_num to PERROR_UNKNOWN_KEY, if the
* value is not valid it will set error_num to
* PERROR_BAD_VALUE, if the value can not be
* changed it sets error_num to
* PERROR_CANT_CHANGE_VALUE, and if the value is
* a list and you are trying to set its directory,
* it sets error_num to PERROR_LIST_SET */
int aspell_config_replace(struct AspellConfig * ths, const char * key, const char * value);
/* Remove a key and returns TRUE if it exists
* otherwise return FALSE. This effectively sets
* the key to its default value. Calling replace
* with a value of "<default>" will also call
* remove. If the key does not exist then it sets
* error_num to 0 or PERROR_NOT, if the key is
* not valid then it sets error_num to
* PERROR_UNKNOWN_KEY, if the value can not be
* changed then it sets error_num to
* PERROR_CANT_CHANGE_VALUE */
int aspell_config_remove(struct AspellConfig * ths, const char * key);
int aspell_config_have(const struct AspellConfig * ths, const char * key);
/* Returns NULL on error. */
const char * aspell_config_retrieve(struct AspellConfig * ths, const char * key);
int aspell_config_retrieve_list(struct AspellConfig * ths, const char * key, struct AspellMutableContainer * lst);
/* Return -1 on error, 0 if false, 1 if true. */
int aspell_config_retrieve_bool(struct AspellConfig * ths, const char * key);
/* Return -1 on error. */
int aspell_config_retrieve_int(struct AspellConfig * ths, const char * key);
/******************************** error ********************************/
struct AspellError {
const char * mesg;
const struct AspellErrorInfo * err;
};
typedef struct AspellError AspellError;
int aspell_error_is_a(const struct AspellError * ths, const struct AspellErrorInfo * e);
struct AspellErrorInfo {
const struct AspellErrorInfo * isa;
const char * mesg;
unsigned int num_parms;
const char * parms[3];
};
typedef struct AspellErrorInfo AspellErrorInfo;
/**************************** can have error ****************************/
typedef struct AspellCanHaveError AspellCanHaveError;
unsigned int aspell_error_number(const struct AspellCanHaveError * ths);
const char * aspell_error_message(const struct AspellCanHaveError * ths);
const struct AspellError * aspell_error(const struct AspellCanHaveError * ths);
void delete_aspell_can_have_error(struct AspellCanHaveError * ths);
/******************************** errors ********************************/
extern const struct AspellErrorInfo * const aerror_other;
extern const struct AspellErrorInfo * const aerror_operation_not_supported;
extern const struct AspellErrorInfo * const aerror_cant_copy;
extern const struct AspellErrorInfo * const aerror_unimplemented_method;
extern const struct AspellErrorInfo * const aerror_file;
extern const struct AspellErrorInfo * const aerror_cant_open_file;
extern const struct AspellErrorInfo * const aerror_cant_read_file;
extern const struct AspellErrorInfo * const aerror_cant_write_file;
extern const struct AspellErrorInfo * const aerror_invalid_name;
extern const struct AspellErrorInfo * const aerror_bad_file_format;
extern const struct AspellErrorInfo * const aerror_dir;
extern const struct AspellErrorInfo * const aerror_cant_read_dir;
extern const struct AspellErrorInfo * const aerror_config;
extern const struct AspellErrorInfo * const aerror_unknown_key;
extern const struct AspellErrorInfo * const aerror_cant_change_value;
extern const struct AspellErrorInfo * const aerror_bad_key;
extern const struct AspellErrorInfo * const aerror_bad_value;
extern const struct AspellErrorInfo * const aerror_duplicate;
extern const struct AspellErrorInfo * const aerror_key_not_string;
extern const struct AspellErrorInfo * const aerror_key_not_int;
extern const struct AspellErrorInfo * const aerror_key_not_bool;
extern const struct AspellErrorInfo * const aerror_key_not_list;
extern const struct AspellErrorInfo * const aerror_no_value_reset;
extern const struct AspellErrorInfo * const aerror_no_value_enable;
extern const struct AspellErrorInfo * const aerror_no_value_disable;
extern const struct AspellErrorInfo * const aerror_no_value_clear;
extern const struct AspellErrorInfo * const aerror_language_related;
extern const struct AspellErrorInfo * const aerror_unknown_language;
extern const struct AspellErrorInfo * const aerror_unknown_soundslike;
extern const struct AspellErrorInfo * const aerror_language_not_supported;
extern const struct AspellErrorInfo * const aerror_no_wordlist_for_lang;
extern const struct AspellErrorInfo * const aerror_mismatched_language;
extern const struct AspellErrorInfo * const aerror_affix;
extern const struct AspellErrorInfo * const aerror_corrupt_affix;
extern const struct AspellErrorInfo * const aerror_invalid_cond;
extern const struct AspellErrorInfo * const aerror_invalid_cond_strip;
extern const struct AspellErrorInfo * const aerror_incorrect_encoding;
extern const struct AspellErrorInfo * const aerror_encoding;
extern const struct AspellErrorInfo * const aerror_unknown_encoding;
extern const struct AspellErrorInfo * const aerror_encoding_not_supported;
extern const struct AspellErrorInfo * const aerror_conversion_not_supported;
extern const struct AspellErrorInfo * const aerror_pipe;
extern const struct AspellErrorInfo * const aerror_cant_create_pipe;
extern const struct AspellErrorInfo * const aerror_process_died;
extern const struct AspellErrorInfo * const aerror_bad_input;
extern const struct AspellErrorInfo * const aerror_invalid_string;
extern const struct AspellErrorInfo * const aerror_invalid_word;
extern const struct AspellErrorInfo * const aerror_invalid_affix;
extern const struct AspellErrorInfo * const aerror_inapplicable_affix;
extern const struct AspellErrorInfo * const aerror_unknown_unichar;
extern const struct AspellErrorInfo * const aerror_word_list_flags;
extern const struct AspellErrorInfo * const aerror_invalid_flag;
extern const struct AspellErrorInfo * const aerror_conflicting_flags;
extern const struct AspellErrorInfo * const aerror_version_control;
extern const struct AspellErrorInfo * const aerror_bad_version_string;
extern const struct AspellErrorInfo * const aerror_filter;
extern const struct AspellErrorInfo * const aerror_cant_dlopen_file;
extern const struct AspellErrorInfo * const aerror_empty_filter;
extern const struct AspellErrorInfo * const aerror_no_such_filter;
extern const struct AspellErrorInfo * const aerror_confusing_version;
extern const struct AspellErrorInfo * const aerror_bad_version;
extern const struct AspellErrorInfo * const aerror_identical_option;
extern const struct AspellErrorInfo * const aerror_options_only;
extern const struct AspellErrorInfo * const aerror_invalid_option_modifier;
extern const struct AspellErrorInfo * const aerror_cant_describe_filter;
extern const struct AspellErrorInfo * const aerror_filter_mode_file;
extern const struct AspellErrorInfo * const aerror_mode_option_name;
extern const struct AspellErrorInfo * const aerror_no_filter_to_option;
extern const struct AspellErrorInfo * const aerror_bad_mode_key;
extern const struct AspellErrorInfo * const aerror_expect_mode_key;
extern const struct AspellErrorInfo * const aerror_mode_version_requirement;
extern const struct AspellErrorInfo * const aerror_confusing_mode_version;
extern const struct AspellErrorInfo * const aerror_bad_mode_version;
extern const struct AspellErrorInfo * const aerror_missing_magic_expression;
extern const struct AspellErrorInfo * const aerror_empty_file_ext;
extern const struct AspellErrorInfo * const aerror_filter_mode_expand;
extern const struct AspellErrorInfo * const aerror_unknown_mode;
extern const struct AspellErrorInfo * const aerror_mode_extend_expand;
extern const struct AspellErrorInfo * const aerror_filter_mode_magic;
extern const struct AspellErrorInfo * const aerror_file_magic_pos;
extern const struct AspellErrorInfo * const aerror_file_magic_range;
extern const struct AspellErrorInfo * const aerror_missing_magic;
extern const struct AspellErrorInfo * const aerror_bad_magic;
extern const struct AspellErrorInfo * const aerror_expression;
extern const struct AspellErrorInfo * const aerror_invalid_expression;
/******************************* speller *******************************/
typedef struct AspellSpeller AspellSpeller;
struct AspellCanHaveError * new_aspell_speller(struct AspellConfig * config);
struct AspellSpeller * to_aspell_speller(struct AspellCanHaveError * obj);
void delete_aspell_speller(struct AspellSpeller * ths);
unsigned int aspell_speller_error_number(const struct AspellSpeller * ths);
const char * aspell_speller_error_message(const struct AspellSpeller * ths);
const struct AspellError * aspell_speller_error(const struct AspellSpeller * ths);
struct AspellConfig * aspell_speller_config(struct AspellSpeller * ths);
/* Returns 0 if it is not in the dictionary,
* 1 if it is, or -1 on error. */
int aspell_speller_check(struct AspellSpeller * ths, const char * word, int word_size);
/* Add this word to your own personal word list. */
int aspell_speller_add_to_personal(struct AspellSpeller * ths, const char * word, int word_size);
/* Add this word to the current spelling session. */
int aspell_speller_add_to_session(struct AspellSpeller * ths, const char * word, int word_size);
/* This is your own personal word list file plus
* any extra words added during this session to
* your own personal word list. */
const struct AspellWordList * aspell_speller_personal_word_list(struct AspellSpeller * ths);
/* This is a list of words added to this session
* that are not in the main word list or in your
* own personal list but are considered valid for
* this spelling session. */
const struct AspellWordList * aspell_speller_session_word_list(struct AspellSpeller * ths);
/* This is the main list of words used during this
* spelling session. */
const struct AspellWordList * aspell_speller_main_word_list(struct AspellSpeller * ths);
int aspell_speller_save_all_word_lists(struct AspellSpeller * ths);
int aspell_speller_clear_session(struct AspellSpeller * ths);
/* Return NULL on error.
* The word list returned by suggest is only
* valid until the next call to suggest. */
const struct AspellWordList * aspell_speller_suggest(struct AspellSpeller * ths, const char * word, int word_size);
int aspell_speller_store_replacement(struct AspellSpeller * ths, const char * mis, int mis_size, const char * cor, int cor_size);
/******************************** filter ********************************/
typedef struct AspellFilter AspellFilter;
void delete_aspell_filter(struct AspellFilter * ths);
unsigned int aspell_filter_error_number(const struct AspellFilter * ths);
const char * aspell_filter_error_message(const struct AspellFilter * ths);
const struct AspellError * aspell_filter_error(const struct AspellFilter * ths);
struct AspellFilter * to_aspell_filter(struct AspellCanHaveError * obj);
/*************************** document checker ***************************/
struct AspellToken {
unsigned int offset;
unsigned int len;
};
typedef struct AspellToken AspellToken;
typedef struct AspellDocumentChecker AspellDocumentChecker;
void delete_aspell_document_checker(struct AspellDocumentChecker * ths);
unsigned int aspell_document_checker_error_number(const struct AspellDocumentChecker * ths);
const char * aspell_document_checker_error_message(const struct AspellDocumentChecker * ths);
const struct AspellError * aspell_document_checker_error(const struct AspellDocumentChecker * ths);
/* Creates a new document checker.
* The speller class is expected to last until
* this class is destroyed.
* If config is given it will be used to override
* any relevent options set by this speller class.
* The config class is not once this function is done.
* If filter is given then it will take ownership of
* the filter class and use it to do the filtering.
* You are expected to free the checker when done. */
struct AspellCanHaveError * new_aspell_document_checker(struct AspellSpeller * speller);
struct AspellDocumentChecker * to_aspell_document_checker(struct AspellCanHaveError * obj);
/* Reset the internal state of the filter.
* Should be called whenever a new document is
* being filtered. */
void aspell_document_checker_reset(struct AspellDocumentChecker * ths);
/* Process a string.
* The string passed in should only be split on
* white space characters. Furthermore, between
* calls to reset, each string should be passed
* in exactly once and in the order they appeared
* in the document. Passing in strings out of
* order, skipping strings or passing them in
* more than once may lead to undefined results. */
void aspell_document_checker_process(struct AspellDocumentChecker * ths, const char * str, int size);
/* Returns the next misspelled word in the
* processed string. If there are no more
* misspelled words, then token.word will be
* NULL and token.size will be 0 */
struct AspellToken aspell_document_checker_next_misspelling(struct AspellDocumentChecker * ths);
/* Returns the underlying filter class. */
struct AspellFilter * aspell_document_checker_filter(struct AspellDocumentChecker * ths);
/****************************** word list ******************************/
typedef struct AspellWordList AspellWordList;
int aspell_word_list_empty(const struct AspellWordList * ths);
unsigned int aspell_word_list_size(const struct AspellWordList * ths);
struct AspellStringEnumeration * aspell_word_list_elements(const struct AspellWordList * ths);
/************************** string enumeration **************************/
typedef struct AspellStringEnumeration AspellStringEnumeration;
void delete_aspell_string_enumeration(struct AspellStringEnumeration * ths);
struct AspellStringEnumeration * aspell_string_enumeration_clone(const struct AspellStringEnumeration * ths);
void aspell_string_enumeration_assign(struct AspellStringEnumeration * ths, const struct AspellStringEnumeration * other);
int aspell_string_enumeration_at_end(const struct AspellStringEnumeration * ths);
const char * aspell_string_enumeration_next(struct AspellStringEnumeration * ths);
/********************************* info *********************************/
struct AspellModuleInfo {
const char * name;
double order_num;
const char * lib_dir;
struct AspellStringList * dict_dirs;
struct AspellStringList * dict_exts;
};
typedef struct AspellModuleInfo AspellModuleInfo;
struct AspellDictInfo {
/* The Name to identify this dictionary by. */
const char * name;
/* The language code to identify this dictionary.
* A two letter UPPER-CASE ISO 639 language code
* and an optional two letter ISO 3166 country
* code after a dash or underscore. */
const char * code;
/* Any extra information to distinguish this
* variety of dictionary from other dictionaries
* which may have the same language and size. */
const char * jargon;
int size;
/* A two char digit code describing the size of
* the dictionary: 10=tiny, 20=really small,
* 30=small, 40=med-small, 50=med, 60=med-large,
* 70=large, 80=huge, 90=insane. Please check
* the README in aspell-lang-200?????.tar.bz2 or
* see SCOWL (http://wordlist.sourceforge.net)
* for an example of how these sizes are used. */
const char * size_str;
struct AspellModuleInfo * module;
};
typedef struct AspellDictInfo AspellDictInfo;
typedef struct AspellModuleInfoList AspellModuleInfoList;
struct AspellModuleInfoList * get_aspell_module_info_list(struct AspellConfig * config);
int aspell_module_info_list_empty(const struct AspellModuleInfoList * ths);
unsigned int aspell_module_info_list_size(const struct AspellModuleInfoList * ths);
struct AspellModuleInfoEnumeration * aspell_module_info_list_elements(const struct AspellModuleInfoList * ths);
typedef struct AspellDictInfoList AspellDictInfoList;
struct AspellDictInfoList * get_aspell_dict_info_list(struct AspellConfig * config);
int aspell_dict_info_list_empty(const struct AspellDictInfoList * ths);
unsigned int aspell_dict_info_list_size(const struct AspellDictInfoList * ths);
struct AspellDictInfoEnumeration * aspell_dict_info_list_elements(const struct AspellDictInfoList * ths);
typedef struct AspellModuleInfoEnumeration AspellModuleInfoEnumeration;
int aspell_module_info_enumeration_at_end(const struct AspellModuleInfoEnumeration * ths);
const struct AspellModuleInfo * aspell_module_info_enumeration_next(struct AspellModuleInfoEnumeration * ths);
void delete_aspell_module_info_enumeration(struct AspellModuleInfoEnumeration * ths);
struct AspellModuleInfoEnumeration * aspell_module_info_enumeration_clone(const struct AspellModuleInfoEnumeration * ths);
void aspell_module_info_enumeration_assign(struct AspellModuleInfoEnumeration * ths, const struct AspellModuleInfoEnumeration * other);
typedef struct AspellDictInfoEnumeration AspellDictInfoEnumeration;
int aspell_dict_info_enumeration_at_end(const struct AspellDictInfoEnumeration * ths);
const struct AspellDictInfo * aspell_dict_info_enumeration_next(struct AspellDictInfoEnumeration * ths);
void delete_aspell_dict_info_enumeration(struct AspellDictInfoEnumeration * ths);
struct AspellDictInfoEnumeration * aspell_dict_info_enumeration_clone(const struct AspellDictInfoEnumeration * ths);
void aspell_dict_info_enumeration_assign(struct AspellDictInfoEnumeration * ths, const struct AspellDictInfoEnumeration * other);
/***************************** string list *****************************/
typedef struct AspellStringList AspellStringList;
struct AspellStringList * new_aspell_string_list();
int aspell_string_list_empty(const struct AspellStringList * ths);
unsigned int aspell_string_list_size(const struct AspellStringList * ths);
struct AspellStringEnumeration * aspell_string_list_elements(const struct AspellStringList * ths);
int aspell_string_list_add(struct AspellStringList * ths, const char * to_add);
int aspell_string_list_remove(struct AspellStringList * ths, const char * to_rem);
void aspell_string_list_clear(struct AspellStringList * ths);
struct AspellMutableContainer * aspell_string_list_to_mutable_container(struct AspellStringList * ths);
void delete_aspell_string_list(struct AspellStringList * ths);
struct AspellStringList * aspell_string_list_clone(const struct AspellStringList * ths);
void aspell_string_list_assign(struct AspellStringList * ths, const struct AspellStringList * other);
/****************************** string map ******************************/
typedef struct AspellStringMap AspellStringMap;
struct AspellStringMap * new_aspell_string_map();
int aspell_string_map_add(struct AspellStringMap * ths, const char * to_add);
int aspell_string_map_remove(struct AspellStringMap * ths, const char * to_rem);
void aspell_string_map_clear(struct AspellStringMap * ths);
struct AspellMutableContainer * aspell_string_map_to_mutable_container(struct AspellStringMap * ths);
void delete_aspell_string_map(struct AspellStringMap * ths);
struct AspellStringMap * aspell_string_map_clone(const struct AspellStringMap * ths);
void aspell_string_map_assign(struct AspellStringMap * ths, const struct AspellStringMap * other);
int aspell_string_map_empty(const struct AspellStringMap * ths);
unsigned int aspell_string_map_size(const struct AspellStringMap * ths);
struct AspellStringPairEnumeration * aspell_string_map_elements(const struct AspellStringMap * ths);
/* Insert a new element.
* Will NOT overwrite an existing entry.
* Returns FALSE if the element already exists. */
int aspell_string_map_insert(struct AspellStringMap * ths, const char * key, const char * value);
/* Insert a new element.
* Will overwrite an existing entry.
* Always returns TRUE. */
int aspell_string_map_replace(struct AspellStringMap * ths, const char * key, const char * value);
/* Looks up an element and returns the value.
* Returns NULL if the element does not exist.
* Returns an empty string if the element exists
* but has a NULL value. */
const char * aspell_string_map_lookup(const struct AspellStringMap * ths, const char * key);
/***************************** string pair *****************************/
struct AspellStringPair {
const char * first;
const char * second;
};
typedef struct AspellStringPair AspellStringPair;
/*********************** string pair enumeration ***********************/
typedef struct AspellStringPairEnumeration AspellStringPairEnumeration;
int aspell_string_pair_enumeration_at_end(const struct AspellStringPairEnumeration * ths);
struct AspellStringPair aspell_string_pair_enumeration_next(struct AspellStringPairEnumeration * ths);
void delete_aspell_string_pair_enumeration(struct AspellStringPairEnumeration * ths);
struct AspellStringPairEnumeration * aspell_string_pair_enumeration_clone(const struct AspellStringPairEnumeration * ths);
void aspell_string_pair_enumeration_assign(struct AspellStringPairEnumeration * ths, const struct AspellStringPairEnumeration * other);
/******************************** cache ********************************/
/* Reset the global cache(s) so that cache queries will
* create a new object. If existing objects are still in
* use they are not deleted. If which is NULL then all
* caches will be reset. Current caches are "encode",
* "decode", "dictionary", "language", and "keyboard". */
int aspell_reset_cache(const char * which);
#ifdef __cplusplus
}
#endif
#endif /* ASPELL_ASPELL__H */

579
src/aspell/rclaspell.cpp Normal file
View file

@ -0,0 +1,579 @@
#ifndef TEST_RCLASPELL
/* Copyright (C) 2006 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "autoconfig.h"
#endif
#ifdef RCL_USE_ASPELL
#include <unistd.h>
#include <dlfcn.h>
#include <stdlib.h>
#include ASPELL_INCLUDE
#include "pathut.h"
#include "execmd.h"
#include "rclaspell.h"
#include "debuglog.h"
#include "unacpp.h"
#include "ptmutex.h"
using namespace std;
// Just a place where we keep the Aspell library entry points together
class AspellApi {
public:
struct AspellConfig *(*new_aspell_config)();
int (*aspell_config_replace)(struct AspellConfig *, const char * key,
const char * value);
struct AspellCanHaveError *(*new_aspell_speller)(struct AspellConfig *);
void (*delete_aspell_config)(struct AspellConfig *);
void (*delete_aspell_can_have_error)(struct AspellCanHaveError *);
struct AspellSpeller * (*to_aspell_speller)(struct AspellCanHaveError *);
struct AspellConfig * (*aspell_speller_config)(struct AspellSpeller *);
const struct AspellWordList * (*aspell_speller_suggest)
(struct AspellSpeller *, const char *, int);
int (*aspell_speller_check)(struct AspellSpeller *, const char *, int);
struct AspellStringEnumeration * (*aspell_word_list_elements)
(const struct AspellWordList * ths);
const char * (*aspell_string_enumeration_next)
(struct AspellStringEnumeration * ths);
void (*delete_aspell_string_enumeration)(struct AspellStringEnumeration *);
const struct AspellError *(*aspell_error)
(const struct AspellCanHaveError *);
const char *(*aspell_error_message)(const struct AspellCanHaveError *);
const char *(*aspell_speller_error_message)(const struct AspellSpeller *);
void (*delete_aspell_speller)(struct AspellSpeller *);
};
static AspellApi aapi;
static PTMutexInit o_aapi_mutex;
#define NMTOPTR(NM, TP) \
if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) { \
badnames += #NM + string(" "); \
}
static const char *aspell_lib_suffixes[] = {
".so",
".so.15",
".so.16"
};
static const unsigned int nlibsuffs = sizeof(aspell_lib_suffixes) / sizeof(char *);
// Stuff that we don't wish to see in the .h (possible sysdeps, etc.)
class AspellData {
public:
AspellData()
: m_handle(0), m_speller(0)
{}
~AspellData() {
LOGDEB2(("~AspellData\n"));
if (m_handle) {
dlclose(m_handle);
m_handle = 0;
}
if (m_speller) {
// Dumps core if I do this??
//aapi.delete_aspell_speller(m_speller);
m_speller = 0;
LOGDEB2(("~AspellData: speller done\n"));
}
}
void *m_handle;
string m_exec;
AspellSpeller *m_speller;
};
Aspell::Aspell(RclConfig *cnf)
: m_config(cnf), m_data(0)
{
}
Aspell::~Aspell()
{
deleteZ(m_data);
}
bool Aspell::init(string &reason)
{
PTMutexLocker locker(o_aapi_mutex);
deleteZ(m_data);
// Language: we get this from the configuration, else from the NLS
// environment. The aspell language names used for selecting language
// definition files (used to create dictionaries) are like en, fr
if (!m_config->getConfParam("aspellLanguage", m_lang) || m_lang.empty()) {
string lang = "en";
const char *cp;
if ((cp = getenv("LC_ALL")))
lang = cp;
else if ((cp = getenv("LANG")))
lang = cp;
if (!lang.compare("C"))
lang = "en";
m_lang = lang.substr(0, lang.find_first_of("_"));
}
m_data = new AspellData;
const char *aspell_prog_from_env = getenv("ASPELL_PROG");
if (aspell_prog_from_env && access(aspell_prog_from_env, X_OK) == 0) {
m_data->m_exec = aspell_prog_from_env;
#ifdef ASPELL_PROG
} else if (access(ASPELL_PROG, X_OK) == 0) {
m_data->m_exec = ASPELL_PROG;
#endif // ASPELL_PROG
} else {
ExecCmd::which("aspell", m_data->m_exec);
}
if (m_data->m_exec.empty()) {
reason = "aspell program not found or not executable";
deleteZ(m_data);
return false;
}
reason = "Could not open shared library ";
string libbase("libaspell");
string lib;
for (unsigned int i = 0; i < nlibsuffs; i++) {
lib = libbase + aspell_lib_suffixes[i];
reason += string("[") + lib + "] ";
if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
reason.erase();
goto found;
}
}
found:
if (m_data->m_handle == 0) {
reason += string(" : ") + dlerror();
deleteZ(m_data);
return false;
}
string badnames;
NMTOPTR(new_aspell_config, (struct AspellConfig *(*)()));
NMTOPTR(aspell_config_replace, (int (*)(struct AspellConfig *,
const char *, const char *)));
NMTOPTR(new_aspell_speller,
(struct AspellCanHaveError *(*)(struct AspellConfig *)));
NMTOPTR(delete_aspell_config,
(void (*)(struct AspellConfig *)));
NMTOPTR(delete_aspell_can_have_error,
(void (*)(struct AspellCanHaveError *)));
NMTOPTR(to_aspell_speller,
(struct AspellSpeller *(*)(struct AspellCanHaveError *)));
NMTOPTR(aspell_speller_config,
(struct AspellConfig *(*)(struct AspellSpeller *)));
NMTOPTR(aspell_speller_suggest,
(const struct AspellWordList *(*)(struct AspellSpeller *,
const char *, int)));
NMTOPTR(aspell_speller_check,
(int (*)(struct AspellSpeller *, const char *, int)));
NMTOPTR(aspell_word_list_elements,
(struct AspellStringEnumeration *(*)
(const struct AspellWordList *)));
NMTOPTR(aspell_string_enumeration_next,
(const char * (*)(struct AspellStringEnumeration *)));
NMTOPTR(delete_aspell_string_enumeration,
(void (*)(struct AspellStringEnumeration *)));
NMTOPTR(aspell_error,
(const struct AspellError*(*)(const struct AspellCanHaveError *)));
NMTOPTR(aspell_error_message,
(const char *(*)(const struct AspellCanHaveError *)));
NMTOPTR(aspell_speller_error_message,
(const char *(*)(const struct AspellSpeller *)));
NMTOPTR(delete_aspell_speller, (void (*)(struct AspellSpeller *)));
if (!badnames.empty()) {
reason = string("Aspell::init: symbols not found:") + badnames;
deleteZ(m_data);
return false;
}
return true;
}
bool Aspell::ok() const
{
return m_data != 0 && m_data->m_handle != 0;
}
string Aspell::dicPath()
{
return path_cat(m_config->getConfDir(),
string("aspdict.") + m_lang + string(".rws"));
}
// The data source for the create dictionary aspell command. We walk
// the term list, filtering out things that are probably not words.
// Note that the manual for the current version (0.60) of aspell
// states that utf-8 is not well supported, so that we should maybe
// also filter all 8bit chars.
class AspExecPv : public ExecCmdProvide {
public:
string *m_input; // pointer to string used as input buffer to command
Rcl::TermIter *m_tit;
Rcl::Db &m_db;
AspExecPv(string *i, Rcl::TermIter *tit, Rcl::Db &db)
: m_input(i), m_tit(tit), m_db(db)
{}
void newData() {
while (m_db.termWalkNext(m_tit, *m_input)) {
LOGDEB2(("Aspell::buildDict: term: [%s]\n", m_input->c_str()));
if (!Rcl::Db::isSpellingCandidate(*m_input)) {
LOGDEB2(("Aspell::buildDict: SKIP\n"));
continue;
}
if (!o_index_stripchars) {
string lower;
if (!unacmaybefold(*m_input, lower, "UTF-8", UNACOP_FOLD))
continue;
m_input->swap(lower);
}
// Got a non-empty sort-of appropriate term, let's send it to
// aspell
LOGDEB2(("Apell::buildDict: SEND\n"));
m_input->append("\n");
return;
}
// End of data. Tell so. Exec will close cmd.
m_input->erase();
}
};
bool Aspell::buildDict(Rcl::Db &db, string &reason)
{
if (!ok())
return false;
// We create the dictionary by executing the aspell command:
// aspell --lang=[lang] create master [dictApath]
string cmdstring(m_data->m_exec);
ExecCmd aspell;
vector<string> args;
args.push_back(string("--lang=")+ m_lang);
cmdstring += string(" ") + string("--lang=") + m_lang;
args.push_back("--encoding=utf-8");
cmdstring += string(" ") + "--encoding=utf-8";
args.push_back("create");
cmdstring += string(" ") + "create";
args.push_back("master");
cmdstring += string(" ") + "master";
args.push_back(dicPath());
cmdstring += string(" ") + dicPath();
// Have to disable stderr, as numerous messages about bad strings are
// printed. We'd like to keep errors about missing databases though, so
// make it configurable for diags
bool keepStderr = false;
m_config->getConfParam("aspellKeepStderr", &keepStderr);
if (!keepStderr)
aspell.setStderr("/dev/null");
Rcl::TermIter *tit = db.termWalkOpen();
if (tit == 0) {
reason = "termWalkOpen failed\n";
return false;
}
string termbuf;
AspExecPv pv(&termbuf, tit, db);
aspell.setProvide(&pv);
if (aspell.doexec(m_data->m_exec, args, &termbuf)) {
ExecCmd cmd;
args.clear();
args.push_back("dicts");
string dicts;
bool hasdict = false;
if (cmd.doexec(m_data->m_exec, args, 0, &dicts)) {
vector<string> vdicts;
stringToTokens(dicts, vdicts, "\n\r\t ");
if (find(vdicts.begin(), vdicts.end(), m_lang) != vdicts.end()) {
hasdict = true;
}
}
if (hasdict)
reason = string(
"\naspell dictionary creation command [") +
cmdstring + string("] failed. Reason unknown.\n"
"Try to set aspellKeepStderr = 1 in recoll.conf, and execute \n"
"the indexing command in a terminal to see the aspell "
"diagnostic output.\n");
else
reason = string("aspell dictionary creation command failed:\n") +
cmdstring + "\n"
"One possible reason might be missing language "
"data files for lang = " + m_lang +
". Maybe try to execute the command by hand for a better diag.";
return false;
}
db.termWalkClose(tit);
return true;
}
bool Aspell::make_speller(string& reason)
{
if (!ok())
return false;
if (m_data->m_speller != 0)
return true;
AspellCanHaveError *ret;
AspellConfig *config = aapi.new_aspell_config();
aapi.aspell_config_replace(config, "lang", m_lang.c_str());
aapi.aspell_config_replace(config, "encoding", "utf-8");
aapi.aspell_config_replace(config, "master", dicPath().c_str());
aapi.aspell_config_replace(config, "sug-mode", "fast");
// aapi.aspell_config_replace(config, "sug-edit-dist", "2");
ret = aapi.new_aspell_speller(config);
aapi.delete_aspell_config(config);
if (aapi.aspell_error(ret) != 0) {
reason = aapi.aspell_error_message(ret);
aapi.delete_aspell_can_have_error(ret);
return false;
}
m_data->m_speller = aapi.to_aspell_speller(ret);
return true;
}
bool Aspell::check(const string &iterm, string& reason)
{
LOGDEB2(("Aspell::check [%s]\n", iterm.c_str()));
string mterm(iterm);
if (!ok() || !make_speller(reason))
return false;
if (iterm.empty())
return true; //??
if (!o_index_stripchars) {
string lower;
if (!unacmaybefold(mterm, lower, "UTF-8", UNACOP_FOLD)) {
LOGERR(("Aspell::check : cant lowercase input\n"));
return false;
}
mterm.swap(lower);
}
int ret = aapi.aspell_speller_check(m_data->m_speller,
mterm.c_str(), mterm.length());
reason.clear();
switch (ret) {
case 0: return false;
case 1: return true;
default:
case -1:
reason.append("Aspell error: ");
reason.append(aapi.aspell_speller_error_message(m_data->m_speller));
return false;
}
}
bool Aspell::suggest(Rcl::Db &db, const string &_term,
list<string>& suggestions, string& reason)
{
if (!ok() || !make_speller(reason))
return false;
string mterm(_term);
if (mterm.empty())
return true; //??
if (!o_index_stripchars) {
string lower;
if (!unacmaybefold(mterm, lower, "UTF-8", UNACOP_FOLD)) {
LOGERR(("Aspell::check : cant lowercase input\n"));
return false;
}
mterm.swap(lower);
}
AspellCanHaveError *ret;
const AspellWordList *wl =
aapi.aspell_speller_suggest(m_data->m_speller,
mterm.c_str(), mterm.length());
if (wl == 0) {
reason = aapi.aspell_speller_error_message(m_data->m_speller);
return false;
}
AspellStringEnumeration *els = aapi.aspell_word_list_elements(wl);
const char *word;
while ((word = aapi.aspell_string_enumeration_next(els)) != 0) {
// Check that the word exists in the index (we don't want
// aspell computed stuff, only exact terms from the
// dictionary). We used to also check that it stems
// differently from the base word but this is complicated
// (stemming on/off + language), so we now leave this to the
// caller.
if (db.termExists(word))
suggestions.push_back(word);
}
aapi.delete_aspell_string_enumeration(els);
return true;
}
#endif // RCL_USE_ASPELL
#else // TEST_RCLASPELL test driver ->
#ifdef HAVE_CONFIG_H
#include "autoconfig.h"
#endif
#ifdef RCL_USE_ASPELL
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <iostream>
using namespace std;
#include "rclinit.h"
#include "rclconfig.h"
#include "rcldb.h"
#include "rclaspell.h"
static char *thisprog;
RclConfig *rclconfig;
static char usage [] =
" -b : build dictionary\n"
" -s <term>: suggestions for term\n"
" -c <term>: check term\n"
"\n"
;
static void
Usage(void)
{
fprintf(stderr, "%s: usage:\n%s", thisprog, usage);
exit(1);
}
static int op_flags;
#define OPT_MOINS 0x1
#define OPT_s 0x2
#define OPT_b 0x4
#define OPT_c 0x8
int main(int argc, char **argv)
{
string word;
thisprog = argv[0];
argc--; argv++;
while (argc > 0 && **argv == '-') {
(*argv)++;
if (!(**argv))
/* Cas du "adb - core" */
Usage();
while (**argv)
switch (*(*argv)++) {
case 'b': op_flags |= OPT_b; break;
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
word = *(++argv);
argc--;
goto b1;
case 's': op_flags |= OPT_s; if (argc < 2) Usage();
word = *(++argv);
argc--;
goto b1;
default: Usage(); break;
}
b1: argc--; argv++;
}
if (argc != 0 || op_flags == 0)
Usage();
string reason;
rclconfig = recollinit(0, 0, reason);
if (!rclconfig || !rclconfig->ok()) {
fprintf(stderr, "Configuration problem: %s\n", reason.c_str());
exit(1);
}
string dbdir = rclconfig->getDbDir();
if (dbdir.empty()) {
fprintf(stderr, "No db directory in configuration");
exit(1);
}
Rcl::Db rcldb(rclconfig);
if (!rcldb.open(Rcl::Db::DbRO, 0)) {
fprintf(stderr, "Could not open database in %s\n", dbdir.c_str());
exit(1);
}
Aspell aspell(rclconfig);
if (!aspell.init(reason)) {
cerr << "Init failed: " << reason << endl;
exit(1);
}
if (op_flags & OPT_b) {
if (!aspell.buildDict(rcldb, reason)) {
cerr << "buildDict failed: " << reason << endl;
exit(1);
}
} else if (op_flags & OPT_c) {
bool ret = aspell.check(word, reason);
if (!ret && reason.size()) {
cerr << "Aspell error: " << reason << endl;
return 1;
}
cout << word;
if (ret) {
cout << " is in dictionary" << endl;
} else {
cout << " not in dictionary" << endl;
}
} else {
list<string> suggs;
if (!aspell.suggest(rcldb, word, suggs, reason)) {
cerr << "suggest failed: " << reason << endl;
exit(1);
}
cout << "Suggestions for " << word << ":" << endl;
for (list<string>::iterator it = suggs.begin();
it != suggs.end(); it++) {
cout << *it << endl;
}
}
exit(0);
}
#else
int main(int argc, char **argv)
{return 1;}
#endif // RCL_USE_ASPELL
#endif // TEST_RCLASPELL test driver

79
src/aspell/rclaspell.h Normal file
View file

@ -0,0 +1,79 @@
/* Copyright (C) 2006 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _RCLASPELL_H_INCLUDED_
#define _RCLASPELL_H_INCLUDED_
/* autoconfig.h must be included before this file */
#ifdef RCL_USE_ASPELL
/**
* Aspell speller interface class.
*
* Aspell is used to let the user find about spelling variations that may
* exist in the document set for a given word.
* A specific aspell dictionary is created out of all the terms in the
* xapian index, and we then use it to expand a term to spelling neighbours.
* We use the aspell C api for term expansion, but have
* to execute the program to create dictionaries.
*/
#include <string>
#include <list>
#include "rclconfig.h"
#include "rcldb.h"
class AspellData;
class Aspell {
public:
Aspell(RclConfig *cnf);
~Aspell();
/** Check health */
bool ok() const;
/** Find the aspell command and shared library, init function pointers */
bool init(std::string &reason);
/** Build dictionary out of index term list. This is done at the end
* of an indexing pass. */
bool buildDict(Rcl::Db &db, std::string &reason);
/** Check that word is in dictionary. Note that this would mean
* that the EXACT word is: aspell just does a lookup, no
* grammatical, case or diacritics magic of any kind
*
* @return true if word in dic, false if not. reason.size() -> error
*/
bool check(const std::string& term, std::string& reason);
/** Return a list of possible expansions for a given word */
bool suggest(Rcl::Db &db, const std::string& term,
std::list<std::string> &suggestions, std::string &reason);
private:
std::string dicPath();
RclConfig *m_config;
std::string m_lang;
AspellData *m_data;
bool make_speller(std::string& reason);
};
#endif /* RCL_USE_ASPELL */
#endif /* _RCLASPELL_H_INCLUDED_ */

View file

@ -0,0 +1,3 @@
Most of the code in this directory was taken from the Binc IMAP project
(http://www.bincimap.org/), version 1.3.3

45
src/bincimapmime/AUTHORS Normal file
View file

@ -0,0 +1,45 @@
The following parties have participated in writing code or otherwise
contributed to the Binc IMAP project:
Author:
Andreas Aardal Hanssen <andreas-binc@bincimap.org>
Several users have been very helpful with bug reports and suggestions, and
the author is very grateful for their contributions.
Some users have also gone to the extra effort of debugging the cause of a
bug, or have found a way of implementing a feature, and have either provided
a very good description of what is needed, or they have actually provided a
patch that has been added to Binc IMAP.
While adding extra value to the discussion around the discovery of a bug or
the evaluation of a new feature, these contributors also take some load of
the author's back, so they deserve extra thanks.
In this list are also included people who have contributed with mirrors and
translations of the web pages.
Henry Baragar <Henry.Baragar (a) Instantiated.Ca>
Jürgen Botz <jurgen (a) botz.org>
Charlie Brady <charlieb (a) e-smith.com>
Caskey Dickson <caskey (a) technocage.com>
Ketil Froyn <ketil (a) froyn.name>
Gary Gordon <gv-mail (a) mygirlfriday.info>
Marek Gutkowski <marek (a) moveo.pl>
Daniel James <daniel_james (a) eml.cc>
Zak Johnson <zakj (a) nox.cx>
Sergei Kolobov <sergei (a) kolobov.com>
Rafal Kupka <kupson (a) kupson.fdns.net>
Eivind Kvedalen <bincimap (a) eivind.kvedalen.name>
HIROSHIMA Naoki <naokih (a) iron-horse.org>
Greger Stolt Nilsen <greger (a) psychoproject.net>
John Starks <jstarks (a) starksnet.net>
Peter Stuge <stuge-binc (a) cdy.org>
Gerrit Pape <pape (a) smarden.org>
Jeremy Rossi <jeremy (a) jeremyrossi.com>
Dale Woolridge <dale-contrib-bincimap (a) woolridge.org>
If you have contributed to the Binc IMAP project but are not listed here
(this happens quite often), please send a mail to andreas-binc@bincimap.org
and I'll add you to the list.

356
src/bincimapmime/COPYING Normal file
View file

@ -0,0 +1,356 @@
This software is released under the GPL. Find a full copy of the GNU
General Public License below.
In addition, as a special exception, Andreas Aardal Hanssen, author of
Binc IMAP, gives permission to link the code of this program with the
OpenSSL library (or with modified versions of OpenSSL that use the
same license as OpenSSL, listed in the included COPYING.OpenSSL file),
and distribute linked combinations including the two.
You must obey the GNU General Public License in all respects for all
of the code used other than OpenSSL. If you modify this file, you may
extend this exception to your version of the file, but you are not
obligated to do so. If you do not wish to do so, delete this exception
statement from your version.
---------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.

31
src/bincimapmime/Makefile Normal file
View file

@ -0,0 +1,31 @@
# @(#$Id: Makefile,v 1.6 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes
depth = ..
include $(depth)/mk/sysconf
LIBS = libmime.a
PROGS = trbinc
all: depend $(LIBS)
SRCS = mime-parsefull.cc mime-parseonlyheader.cc \
mime-printbody.cc mime.cc \
convert.cc iodevice.cc iofactory.cc
OBJS = mime-parsefull.o mime-parseonlyheader.o \
mime-printbody.o mime.o \
convert.o iodevice.o iofactory.o
libmime.a : $(OBJS)
$(AR) ru libmime.a $(OBJS)
.cc.o:
$(CXX) $(ALL_CXXFLAGS) -c $<
TRBINCOBJS = trbinc.o
trbinc: trbinc.o
$(CXX) -o trbinc trbinc.o libmime.a
include $(depth)/mk/commontargets
include alldeps

View file

133
src/bincimapmime/convert.cc Normal file
View file

@ -0,0 +1,133 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* convert.cc
*
* Description:
* Implementation of miscellaneous convertion functions.
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "convert.h"
#include <string>
#ifndef NO_NAMESPACES
using namespace ::std;
using namespace Binc;
#endif /* NO_NAMESPACES */
//------------------------------------------------------------------------
BincStream::BincStream(void)
{
}
//------------------------------------------------------------------------
BincStream::~BincStream(void)
{
clear();
}
//------------------------------------------------------------------------
string BincStream::popString(unsigned int size)
{
if (size > nstr.length())
size = nstr.length();
string tmp = nstr.substr(0, size);
nstr = nstr.substr(size);
return tmp;
}
//------------------------------------------------------------------------
char BincStream::popChar(void)
{
if (nstr.length() == 0)
return '\0';
char c = nstr[0];
nstr = nstr.substr(1);
return c;
}
//------------------------------------------------------------------------
void BincStream::unpopChar(char c)
{
nstr = c + nstr;
}
//------------------------------------------------------------------------
void BincStream::unpopStr(const string &s)
{
nstr = s + nstr;
}
//------------------------------------------------------------------------
const string &BincStream::str(void) const
{
return nstr;
}
//------------------------------------------------------------------------
void BincStream::clear(void)
{
nstr.clear();
}
//------------------------------------------------------------------------
unsigned int BincStream::getSize(void) const
{
return (unsigned int) nstr.length();
}
//------------------------------------------------------------------------
BincStream &BincStream::operator << (std::ostream&(*)(std::ostream&))
{
nstr += "\r\n";
return *this;
}
//------------------------------------------------------------------------
BincStream &BincStream::operator << (const string &t)
{
nstr += t;
return *this;
}
//------------------------------------------------------------------------
BincStream &BincStream::operator << (int t)
{
nstr += toString(t);
return *this;
}
//------------------------------------------------------------------------
BincStream &BincStream::operator << (unsigned int t)
{
nstr += toString(t);
return *this;
}
//------------------------------------------------------------------------
BincStream &BincStream::operator << (char t)
{
nstr += t;
return *this;
}

320
src/bincimapmime/convert.h Normal file
View file

@ -0,0 +1,320 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* src/util/convert.h
*
* Description:
* Declaration of miscellaneous convertion functions.
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef convert_h_included
#define convert_h_included
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <sys/stat.h>
#include <cstdlib>
#include <cstring>
namespace Binc {
//----------------------------------------------------------------------
inline std::string toString(int i_in)
{
char intbuf[16];
snprintf(intbuf, sizeof(intbuf), "%d", i_in);
return std::string(intbuf);
}
//----------------------------------------------------------------------
inline std::string toString(unsigned int i_in)
{
char intbuf[16];
snprintf(intbuf, sizeof(intbuf), "%u", i_in);
return std::string(intbuf);
}
//----------------------------------------------------------------------
inline std::string toString(unsigned long i_in)
{
char longbuf[40];
snprintf(longbuf, sizeof(longbuf), "%lu", i_in);
return std::string(longbuf);
}
//----------------------------------------------------------------------
inline std::string toString(const char *i_in)
{
return std::string(i_in);
}
//----------------------------------------------------------------------
inline int atoi(const std::string &s_in)
{
return ::atoi(s_in.c_str());
}
//----------------------------------------------------------------------
inline std::string toHex(const std::string &s)
{
const char hexchars[] = "0123456789abcdef";
std::string tmp;
for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) {
unsigned char c = (unsigned char)*i;
tmp += hexchars[((c & 0xf0) >> 4)];
tmp += hexchars[c & 0x0f];
}
return tmp;
}
//----------------------------------------------------------------------
inline std::string fromHex(const std::string &s)
{
const char hexchars[] = "0123456789abcdef";
std::string tmp;
for (std::string::const_iterator i = s.begin();
i != s.end() && i + 1 != s.end(); i += 2) {
int n;
unsigned char c = *i;
unsigned char d = *(i + 1);
const char *t;
if ((t = strchr(hexchars, c)) == 0)
return "out of range";
n = (t - hexchars) << 4;
if ((t = strchr(hexchars, d)) == 0)
return "out of range";
n += (t - hexchars);
if (n >= 0 && n <= 255)
tmp += (char) n;
else
return "out of range";
}
return tmp;
}
//----------------------------------------------------------------------
inline std::string toImapString(const std::string &s_in)
{
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
unsigned char c = (unsigned char)*i;
if (c <= 31 || c >= 127 || c == '\"' || c == '\\')
return "{" + toString(s_in.length()) + "}\r\n" + s_in;
}
return "\"" + s_in + "\"";
}
//----------------------------------------------------------------------
inline void uppercase(std::string &input)
{
for (std::string::iterator i = input.begin(); i != input.end(); ++i)
*i = toupper(*i);
}
//----------------------------------------------------------------------
inline void lowercase(std::string &input)
{
for (std::string::iterator i = input.begin(); i != input.end(); ++i)
*i = tolower(*i);
}
//----------------------------------------------------------------------
inline void chomp(std::string &s_in, const std::string &chars = " \t\r\n")
{
int n = s_in.length();
while (n > 1 && chars.find(s_in[n - 1]) != std::string::npos)
s_in.resize(n-- - 1);
}
//----------------------------------------------------------------------
inline void trim(std::string &s_in, const std::string &chars = " \t\r\n")
{
while (s_in != "" && chars.find(s_in[0]) != std::string::npos)
s_in = s_in.substr(1);
chomp(s_in, chars);
}
//----------------------------------------------------------------------
inline const std::string unfold(const std::string &a,
bool removecomment = true)
{
std::string tmp;
bool incomment = false;
bool inquotes = false;
for (std::string::const_iterator i = a.begin(); i != a.end(); ++i) {
unsigned char c = (unsigned char)*i;
if (!inquotes && removecomment) {
if (c == '(') {
incomment = true;
tmp += " ";
} else if (c == ')') {
incomment = false;
} else if (c != 0x0a && c != 0x0d) {
tmp += *i;
}
} else if (c != 0x0a && c != 0x0d) {
tmp += *i;
}
if (!incomment) {
if (*i == '\"')
inquotes = !inquotes;
}
}
trim(tmp);
return tmp;
}
//----------------------------------------------------------------------
inline void split(const std::string &s_in, const std::string &delim,
std::vector<std::string> &dest, bool skipempty = true)
{
std::string token;
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
if (delim.find(*i) != std::string::npos) {
if (!skipempty || token != "")
dest.push_back(token);
token.clear();
} else
token += *i;
}
if (token != "")
dest.push_back(token);
}
//----------------------------------------------------------------------
inline void splitAddr(const std::string &s_in,
std::vector<std::string> &dest, bool skipempty = true)
{
static const std::string delim = ",";
std::string token;
bool inquote = false;
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
if (inquote && *i == '\"') inquote = false;
else if (!inquote && *i == '\"') inquote = true;
if (!inquote && delim.find(*i) != std::string::npos) {
if (!skipempty || token != "")
dest.push_back(token);
token.clear();
} else
token += *i;
}
if (token != "")
dest.push_back(token);
}
//----------------------------------------------------------------------
inline std::string toCanonMailbox(const std::string &s_in)
{
if (s_in.find("..") != std::string::npos) return std::string();
if (s_in.length() >= 5) {
std::string a = s_in.substr(0, 5);
uppercase(a);
return a == "INBOX" ?
a + (s_in.length() > 5 ? s_in.substr(5) : std::string()) : s_in;
}
return s_in;
}
//------------------------------------------------------------------------
inline std::string toRegex(const std::string &s_in, char delimiter)
{
std::string regex = "^";
for (std::string::const_iterator i = s_in.begin(); i != s_in.end(); ++i) {
if (*i == '.' || *i == '[' || *i == ']' || *i == '{' || *i == '}' ||
*i == '(' || *i == ')' || *i == '^' || *i == '$' || *i == '?' ||
*i == '+' || *i == '\\') {
regex += "\\";
regex += *i;
} else if (*i == '*')
regex += ".*?";
else if (*i == '%') {
regex += "(\\";
regex += delimiter;
regex += "){0,1}";
regex += "[^\\";
regex += delimiter;
regex += "]*?";
} else regex += *i;
}
if (regex[regex.length() - 1] == '?')
regex[regex.length() - 1] = '$';
else
regex += "$";
return regex;
}
//------------------------------------------------------------------------
class BincStream {
private:
std::string nstr;
public:
//--
BincStream &operator << (std::ostream&(*)(std::ostream&));
BincStream &operator << (const std::string &t);
BincStream &operator << (unsigned int t);
BincStream &operator << (int t);
BincStream &operator << (char t);
//--
std::string popString(unsigned int size);
//--
char popChar(void);
void unpopChar(char c);
void unpopStr(const std::string &s);
//--
const std::string &str(void) const;
//--
unsigned int getSize(void) const;
//--
void clear(void);
//--
BincStream(void);
~BincStream(void);
};
}
#endif

View file

@ -0,0 +1,322 @@
/*-*-mode:c++-*-*/
/* --------------------------------------------------------------------
* Filename:
* src/iodevice.cc
*
* Description:
* Implementation of the IODevice class.
* --------------------------------------------------------------------
* Copyright 2002, 2003 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#include "iodevice.h"
#include "convert.h" // BincStream
//#include "session.h" // getEnv/hasEnv
#include <stdlib.h>
#include <unistd.h>
#ifndef NO_NAMESPACES
using namespace ::std;
using namespace ::Binc;
#endif /* NO_NAMESPACES */
//------------------------------------------------------------------------
IODevice::IODevice(int f) : flags(f | IsEnabled),
maxInputBufferSize(0),
maxOutputBufferSize(0),
timeout(0),
readCount(0), writeCount(0),
outputLevel(ErrorLevel),
outputLevelLimit(ErrorLevel),
error(Unknown), errorString("Unknown error"),
dumpfd(0)
{
}
//------------------------------------------------------------------------
IODevice::~IODevice(void)
{
}
//------------------------------------------------------------------------
IODevice &IODevice::operator <<(ostream &(*source)(ostream &))
{
if (!(flags & IsEnabled) || outputLevel > outputLevelLimit)
return *this;
static std::ostream &(*endl_funcptr)(ostream &) = endl;
if (source != endl_funcptr)
return *this;
outputBuffer << "\r\n";
if (dumpfd)
::write(dumpfd, "\r\n", 2);
if (flags & FlushesOnEndl)
flush();
else if (flags & HasOutputLimit)
if (outputBuffer.getSize() > maxOutputBufferSize)
flush();
return *this;
}
//------------------------------------------------------------------------
bool IODevice::canRead(void) const
{
return false;
}
//------------------------------------------------------------------------
void IODevice::clear()
{
if (!(flags & IsEnabled))
return;
inputBuffer.clear();
outputBuffer.clear();
}
//------------------------------------------------------------------------
bool IODevice::flush()
{
if (!(flags & IsEnabled))
return true;
WriteResult writeResult = WriteWait;
do {
unsigned int s = outputBuffer.getSize();
if (s == 0)
break;
if (!waitForWrite())
return false;
writeResult = write();
if (writeResult == WriteError)
return false;
writeCount += s - outputBuffer.getSize();
} while (outputBuffer.getSize() > 0 && writeResult == WriteWait);
outputBuffer.clear();
return true;
}
//------------------------------------------------------------------------
void IODevice::setFlags(unsigned int f)
{
flags |= f;
}
//------------------------------------------------------------------------
void IODevice::clearFlags(unsigned int f)
{
flags &= ~f;
}
//------------------------------------------------------------------------
void IODevice::setMaxInputBufferSize(unsigned int max)
{
maxInputBufferSize = max;
}
//------------------------------------------------------------------------
void IODevice::setMaxOutputBufferSize(unsigned int max)
{
maxOutputBufferSize = max;
}
//------------------------------------------------------------------------
void IODevice::setTimeout(unsigned int t)
{
timeout = t;
if (t)
flags |= HasTimeout;
else
flags &= ~HasTimeout;
}
//------------------------------------------------------------------------
unsigned int IODevice::getTimeout(void) const
{
return timeout;
}
//------------------------------------------------------------------------
void IODevice::setOutputLevel(LogLevel level)
{
outputLevel = level;
}
//------------------------------------------------------------------------
IODevice::LogLevel IODevice::getOutputLevel(void) const
{
return outputLevel;
}
//------------------------------------------------------------------------
void IODevice::setOutputLevelLimit(LogLevel level)
{
outputLevelLimit = level;
}
//------------------------------------------------------------------------
IODevice::LogLevel IODevice::getOutputLevelLimit(void) const
{
return outputLevelLimit;
}
//------------------------------------------------------------------------
bool IODevice::readStr(string *dest, unsigned int max)
{
// If max is 0, fill the input buffer once only if it's empty.
if (!max && inputBuffer.getSize() == 0 && !fillInputBuffer())
return false;
// If max is != 0, wait until we have max.
while (max && inputBuffer.getSize() < max) {
if (!fillInputBuffer())
return false;
}
unsigned int bytesToRead = max ? max : inputBuffer.getSize();
*dest += inputBuffer.str().substr(0, bytesToRead);
if (dumpfd) {
::write(dumpfd, inputBuffer.str().substr(0, bytesToRead).c_str(),
bytesToRead);
}
inputBuffer.popString(bytesToRead);
readCount += bytesToRead;
return true;
}
//------------------------------------------------------------------------
bool IODevice::readChar(char *dest)
{
if (inputBuffer.getSize() == 0 && !fillInputBuffer())
return false;
char c = inputBuffer.popChar();
if (dest)
*dest = c;
if (dumpfd)
::write(dumpfd, &c, 1);
++readCount;
return true;
}
//------------------------------------------------------------------------
void IODevice::unreadChar(char c)
{
inputBuffer.unpopChar(c);
}
//------------------------------------------------------------------------
void IODevice::unreadStr(const string &s)
{
inputBuffer.unpopStr(s);
}
//------------------------------------------------------------------------
bool IODevice::skipTo(char c)
{
char dest = '\0';
do {
if (!readChar(&dest))
return false;
if (dumpfd)
::write(dumpfd, &dest, 1);
} while (c != dest);
return true;
}
//------------------------------------------------------------------------
string IODevice::service(void) const
{
return "nul";
}
//------------------------------------------------------------------------
bool IODevice::waitForWrite(void) const
{
return false;
}
//------------------------------------------------------------------------
bool IODevice::waitForRead(void) const
{
return false;
}
//------------------------------------------------------------------------
IODevice::WriteResult IODevice::write(void)
{
return WriteError;
}
//------------------------------------------------------------------------
bool IODevice::fillInputBuffer(void)
{
return false;
}
//------------------------------------------------------------------------
IODevice::Error IODevice::getLastError(void) const
{
return error;
}
//------------------------------------------------------------------------
string IODevice::getLastErrorString(void) const
{
return errorString;
}
//------------------------------------------------------------------------
unsigned int IODevice::getReadCount(void) const
{
return readCount;
}
//------------------------------------------------------------------------
unsigned int IODevice::getWriteCount(void) const
{
return writeCount;
}
//------------------------------------------------------------------------
void IODevice::enableProtocolDumping(void)
{
#if 0
BincStream ss;
ss << "/tmp/bincimap-dump-" << (int) time(0) << "-"
<< Session::getInstance().getIP() << "-XXXXXX";
char *safename = strdup(ss.str().c_str());
dumpfd = mkstemp(safename);
if (dumpfd == -1)
dumpfd = 0;
delete safename;
#endif
}

401
src/bincimapmime/iodevice.h Normal file
View file

@ -0,0 +1,401 @@
/*-*-mode:c++;c-basic-offset:2-*-*/
/* --------------------------------------------------------------------
* Filename:
* src/iodevice.h
*
* Description:
* Declaration of the IODevice class.
* --------------------------------------------------------------------
* Copyright 2002, 2003 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifndef iodevice_h_included
#define iodevice_h_included
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "convert.h" // BincStream
#include <string>
#include <unistd.h> // ::write
namespace Binc {
/*!
\class IODevice
\brief The IODevice class provides a framework for reading and
writing to device.
Implement new devices by inheriting this class and overloading all
virtual methods.
service() returns the service that the specific device is used
for. Two values are "log" and "client".
\sa IOFactory, MultilogDevice, SyslogDevice, StdIODevice, SSLDevice
*/
class IODevice {
public:
/*!
Standard options for an IODevice.
*/
enum Flags {
None = 0,
FlushesOnEndl = 1 << 0,
HasInputLimit = 1 << 1,
HasOutputLimit = 1 << 2,
IsEnabled = 1 << 3,
HasTimeout = 1 << 4
};
/*!
Errors from when an operation returned false.
*/
enum Error {
Unknown,
Timeout
};
/*!
Constructs an invalid IODevice.
Instances of IODevice perform no operations, and all boolean
functions always return false. This constructor is only useful
if called from a subclass that reimplements all virtual methods.
*/
IODevice(int f = 0);
/*!
Destructs an IODevice; does nothing.
*/
virtual ~IODevice(void);
/*!
Clears all data in the input and output buffers.
*/
void clear(void);
/*!
Sets one or more flags.
\param f A bitwise OR of flags from the Flags enum.
*/
void setFlags(unsigned int f);
/*!
Clears one or more flags.
\param f A bitwise OR of flags from the Flags enum.
*/
void clearFlags(unsigned int f);
/*!
Sets the maximum allowed input buffer size. If this size is
non-zero and exceeded, reading from the device will fail. This
functionality is used to prevent clients from forcing this class
to consume so much memory that the program crashes.
Setting the max input buffer size to 0 disables the input size
limit.
\param max The maximum input buffer size in bytes.
*/
void setMaxInputBufferSize(unsigned int max);
/*!
Sets the maximum allowed output buffer size. If this size is
non-zero and exceeded, flush() is called implicitly.
Setting the max output buffer size to 0 disables the output size
limit. This is generally discouraged.
As a contrast to setMaxInputBufferSize(), this function is used
to bundle up consequent write calls, allowing more efficient use
of the underlying device as larger blocks of data are written at
a time.
\param max The maximum output buffer size in bytes.
*/
void setMaxOutputBufferSize(unsigned int max);
/*!
Sets the device's internal timeout in seconds. This timeout is
used both when waiting for data to read and for waiting for the
ability to write.
If this timeout is exceeded, the read or write function that
triggered the timeout will fail.
Setting the timeout to 0 disables the timeout.
\param t The timeout in seconds.
\sa getTimeout()
*/
void setTimeout(unsigned int t);
/*!
Returns the timeout in seconds, or 0 if there is no timeout.
\sa setTimeout()
*/
unsigned int getTimeout(void) const;
enum LogLevel {
ErrorLevel,
InfoLevel,
WarningLevel,
DebugLevel
};
/*!
Sets the output level for the following write operations on this
device.
The output level is a number which gives the following write
operations a priority. You can use setOutputLevelLimit() to
filter the write operations valid for different operating modes.
This enables you to have certain write operations ignored.
For instance, if the output level is set to 0, then "Hello" is
written, and the output level is set to 1, followed by writing
"Daisy", the output level limit value will decive wether only
"Hello" is written, or if also "Daisy" is written.
A low value of the level gives higher priority, and a high level
will give low priority. The default value is 0, and write
operations that are done with output level 0 are never ignored.
\param level The output level
\sa getOutputLevel(), setOutputLevelLimit()
*/
void setOutputLevel(LogLevel level);
/*!
Returns the current output level.
\sa setOutputLevel()
*/
LogLevel getOutputLevel(void) const;
/*!
Sets the current output level limit. Write operations with a
level higher than the output level limit are ignored.
\param level The output level limit
\sa setOutputLevel()
*/
void setOutputLevelLimit(LogLevel level);
/*!
Returns the current output level limit.
\sa setOutputLevelLimit()
*/
LogLevel getOutputLevelLimit(void) const;
/*!
Returns the number of bytes that have been read from this device
since it was created.
*/
unsigned int getReadCount(void) const;
/*!
Returns the number of bytes that have been written to this
device since it was created.
*/
unsigned int getWriteCount(void) const;
/*!
Calling this function enables the built-in protocol dumping feature in
the device. All input and output to this device will be dumped to a file
in /tmp.
*/
void enableProtocolDumping(void);
/*!
Writes data to the device. Depending on the value of the max
output buffer size, the data may not be written immediately.
\sa setMaxOutputBufferSize()
*/
template <class T> IODevice &operator <<(const T &source);
/*!
Writes data to the device. This function specializes on standard
ostream derivates, such as std::endl.
*/
IODevice &operator <<(std::ostream &(*source)(std::ostream &));
/*!
Returns true if data can be read from the device; otherwise
returns false.
*/
virtual bool canRead(void) const;
/*!
Reads data from the device, and stores this in a string. Returns
true on success; otherwise returns false.
\param dest The incoming data is stored in this string.
\param max No more than this number of bytes is read from the
device.
*/
bool readStr(std::string *dest, unsigned int max = 0);
/*!
Reads exactly one byte from the device and stores this in a
char. Returns true on success; otherwise returns false.
\param dest The incoming byte is stored in this char.
*/
bool readChar(char *dest = 0);
/*!
FIXME: add docs
*/
void unreadChar(char c);
/*!
FIXME: add docs
*/
void unreadStr(const std::string &s);
/*!
Reads characters from the device, until and including one
certain character is found. All read characters are discarded.
This function can be used to skip to the beginning of a line,
with the terminating character being '\n'.
\param The certain character.
*/
bool skipTo(char c);
/*!
Flushes the output buffer. Writes all data in the output buffer
to the device.
*/
bool flush(void);
/*!
Returns the type of error that most recently occurred.
*/
Error getLastError(void) const;
/*!
Returns a human readable description of the error that most
recently occurred. If no known error has occurred, this method
returns "Unknown error".
*/
std::string getLastErrorString(void) const;
/*!
Returns the type of service provided by this device. Two valid
return values are "client" and "log".
*/
virtual std::string service(void) const;
protected:
/*!
Waits until data can be written to the device. If the timeout is
0, this function waits indefinitely. Otherwise, it waits until
the timeout has expired.
If this function returns true, data can be written to the
device; otherwise, getLastError() must be checked to determine
whether a timeout occurred or whether an error with the device
prevents further writing.
*/
virtual bool waitForWrite(void) const;
/*!
Waits until data can be read from the device.
\sa waitForWrite()
*/
virtual bool waitForRead(void) const;
/*!
Types of results from a write.
*/
enum WriteResult {
WriteWait = 0,
WriteDone = 1 << 0,
WriteError = 1 << 1
};
/*!
Writes as much data as possible to the device. If some but not
all data was written, returns WriteWait. If all data was
written, returns WriteDone. If an error occurred, returns
WriteError.
*/
virtual WriteResult write(void);
/*!
Reads data from the device, and stores it in the input buffer.
Returns true on success; otherwise returns false.
This method will fail if there is no more data available, if a
timeout occurred or if an error with the device prevents more
data from being read.
The number of bytes read from the device is undefined.
*/
virtual bool fillInputBuffer(void);
BincStream inputBuffer;
BincStream outputBuffer;
protected:
unsigned int flags;
unsigned int maxInputBufferSize;
unsigned int maxOutputBufferSize;
unsigned int timeout;
unsigned int readCount;
unsigned int writeCount;
LogLevel outputLevel;
LogLevel outputLevelLimit;
mutable Error error;
mutable std::string errorString;
int dumpfd;
};
//----------------------------------------------------------------------
template <class T> IODevice &IODevice::operator <<(const T &source)
{
if ((flags & IsEnabled) && outputLevel <= outputLevelLimit) {
outputBuffer << source;
if (dumpfd) {
BincStream ss;
ss << source;
::write(dumpfd, ss.str().c_str(), ss.getSize());
}
if (flags & HasInputLimit)
if (outputBuffer.getSize() > maxOutputBufferSize)
flush();
}
return *this;
}
}
#endif

View file

@ -0,0 +1,87 @@
/*-*-mode:c++-*-*/
/* --------------------------------------------------------------------
* Filename:
* src/iofactory.cc
*
* Description:
* Implementation of the IOFactory class.
* --------------------------------------------------------------------
* Copyright 2002, 2003 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#include "iofactory.h"
#include "iodevice.h"
#ifndef NO_NAMESPACES
using namespace ::Binc;
using namespace ::std;
#endif /* NO_NAMESPACES */
//------------------------------------------------------------------------
IOFactory::IOFactory(void)
{
}
//------------------------------------------------------------------------
IOFactory::~IOFactory(void)
{
}
//------------------------------------------------------------------------
IOFactory &IOFactory::getInstance(void)
{
static IOFactory ioFactory;
return ioFactory;
}
//------------------------------------------------------------------------
void IOFactory::addDevice(IODevice *dev)
{
IODevice *ioDevice = IOFactory::getInstance().devices[dev->service()];
// FIXME: Delete correct object. Now, only IODevice's destructor is
// called, and only IODevice's memory is freed.
if (ioDevice)
delete ioDevice;
IOFactory::getInstance().devices[dev->service()] = dev;
}
//------------------------------------------------------------------------
IODevice &IOFactory::getClient(void)
{
static IODevice nulDevice;
IOFactory &ioFactory = IOFactory::getInstance();
if (ioFactory.devices.find("client") != ioFactory.devices.end())
return *ioFactory.devices["client"];
return nulDevice;
}
//------------------------------------------------------------------------
IODevice &IOFactory::getLogger(void)
{
static IODevice nulDevice;
IOFactory &ioFactory = IOFactory::getInstance();
if (ioFactory.devices.find("log") != ioFactory.devices.end())
return *ioFactory.devices["log"];
return nulDevice;
}

View file

@ -0,0 +1,69 @@
/*-*-mode:c++-*-*/
/* --------------------------------------------------------------------
* Filename:
* src/iofactory.h
*
* Description:
* Declaration of the IOFactory class.
* --------------------------------------------------------------------
* Copyright 2002, 2003 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifndef IOFACTORY_H_INCLUDED
#define IOFACTORY_H_INCLUDED
#include <map>
#include <string>
#include "iodevice.h"
namespace Binc {
class IOFactory {
public:
~IOFactory(void);
static void addDevice(IODevice *dev);
static IOFactory &getInstance(void);
static IODevice &getClient(void);
static IODevice &getLogger(void);
private:
IOFactory(void);
std::map<std::string, IODevice *> devices;
};
}
#define bincClient \
IOFactory::getClient()
#if !defined (DEBUG)
#define bincError if (false) std::cout
#define bincWarning if (false) std::cout
#define bincDebug if (false) std::cout
#else
#define bincError \
IOFactory::getLogger().setOutputLevel(IODevice::ErrorLevel);IOFactory::getLogger()
#define bincWarning \
IOFactory::getLogger().setOutputLevel(IODevice::WarningLevel);IOFactory::getLogger()
#define bincDebug \
IOFactory::getLogger().setOutputLevel(IODevice::DebugLevel);IOFactory::getLogger()
#endif
#define bincInfo \
IOFactory::getLogger().setOutputLevel(IODevice::InfoLevel);IOFactory::getLogger()
#endif

View file

@ -0,0 +1,216 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* src/mime-inputsource.h
*
* Description:
* The base class of the MIME input source
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifndef mime_inputsource_h_included
#define mime_inputsource_h_included
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <unistd.h>
#include <iostream>
namespace Binc {
class MimeInputSource {
public:
// Note that we do NOT take ownership of fd, won't close it on delete
inline MimeInputSource(int fd, unsigned int start = 0);
virtual inline ~MimeInputSource(void);
virtual inline size_t fillRaw(char *raw, size_t nbytes);
virtual inline void reset(void);
virtual inline bool fillInputBuffer(void);
inline void seek(unsigned int offset);
inline bool getChar(char *c);
inline void ungetChar(void);
inline int getFileDescriptor(void) const;
inline unsigned int getOffset(void) const;
private:
int fd;
char data[16384];
unsigned int offset;
unsigned int tail;
unsigned int head;
unsigned int start;
char lastChar;
};
inline MimeInputSource::MimeInputSource(int fd, unsigned int start)
{
this->fd = fd;
this->start = start;
offset = 0;
tail = 0;
head = 0;
lastChar = '\0';
memset(data, '\0', sizeof(data));
seek(start);
}
inline MimeInputSource::~MimeInputSource(void)
{
}
inline size_t MimeInputSource::fillRaw(char *raw, size_t nbytes)
{
return read(fd, raw, nbytes);
}
inline bool MimeInputSource::fillInputBuffer(void)
{
char raw[4096];
ssize_t nbytes = fillRaw(raw, 4096);
if (nbytes <= 0) {
// FIXME: If ferror(crlffile) we should log this.
return false;
}
for (ssize_t i = 0; i < nbytes; ++i) {
const char c = raw[i];
if (c == '\r') {
if (lastChar == '\r') {
data[tail++ & (0x4000-1)] = '\r';
data[tail++ & (0x4000-1)] = '\n';
}
} else if (c == '\n') {
data[tail++ & (0x4000-1)] = '\r';
data[tail++ & (0x4000-1)] = '\n';
} else {
if (lastChar == '\r') {
data[tail++ & (0x4000-1)] = '\r';
data[tail++ & (0x4000-1)] = '\n';
}
data[tail++ & (0x4000-1)] = c;
}
lastChar = c;
}
return true;
}
inline void MimeInputSource::reset(void)
{
offset = head = tail = 0;
lastChar = '\0';
if (fd != -1)
lseek(fd, 0, SEEK_SET);
}
inline void MimeInputSource::seek(unsigned int seekToOffset)
{
if (offset > seekToOffset)
reset();
char c;
int n = 0;
while (seekToOffset > offset) {
if (!getChar(&c))
break;
++n;
}
}
inline bool MimeInputSource::getChar(char *c)
{
if (head == tail && !fillInputBuffer())
return false;
*c = data[head++ & (0x4000-1)];
++offset;
return true;
}
inline void MimeInputSource::ungetChar()
{
--head;
--offset;
}
inline int MimeInputSource::getFileDescriptor(void) const
{
return fd;
}
inline unsigned int MimeInputSource::getOffset(void) const
{
return offset;
}
///////////////////////////////////
class MimeInputSourceStream : public MimeInputSource {
public:
inline MimeInputSourceStream(istream& s, unsigned int start = 0);
virtual inline size_t fillRaw(char *raw, size_t nb);
virtual inline void reset(void);
private:
istream& s;
};
inline MimeInputSourceStream::MimeInputSourceStream(istream& si,
unsigned int start)
: MimeInputSource(-1, start), s(si)
{
}
inline size_t MimeInputSourceStream::fillRaw(char *raw, size_t nb)
{
// Why can't streams tell how many characters were actually read
// when hitting eof ?
std::streampos st = s.tellg();
s.seekg(0, ios::end);
std::streampos lst = s.tellg();
s.seekg(st);
size_t nbytes = lst - st;
if (nbytes > nb) {
nbytes = nb;
}
if (nbytes <= 0) {
return (size_t)-1;
}
s.read(raw, nbytes);
return nbytes;
}
inline void MimeInputSourceStream::reset(void)
{
MimeInputSource::reset();
s.seekg(0);
}
}
#endif

View file

@ -0,0 +1,629 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* mime-parsefull.cc
*
* Description:
* Implementation of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include <string>
#include <vector>
#include <map>
#include <exception>
#include <iostream>
#ifndef NO_NAMESPACES
using namespace ::std;
#endif /* NO_NAMESPACES */
#include "mime.h"
#include "mime-utils.h"
#include "mime-inputsource.h"
#include "convert.h"
// #define MPF
#ifdef MPF
#define MPFDEB(X) fprintf X
#else
#define MPFDEB(X)
#endif
//------------------------------------------------------------------------
void Binc::MimeDocument::parseFull(int fd)
{
if (allIsParsed)
return;
allIsParsed = true;
delete doc_mimeSource;
doc_mimeSource = new MimeInputSource(fd);
headerstartoffsetcrlf = 0;
headerlength = 0;
bodystartoffsetcrlf = 0;
bodylength = 0;
size = 0;
messagerfc822 = false;
multipart = false;
int bsize = 0;
string bound;
doParseFull(doc_mimeSource, bound, bsize);
// eat any trailing junk to get the correct size
char c;
while (doc_mimeSource->getChar(&c));
size = doc_mimeSource->getOffset();
}
void Binc::MimeDocument::parseFull(istream& s)
{
if (allIsParsed)
return;
allIsParsed = true;
delete doc_mimeSource;
doc_mimeSource = new MimeInputSourceStream(s);
headerstartoffsetcrlf = 0;
headerlength = 0;
bodystartoffsetcrlf = 0;
bodylength = 0;
size = 0;
messagerfc822 = false;
multipart = false;
int bsize = 0;
string bound;
doParseFull(doc_mimeSource, bound, bsize);
// eat any trailing junk to get the correct size
char c;
while (doc_mimeSource->getChar(&c));
size = doc_mimeSource->getOffset();
}
//------------------------------------------------------------------------
bool Binc::MimePart::parseOneHeaderLine(Binc::Header *header,
unsigned int *nlines)
{
using namespace ::Binc;
char c;
bool eof = false;
char cqueue[4];
string name;
string content;
while (mimeSource->getChar(&c)) {
// If we encounter a \r before we got to the first ':', then
// rewind back to the start of the line and assume we're at the
// start of the body.
if (c == '\r') {
for (int i = 0; i < (int) name.length() + 1; ++i)
mimeSource->ungetChar();
return false;
}
// A colon marks the end of the header name
if (c == ':') break;
// Otherwise add to the header name
name += c;
}
cqueue[0] = '\0';
cqueue[1] = '\0';
cqueue[2] = '\0';
cqueue[3] = '\0';
// Read until the end of the header.
bool endOfHeaders = false;
while (!endOfHeaders) {
if (!mimeSource->getChar(&c)) {
eof = true;
break;
}
if (c == '\n') ++*nlines;
for (int i = 0; i < 3; ++i)
cqueue[i] = cqueue[i + 1];
cqueue[3] = c;
if (strncmp(cqueue, "\r\n\r\n", 4) == 0) {
endOfHeaders = true;
break;
}
// If the last character was a newline, and the first now is not
// whitespace, then rewind one character and store the current
// key,value pair.
if (cqueue[2] == '\n' && c != ' ' && c != '\t') {
if (content.length() > 2)
content.resize(content.length() - 2);
trim(content);
header->add(name, content);
if (c != '\r') {
mimeSource->ungetChar();
if (c == '\n') --*nlines;
return true;
}
mimeSource->getChar(&c);
return false;
}
content += c;
}
if (name != "") {
if (content.length() > 2)
content.resize(content.length() - 2);
header->add(name, content);
}
return !(eof || endOfHeaders);
}
//------------------------------------------------------------------------
void Binc::MimePart::parseHeader(Binc::Header *header, unsigned int *nlines)
{
while (parseOneHeaderLine(header, nlines))
{ }
}
//------------------------------------------------------------------------
void Binc::MimePart::analyzeHeader(Binc::Header *header, bool *multipart,
bool *messagerfc822, string *subtype,
string *boundary)
{
using namespace ::Binc;
// Do simple parsing of headers to determine the
// type of message (multipart,messagerfc822 etc)
HeaderItem ctype;
if (header->getFirstHeader("content-type", ctype)) {
vector<string> types;
split(ctype.getValue(), ";", types);
if (types.size() > 0) {
// first element should describe content type
string tmp = types[0];
trim(tmp);
vector<string> v;
split(tmp, "/", v);
string key, value;
key = (v.size() > 0) ? v[0] : "text";
value = (v.size() > 1) ? v[1] : "plain";
lowercase(key);
if (key == "multipart") {
*multipart = true;
lowercase(value);
*subtype = value;
} else if (key == "message") {
lowercase(value);
if (value == "rfc822")
*messagerfc822 = true;
}
}
for (vector<string>::const_iterator i = types.begin();
i != types.end(); ++i) {
string element = *i;
trim(element);
if (element.find("=") != string::npos) {
string::size_type pos = element.find('=');
string key = element.substr(0, pos);
string value = element.substr(pos + 1);
lowercase(key);
trim(key);
if (key == "boundary") {
trim(value, " \"");
*boundary = value;
}
}
}
}
}
void Binc::MimePart::parseMessageRFC822(vector<Binc::MimePart> *members,
bool *foundendofpart,
unsigned int *bodylength,
unsigned int *nbodylines,
const string &toboundary)
{
using namespace ::Binc;
// message rfc822 means a completely enclosed mime document. we
// call the parser recursively, and pass on the boundary string
// that we got. when parse() finds this boundary, it returns 0. if
// it finds the end boundary (boundary + "--"), it returns != 0.
MimePart m;
unsigned int bodystartoffsetcrlf = mimeSource->getOffset();
// parsefull returns the number of bytes that need to be removed
// from the body because of the terminating boundary string.
int bsize = 0;
if (m.doParseFull(mimeSource, toboundary, bsize))
*foundendofpart = true;
// make sure bodylength doesn't overflow
*bodylength = mimeSource->getOffset();
if (*bodylength >= bodystartoffsetcrlf) {
*bodylength -= bodystartoffsetcrlf;
if (*bodylength >= (unsigned int) bsize) {
*bodylength -= (unsigned int) bsize;
} else {
*bodylength = 0;
}
} else {
*bodylength = 0;
}
*nbodylines += m.getNofLines();
members->push_back(m);
}
bool Binc::MimePart::skipUntilBoundary(const string &delimiter,
unsigned int *nlines, bool *eof)
{
int endpos = delimiter.length();
char *delimiterqueue = 0;
int delimiterpos = 0;
const char *delimiterStr = delimiter.c_str();
if (delimiter != "") {
delimiterqueue = new char[endpos];
memset(delimiterqueue, 0, endpos);
}
// first, skip to the first delimiter string. Anything between the
// header and the first delimiter string is simply ignored (it's
// usually a text message intended for non-mime clients)
char c;
bool foundBoundary = false;
for (;;) {
if (!mimeSource->getChar(&c)) {
*eof = true;
break;
}
if (c == '\n')
++*nlines;
// if there is no delimiter, we just read until the end of the
// file.
if (!delimiterqueue)
continue;
delimiterqueue[delimiterpos++] = c;
if (delimiterpos == endpos)
delimiterpos = 0;
if (compareStringToQueue(delimiterStr, delimiterqueue,
delimiterpos, endpos)) {
foundBoundary = true;
break;
}
}
delete [] delimiterqueue;
delimiterqueue = 0;
return foundBoundary;
}
// JFD: Things we do after finding a boundary (something like CRLF--somestring)
// Need to see if this is a final one (with an additional -- at the end),
// and need to check if it is immediately followed by another boundary
// (in this case, we give up our final CRLF in its favour)
inline void Binc::MimePart::postBoundaryProcessing(bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart)
{
// Read two more characters. This may be CRLF, it may be "--" and
// it may be any other two characters.
char a = '\0';
if (!mimeSource->getChar(&a))
*eof = true;
if (a == '\n')
++*nlines;
char b = '\0';
if (!mimeSource->getChar(&b))
*eof = true;
if (b == '\n')
++*nlines;
// If eof, we're done here
if (*eof)
return;
// If we find two dashes after the boundary, then this is the end
// of boundary marker, and we need to get 2 more chars
if (a == '-' && b == '-') {
*foundendofpart = true;
*boundarysize += 2;
if (!mimeSource->getChar(&a))
*eof = true;
if (a == '\n')
++*nlines;
if (!mimeSource->getChar(&b))
*eof = true;
if (b == '\n')
++*nlines;
}
// If the boundary is followed by CRLF, we need to handle the
// special case where another boundary line follows
// immediately. In this case we consider the CRLF to be part of
// the NEXT boundary.
if (a == '\r' && b == '\n') {
// Get 2 more
if (!mimeSource->getChar(&a) || !mimeSource->getChar(&b)) {
*eof = true;
} else if (a == '-' && b == '-') {
MPFDEB((stderr, "BINC: consecutive delimiters, giving up CRLF\n"));
mimeSource->ungetChar();
mimeSource->ungetChar();
mimeSource->ungetChar();
mimeSource->ungetChar();
} else {
// We unget the 2 chars, and keep our crlf (increasing our own size)
MPFDEB((stderr, "BINC: keeping my CRLF\n"));
mimeSource->ungetChar();
mimeSource->ungetChar();
*boundarysize += 2;
}
} else {
// Boundary string not followed by CRLF, don't read more and let
// others skip the rest. Note that this is allowed but quite uncommon
mimeSource->ungetChar();
mimeSource->ungetChar();
}
}
void Binc::MimePart::parseMultipart(const string &boundary,
const string &toboundary,
bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart,
unsigned int *bodylength,
vector<Binc::MimePart> *members)
{
MPFDEB((stderr, "BINC: ParseMultipart: boundary [%s], toboundary[%s]\n",
boundary.c_str(),
toboundary.c_str()));
using namespace ::Binc;
unsigned int bodystartoffsetcrlf = mimeSource->getOffset();
// multipart parsing starts with skipping to the first
// boundary. then we call parse() for all parts. the last parse()
// command will return a code indicating that it found the last
// boundary of this multipart. Note that the first boundary does
// not have to start with CRLF.
string delimiter = "--" + boundary;
skipUntilBoundary(delimiter, nlines, eof);
if (!eof)
*boundarysize = delimiter.size();
postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart);
// read all mime parts.
if (!*foundendofpart && !*eof) {
bool quit = false;
do {
MimePart m;
// If parseFull returns != 0, then it encountered the multipart's
// final boundary.
int bsize = 0;
if (m.doParseFull(mimeSource, boundary, bsize)) {
quit = true;
*boundarysize = bsize;
}
members->push_back(m);
} while (!quit);
}
if (!*foundendofpart && !*eof) {
// multipart parsing starts with skipping to the first
// boundary. then we call parse() for all parts. the last parse()
// command will return a code indicating that it found the last
// boundary of this multipart. Note that the first boundary does
// not have to start with CRLF.
string delimiter = "\r\n--" + toboundary;
skipUntilBoundary(delimiter, nlines, eof);
if (!*eof)
*boundarysize = delimiter.size();
postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart);
}
// make sure bodylength doesn't overflow
*bodylength = mimeSource->getOffset();
if (*bodylength >= bodystartoffsetcrlf) {
*bodylength -= bodystartoffsetcrlf;
if (*bodylength >= (unsigned int) *boundarysize) {
*bodylength -= (unsigned int) *boundarysize;
} else {
*bodylength = 0;
}
} else {
*bodylength = 0;
}
MPFDEB((stderr, "BINC: ParseMultipart return\n"));
}
void Binc::MimePart::parseSinglePart(const string &toboundary,
int *boundarysize,
unsigned int *nbodylines,
unsigned int *nlines,
bool *eof, bool *foundendofpart,
unsigned int *bodylength)
{
MPFDEB((stderr, "BINC: parseSinglePart, boundary [%s]\n",
toboundary.c_str()));
using namespace ::Binc;
unsigned int bodystartoffsetcrlf = mimeSource->getOffset();
// If toboundary is empty, then we read until the end of the
// file. Otherwise we will read until we encounter toboundary.
string _toboundary;
if (toboundary != "") {
_toboundary = "\r\n--";
_toboundary += toboundary;
}
// if (skipUntilBoundary(_toboundary, nlines, eof))
// *boundarysize = _toboundary.length();
char *boundaryqueue = 0;
int endpos = _toboundary.length();
if (toboundary != "") {
boundaryqueue = new char[endpos];
memset(boundaryqueue, 0, endpos);
}
*boundarysize = 0;
const char *_toboundaryStr = _toboundary.c_str();
string line;
bool toboundaryIsEmpty = (toboundary == "");
char c;
int boundarypos = 0;
while (mimeSource->getChar(&c)) {
if (c == '\n') { ++*nbodylines; ++*nlines; }
if (toboundaryIsEmpty)
continue;
// find boundary
boundaryqueue[boundarypos++] = c;
if (boundarypos == endpos)
boundarypos = 0;
if (compareStringToQueue(_toboundaryStr, boundaryqueue,
boundarypos, endpos)) {
*boundarysize = _toboundary.length();
break;
}
}
delete [] boundaryqueue;
if (toboundary != "") {
postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart);
} else {
// Recoll: in the case of a multipart body with a null
// boundary (probably illegal but wtf), eof was not set and
// multipart went into a loop until bad alloc.
*eof = true;
}
// make sure bodylength doesn't overflow
*bodylength = mimeSource->getOffset();
if (*bodylength >= bodystartoffsetcrlf) {
*bodylength -= bodystartoffsetcrlf;
if (*bodylength >= (unsigned int) *boundarysize) {
*bodylength -= (unsigned int) *boundarysize;
} else {
*bodylength = 0;
}
} else {
*bodylength = 0;
}
MPFDEB((stderr, "BINC: parseSimple ret: bodylength %d, boundarysize %d\n",
*bodylength, *boundarysize));
}
//------------------------------------------------------------------------
int Binc::MimePart::doParseFull(MimeInputSource *ms, const string &toboundary,
int &boundarysize)
{
MPFDEB((stderr, "BINC: doParsefull, toboundary[%s]\n", toboundary.c_str()));
mimeSource = ms;
headerstartoffsetcrlf = mimeSource->getOffset();
// Parse the header of this mime part.
parseHeader(&h, &nlines);
// Headerlength includes the seperating CRLF. Body starts after the
// CRLF.
headerlength = mimeSource->getOffset() - headerstartoffsetcrlf;
bodystartoffsetcrlf = mimeSource->getOffset();
MPFDEB((stderr, "BINC: doParsefull, bodystartoffsetcrlf %d\n", bodystartoffsetcrlf));
bodylength = 0;
// Determine the type of mime part by looking at fields in the
// header.
analyzeHeader(&h, &multipart, &messagerfc822, &subtype, &boundary);
bool eof = false;
bool foundendofpart = false;
if (messagerfc822) {
parseMessageRFC822(&members, &foundendofpart, &bodylength,
&nbodylines, toboundary);
} else if (multipart) {
parseMultipart(boundary, toboundary, &eof, &nlines, &boundarysize,
&foundendofpart, &bodylength,
&members);
} else {
parseSinglePart(toboundary, &boundarysize, &nbodylines, &nlines,
&eof, &foundendofpart, &bodylength);
}
MPFDEB((stderr, "BINC: doParsefull ret, toboundary[%s]\n", toboundary.c_str()));
return (eof || foundendofpart) ? 1 : 0;
}

View file

@ -0,0 +1,193 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* mime-parseonlyheader.cc
*
* Description:
* Implementation of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "mime.h"
#include "mime-utils.h"
#include "mime-inputsource.h"
#include "convert.h"
#include <string>
#include <vector>
#include <map>
#include <exception>
#include <iostream>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#ifndef NO_NAMESPACES
using namespace ::std;
#endif /* NO_NAMESPACES */
//------------------------------------------------------------------------
void Binc::MimeDocument::parseOnlyHeader(int fd)
{
if (allIsParsed || headerIsParsed)
return;
headerIsParsed = true;
delete doc_mimeSource;
doc_mimeSource = new MimeInputSource(fd);
headerstartoffsetcrlf = 0;
headerlength = 0;
bodystartoffsetcrlf = 0;
bodylength = 0;
messagerfc822 = false;
multipart = false;
nlines = 0;
nbodylines = 0;
doParseOnlyHeader(doc_mimeSource, "");
}
void Binc::MimeDocument::parseOnlyHeader(istream& s)
{
if (allIsParsed || headerIsParsed)
return;
headerIsParsed = true;
delete doc_mimeSource;
doc_mimeSource = new MimeInputSourceStream(s);
headerstartoffsetcrlf = 0;
headerlength = 0;
bodystartoffsetcrlf = 0;
bodylength = 0;
messagerfc822 = false;
multipart = false;
nlines = 0;
nbodylines = 0;
doParseOnlyHeader(doc_mimeSource, "");
}
//------------------------------------------------------------------------
int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms,
const string &toboundary)
{
mimeSource = ms;
string name;
string content;
char cqueue[4];
memset(cqueue, 0, sizeof(cqueue));
headerstartoffsetcrlf = mimeSource->getOffset();
bool quit = false;
char c = '\0';
while (!quit) {
// read name
while (1) {
if (!mimeSource->getChar(&c)) {
quit = true;
break;
}
if (c == '\n') ++nlines;
if (c == ':') break;
if (c == '\n') {
for (int i = name.length() - 1; i >= 0; --i)
mimeSource->ungetChar();
quit = true;
name.clear();
break;
}
name += c;
if (name.length() == 2 && name.substr(0, 2) == "\r\n") {
name.clear();
quit = true;
break;
}
}
if (name.length() == 1 && name[0] == '\r') {
name.clear();
break;
}
if (quit) break;
while (!quit) {
if (!mimeSource->getChar(&c)) {
quit = true;
break;
}
if (c == '\n') ++nlines;
for (int i = 0; i < 3; ++i)
cqueue[i] = cqueue[i + 1];
cqueue[3] = c;
if (strncmp(cqueue, "\r\n\r\n", 4) == 0) {
quit = true;
break;
}
if (cqueue[2] == '\n') {
// guess the mime rfc says what can not appear on the beginning
// of a line.
if (!isspace(cqueue[3])) {
if (content.length() > 2)
content.resize(content.length() - 2);
trim(content);
h.add(name, content);
name = c;
content.clear();
break;
}
}
content += c;
}
}
if (name != "") {
if (content.length() > 2)
content.resize(content.length() - 2);
h.add(name, content);
}
headerlength = mimeSource->getOffset() - headerstartoffsetcrlf;
return 1;
}

View file

@ -0,0 +1,90 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* mime-printbody.cc
*
* Description:
* Implementation of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "mime.h"
#include "mime-utils.h"
#include "mime-inputsource.h"
#include "convert.h"
#include "iodevice.h"
#include "iofactory.h"
#include <string>
#include <vector>
#include <map>
#include <exception>
#include <iostream>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#ifndef NO_NAMESPACES
using namespace ::std;
#endif /* NO_NAMESPACES */
//------------------------------------------------------------------------
void Binc::MimePart::printBody(IODevice &output,
unsigned int startoffset,
unsigned int length) const
{
mimeSource->reset();
mimeSource->seek(bodystartoffsetcrlf + startoffset);
if (startoffset + length > bodylength)
length = bodylength - startoffset;
char c = '\0';
for (unsigned int i = 0; i < length; ++i) {
if (!mimeSource->getChar(&c))
break;
output << (char)c;
}
}
void Binc::MimePart::getBody(string &s,
unsigned int startoffset,
unsigned int length) const
{
mimeSource->reset();
mimeSource->seek(bodystartoffsetcrlf + startoffset);
s.reserve(length);
if (startoffset + length > bodylength)
length = bodylength - startoffset;
char c = '\0';
for (unsigned int i = 0; i < length; ++i) {
if (!mimeSource->getChar(&c))
break;
s += (char)c;
}
}

View file

@ -0,0 +1,55 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* mime.cc
*
* Description:
* Implementation of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifndef mime_utils_h_included
#define mime_utils_h_included
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#ifndef NO_NAMESPACES
using namespace ::std;
#endif /* NO_NAMESPACES */
inline bool compareStringToQueue(const char *s_in, char *bqueue,
int pos, int size)
{
for (int i = 0; i < size; ++i) {
if (s_in[i] != bqueue[pos])
return false;
if (++pos == size)
pos = 0;
}
return true;
}
#endif

168
src/bincimapmime/mime.cc Normal file
View file

@ -0,0 +1,168 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* mime.cc
*
* Description:
* Implementation of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include <string>
#include <vector>
#include <map>
#include <exception>
#include <iostream>
#ifndef NO_NAMESPACES
using namespace ::std;
#endif /* NO_NAMESPACES */
#include "mime.h"
#include "convert.h"
#include "mime-inputsource.h"
//------------------------------------------------------------------------
Binc::MimeDocument::MimeDocument(void)
{
allIsParsed = false;
headerIsParsed = false;
doc_mimeSource = 0;
}
//------------------------------------------------------------------------
Binc::MimeDocument::~MimeDocument(void)
{
delete doc_mimeSource;
doc_mimeSource = 0;
}
//------------------------------------------------------------------------
void Binc::MimeDocument::clear(void)
{
members.clear();
h.clear();
headerIsParsed = false;
allIsParsed = false;
delete doc_mimeSource;
doc_mimeSource = 0;
}
//------------------------------------------------------------------------
void Binc::MimePart::clear(void)
{
members.clear();
h.clear();
mimeSource = 0;
}
//------------------------------------------------------------------------
Binc::MimePart::MimePart(void)
{
size = 0;
messagerfc822 = false;
multipart = false;
nlines = 0;
nbodylines = 0;
mimeSource = 0;
}
//------------------------------------------------------------------------
Binc::MimePart::~MimePart(void)
{
}
//------------------------------------------------------------------------
Binc::HeaderItem::HeaderItem(void)
{
}
//------------------------------------------------------------------------
Binc::HeaderItem::HeaderItem(const string &key, const string &value)
{
this->key = key;
this->value = value;
}
//------------------------------------------------------------------------
Binc::Header::Header(void)
{
}
//------------------------------------------------------------------------
Binc::Header::~Header(void)
{
}
//------------------------------------------------------------------------
bool Binc::Header::getFirstHeader(const string &key, HeaderItem &dest) const
{
string k = key;
lowercase(k);
for (vector<HeaderItem>::const_iterator i = content.begin();
i != content.end(); ++i) {
string tmp = (*i).getKey();
lowercase(tmp);
if (tmp == k) {
dest = *i;
return true;
}
}
return false;
}
//------------------------------------------------------------------------
bool Binc::Header::getAllHeaders(const string &key, vector<HeaderItem> &dest) const
{
string k = key;
lowercase(k);
for (vector<HeaderItem>::const_iterator i = content.begin();
i != content.end(); ++i) {
string tmp = (*i).getKey();
lowercase(tmp);
if (tmp == k)
dest.push_back(*i);
}
return (dest.size() != 0);
}
//------------------------------------------------------------------------
void Binc::Header::clear(void)
{
content.clear();
}
//------------------------------------------------------------------------
void Binc::Header::add(const string &key, const string &value)
{
content.push_back(HeaderItem(key, value));
}

191
src/bincimapmime/mime.h Normal file
View file

@ -0,0 +1,191 @@
/* -*- mode:c++;c-basic-offset:2 -*- */
/* --------------------------------------------------------------------
* Filename:
* src/parsers/mime/mime.h
*
* Description:
* Declaration of main mime parser components
* --------------------------------------------------------------------
* Copyright 2002-2005 Andreas Aardal Hanssen
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
* --------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef mime_h_included
#define mime_h_included
#include <string>
#include <vector>
#include <map>
#include <stdio.h>
namespace Binc {
class MimeInputSource;
//----------------------------------------------------------------------
class HeaderItem {
private:
mutable std::string key;
mutable std::string value;
public:
inline const std::string &getKey(void) const { return key; }
inline const std::string &getValue(void) const { return value; }
//--
HeaderItem(void);
HeaderItem(const std::string &key, const std::string &value);
};
//----------------------------------------------------------------------
class Header {
private:
mutable std::vector<HeaderItem> content;
public:
bool getFirstHeader(const std::string &key, HeaderItem &dest) const;
bool getAllHeaders(const std::string &key, std::vector<HeaderItem> &dest) const;
void add(const std::string &name, const std::string &content);
void clear(void);
//--
Header(void);
~Header(void);
};
//----------------------------------------------------------------------
class IODevice;
class MimeDocument;
class MimePart {
protected:
public:
mutable bool multipart;
mutable bool messagerfc822;
mutable std::string subtype;
mutable std::string boundary;
mutable unsigned int headerstartoffsetcrlf;
mutable unsigned int headerlength;
mutable unsigned int bodystartoffsetcrlf;
mutable unsigned int bodylength;
mutable unsigned int nlines;
mutable unsigned int nbodylines;
mutable unsigned int size;
public:
enum FetchType {
FetchBody,
FetchHeader,
FetchMime
};
mutable Header h;
mutable std::vector<MimePart> members;
inline const std::string &getSubType(void) const { return subtype; }
inline bool isMultipart(void) const { return multipart; }
inline bool isMessageRFC822(void) const { return messagerfc822; }
inline unsigned int getSize(void) const { return bodylength; }
inline unsigned int getNofLines(void) const { return nlines; }
inline unsigned int getNofBodyLines(void) const { return nbodylines; }
inline unsigned int getBodyLength(void) const { return bodylength; }
inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; }
void printBody(Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
void getBody(std::string& s, unsigned int startoffset, unsigned int length) const;
virtual void clear(void);
virtual int doParseOnlyHeader(MimeInputSource *ms,
const std::string &toboundary);
virtual int doParseFull(MimeInputSource *ms,
const std::string &toboundary, int &boundarysize);
MimePart(void);
virtual ~MimePart(void);
private:
MimeInputSource *mimeSource;
bool parseOneHeaderLine(Binc::Header *header, unsigned int *nlines);
bool skipUntilBoundary(const std::string &delimiter,
unsigned int *nlines, bool *eof);
inline void postBoundaryProcessing(bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart);
void parseMultipart(const std::string &boundary,
const std::string &toboundary,
bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart,
unsigned int *bodylength,
std::vector<Binc::MimePart> *members);
void parseSinglePart(const std::string &toboundary,
int *boundarysize,
unsigned int *nbodylines,
unsigned int *nlines,
bool *eof, bool *foundendofpart,
unsigned int *bodylength);
void parseHeader(Binc::Header *header, unsigned int *nlines);
void analyzeHeader(Binc::Header *header, bool *multipart,
bool *messagerfc822, std::string *subtype,
std::string *boundary);
void parseMessageRFC822(std::vector<Binc::MimePart> *members,
bool *foundendofpart,
unsigned int *bodylength,
unsigned int *nbodylines,
const std::string &toboundary);
};
//----------------------------------------------------------------------
class MimeDocument : public MimePart {
public:
MimeDocument(void);
~MimeDocument(void);
void parseOnlyHeader(int fd);
void parseFull(int fd);
void parseOnlyHeader(std::istream& s);
void parseFull(std::istream& s);
void clear(void);
bool isHeaderParsed(void) const
{
return headerIsParsed;
}
bool isAllParsed(void) const
{
return allIsParsed;
}
private:
bool headerIsParsed;
bool allIsParsed;
MimeInputSource *doc_mimeSource;
};
};
#endif

126
src/bincimapmime/trbinc.cc Normal file
View file

@ -0,0 +1,126 @@
/* Copyright (C) 2006 J.F.Dockes */
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sstream>
#ifndef NO_NAMESPACES
using namespace std;
#endif /* NO_NAMESPACES */
#include "mime.h"
static char *thisprog;
static char usage [] =
"trbinc <mboxfile> \n\n"
;
static void
Usage(void)
{
fprintf(stderr, "%s: usage:\n%s", thisprog, usage);
exit(1);
}
static int op_flags;
#define OPT_MOINS 0x1
#define OPT_s 0x2
#define OPT_b 0x4
#define DEFCOUNT 10
const char *hnames[] = {"Subject", "Content-type"};
int nh = sizeof(hnames) / sizeof(char *);
int main(int argc, char **argv)
{
int count = DEFCOUNT;
thisprog = argv[0];
argc--; argv++;
while (argc > 0 && **argv == '-') {
(*argv)++;
if (!(**argv))
/* Cas du "adb - core" */
Usage();
while (**argv)
switch (*(*argv)++) {
case 's': op_flags |= OPT_s; break;
case 'b': op_flags |= OPT_b; if (argc < 2) Usage();
if ((sscanf(*(++argv), "%d", &count)) != 1)
Usage();
argc--;
goto b1;
default: Usage(); break;
}
b1: argc--; argv++;
}
if (argc != 1)
Usage();
char *mfile = *argv++;argc--;
int fd;
if ((fd = open(mfile, 0)) < 0) {
perror("Opening");
exit(1);
}
Binc::MimeDocument doc;
#if 0
doc.parseFull(fd);
#else
char *cp;
int size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, 0);
fprintf(stderr, "Size: %d\n", size);
cp = (char *)malloc(size);
if (cp==0) {
fprintf(stderr, "Malloc %d failed\n", size);
exit(1);
}
int n;
if ((n=read(fd, cp, size)) != size) {
fprintf(stderr, "Read failed: requested %d, got %d\n", size, n);
exit(1);
}
std::stringstream s(string(cp, size), ios::in);
doc.parseFull(s);
#endif
if (!doc.isHeaderParsed() && !doc.isAllParsed()) {
fprintf(stderr, "Parse error\n");
exit(1);
}
close(fd);
Binc::HeaderItem hi;
for (int i = 0; i < nh ; i++) {
if (!doc.h.getFirstHeader(hnames[i], hi)) {
fprintf(stderr, "No %s\n", hnames[i]);
exit(1);
}
printf("%s: %s\n", hnames[i], hi.getValue().c_str());
}
exit(0);
}

33
src/common/Makefile Normal file
View file

@ -0,0 +1,33 @@
depth = ..
include $(depth)/mk/sysconf
# Only test executables get build in here
PROGS = unacpp textsplit rclconfig
all: librecoll $(PROGS)
UNACPP_OBJS= trunacpp.o
unacpp : $(UNACPP_OBJS)
$(CXX) $(ALL_CXXFLAGS) -o unacpp $(UNACPP_OBJS) \
$(LIBRECOLL) $(LIBICONV)
trunacpp.o : unacpp.cpp unacpp.h
$(CXX) $(ALL_CXXFLAGS) -DTEST_UNACPP -c -o trunacpp.o unacpp.cpp
TEXTSPLIT_OBJS= trtextsplit.o
textsplit : $(TEXTSPLIT_OBJS)
$(CXX) $(ALL_CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS) \
$(LIBRECOLL) $(LIBICONV)
trtextsplit.o : textsplit.cpp
$(CXX) $(ALL_CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \
textsplit.cpp
RCLCONFIG_OBJS= trrclconfig.o
rclconfig : $(RCLCONFIG_OBJS)
$(CXX) $(ALL_CXXFLAGS) -o rclconfig $(RCLCONFIG_OBJS) \
$(LIBRECOLL) $(LIBICONV) $(LIBSYS)
trrclconfig.o : rclconfig.cpp
$(CXX) $(ALL_CXXFLAGS) -DTEST_RCLCONFIG -c -o trrclconfig.o \
rclconfig.cpp
include $(depth)/mk/commontargets

115
src/common/autoconfig.h.in Normal file
View file

@ -0,0 +1,115 @@
/* common/autoconfig.h.in. Generated from configure.ac by autoheader. */
/* Path to the aspell api include file */
#undef ASPELL_INCLUDE
/* Path to the aspell program */
#undef ASPELL_PROG
/* No X11 session monitoring support */
#undef DISABLE_X11MON
/* Path to the fam api include file */
#undef FAM_INCLUDE
/* Path to the file program */
#undef FILE_PROG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mkdtemp' function. */
#undef HAVE_MKDTEMP
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/mount.h> header file. */
#undef HAVE_SYS_MOUNT_H
/* Define to 1 if you have the <sys/statfs.h> header file. */
#undef HAVE_SYS_STATFS_H
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#undef HAVE_SYS_STATVFS_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* putenv parameter is const */
#undef PUTENV_ARG_CONST
/* iconv parameter 2 is const char** */
#undef RCL_ICONV_INBUF_CONST
/* Real time monitoring option */
#undef RCL_MONITOR
/* Split camelCase words */
#undef RCL_SPLIT_CAMELCASE
/* Compile the aspell interface */
#undef RCL_USE_ASPELL
/* Compile the fam interface */
#undef RCL_USE_FAM
/* Compile the inotify interface */
#undef RCL_USE_INOTIFY
/* Use multiple threads for indexing */
#undef IDX_THREADS
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Enable using the system's 'file' command to id mime if we fail internally
*/
#undef USE_SYSTEM_FILE_COMMAND
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
#undef _FILE_OFFSET_BITS
#undef _LARGE_FILES
#undef WORDS_BIGENDIAN
#undef HAVE_TR1_UNORDERED
#undef HAVE_CXX0X_UNORDERED

View file

@ -0,0 +1,95 @@
/* Copyright (C) 2011 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "autoconfig.h"
#include "cstr.h"
#include "beaglequeuecache.h"
#include "circache.h"
#include "debuglog.h"
#include "rclconfig.h"
#include "pathut.h"
#include "rcldoc.h"
const string cstr_bgc_mimetype("mimetype");
BeagleQueueCache::BeagleQueueCache(RclConfig *cnf)
{
string ccdir;
cnf->getConfParam("webcachedir", ccdir);
if (ccdir.empty())
ccdir = "webcache";
ccdir = path_tildexpand(ccdir);
// If not an absolute path, compute relative to config dir
if (ccdir.at(0) != '/')
ccdir = path_cat(cnf->getConfDir(), ccdir);
int maxmbs = 40;
cnf->getConfParam("webcachemaxmbs", &maxmbs);
if ((m_cache = new CirCache(ccdir)) == 0) {
LOGERR(("BeagleQueueCache: cant create CirCache object\n"));
return;
}
if (!m_cache->create(off_t(maxmbs)*1000*1024, CirCache::CC_CRUNIQUE)) {
LOGERR(("BeagleQueueCache: cache file creation failed: %s\n",
m_cache->getReason().c_str()));
delete m_cache;
m_cache = 0;
return;
}
}
BeagleQueueCache::~BeagleQueueCache()
{
delete m_cache;
}
// Read document from cache. Return the metadata as an Rcl::Doc
// @param htt Beagle Hit Type
bool BeagleQueueCache::getFromCache(const string& udi, Rcl::Doc &dotdoc,
string& data, string *htt)
{
string dict;
if (m_cache == 0) {
LOGERR(("BeagleQueueCache::getFromCache: cache is null\n"));
return false;
}
if (!m_cache->get(udi, dict, data)) {
LOGDEB(("BeagleQueueCache::getFromCache: get failed\n"));
return false;
}
ConfSimple cf(dict, 1);
if (htt)
cf.get(Rcl::Doc::keybght, *htt, cstr_null);
// Build a doc from saved metadata
cf.get(cstr_url, dotdoc.url, cstr_null);
cf.get(cstr_bgc_mimetype, dotdoc.mimetype, cstr_null);
cf.get(cstr_fmtime, dotdoc.fmtime, cstr_null);
cf.get(cstr_fbytes, dotdoc.pcbytes, cstr_null);
dotdoc.sig.clear();
vector<string> names = cf.getNames(cstr_null);
for (vector<string>::const_iterator it = names.begin();
it != names.end(); it++) {
cf.get(*it, dotdoc.meta[*it], cstr_null);
}
dotdoc.meta[Rcl::Doc::keyudi] = udi;
return true;
}

View file

@ -0,0 +1,50 @@
/* Copyright (C) 2009 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _beaglequeuecache_h_included_
#define _beaglequeuecache_h_included_
#include <string>
using std::string;
class RclConfig;
namespace Rcl {
class Db;
class Doc;
}
class CirCache;
/**
* Manage the CirCache for the Beagle Queue indexer. Separated from the main
* indexer code because it's also used for querying (getting the data for a
* preview
*/
class BeagleQueueCache {
public:
BeagleQueueCache(RclConfig *config);
~BeagleQueueCache();
bool getFromCache(const string& udi, Rcl::Doc &doc, string& data,
string *hittype = 0);
// We could write proxies for all the circache ops, but why bother?
CirCache *cc() {return m_cache;}
private:
CirCache *m_cache;
};
extern const string cstr_bgc_mimetype;
#endif /* _beaglequeuecache_h_included_ */

6
src/common/cstr.cpp Normal file
View file

@ -0,0 +1,6 @@
#include "cstr.h"
#define RCLIN_CSTR_CPPFILE
#undef _CSTR_H_INCLUDED_
#include "cstr.h"

86
src/common/cstr.h Normal file
View file

@ -0,0 +1,86 @@
/* Copyright (C) 2011 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CSTR_H_INCLUDED_
#define _CSTR_H_INCLUDED_
// recoll mostly uses STL strings. In many places we had automatic
// conversion from a C string to an STL one. This costs, and can
// become significant if used often.
//
// This file and the associated .cpp file declares/defines constant
// strings used in the program. Strings are candidates for a move here
// when they are used in a fast loop or are shared.
#include <string>
using std::string;
// The following slightly hacky preprocessing directives and the
// companion code in the cpp file looks complicated, but it just
// ensures that we only have to write the strings once to get the
// extern declaration and the definition.
#ifdef RCLIN_CSTR_CPPFILE
#undef DEF_CSTR
#define DEF_CSTR(NM, STR) const string cstr_##NM(STR)
#else
#define DEF_CSTR(NM, STR) extern const string cstr_##NM
#endif
DEF_CSTR(caption, "caption");
DEF_CSTR(colon, ":");
DEF_CSTR(dmtime, "dmtime");
DEF_CSTR(dquote, "\"");
DEF_CSTR(fbytes, "fbytes");
DEF_CSTR(fileu, "file://");
DEF_CSTR(fmtime, "fmtime");
DEF_CSTR(iso_8859_1, "ISO-8859-1");
DEF_CSTR(utf8, "UTF-8");
DEF_CSTR(cp1252, "CP1252");
DEF_CSTR(minwilds, "*?[");
DEF_CSTR(newline, "\n");
DEF_CSTR(null, "");
DEF_CSTR(plus, "+");
DEF_CSTR(textplain, "text/plain");
DEF_CSTR(url, "url");
// Marker for HTML format fields
DEF_CSTR(fldhtm, "\007");
// Characters that can -begin- a wildcard or regexp expression.
DEF_CSTR(wildSpecStChars, "*?[");
DEF_CSTR(regSpecStChars, "(.[{");
// Values used as keys inside Dijon::Filter::metaData[]. This structure is
// used to store all data generated by format-translating filters. It is
// different from Rcl::Doc for mostly historical reasons. The translation
// from Filter to Doc occurs inside internfile.cpp
DEF_CSTR(dj_keyds, "description");
DEF_CSTR(dj_keyfn, "filename");
DEF_CSTR(dj_keymd, "modificationdate");
DEF_CSTR(dj_keyorigcharset, "origcharset");
DEF_CSTR(dj_keytitle, "title");
DEF_CSTR(dj_keyrecipient, "recipient");
DEF_CSTR(dj_keymsgid, "msgid");
DEF_CSTR(dj_keyabstract, "abstract");
DEF_CSTR(dj_keyauthor, "author");
DEF_CSTR(dj_keycharset, "charset");
DEF_CSTR(dj_keycontent, "content");
DEF_CSTR(dj_keyipath, "ipath");
DEF_CSTR(dj_keymd5, "md5");
DEF_CSTR(dj_keymt, "mimetype");
DEF_CSTR(dj_keydocsize, "docsize");
DEF_CSTR(dj_keyanc, "rclanc");
#endif /* _CSTR_H_INCLUDED_ */

1672
src/common/rclconfig.cpp Normal file

File diff suppressed because it is too large Load diff

389
src/common/rclconfig.h Normal file
View file

@ -0,0 +1,389 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
#include <string>
#include <vector>
#include <set>
#include <utility>
#include <map>
#include "unordered_defs.h"
using std::string;
using std::vector;
using std::pair;
using std::set;
using std::map;
#include "conftree.h"
#include "smallut.h"
class RclConfig;
// A small class used for parameters that need to be computed from the
// config string, and which can change with the keydir. Minimize work
// by using the keydirgen and a saved string to avoid unneeded
// recomputations
class ParamStale {
public:
RclConfig *parent;
ConfNull *conffile;
string paramname;
bool active; // Check at init if config defines name at all
int savedkeydirgen;
string savedvalue;
ParamStale(RclConfig *rconf, const string& nm);
void init(ConfNull *cnf);
bool needrecompute();
};
// Hold the description for an external metadata-gathering command
struct MDReaper {
string fieldname;
vector<string> cmdv;
};
// Data associated to a indexed field name:
struct FieldTraits {
string pfx; // indexing prefix,
int wdfinc; // Index time term frequency increment (default 1)
double boost; // Query time boost (default 1.0)
bool pfxonly; // Suppress prefix-less indexing
FieldTraits()
: wdfinc(1), boost(1.0), pfxonly(false)
{}
};
class RclConfig {
public:
// Constructor: we normally look for a configuration file, except
// if this was specified on the command line and passed through
// argcnf
RclConfig(const string *argcnf = 0);
RclConfig(const RclConfig &r)
: m_oldstpsuffstate(this, "recoll_noindex"),
m_stpsuffstate(this, "noContentSuffixes"),
m_skpnstate(this, "skippedNames"),
m_rmtstate(this, "indexedmimetypes"),
m_xmtstate(this, "excludedmimetypes"),
m_mdrstate(this, "metadatacmds") {
initFrom(r);
}
~RclConfig() {
freeAll();
}
// Return a writable clone of the main config. This belongs to the
// caller (must delete it when done)
ConfNull *cloneMainConfig();
/** (re)Read recoll.conf */
bool updateMainConfig();
bool ok() const {return m_ok;}
const string &getReason() const {return m_reason;}
/** Return the directory where this configuration is stored.
* This was possibly silently created by the rclconfig
* constructor it it is the default one (~/.recoll) and it did
* not exist yet. */
string getConfDir() const {return m_confdir;}
/** Check if the config files were modified since we read them */
bool sourceChanged() const;
/** Returns true if this is ~/.recoll */
bool isDefaultConfig() const;
/** Get the local value for /usr/local/share/recoll/ */
const string& getDatadir() const {return m_datadir;}
/** Set current directory reference, and fetch automatic parameters. */
void setKeyDir(const string &dir);
string getKeyDir() const {return m_keydir;}
/** Get generic configuration parameter according to current keydir */
bool getConfParam(const string &name, string &value) const
{
if (m_conf == 0)
return false;
return m_conf->get(name, value, m_keydir);
}
/** Variant with autoconversion to int */
bool getConfParam(const string &name, int *value) const;
/** Variant with autoconversion to bool */
bool getConfParam(const string &name, bool *value) const;
/** Variant with conversion to vector<string>
* (stringToStrings). Can fail if the string is malformed. */
bool getConfParam(const string &name, vector<string> *value) const;
/** Variant with conversion to vector<int> */
bool getConfParam(const string &name, vector<int> *value) const;
enum ThrStage {ThrIntern=0, ThrSplit=1, ThrDbWrite=2};
pair<int, int> getThrConf(ThrStage who) const;
/**
* Get list of config names under current sk, with possible
* wildcard filtering
*/
vector<string> getConfNames(const char *pattern = 0) const
{
return m_conf->getNames(m_keydir, pattern);
}
/** Check if name exists anywhere in config */
bool hasNameAnywhere(const string& nm) const
{
return m_conf? m_conf->hasNameAnywhere(nm) : false;
}
/** Get default charset for current keydir (was set during setKeydir)
* filenames are handled differently */
const string &getDefCharset(bool filename = false) const;
/** Get list of top directories. This is needed from a number of places
* and needs some cleaning-up code. An empty list is always an error, no
* need for other status */
vector<string> getTopdirs() const;
/** Get database directory */
string getDbDir() const;
/** Get stoplist file name */
string getStopfile() const;
/** Get indexing pid file name */
string getPidfile() const;
/** Get indexing status file name */
string getIdxStatusFile() const;
/** Do path translation according to the ptrans table */
void urlrewrite(const string& dbdir, string& url) const;
ConfSimple *getPTrans()
{
return m_ptrans;
}
/** Get Web Queue directory name */
string getWebQueueDir() const;
/** Get list of skipped file names for current keydir */
vector<string>& getSkippedNames();
/** Get list of skipped paths patterns. Doesn't depend on the keydir */
vector<string> getSkippedPaths() const;
/** Get list of skipped paths patterns, daemon version (may add some)
Doesn't depend on the keydir */
vector<string> getDaemSkippedPaths() const;
/**
* mimemap: Check if file name should be ignored because of suffix
*
* The list of ignored suffixes is initialized on first call, and
* not changed for subsequent setKeydirs.
*/
bool inStopSuffixes(const string& fn);
/**
* Check in mimeconf if input mime type is a compressed one, and
* return command to uncompress if it is.
*
* The returned command has substitutable places for input file name
* and temp dir name, and will return output name
*/
bool getUncompressor(const string &mtpe, vector<string>& cmd) const;
/** mimemap: compute mimetype */
string getMimeTypeFromSuffix(const string &suffix) const;
/** mimemap: get a list of all indexable mime types defined */
vector<string> getAllMimeTypes() const;
/** mimemap: Get appropriate suffix for mime type. This is inefficient */
string getSuffixFromMimeType(const string &mt) const;
/** mimeconf: get input filter for mimetype */
string getMimeHandlerDef(const string &mimetype, bool filtertypes=false);
/** For lines like: "name = some value; attr1 = value1; attr2 = val2"
* Separate the value and store the attributes in a ConfSimple
* @param whole the raw value. No way to escape a semi-colon in there.
*/
static bool valueSplitAttributes(const string& whole, string& value,
ConfSimple& attrs) ;
/** Return icon path for mime type and tag */
string getMimeIconPath(const string &mt, const string& apptag) const;
/** mimeconf: get list of file categories */
bool getMimeCategories(vector<string>&) const;
/** mimeconf: is parameter one of the categories ? */
bool isMimeCategory(string&) const;
/** mimeconf: get list of mime types for category */
bool getMimeCatTypes(const string& cat, vector<string>&) const;
/** mimeconf: get list of gui filters (doc cats by default */
bool getGuiFilterNames(vector<string>&) const;
/** mimeconf: get query lang frag for named filter */
bool getGuiFilter(const string& filtername, string& frag) const;
/** fields: get field prefix from field name. Use additional query
aliases if isquery is set */
bool getFieldTraits(const string& fldname, const FieldTraits **,
bool isquery = false) const;
const set<string>& getStoredFields() const {return m_storedFields;}
set<string> getIndexedFields() const;
/** Get canonic name for possible alias */
string fieldCanon(const string& fld) const;
/** Get canonic name for possible alias, including query-only aliases */
string fieldQCanon(const string& fld) const;
/** Get xattr name to field names translations */
const map<string, string>& getXattrToField() const {return m_xattrtofld;}
/** Get value of a parameter inside the "fields" file. Only some filters
* use this (ie: mh_mail). The information specific to a given filter
* is typically stored in a separate section(ie: [mail])
*/
vector<string> getFieldSectNames(const string &sk, const char* = 0) const;
bool getFieldConfParam(const string &name, const string &sk, string &value)
const;
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
string getMimeViewerDef(const string &mimetype, const string& apptag,
bool useall) const;
string getMimeViewerAllEx() const;
bool setMimeViewerAllEx(const string& allex);
bool getMimeViewerDefs(vector<pair<string, string> >&) const;
bool setMimeViewerDef(const string& mimetype, const string& cmd);
/** Check if mime type is designated as needing no uncompress before view
* (if a file of this type is found compressed). Default is true,
* exceptions are found in the nouncompforviewmts mimeview list */
bool mimeViewerNeedsUncomp(const string &mimetype) const;
/** Retrieve extra metadata-gathering commands */
const vector<MDReaper>& getMDReapers();
/** Store/retrieve missing helpers description string */
bool getMissingHelperDesc(string&) const;
void storeMissingHelperDesc(const string &s);
/** Find exec file for external filter. cmd is the command name from the
* command string returned by getMimeHandlerDef */
string findFilter(const string& cmd) const;
/** Thread config init is not done automatically because not all
programs need it and it uses debuglog so that it's better to
call it after primary init */
void initThrConf();
const string& getOrigCwd()
{
return o_origcwd;
}
RclConfig& operator=(const RclConfig &r) {
if (this != &r) {
freeAll();
initFrom(r);
}
return *this;
}
friend class ParamStale;
private:
int m_ok;
string m_reason; // Explanation for bad state
string m_confdir; // User directory where the customized files are stored
string m_datadir; // Example: /usr/local/share/recoll
string m_keydir; // Current directory used for parameter fetches.
int m_keydirgen; // To help with knowing when to update computed data.
vector<string> m_cdirs; // directory stack for the confstacks
ConfStack<ConfTree> *m_conf; // Parsed configuration files
ConfStack<ConfTree> *mimemap; // The files don't change with keydir,
ConfStack<ConfSimple> *mimeconf; // but their content may depend on it.
ConfStack<ConfSimple> *mimeview; //
ConfStack<ConfSimple> *m_fields;
ConfSimple *m_ptrans; // Paths translations
map<string, FieldTraits> m_fldtotraits; // Field to field params
map<string, string> m_aliastocanon;
map<string, string> m_aliastoqcanon;
set<string> m_storedFields;
map<string, string> m_xattrtofld;
void *m_stopsuffixes;
unsigned int m_maxsufflen;
ParamStale m_oldstpsuffstate; // Values from user mimemap, now obsolete
ParamStale m_stpsuffstate;
ParamStale m_skpnstate;
vector<string> m_skpnlist;
// Original current working directory. Set once at init before we do any
// chdir'ing and used for converting user args to absolute paths.
static string o_origcwd;
// Parameters auto-fetched on setkeydir
string m_defcharset;
static string o_localecharset;
// Limiting set of mime types to be processed. Normally empty.
ParamStale m_rmtstate;
STD_UNORDERED_SET<string> m_restrictMTypes;
// Exclusion set of mime types. Normally empty
ParamStale m_xmtstate;
STD_UNORDERED_SET<string> m_excludeMTypes;
vector<pair<int, int> > m_thrConf;
// Same idea with the metadata-gathering external commands,
// (e.g. used to reap tagging info: "tmsu tags %f")
ParamStale m_mdrstate;
vector<MDReaper> m_mdreapers;
/** Create initial user configuration */
bool initUserConfig();
/** Copy from other */
void initFrom(const RclConfig& r);
/** Init pointers to 0 */
void zeroMe();
/** Free data then zero pointers */
void freeAll();
bool readFieldsConfig(const string& errloc);
};
// This global variable defines if we are running with an index
// stripped of accents and case or a raw one. Ideally, it should be
// constant, but it needs to be initialized from the configuration, so
// there is no way to do this. It never changes after initialization
// of course. Changing the value on a given index imposes a
// reset. When using multiple indexes, all must have the same value
extern bool o_index_stripchars;
// This global variable defines if we use mtime instead of ctime for
// up-to-date tests. This is mostly incompatible with xattr indexing,
// in addition to other issues. See recoll.conf comments.
extern bool o_uptodate_test_use_mtime;
#endif /* _RCLCONFIG_H_INCLUDED_ */

196
src/common/rclinit.cpp Normal file
View file

@ -0,0 +1,196 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "autoconfig.h"
#include <stdio.h>
#include <signal.h>
#include <locale.h>
#include <pthread.h>
#include <cstdlib>
#if !defined(PUTENV_ARG_CONST)
#include <string.h>
#endif
#include "debuglog.h"
#include "rclconfig.h"
#include "rclinit.h"
#include "pathut.h"
#include "unac.h"
#include "smallut.h"
#include "execmd.h"
static const int catchedSigs[] = {SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2};
static pthread_t mainthread_id;
static void siglogreopen(int)
{
if (recoll_ismainthread())
DebugLog::reopen();
}
RclConfig *recollinit(RclInitFlags flags,
void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf)
{
if (cleanup)
atexit(cleanup);
// We ignore SIGPIPE always. All pieces of code which can write to a pipe
// must check write() return values.
signal(SIGPIPE, SIG_IGN);
// Make sure the locale is set. This is only for converting file names
// to utf8 for indexing.
setlocale(LC_CTYPE, "");
// We would like to block SIGCHLD globally, but we can't because
// QT uses it. Have to block it inside execmd.cpp
// Install app signal handler
if (sigcleanup) {
struct sigaction action;
action.sa_handler = sigcleanup;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
for (unsigned int i = 0; i < sizeof(catchedSigs) / sizeof(int); i++)
if (signal(catchedSigs[i], SIG_IGN) != SIG_IGN) {
if (sigaction(catchedSigs[i], &action, 0) < 0) {
perror("Sigaction failed");
}
}
}
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::setfilename("stderr");
RclConfig *config = new RclConfig(argcnf);
if (!config || !config->ok()) {
reason = "Configuration could not be built:\n";
if (config)
reason += config->getReason();
else
reason += "Out of memory ?";
return 0;
}
// Retrieve the log file name and level
string logfilename, loglevel;
if (flags & RCLINIT_DAEMON) {
config->getConfParam(string("daemlogfilename"), logfilename);
config->getConfParam(string("daemloglevel"), loglevel);
}
if (logfilename.empty())
config->getConfParam(string("logfilename"), logfilename);
if (loglevel.empty())
config->getConfParam(string("loglevel"), loglevel);
// Initialize logging
if (!logfilename.empty()) {
logfilename = path_tildexpand(logfilename);
// If not an absolute path or , compute relative to config dir
if (logfilename.at(0) != '/' &&
!DebugLog::DebugLog::isspecialname(logfilename.c_str())) {
logfilename = path_cat(config->getConfDir(), logfilename);
}
DebugLog::setfilename(logfilename.c_str());
}
if (!loglevel.empty()) {
int lev = atoi(loglevel.c_str());
DebugLog::getdbl()->setloglevel(lev);
}
// Install log rotate sig handler
{
struct sigaction action;
action.sa_handler = siglogreopen;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
if (sigaction(SIGHUP, &action, 0) < 0) {
perror("Sigaction failed");
}
}
}
// Make sure the locale charset is initialized (so that multiple
// threads don't try to do it at once).
config->getDefCharset();
mainthread_id = pthread_self();
// Init unac locking
unac_init_mt();
// Init smallut and pathut static values
pathut_init_mt();
smallut_init_mt();
// Init Unac translation exceptions
string unacex;
if (config->getConfParam("unac_except_trans", unacex) && !unacex.empty())
unac_set_except_translations(unacex.c_str());
#ifndef IDX_THREADS
ExecCmd::useVfork(true);
#else
// Keep threads init behind log init, but make sure it's done before
// we do the vfork choice !
config->initThrConf();
bool intern_noThr = config->getThrConf(RclConfig::ThrIntern).first == -1;
bool split_noThr = config->getThrConf(RclConfig::ThrSplit).first == -1;
bool write_noThr = config->getThrConf(RclConfig::ThrDbWrite).first == -1;
if (intern_noThr && split_noThr && write_noThr) {
LOGDEB0(("rclinit: single-threaded execution: use vfork\n"));
ExecCmd::useVfork(true);
} else {
LOGDEB0(("rclinit: multi-threaded execution: do not use vfork\n"));
ExecCmd::useVfork(false);
}
#endif
int flushmb;
if (config->getConfParam("idxflushmb", &flushmb) && flushmb > 0) {
LOGDEB1(("rclinit: idxflushmb=%d, set XAPIAN_FLUSH_THRESHOLD to 10E6\n",
flushmb));
static const char *cp = "XAPIAN_FLUSH_THRESHOLD=1000000";
#ifdef PUTENV_ARG_CONST
::putenv(cp);
#else
::putenv(strdup(cp));
#endif
}
return config;
}
// Signals are handled by the main thread. All others should call this routine
// to block possible signals
void recoll_threadinit()
{
sigset_t sset;
sigemptyset(&sset);
for (unsigned int i = 0; i < sizeof(catchedSigs) / sizeof(int); i++)
sigaddset(&sset, catchedSigs[i]);
sigaddset(&sset, SIGHUP);
pthread_sigmask(SIG_BLOCK, &sset, 0);
}
bool recoll_ismainthread()
{
return pthread_equal(pthread_self(), mainthread_id);
}

60
src/common/rclinit.h Normal file
View file

@ -0,0 +1,60 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _RCLINIT_H_INCLUDED_
#define _RCLINIT_H_INCLUDED_
#include <string>
#ifndef NO_NAMESPACES
using std::string;
#endif
class RclConfig;
/**
* Initialize by reading configuration, opening log file, etc.
*
* This must be called from the main thread before starting any others. It sets
* up the global signal handling. other threads must call recoll_threadinit()
* when starting.
*
* @param flags misc modifiers
* @param cleanup function to call before exiting (atexit)
* @param sigcleanup function to call on terminal signal (INT/HUP...) This
* should typically set a flag which tells the program (recoll,
* recollindex etc.. to exit as soon as possible (after closing the db,
* etc.). cleanup will then be called by exit().
* @param reason in case of error: output string explaining things
* @param argcnf Configuration directory name from the command line (overriding
* default and environment
* @return the parsed configuration.
*/
enum RclInitFlags {RCLINIT_NONE=0, RCLINIT_DAEMON=1};
extern RclConfig *recollinit(RclInitFlags flags,
void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf = 0);
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf = 0) {
return recollinit(RCLINIT_NONE, cleanup, sigcleanup, reason, argcnf);
}
// Threads need to call this to block signals.
// The main thread handles all signals.
extern void recoll_threadinit();
// Check if main thread
extern bool recoll_ismainthread();
#endif /* _RCLINIT_H_INCLUDED_ */

View file

@ -0,0 +1 @@
static const char *rclversionstr = "@RCLVERSION@";

1217
src/common/textsplit.cpp Normal file

File diff suppressed because it is too large Load diff

226
src/common/textsplit.h Normal file
View file

@ -0,0 +1,226 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _TEXTSPLIT_H_INCLUDED_
#define _TEXTSPLIT_H_INCLUDED_
#include <math.h>
#include <string>
#include <vector>
using std::string;
using std::vector;
using std::pair;
class Utf8Iter;
/**
* Split text into words.
* See comments at top of .cpp for more explanations.
* This uses a callback function. It could be done with an iterator instead,
* but 'ts much simpler this way...
*/
class TextSplit {
public:
// Should we activate special processing of Chinese characters ? This
// needs a little more cpu, so it can be turned off globally. This is set
// by rclconfig, changing it means reindexing
static bool o_processCJK;
static unsigned int o_CJKNgramLen;
static const unsigned int o_CJKMaxNgramLen = 5;
static void cjkProcessing(bool onoff, unsigned int ngramlen = 2)
{
o_processCJK = onoff;
o_CJKNgramLen = ngramlen <= o_CJKMaxNgramLen ?
ngramlen : o_CJKMaxNgramLen;
}
// Are we indexing numbers ? Set by rclconfig. Change needs reindex
static bool o_noNumbers;
static void noNumbers()
{
o_noNumbers = true;
}
enum Flags {
// Default: will return spans and words (a_b, a, b)
TXTS_NONE = 0,
// Only return maximum spans (a@b.com, not a, b, or com)
TXTS_ONLYSPANS = 1,
// Special: Only return atomic words (a, b, com). This is not
// used for indexing, but for position computation during
// abstract generation,
TXTS_NOSPANS = 2,
// Handle wildcards as letters. This is used with ONLYSPANS
// for parsing a user query (never alone).
TXTS_KEEPWILD = 4
};
TextSplit(Flags flags = Flags(TXTS_NONE))
: m_flags(flags), m_maxWordLength(40), m_prevpos(-1)
{
}
virtual ~TextSplit() {}
virtual void setMaxWordLength(int l)
{
m_maxWordLength = l;
}
/** Split text, emit words and positions. */
virtual bool text_to_words(const string &in);
/** Process one output word: to be implemented by the actual user class */
virtual bool takeword(const string& term,
int pos, // term pos
int bts, // byte offset of first char in term
int bte // byte offset of first char after term
) = 0;
/** Called when we encounter formfeed \f 0x0c. Override to use the event.
* Mostly or exclusively used with pdftoxx output. Other filters mostly
* just don't know about pages. */
virtual void newpage(int /*pos*/)
{
}
// Static utility functions:
/** Count words in string, as the splitter would generate them */
static int countWords(const string &in, Flags flgs = TXTS_ONLYSPANS);
/** Check if this is visibly not a single block of text */
static bool hasVisibleWhite(const string &in);
/** Split text span into strings, at white space, allowing for substrings
* quoted with " . Escaping with \ works as usual inside the quoted areas.
* This has to be kept separate from smallut.cpp's stringsToStrings, which
* basically works only if whitespace is ascii, and which processes
* non-utf-8 input (iso-8859 config files work ok). This hopefully
* handles all Unicode whitespace, but needs correct utf-8 input
*/
static bool stringToStrings(const string &s, vector<string> &tokens);
/** Is char CJK ? */
static bool isCJK(int c);
/** Statistics about word length (average and dispersion) can
* detect bad data like undecoded base64 or other mis-identified
* pieces of data taken as text. In practise, this keeps some junk out
* of the index, but does not decrease the index size much, and is
* probably not worth the trouble in general. Code kept because it
* probably can be useful in special cases. Base64 data does has
* word separators in it (+/) and is characterised by high average
* word length (>10, often close to 20) and high word length
* dispersion (avg/sigma > 0.8). In my tests, most natural
* language text has average word lengths around 5-8 and avg/sigma
* < 0.7
*/
#ifdef TEXTSPLIT_STATS
class Stats {
public:
Stats()
{
reset();
}
void reset()
{
count = 0;
totlen = 0;
sigma_acc = 0;
}
void newsamp(unsigned int len)
{
++count;
totlen += len;
double avglen = double(totlen) / double(count);
sigma_acc += (avglen - len) * (avglen - len);
}
struct Values {
int count;
double avglen;
double sigma;
};
Values get()
{
Values v;
v.count = count;
v.avglen = double(totlen) / double(count);
v.sigma = sqrt(sigma_acc / count);
return v;
}
private:
int count;
int totlen;
double sigma_acc;
};
Stats::Values getStats()
{
return m_stats.get();
}
void resetStats()
{
m_stats.reset();
}
#endif // TEXTSPLIT_STATS
private:
Flags m_flags;
int m_maxWordLength;
// Current span. Might be jf.dockes@wanadoo.f
string m_span;
vector <pair<unsigned int, unsigned int> > m_words_in_span;
// Current word: no punctuation at all in there. Byte offset
// relative to the current span and byte length
int m_wordStart;
unsigned int m_wordLen;
// Currently inside number
bool m_inNumber;
// Term position of current word and span
int m_wordpos;
int m_spanpos;
// It may happen that our cleanup would result in emitting the
// same term twice. We try to avoid this
int m_prevpos;
unsigned int m_prevlen;
#ifdef TEXTSPLIT_STATS
// Stats counters. These are processed in TextSplit rather than by a
// TermProc so that we can take very long words (not emitted) into
// account.
Stats m_stats;
#endif
// Word length in characters. Declared but not updated if !TEXTSPLIT_STATS
unsigned int m_wordChars;
// This processes cjk text:
bool cjk_to_words(Utf8Iter *it, unsigned int *cp);
bool emitterm(bool isspan, string &term, int pos, int bs, int be);
bool doemit(bool spanerase, int bp);
void discardspan();
bool span_is_acronym(std::string *acronym);
bool words_from_span(int bp);
};
#endif /* _TEXTSPLIT_H_INCLUDED_ */

249
src/common/unacpp.cpp Normal file
View file

@ -0,0 +1,249 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef TEST_UNACPP
#include <stdio.h>
#include <cstdlib>
#include <errno.h>
#include <string>
#include "unacpp.h"
#include "unac.h"
#include "debuglog.h"
#include "utf8iter.h"
bool unacmaybefold(const string &in, string &out,
const char *encoding, UnacOp what)
{
char *cout = 0;
size_t out_len;
int status = -1;
switch (what) {
case UNACOP_UNAC:
status = unac_string(encoding, in.c_str(), in.length(),
&cout, &out_len);
break;
case UNACOP_UNACFOLD:
status = unacfold_string(encoding, in.c_str(), in.length(),
&cout, &out_len);
break;
case UNACOP_FOLD:
status = fold_string(encoding, in.c_str(), in.length(),
&cout, &out_len);
break;
}
if (status < 0) {
if (cout)
free(cout);
char cerrno[20];
sprintf(cerrno, "%d", errno);
out = string("unac_string failed, errno : ") + cerrno;
return false;
}
out.assign(cout, out_len);
if (cout)
free(cout);
return true;
}
// Functions to determine upper-case or accented status could be implemented
// hugely more efficiently inside the unac c code, but there only used for
// testing user-entered terms, so we don't really care.
bool unaciscapital(const string& in)
{
LOGDEB2(("unaciscapital: [%s]\n", in.c_str()));
if (in.empty())
return false;
Utf8Iter it(in);
string shorter;
it.appendchartostring(shorter);
string lower;
if (!unacmaybefold(shorter, lower, "UTF-8", UNACOP_FOLD)) {
LOGINFO(("unaciscapital: unac/fold failed for [%s]\n", in.c_str()));
return false;
}
Utf8Iter it1(lower);
if (*it != *it1)
return true;
else
return false;
}
bool unachasuppercase(const string& in)
{
LOGDEB2(("unachasuppercase: [%s]\n", in.c_str()));
if (in.empty())
return false;
string lower;
if (!unacmaybefold(in, lower, "UTF-8", UNACOP_FOLD)) {
LOGINFO(("unachasuppercase: unac/fold failed for [%s]\n", in.c_str()));
return false;
}
if (lower != in)
return true;
else
return false;
}
bool unachasaccents(const string& in)
{
LOGDEB2(("unachasaccents: [%s]\n", in.c_str()));
if (in.empty())
return false;
string noac;
if (!unacmaybefold(in, noac, "UTF-8", UNACOP_UNAC)) {
LOGINFO(("unachasaccents: unac/unac failed for [%s]\n", in.c_str()));
return false;
}
if (noac != in)
return true;
else
return false;
}
#else // not testing
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <iostream>
using namespace std;
#include "unacpp.h"
#include "readfile.h"
#include "rclinit.h"
static char *thisprog;
static char usage [] = "\n"
"[-c|-C] <encoding> <infile> <outfile>\n"
" Default : unaccent\n"
" -c : unaccent and casefold\n"
" -C : casefold only\n"
"-t <string> test string as capitalized, upper-case anywhere, accents\n"
" the parameter is supposedly utf-8 so this can only work in an utf-8\n"
" locale\n"
"\n";
;
static void
Usage(void)
{
fprintf(stderr, "%s: usage: %s\n", thisprog, usage);
exit(1);
}
static int op_flags;
#define OPT_c 0x2
#define OPT_C 0x4
#define OPT_t 0x8
int main(int argc, char **argv)
{
UnacOp op = UNACOP_UNAC;
thisprog = argv[0];
argc--; argv++;
while (argc > 0 && **argv == '-') {
(*argv)++;
if (!(**argv))
/* Cas du "adb - core" */
Usage();
while (**argv)
switch (*(*argv)++) {
case 'c': op_flags |= OPT_c; break;
case 'C': op_flags |= OPT_C; break;
case 't': op_flags |= OPT_t; break;
default: Usage(); break;
}
argc--; argv++;
}
if (op_flags & OPT_t) {
if (argc != 1)
Usage();
string in = *argv++;argc--;
bool capital, upper, accent;
capital = unaciscapital(in);
upper = unachasuppercase(in);
accent = unachasaccents(in);
cout << "[" << in << "] : " <<
"capitalized: " << (capital ? "Yes. " : "No. ") <<
"has uppercase: " << (upper ? "Yes. " : "No. ") <<
"has accents: " << (accent ? "Yes. " : "No. ") <<
endl;
return 0;
} else {
if (argc != 3)
Usage();
if (op_flags & OPT_c) {
op = UNACOP_UNACFOLD;
} else if (op_flags & OPT_C) {
op = UNACOP_FOLD;
}
const char *encoding = *argv++; argc--;
string ifn = *argv++; argc--;
if (!ifn.compare("stdin"))
ifn.clear();
const char *ofn = *argv++; argc--;
string reason;
(void)recollinit(RCLINIT_NONE, 0, 0, reason, 0);
string odata;
if (!file_to_string(ifn, odata)) {
cerr << "file_to_string " << ifn << " : " << odata << endl;
return 1;
}
string ndata;
if (!unacmaybefold(odata, ndata, encoding, op)) {
cerr << "unac: " << ndata << endl;
return 1;
}
int fd;
if (strcmp(ofn, "stdout")) {
fd = open(ofn, O_CREAT|O_EXCL|O_WRONLY, 0666);
} else {
fd = 1;
}
if (fd < 0) {
cerr << "Open/Create " << ofn << " failed: " << strerror(errno)
<< endl;
return 1;
}
if (write(fd, ndata.c_str(), ndata.length()) != (int)ndata.length()) {
cerr << "Write(2) failed: " << strerror(errno) << endl;
return 1;
}
close(fd);
return 0;
}
}
#endif

40
src/common/unacpp.h Normal file
View file

@ -0,0 +1,40 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _UNACPP_H_INCLUDED_
#define _UNACPP_H_INCLUDED_
#include <string>
#ifndef NO_NAMESPACES
using std::string;
#endif /* NO_NAMESPACES */
// A small stringified wrapper for unac.c
enum UnacOp {UNACOP_UNAC = 1, UNACOP_FOLD = 2, UNACOP_UNACFOLD = 3};
extern bool unacmaybefold(const string& in, string& out,
const char *encoding, UnacOp what);
// Utility function to determine if string begins with capital
extern bool unaciscapital(const string& in);
// Utility function to determine if string has upper-case anywhere
extern bool unachasuppercase(const string& in);
// Utility function to determine if any character is accented. This
// approprialey ignores the characters from unac_except_chars which
// are really separate letters
extern bool unachasaccents(const string& in);
#endif /* _UNACPP_H_INCLUDED_ */

View file

@ -0,0 +1,19 @@
#include "autoconfig.h"
#ifdef HAVE_CXX0X_UNORDERED
# include <unordered_map>
# include <unordered_set>
# define STD_UNORDERED_MAP std::unordered_map
# define STD_UNORDERED_SET std::unordered_set
#elif defined(HAVE_TR1_UNORDERED)
# include <tr1/unordered_map>
# include <tr1/unordered_set>
# define STD_UNORDERED_MAP std::tr1::unordered_map
# define STD_UNORDERED_SET std::tr1::unordered_set
#else
# include <map>
# include <set>
# define STD_UNORDERED_MAP std::map
# define STD_UNORDERED_SET std::set
#endif

202
src/common/uproplist.h Normal file
View file

@ -0,0 +1,202 @@
/* Copyright (C) 2004 J.F.Dockes
* 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.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _PROPLIST_H_INCLUDED_
#define _PROPLIST_H_INCLUDED_
/**
* A subset of Unicode chars that we consider word breaks when we
* split text in words.
*
* This is used as a quick fix to the ascii-based code, and is not correct.
* the correct way would be to do what http://www.unicode.org/reports/tr29/
* says.
*/
// Punctuation chararacters blocks array. Each block is defined by a
// starting and ending code point (both included). MUST BE SORTED.
static const unsigned unipuncblocks[] = {
// Start of latin-1 supplement block, up to capital A grave
0x0080, 0x00BF,
// General punctuation
0x2000, 0x206F,
// Superscripts and subscripts
0x2070, 0x209F,
// Currency symbols
0x20A0, 0x20CF,
// Letterlike symbols
0x2100, 0x214f,
// Number forms
0x2150, 0x218F,
// Arrows
0x2190, 0x21FF,
// Mathematical Operators
0x2200, 0x22FF,
// Miscellaneous Technical
0x2300, 0x23FF,
// Control Pictures
0x2400, 0x243F,
// Optical Character Recognition
0x2440, 0x245F,
// Enclosed Alphanumerics
0x2460, 0x24FF,
// Box Drawing
0x2500, 0x257F,
// Block Elements
0x2580, 0x259F,
// Geometric Shapes
0x25A0, 0x25FF,
// Miscellaneous Symbols
0x2600, 0x26FF,
// Dingbats
0x2700, 0x27BF,
// Miscellaneous Mathematical Symbols-A
0x27C0, 0x27EF,
// Supplemental Arrows-A
0x27F0, 0x27FF,
// Supplemental Arrows-B
0x2900, 0x297F,
// Miscellaneous Mathematical Symbols-B
0x2980, 0x29FF,
// Supplemental Mathematical Operators
0x2A00, 0x2AFF,
// Miscellaneous Symbols and Arrows
0x2B00, 0x2BFF,
};
// Other punctuation characters list. Not all punctuation is in a
// separate block some is found in the middle of alphanumeric codes.
static const unsigned int unipunc[] = {
0x00D7, /* MULTIPLICATION SIGN */
0x00F7, /* DIVISION SIGN */
0x037E, /* GREEK QUESTION MARK */
0x0387, /* GREEK ANO TELEIA */
0x055C, /* ARMENIAN EXCLAMATION MARK */
0x055E, /* ARMENIAN QUESTION MARK */
0x0589, /* ARMENIAN FULL STOP */
0x058A, /* ARMENIAN HYPHEN */
0x05C3, /* HEBREW PUNCTUATION SOF PASUQ */
0x060C, /* ARABIC COMMA */
0x061B, /* ARABIC SEMICOLON */
0x061F, /* ARABIC QUESTION MARK */
0x06D4, /* ARABIC FULL STOP */
0x0964, /* DEVANAGARI DANDA */
0x0965, /* DEVANAGARI DOUBLE DANDA */
0x166E, /* CANADIAN SYLLABICS FULL STOP */
0x1680, /* OGHAM SPACE MARK */
0x16EB, /* RUNIC SINGLE PUNCTUATION */
0x16EC, /* RUNIC MULTIPLE PUNCTUATION */
0x16ED, /* RUNIC CROSS PUNCTUATION */
0x1803, /* MONGOLIAN FULL STOP */
0x1806, /* MONGOLIAN TODO SOFT HYPHEN */
0x1809, /* MONGOLIAN MANCHU FULL STOP */
0x180E, /* MONGOLIAN VOWEL SEPARATOR */
0x2E2E, /* REVERSED QUESTION MARK;Po;0;ON;;;;;N;;;;; */
0x3000, /* IDEOGRAPHIC SPACE*/
0x3002, /* IDEOGRAPHIC FULL STOP*/
0x300C, /* LEFT CORNER BRACKET*/
0x300D, /* RIGHT CORNER BRACKET*/
0x300E, /* LEFT WHITE CORNER BRACKET*/
0x300F, /* RIGHT WHITE CORNER BRACKET*/
0x301C, /* WAVE DASH*/
0x301D, /* REVERSED DOUBLE PRIME QUOTATION MARK*/
0x301E, /* LOW DOUBLE PRIME QUOTATION MARK*/
0x3030, /* WAVY DASH*/
0x30FB, /* KATAKANA MIDDLE DOT*/
0xC2B6, /* PILCROW SIGN;So;0;ON;;;;;N;PARAGRAPH SIGN;;;; */
0xC3B7, /* DIVISION SIGN;Sm;0;ON;;;;;N;;;;; */
0xFE31, /* PRESENTATION FORM FOR VERTICAL EM DASH*/
0xFE32, /* PRESENTATION FORM FOR VERTICAL EN DASH*/
0xFE41, /* PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET*/
0xFE42, /* PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET*/
0xFE43, /* PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET*/
0xFE44, /* PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET*/
0xFE50, /* [3] SMALL COMMA..SMALL FULL STOP*/
0xFE51, /* [3] SMALL COMMA..SMALL FULL STOP*/
0xFE52, /* STOP*/
0xFE52, /* [3] SMALL COMMA..SMALL FULL STOP*/
0xFE54, /* [4] SMALL SEMICOLON..SMALL EXCLAMATION MARK*/
0xFE55, /* [4] SMALL SEMICOLON..SMALL EXCLAMATION MARK*/
0xFE56, /* [4] SMALL SEMICOLON..SMALL EXCLAMATION MARK*/
0xFE57, /* [4] SMALL SEMICOLON..SMALL EXCLAMATION MARK*/
0xFE58, /* SMALL EM DASH */
0xFE63, /* SMALL HYPHEN-MINUS */
0xFF01, /* FULLWIDTH EXCLAMATION MARK */
0xFF02, /* FULLWIDTH QUOTATION MARK */
0xFF03, /* FULLWIDTH NUMBER SIGN */
0xFF04, /* FULLWIDTH DOLLAR SIGN */
0xFF05, /* FULLWIDTH PERCENT SIGN */
0xFF06, /* FULLWIDTH AMPERSAND */
0xFF07, /* FULLWIDTH APOSTROPHE */
0xFF08, /* FULLWIDTH LEFT PARENTHESIS */
0xFF09, /* FULLWIDTH RIGHT PARENTHESIS */
0xFF0A, /* FULLWIDTH ASTERISK */
0xFF0B, /* FULLWIDTH PLUS SIGN */
0xFF0C, /* FULLWIDTH COMMA */
0xFF0D, /* FULLWIDTH HYPHEN-MINUS */
0xFF0E, /* FULLWIDTH FULL STOP */
0xFF0F, /* FULLWIDTH SOLIDUS */
0xFF1A, /* [2] FULLWIDTH COLON..FULLWIDTH SEMICOLON*/
0xFF1B, /* [2] FULLWIDTH COLON..FULLWIDTH SEMICOLON*/
0xFF1F, /* FULLWIDTH QUESTION MARK*/
0xFF61, /* HALFWIDTH IDEOGRAPHIC FULL STOP*/
0xFF62, /* HALFWIDTH LEFT CORNER BRACKET*/
0xFF63, /* HALFWIDTH RIGHT CORNER BRACKET*/
0xFF64, /* HALFWIDTH IDEOGRAPHIC COMMA*/
0xFF65, /* HALFWIDTH KATAKANA MIDDLE DOT*/
};
// Characters that should just be discarded. Some of these are in the
// above blocks, but this array is tested first, so it's not worth
// breaking the blocks
static const unsigned int uniskip[] = {
0x00AD, /* SOFT HYPHEN */
0x034F, /* COMBINING GRAPHEME JOINER */
0x2027, /* HYPHENATION POINT */
0x200C, /* ZERO WIDTH NON-JOINER */
0x200D, /* ZERO WIDTH JOINER */
0x2060, /* WORD JOINER . Actually this should not be ignored but used to
* prevent a word break... */
};
/* Things that would visibly break a block of text, rendering obvious the need
* of quotation if a phrase search is wanted */
static const unsigned int avsbwht[] = {
0x0009, /* CHARACTER TABULATION */
0x000A, /* LINE FEED */
0x000D, /* CARRIAGE RETURN */
0x0020, /* SPACE;Zs;0;WS */
0x00A0, /* NO-BREAK SPACE;Zs;0;CS */
0x1680, /* OGHAM SPACE MARK;Zs;0;WS */
0x180E, /* MONGOLIAN VOWEL SEPARATOR;Zs;0;WS */
0x2000, /* EN QUAD;Zs;0;WS */
0x2001, /* EM QUAD;Zs;0;WS */
0x2002, /* EN SPACE;Zs;0;WS */
0x2003, /* EM SPACE;Zs;0;WS */
0x2004, /* THREE-PER-EM SPACE;Zs;0;WS */
0x2005, /* FOUR-PER-EM SPACE;Zs;0;WS */
0x2006, /* SIX-PER-EM SPACE;Zs;0;WS */
0x2007, /* FIGURE SPACE;Zs;0;WS */
0x2008, /* PUNCTUATION SPACE;Zs;0;WS */
0x2009, /* THIN SPACE;Zs;0;WS */
0x200A, /* HAIR SPACE;Zs;0;WS */
0x202F, /* NARROW NO-BREAK SPACE;Zs;0;CS */
0x205F, /* MEDIUM MATHEMATICAL SPACE;Zs;0;WS */
0x3000, /* IDEOGRAPHIC SPACE;Zs;0;WS */
};
#endif // _PROPLIST_H_INCLUDED_

608
src/configure.ac Normal file
View file

@ -0,0 +1,608 @@
AC_INIT([Recoll], m4_esyscmd_s(cat VERSION))
AC_CONFIG_HEADERS([common/autoconfig.h])
AC_PREREQ(2.53)
AC_CONFIG_SRCDIR(index/recollindex.cpp)
AC_PROG_CXX
if test C$CXX = C ; then
AC_MSG_ERROR([C++ compiler needed. Please install one (ie: gnu g++)])
fi
AC_C_BIGENDIAN
sys=`uname | tr / _ | awk -F_ '{print $1}'`
if test ! -f mk/$sys ; then
AC_MSG_NOTICE([
No system configuration file found in mk/ for uname = '$sys'.
Trying with Default file.
If the build fails, you'll need to write a configuration file, starting
from one of the existing ones.])
sys=Default
fi
(cd mk; rm -f sysconf; ln -s $sys sysconf)
# There a few Recoll users on Mac OS X and a few things are just not worth
# supporting
if test X$sys = XDarwin ; then
NODYNLIB=#
fi
AC_SYS_LARGEFILE
# OpenBSD needs sys/param.h for mount.h to compile
AC_CHECK_HEADERS([sys/param.h])
# Check for where to find unordered_map etc.
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(tr1/unordered_map,[AC_DEFINE([HAVE_TR1_UNORDERED],
[],["Have tr1"])],[])
AC_CHECK_HEADER(unordered_map,[AC_DEFINE([HAVE_CXX0X_UNORDERED],
[],["Have C++0x"])],[])
AC_LANG_POP([C++])
AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h], [], [],
[#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
# Use specific 'file' command ? (Useful on solaris to specify
# /usr/local/bin/file instead of the system's which doesn't understand '-i'
AC_ARG_WITH(file-command,
AC_HELP_STRING([--with-file-command],
[Specify version of 'file' command (ie: --with-file-command=/usr/local/bin/file)]),
withFileCommand=$withval, withFileCommand=file)
case $withFileCommand in
file)
AC_PATH_PROG(fileProg, file);;
*)
fileProg=$withFileCommand;;
esac
if test ! -x "$fileProg"; then
AC_MSG_ERROR([$fileProg does not exist or is not executable])
fi
AC_DEFINE_UNQUOTED(FILE_PROG, "$fileProg", [Path to the file program])
# Can't use Solaris standard 'file' command, it doesn't support -i
if test X$sys != XSunOS -o X$fileProg != X/usr/bin/file; then
AC_DEFINE(USE_SYSTEM_FILE_COMMAND, 1, [Enable using the system's 'file' command to id mime if we fail internally])
fi
# Use aspell to provide spelling expansions ?
# The default is yes. If we do find an aspell installation, we use it. Else
# we do compile the aspell module using an internal copy of aspell.h
# Only --with-aspell=no will completely disable aspell support
AC_ARG_WITH(aspell,
AC_HELP_STRING([--without-aspell],
[Disable use of aspell spelling package to provide term expansion to other spellings]),
withAspell=$withval, withAspell=yes)
case $withAspell in
no);;
yes)
AC_PATH_PROG(aspellProg, aspell)
;;
*) # The argument should be the path to the aspell program
aspellProg=$withAspell
;;
esac
if test X$withAspell != Xno ; then
AC_DEFINE(RCL_USE_ASPELL, 1, [Compile the aspell interface])
if test X$aspellProg != X ; then
aspellBase=`dirname $aspellProg`
aspellBase=`dirname $aspellBase`
AC_DEFINE_UNQUOTED(ASPELL_PROG, "$aspellProg",
[Path to the aspell program])
if test -f $aspellBase/include/aspell.h ; then
AC_DEFINE_UNQUOTED(ASPELL_INCLUDE, "$aspellBase/include/aspell.h",
[Path to the aspell api include file])
else
AC_MSG_NOTICE([aspell support enabled but aspell package not found. Compiling with internal aspell interface file])
AC_DEFINE(ASPELL_INCLUDE, ["aspell-local.h"])
fi
else
# aspell support enabled but no aspell install yet
AC_MSG_NOTICE([aspell support enabled but aspell package not found. Compiling with internal aspell interface file])
AC_DEFINE(ASPELL_INCLUDE, ["aspell-local.h"])
fi
fi
if test -f /usr/include/sys/inotify.h -o -f /usr/include/linux/inotify.h; then
inot_default=yes
else
inot_default=no
fi
# Real time monitoring with inotify
AC_ARG_WITH(inotify,
AC_HELP_STRING([--with-inotify],
[Use inotify for almost real time indexing of modified files (the default
is yes on Linux).]),
withInotify=$withval, withInotify=$inot_default)
if test X$withInotify != Xno ; then
AC_MSG_NOTICE([enabled support for inotify monitoring])
AC_DEFINE(RCL_MONITOR, 1, [Real time monitoring option])
AC_DEFINE(RCL_USE_INOTIFY, 1, [Compile the inotify interface])
else
AC_MSG_NOTICE([inotify not found, inotify monitoring disabled])
fi
# Real time monitoring with FAM
AC_ARG_WITH(fam,
AC_HELP_STRING([--with-fam],
[Use File Alteration Monitor for almost real time indexing of modified files. Give the fam/gamin library as argument (ie: /usr/lib/libfam.so) if configure does not find the right one.]),
withFam=$withval, withFam=yes)
if test X$withFam != Xno -a X$withInotify != Xno ; then
AC_MSG_NOTICE([FAM support enabled but inotify support also enabled. Disabling FAM support and using inotify])
withFam=no
fi
famLib=""
case $withFam in
no);;
yes)
for dir in /usr/local/lib ${libdir};do
if test -f $dir/libfam.so ; then famLib=$dir/libfam.so;break;fi
done
if test X$famLib = X ; then
AC_MSG_NOTICE([FAM library not found, disabling FAM and real time indexing support])
withFam=no
fi
;;
*) # The argument should be the path to the fam library
famLib=$withFam
;;
esac
if test X$withFam != Xno ; then
AC_DEFINE(RCL_MONITOR, 1, [Real time monitoring option])
AC_DEFINE(RCL_USE_FAM, 1, [Compile the fam interface])
if test X$famLib != X ; then
famLibDir=`dirname $famLib`
famBase=`dirname $famLibDir`
famBLib=`basename $famLib .so | sed -e s/lib//`
if test ! -f $famBase/include/fam.h ; then
AC_MSG_ERROR([fam.h not found in $famBase/include. Specify --with-fam=no to disable fam support])
fi
LIBFAM="-L$famLibDir -l$famBLib"
AC_MSG_NOTICE([fam library directive: $LIBFAM])
AC_DEFINE_UNQUOTED(FAM_INCLUDE, "$famBase/include/fam.h",
[Path to the fam api include file])
else
AC_MSG_ERROR([fam library not found])
fi
fi
# Enable use of threads in the indexing pipeline.
# This is disabled by default as we usually care little about indexing
# absolute performance (more about impact on usability and total
# resources used).
AC_ARG_ENABLE(idxthreads,
AC_HELP_STRING([--disable-idxthreads],
[Disable multithread indexing.]),
idxthreadsEnabled=$enableval, idxthreadsEnabled=yes)
if test X$idxthreadsEnabled = Xyes ; then
AC_DEFINE(IDX_THREADS, 1, [Use multiple threads for indexing])
NOTHREADS=""
else
NOTHREADS="#"
fi
# Enable CamelCase word splitting. This is optional because it causes
# problems with phrases: with camelcase enabled, "MySQL manual"
# will be matched by "MySQL manual" and "my sql manual" but not
# "mysql manual" (which would need increased slack as manual is now at pos
# 2 instead of 1
AC_ARG_ENABLE(camelcase,
AC_HELP_STRING([--enable-camelcase],
[Enable splitting camelCase words. This is not enabled by default as
this makes phrase matches more difficult: you need to use matching
case in the phrase query to get a match. Ie querying for
"MySQL manual" and "my sql manual" are the same, but not the same as
"mysql manual" (in phrases only and you could raise the phrase slack to
get a match).]),
camelcaseEnabled=$enableval, camelcaseEnabled=no)
if test X$camelcaseEnabled = Xyes ; then
AC_DEFINE(RCL_SPLIT_CAMELCASE, 1, [Split camelCase words])
fi
# Disable building the python module. This is built by default, because
# it's really the easiest way to interface and extend recoll. It forces PIC
# objects for everything (indexing performance impact: 1%), because it's
# just not worth building the lib twice
# You can still have a non-pic recoll with:
# configure --disable-python-module; make; make install;make clean
# configure; make; cd python/recoll; make install
#
if test X$sys != XDarwin ; then
AC_ARG_ENABLE(python-module,
AC_HELP_STRING([--disable-python-module],
[Do not build the Python module.]),
pythonEnabled=$enableval, pythonEnabled=yes)
if test X$pythonEnabled = Xyes ; then
NOPYTHON=""
else
NOPYTHON="#"
fi
else
NOPYTHON="#"
fi
# Build PIC objects for the library ?
AC_ARG_ENABLE(pic,
AC_HELP_STRING([--disable-pic],
[Do not compile library objects as position independant code.
This is incompatible with the php or python extensions.]),
picEnabled=$enableval, picEnabled=forpython)
case $picEnabled in
forpython) picEnabled=$pythonEnabled; NOPIC=$NOPYTHON;;
yes) NOPIC="";;
*) NOPIC="#";;
esac
if test X$pythonEnabled = Xyes -a X$picEnabled != Xyes; then
AC_MSG_ERROR([Python build needs PIC library])
fi
if test X$NOPIC != X; then
NODYNLIB=#
fi
AC_CHECK_FUNCS(mkdtemp)
##### Look for iconv. This can exist in either libc (ie: Linux, solaris) or
##### libiconv. We'd need a --with-libiconv= option
AC_LANG(C++)
LIBICONV=""
S_LIBS=$LIBS
S_CPPFLAGS=$CPPFLAGS
for dir in ${libdir} /opt/local/lib /usr/local/lib;do
CPPFLAGS="$S_CPPFLAGS -I$dir/../include"
LIBS="$S_LIBS -L$dir"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
LIBICONV="-L$dir";INCICONV=-I$dir/../include)
if test A"$LIBICONV" != A ; then
break
fi
LIBS="$S_LIBS -L$dir -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
LIBICONV="-L$dir -liconv";INCICONV=-I$dir/../include)
if test A"$LIBICONV" != A ; then
break
fi
done
LIBS=$S_LIBS
CPPFLAGS=$S_CPPFLAGS
if test A"$LIBICONV" = A ; then
AC_MSG_ERROR([Cannot find iconv_open anywhere. Please install iconv])
exit 1
fi
#echo LIBICONV $LIBICONV
#echo INCICONV $INCICONV
CPPFLAGS="$CPPFLAGS $INCICONV"
AC_MSG_CHECKING(for type of inbuf parameter to iconv)
AC_TRY_COMPILE([
#include <stddef.h>
#include <iconv.h>
],[
iconv(0,(const char **)0,(size_t *)0,(char **)0,(size_t *)0);
], rcl_iconv_inbuf_const="1", rcl_iconv_inbuf_const="0")
if test X$rcl_iconv_inbuf_const = X1 ; then
AC_DEFINE(RCL_ICONV_INBUF_CONST, 1, [iconv parameter 2 is const char**])
fi
############# Putenv
AC_MSG_CHECKING(for type of string parameter to putenv)
AC_TRY_COMPILE([
#include <stdlib.h>
],[
putenv((const char *)0);
], rcl_putenv_string_const="1", rcl_putenv_string_const="0")
if test X$rcl_putenv_string_const = X1 ; then
AC_DEFINE(PUTENV_ARG_CONST, 1, [putenv parameter is const])
fi
#### Look for Xapian. Done in a strange way to work around autoconf
# cache
XAPIAN_CONFIG=no
if test "$XAPIAN_CONFIG" = "no"; then
AC_PATH_PROG(XAPIAN_CONFIG0, [xapian-config], no)
XAPIAN_CONFIG=$XAPIAN_CONFIG0
fi
if test "$XAPIAN_CONFIG" = "no"; then
AC_PATH_PROG(XAPIAN_CONFIG1, [xapian-config-1.3], no)
XAPIAN_CONFIG=$XAPIAN_CONFIG1
fi
if test "$XAPIAN_CONFIG" = "no"; then
AC_PATH_PROG(XAPIAN_CONFIG2, [xapian-config-1.1], no)
XAPIAN_CONFIG=$XAPIAN_CONFIG2
fi
if test "$XAPIAN_CONFIG" = "no" ; then
AC_MSG_ERROR([Cannot find xapian-config command in $PATH. Is
xapian-core installed ?])
exit 1
fi
LIBXAPIAN=`$XAPIAN_CONFIG --libs`
# The --static thing fails with older Xapians. Happily enough they don't
# need it either (because there are no needed libraries (no uuid and we
# deal explicitely with libz)
LIBXAPIANSTATICEXTRA=`$XAPIAN_CONFIG --static --libs 2> /dev/null`
# Workaround for problem in xapian-config in some versions: wrongly lists
# libstdc++.la in the lib list
for i in $LIBXAPIAN ; do
case $i in
*stdc++*|-lm|-lgcc_s|-lc);;
*) tmpxaplib="$tmpxaplib $i";;
esac
done
LIBXAPIAN=$tmpxaplib
# Also recent xapian libs need lz even when they think they don't...
LIBXAPIAN="$LIBXAPIAN -lz"
LIBXAPIANDIR=`$XAPIAN_CONFIG --libs | awk '{print $1}'`
case A"$LIBXAPIANDIR" in
A-L*) LIBXAPIANDIR=`echo $LIBXAPIANDIR | sed -e 's/-L//'`;;
*) LIBXAPIANDIR="";;
esac
XAPIANCXXFLAGS=`$XAPIAN_CONFIG --cxxflags`
#echo XAPIAN_CONFIG: $XAPIAN_CONFIG
#echo LIBXAPIAN: $LIBXAPIAN
#echo LIBXAPIANDIR: $LIBXAPIANDIR
#echo LIBXAPIANSTATICEXTRA: $LIBXAPIANSTATICEXTRA
#echo XAPIANCXXFLAGS: $XAPIANCXXFLAGS
#### QT
# The way qt and its tools (qmake especially) are installed is very
# different between systems (and maybe qt versions)
#
# In general we need QTDIR to be set, because it is used inside the
# qmake-generated makefiles. But there are exceptions: ie on debian3.1 (at
# least on the sourceforge compile farm), QTDIR is not needed because qmake
# generates hard paths (and is installed in /usr/bin). We don't want to
# force the user to set QTDIR if it is not needed.
#
# The logic is then to first look for qmake, possibly using QTDIR if it is
# set.
#
# If QTDIR is not set, we then generate a bogus qt project and check if
# QTDIR is needed in the Makefile, in which case we complain.
#
# QMAKESPEC: on most Linux system, there is a 'default' link inside the
# mkspecs directory, so that QMAKESPEC is not needed.
# If QMAKESPEC is not set and needed, the qmake test at the previous test
# will have failed, and we tell the user to check his environment.
#
AC_ARG_ENABLE(qtgui,
AC_HELP_STRING([--disable-qtgui],
[Disable the QT-based graphical user interface.]),
enableQT=$enableval, enableQT="yes")
if test "$enableQT" != "yes" ; then
NOQTMAKE="#"
NOCMDLINE=""
else
NOQTMAKE=""
NOCMDLINE="#"
if test X$QTDIR != X ; then
PATH=$PATH:$QTDIR/bin
export PATH
fi
if test X$QMAKE = X ; then
QMAKE=qmake
fi
case $QMAKE in
*/*) QMAKEPATH=$QMAKE;;
*) AC_PATH_PROG([QMAKEPATH], $QMAKE, NOTFOUND);;
esac
if test X$QMAKEPATH = XNOTFOUND ; then
AC_MSG_ERROR([Cannot find the qmake program. Maybe you need to install
qt development files and tools and/or set the QTDIR environment variable?])
fi
QMAKE=$QMAKEPATH
# MAC OS X: we don't support this (the native search tool is more than
# good enough), but we make things work just enough so that the program can
# be compiled and roughly installed (not as a .app, but to /usr/local),
# basically to enable using a Macbook for development
if test X$sys = XDarwin ; then
# The default is xcode
QMAKE="${QMAKE} -spec macx-g++"
fi
# Discriminate qt3/4. Qt3 qmake prints its version on stderr but we don't
# depend on this. We try to detect the qt 4 version string instead.
qmakevers="`${QMAKE} --version 2>&1`"
#echo "qmake version: $qmakevers"
v4=`expr "$qmakevers" : '.*Qt[ ][ ]*version[ ][ ]*4.*'`
v5=`expr "$qmakevers" : '.*Qt[ ][ ]*version[ ][ ]*5.*'`
if test X$v4 = X0 -a X$v5 = X0; then
AC_MSG_ERROR([qmake seems to be using Qt version 3 which is not supported any more])
QTGUI=qtgui
else
if test X$v4 != X0 ; then
AC_MSG_NOTICE([using qt version 4 user interface])
else
AC_MSG_NOTICE([using qt version 5 user interface])
fi
QTGUI=qtgui
fi
cd $QTGUI
# We just want a .pro file: no problem with unsubstituted variables at
# this point.
test -f recoll.pro && chmod +w recoll.pro
cp recoll.pro.in recoll.pro
#echo QMAKE ${QMAKE}
${QMAKE} recoll.pro
if test $? != 0 ; then
AC_MSG_ERROR([Cannot use qmake to generate a Makefile. Maybe you need to
check the QTDIR and QMAKESPEC environment variables?])
fi
# is QTDIR set and do we actually need it ?
if test X$QTDIR = X ; then
QTDIRNEEDED=`grep INCPATH Makefile | grep = | grep QTDIR`
if test "X$QTDIRNEEDED" != "X" ; then
AC_MSG_ERROR([You need to set the QTDIR variable to point to the QT
installation. If there is no default mkspecs, you should also set QMAKESPEC])
fi
fi
cd ..
##### Using Qt webkit for reslist display? Else Qt textbrowser
AC_ARG_ENABLE(webkit,
AC_HELP_STRING([--disable-webkit],
[Disable use of qt-webkit (only meaningful if qtgui is enabled).]),
enableWebkit=$enableval, enableWebkit="yes")
if test "$enableWebkit" = "yes" ; then
QMAKE_ENABLE_WEBKIT=""
QMAKE_DISABLE_WEBKIT="#"
else
QMAKE_ENABLE_WEBKIT="#"
QMAKE_DISABLE_WEBKIT=""
fi
##### Using QZeitGeist lib ? Default no for now
AC_ARG_WITH(qzeitgeist,
AC_HELP_STRING([--with-qzeitgeist],
[Enable the use of the qzeitgeist library to send zeitgeist events.]),
withQZeitgeist=$withval, withQZeitgeist="no")
case "$withQZeitgeist" in
no) LIBQZEITGEIST=;;
yes) LIBQZEITGEIST=-lqzeitgeist;;
*) LIBQZEITGEIST=$withQZeitgeist;;
esac
if test "$withQZeitgeist" != "no" ; then
QMAKE_ENABLE_ZEITGEIST=""
QMAKE_DISABLE_ZEITGEIST="#"
else
QMAKE_ENABLE_ZEITGEIST="#"
QMAKE_DISABLE_ZEITGEIST=""
fi
AC_CONFIG_FILES($QTGUI/recoll.pro)
##################### End QT stuff
fi
### X11: this is needed for the session monitoring code (in recollindex -m)
AC_ARG_ENABLE(x11mon,
AC_HELP_STRING([--disable-x11mon],
[Disable recollindex support for X11 session monitoring.]),
enableX11mon=$enableval, enableX11mon="yes")
if test X$withInotify = Xno -a X$withFam = Xno ; then
enableX11mon=no
fi
if test "$enableX11mon" = "yes" ; then
AC_PATH_XTRA
X_LIBX11=-lX11
else
AC_DEFINE(DISABLE_X11MON, 1, [No X11 session monitoring support])
X_LIBX11=""
fi
#echo X_CFLAGS "'$X_CFLAGS'" X_PRE_LIBS "'$X_PRE_LIBS'" X_LIBS \
# "'$X_LIBS'" X_LIBX11 "'$X_LIBX11'" X_EXTRA_LIBS "'$X_EXTRA_LIBS'"
# We have to expand prefix in here, couldn't find a way to do it inside
# the qt gui .pro file or Makefile. This just means that you can't change
# prefix at build time. It works at install time because we dont' use the
# qtgui Makefile
m_prefix=$prefix
test "X$m_prefix" = "XNONE" && m_prefix=/usr/local
m_datadir=${m_prefix}/share
QTRECOLL_DATADIR=${m_datadir}/recoll
RCLVERSION=`cat VERSION`
RCLLIBVERSION=$RCLVERSION
AC_SUBST(X_CFLAGS)
AC_SUBST(X_PRE_LIBS)
AC_SUBST(X_LIBS)
AC_SUBST(X_LIBX11)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(INCICONV)
AC_SUBST(LIBICONV)
AC_SUBST(LIBXAPIAN)
AC_SUBST(LIBXAPIANDIR)
AC_SUBST(LIBXAPIANSTATICEXTRA)
AC_SUBST(LIBFAM)
AC_SUBST(QMAKE)
AC_SUBST(QTGUI)
AC_SUBST(QTRECOLL_DATADIR)
AC_SUBST(XAPIANCXXFLAGS)
AC_SUBST(HAVE_MKDTEMP)
AC_SUBST(NOQTMAKE)
AC_SUBST(NOCMDLINE)
AC_SUBST(QMAKE_ENABLE_WEBKIT)
AC_SUBST(QMAKE_DISABLE_WEBKIT)
AC_SUBST(QMAKE_ENABLE_ZEITGEIST)
AC_SUBST(QMAKE_DISABLE_ZEITGEIST)
AC_SUBST(LIBQZEITGEIST)
AC_SUBST(NOPIC)
AC_SUBST(NOTHREADS)
AC_SUBST(NOPYTHON)
AC_SUBST(NODYNLIB)
AC_SUBST(RCLVERSION)
AC_SUBST(RCLLIBVERSION)
# All object files depend on localdefs which has the cc flags. Avoid
# changing it unless necessary
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(common/rclversion.h)
AC_CONFIG_FILES(lib/mkMake)
AC_CONFIG_FILES(mk/localdefs.new:mk/localdefs.in)
AC_CONFIG_FILES(python/recoll/setup.py)
AC_CONFIG_FILES(recollinstall)
AC_CONFIG_FILES(sampleconf/recoll.conf)
for d in bincimapmime index lib query
do
rm -f $d/alldeps.stamp
cp -f /dev/null $d/alldeps
done
AC_OUTPUT
if cmp -s mk/localdefs mk/localdefs.new ; then
rm -f mk/localdefs.new
else
mv -f mk/localdefs.new mk/localdefs
fi

66
src/desktop/hotrecoll.py Executable file
View file

@ -0,0 +1,66 @@
#!/usr/bin/python
#
# This script should be linked to a keyboard shortcut. Under gnome,
# you can do this from the main preferences menu, or directly execute
# "gnome-keybinding-properties"
#
# Make the script executable. Install it somewhere in the executable
# path ("echo $PATH" to check what's in there), and then just enter
# its name as the action to perform, or copy it anywhere and copy the
# full path as the action.
import gtk
import wnck
import os
import sys
from optparse import OptionParser
def main():
parser = OptionParser()
parser.add_option("-m", "--move-away", action="store_true", default=False,
dest="clear_workspace",
help="iconify to other workspace to avoid crowding panel")
(options, args) = parser.parse_args()
screen = wnck.screen_get_default()
while gtk.events_pending():
gtk.main_iteration()
recollMain = ""
recollwins = [];
for window in screen.get_windows():
if window.get_class_group().get_name() == "Recoll":
if window.get_name() == "Recoll":
recollMain = window
recollwins.append(window)
if not recollMain:
os.system("recoll&")
sys.exit(0)
# Check the main window state, and either activate or minimize all
# recoll windows.
workspace = screen.get_active_workspace()
if not recollMain.is_visible_on_workspace(workspace):
for win in recollwins:
win.move_to_workspace(workspace)
if win != recollMain:
win.unminimize(gtk.get_current_event_time())
recollMain.activate(gtk.get_current_event_time())
else:
otherworkspace = None
if options.clear_workspace:
# We try to minimize to another workspace
wkspcs = screen.get_workspaces()
for wkspc in wkspcs:
if wkspc.get_number() != workspace.get_number():
otherworkspace = wkspc
break
for win in recollwins:
if otherworkspace:
win.move_to_workspace(otherworkspace)
win.minimize()
if __name__ == '__main__':
main()

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Categories=Utility;Filesystem;Database;
Comment=Find documents by specifying search terms
Exec=recoll
GenericName=Local Text Search
Icon=recoll
Name=Recoll
Terminal=false
Type=Application
Keywords=Search;Full Text;

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Jean-Francois Dockes <jfd@recoll.org> -->
<application>
<id type="desktop">recoll.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<name>Recoll</name>
<summary>Find documents by specifying search terms</summary>
<description>
<p>Recoll finds keywords inside documents text as well as file names.</p>
<ul>
<li>It can search most document formats.</li>
<li>It can reach any storage place: files, archive members, email
attachments, transparently handling decompression.</li>
<li>One click will open the document inside a native editor or
display an even quicker text preview.</li>
</ul>
</description>
<screenshots>
<screenshot type="default">http://www.recoll.org/files/recoll-mainwin-h-1248x702.png</screenshot>
</screenshots>
<url type="homepage">http://www.recoll.org/</url>
<updatecontact>contact@recoll.org</updatecontact>
</application>

BIN
src/desktop/recoll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

275
src/desktop/recoll.svg Normal file
View file

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="New document 1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="317.26408"
inkscape:cy="545.1161"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1600"
inkscape:window-height="1148"
inkscape:window-x="0"
inkscape:window-y="30"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g3184"
transform="translate(0,-0.75762939)">
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002"
width="28.789337"
height="27.779184"
x="272.99374"
y="480.11078" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3"
width="28.789337"
height="27.779184"
x="272.99374"
y="507.88995" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-7"
width="28.789337"
height="27.779184"
x="272.99374"
y="535.66913" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-4"
width="28.789337"
height="27.779184"
x="272.99374"
y="563.4483" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-76"
width="28.789337"
height="27.779184"
x="272.99374"
y="591.22754" />
</g>
<g
id="g3212"
transform="translate(-10.101563,0)">
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-4"
width="28.789337"
height="27.779184"
x="398.25266"
y="479.35315" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-9"
width="28.789337"
height="27.779184"
x="398.25266"
y="507.13232" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-7-2"
width="28.789337"
height="27.779184"
x="398.25266"
y="534.9115" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-4-7"
width="28.789337"
height="27.779184"
x="398.25266"
y="562.69067" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-76-1"
width="28.789337"
height="27.779184"
x="398.25266"
y="590.46991" />
</g>
<g
id="g3198"
transform="translate(-7.0710754,-1.5258789e-5)">
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-30"
width="28.789337"
height="27.779184"
x="337.64349"
y="479.35318" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-3"
width="28.789337"
height="27.779184"
x="337.64349"
y="507.13235" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-7-6"
width="28.789337"
height="27.779184"
x="337.64349"
y="534.9115" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-4-9"
width="28.789337"
height="27.779184"
x="337.64349"
y="562.69067" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-76-4"
width="28.789337"
height="27.779184"
x="337.64349"
y="590.46991" />
</g>
<g
id="g3191"
transform="translate(-0.50506592,-0.50506592)">
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-20"
width="28.789337"
height="27.779184"
x="302.28815"
y="479.85822" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-7-0"
width="28.789337"
height="27.779184"
x="302.28815"
y="507.63739" />
<rect
ry="0"
style="fill:#7676db;fill-opacity:1"
id="rect3002-3-4-8"
width="28.789337"
height="27.779184"
x="302.28815"
y="535.41656" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-76-5"
width="28.789337"
height="27.779184"
x="302.28815"
y="563.19574" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-20-2"
width="28.789337"
height="27.779184"
x="302.28815"
y="590.97498" />
</g>
<g
id="g3205"
transform="translate(-8.5863037,-0.50508118)">
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-20-22"
width="28.789337"
height="27.779184"
x="367.94806"
y="479.85825" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-7-0-7"
width="28.789337"
height="27.779184"
x="367.94806"
y="507.63742" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-4-8-0"
width="28.789337"
height="27.779184"
x="367.94806"
y="535.41656" />
<rect
ry="0"
style="fill:#94d966;fill-opacity:1"
id="rect3002-76-5-9"
width="28.789337"
height="27.779184"
x="367.94806"
y="563.19574" />
<rect
ry="0"
style="fill:#e88233;fill-opacity:1"
id="rect3002-3-20-2-6"
width="28.789337"
height="27.779184"
x="367.94806"
y="590.97498" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
src/desktop/recoll.xcf Normal file

Binary file not shown.

View file

@ -0,0 +1,69 @@
#!/bin/sh
# This is a shell script that starts and stops the recollindex daemon
# depending on whether or not the power supply is plugged in. It should be
# called from the file ~/.config/autostart/recollindex.desktop.
#
# That is: make the script executable (chmod +x) and replace in
# recollindex.desk the line:
# Exec=recollindex -w 60 -m
# With
# Exec=/path/to/recoll_index_on_ac.sh
#
#
# By: The Doctor (drwho at virtadpt dot net)
# License: GPLv3
#
# Modifications by J.F Dockes
# - replaced "acpi" usage with "on_ac_power" which seems to be both
# more common and more universal.
# - Changed the default to be that we run recollindex if we can't determine
# power status (ie: on_ac_power not installed or not working: we're most
# probably not running on a laptop).
INDEXER="recollindex -w 60 -m"
ACPI=`which on_ac_power`
# If the on_ac_power script isn't installed, warn, but run anyway. Maybe
# this is not a laptop or not linux.
if test "x$ACPI" = "x" ; then
echo "on_ac_power utility not found. Starting recollindex anyway."
fi
while true; do
# Determine whether or not the power supply is plugged in.
if test "x$ACPI" != "x" ; then
on_ac_power
STATUS=$?
else
STATUS=0
fi
# Get the PID of the indexing daemon.
if test -f ~/.recoll/index.pid ; then
PID=`cat ~/.recoll/index.pid`
# Make sure that this is recollindex running. pid could have
# been reallocated
ps ax | egrep "^[ \t]*$PID " | grep -q recollindex || PID=""
fi
# echo "Recollindex pid is $PID"
if test $STATUS -eq 1 ; then
# The power supply is not plugged in. See if the indexing daemon is
# running, and if it is, kill it. The indexing daemon will not be
# started.
if test x"$PID" != x; then
kill $PID
fi
else
# The power supply is plugged in or we just don't know.
# See if the indexing daemon is running, and if it's not start it.
if test -z "$PID" ; then
$INDEXER
fi
fi
# Go to sleep for a while.
sleep 120
continue
done

Some files were not shown because too many files have changed in this diff Show more