
Kopete Log Sync Toolkit
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
This tool allows you to sync two kopete log directories. Say you have a notebook with /home/ mounted over NFS and you want to always have your logs in sync - this is the solution.
The tarball contains klt source (kopete log toolkit) - a commmand line tool that allows to merge and validate kopete logs and a slightly modified version of klm bash script (it now doesn't create duplicates of messages as it used in the original).
Requirements:
libxml2
klm also requires gzip bzip and others for archiving purposes. The requirement of xmlstarlet and tidy is elimimnated since the logs are now processed by a separate program.
klm bundled in this package is a rework of the script located here: http://www.kde-apps.org/content/show.php/KopeteLogMerge?content=84589
Apart from the functionality, what was addedfixed:
* zerofix: some old versions of kopete used to poison xm logs with 0x0 characters, so the zerofix option of the bash script will help you fix them: separately or in a batch
* validate: logs can be now validated all in one pakage or in a batch.
Compilation requires cmake.
just run
$ cmake .
$ make
in the directory with the source. Once compiled edit the variable KLT at the top of the bash script to reflect the path of the binary. No proper install script this time since don't have the time.
TODO:
* Test other features
* Support log importing from other instant messangers.
* COntact list synchronisation.
* kdialog-based progressbar in bash script
* proper install script
12 years ago
0.1
Initial version. Synchronisation works 100%, other features still untested.
12 years ago
0.1
Initial version. Synchronisation works 100%, other features still untested.
TTL
9 years ago
I looked through the source-code and beside some missing error checking I could not find any issues.
Only the libxml2 had problems with some strange umlauts in one logfile. (But I guess here its kopetes fault).
I only did not manage to use the script correctly to merge two directories, so based on the given script, I wrote my own:
ORIGDIR=`dirname $0`
KLT="$ORIGDIR/klt"
printHelp() {
echo "Usage: source target"
echo "both need to be existing directories"
exit 0
}
dirMerge() {
if [ ! -d "$src" ]; then
echo "$src is not a directory" >&2
exit 2
fi
if [ ! -d "$dest" ]; then
echo "$dest is not a directory" >&2
exit 2
fi
for log in `find "$src" |grep xml`; do
#echo "found $log"
name=`basename $log`
log2="$dest/$name"
#echo "target is '$log2'. source is '$log'"
if [ -f "$log2" ]; then
if ! cmp -s "$log" "$log2"; then
logMerge
echo ""
fi
else
cp "$log" "$log2"
echo "copy $log -> $log2"
fi
done
}
logMerge() {
echo "merge $log --> $log2 2"
$KLT merge "$log" "$log2" 2
RETSTATE=$?
if [ "$RETSTATE" -ne "0" ] ; then
echo "Error: merging process failed with status $RETSTATE"
exit 1
fi
}
src=$1
dest=$2
dirMerge
Report
Martin22
12 years ago
cmake processed ok
make failed
make:
martin@notebook:~/Down/klt$ make
/usr/bin/cmake -H/home/martin/Down/klt -B/home/martin/Down/klt --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/martin/Down/klt/CMakeFiles /home/martin/Down/klt/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/martin/Down/klt'
make -f CMakeFiles/klt.dir/build.make CMakeFiles/klt.dir/depend
make[2]: Entering directory `/home/martin/Down/klt'
cd /home/martin/Down/klt && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/martin/Down/klt /home/martin/Down/klt /home/martin/Down/klt /home/martin/Down/klt /home/martin/Down/klt/CMakeFiles/klt.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/martin/Down/klt'
make -f CMakeFiles/klt.dir/build.make CMakeFiles/klt.dir/build
make[2]: Entering directory `/home/martin/Down/klt'
/usr/bin/cmake -E cmake_progress_report /home/martin/Down/klt/CMakeFiles 2
[ 50%] Building C object CMakeFiles/klt.dir/merger.o
/usr/bin/gcc -Wall -g -O2 -o CMakeFiles/klt.dir/merger.o -c /home/martin/Down/klt/merger.c
/home/martin/Down/klt/merger.c:28:27: error: libxml/parser.h: No such file or directory
/home/martin/Down/klt/merger.c:29:25: error: libxml/tree.h: No such file or directory
/home/martin/Down/klt/merger.c:32: error: expected ‘)’ before ‘*’ token
/home/martin/Down/klt/merger.c: In function ‘validate’:
/home/martin/Down/klt/merger.c:68: error: ‘xmlDoc’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:68: error: (Each undeclared identifier is reported only once
/home/martin/Down/klt/merger.c:68: error: for each function it appears in.)
/home/martin/Down/klt/merger.c:68: error: ‘doc1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:69: error: ‘doc2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:70: error: ‘xmlIndentTreeOutput’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:71: warning: implicit declaration of function ‘xmlKeepBlanksDefault’
/home/martin/Down/klt/merger.c:72: error: ‘xmlNode’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:72: error: ‘root_element1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:73: error: ‘root_element2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:74: error: ‘LIBXML_TEST_VERSION’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:79: error: expected ‘;’ before ‘xmlParserCtxt’
/home/martin/Down/klt/merger.c:80: error: ‘xmlParserCtxt’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:80: error: ‘ctxt2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:82: error: ‘ctxt1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:82: warning: implicit declaration of function ‘xmlNewParserCtxt’
/home/martin/Down/klt/merger.c:89: warning: implicit declaration of function ‘xmlCtxtReadFile’
/home/martin/Down/klt/merger.c:96: warning: implicit declaration of function ‘xmlDocGetRootElement’
/home/martin/Down/klt/merger.c:98: warning: implicit declaration of function ‘version_check’
/home/martin/Down/klt/merger.c: At top level:
/home/martin/Down/klt/merger.c:105: error: expected ‘)’ before ‘*’ token
/home/martin/Down/klt/merger.c:154: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/home/martin/Down/klt/merger.c:194: error: expected ‘)’ before ‘*’ token
/home/martin/Down/klt/merger.c: In function ‘merge’:
/home/martin/Down/klt/merger.c:275: error: ‘xmlDoc’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:275: error: ‘doc1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:276: error: ‘doc2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:277: error: ‘xmlIndentTreeOutput’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:279: error: ‘xmlNode’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:279: error: ‘root_element1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:280: error: ‘root_element2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:281: error: ‘LIBXML_TEST_VERSION’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:282: error: expected ‘;’ before ‘fprintf’
/home/martin/Down/klt/merger.c:286: error: ‘xmlParserCtxt’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:286: error: ‘ctxt1’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:287: error: ‘ctxt2’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:307: error: ‘XML_FROM_PARSER’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:307: error: ‘XML_ERR_DOCUMENT_EMPTY’ undeclared (first use in this function)
/home/martin/Down/klt/merger.c:352: warning: implicit declaration of function ‘merge_trees’
/home/martin/Down/klt/merger.c:353: warning: implicit declaration of function ‘xmlSaveFormatFileEnc’
/home/martin/Down/klt/merger.c:391: warning: implicit declaration of function ‘xmlFreeDoc’
/home/martin/Down/klt/merger.c:398: warning: implicit declaration of function ‘xmlCleanupParser’
make[2]: *** [CMakeFiles/klt.dir/merger.o] Error 1
make[2]: Leaving directory `/home/martin/Down/klt'
make[1]: *** [CMakeFiles/klt.dir/all] Error 2
make[1]: Leaving directory `/home/martin/Down/klt'
make: *** [all] Error 2
Report
AiFiLTr0
12 years ago
Report
ptitpoul
9 years ago
cmake_minimum_required (VERSION 2.6)
project(klt)
#if you don't want the full compiler output, remove the following line
set(CMAKE_VERBOSE_MAKEFILE ON)
#add definitions, compiler switches, etc.
add_definitions(-Wall -g -O2 )
#list all source files here
add_executable(klt main.c merger.c)
#need to link to some other libraries ? just add them here
find_package(LibXml2 REQUIRED)
include_directories("${LIBXML2_INCLUDE_DIR}")
target_link_libraries(klt ${LIBXML2_LIBRARIES})
Report
PhrkOnLsh
12 years ago
This is definitely something I'd love to see. I'm almost done migrating from pidgin to kopete, and only those darned plain text logs are holding me back :)
Report
AiFiLTr0
12 years ago
#!/bin/bash
KLM=/home/aifiltr0/Documentz/dev/C/klt/klm
cd ~/.scripts/
if [ -a "/media/coralla/.kde4" ]; then
$KLM sync /media/coralla/.kde4/share/apps/kopete/logs ~/.kde4/share/apps/kopete/logs
fi
Report