summaryrefslogtreecommitdiffstats
path: root/korn/tdeconf_update
diff options
context:
space:
mode:
Diffstat (limited to 'korn/tdeconf_update')
-rw-r--r--korn/tdeconf_update/CMakeLists.txt38
-rw-r--r--korn/tdeconf_update/Makefile.am12
-rw-r--r--korn/tdeconf_update/korn-3-4-config_change.cpp261
-rw-r--r--korn/tdeconf_update/korn-3-4-config_change.upd3
-rw-r--r--korn/tdeconf_update/korn-3-5-metadata-update.pl43
-rw-r--r--korn/tdeconf_update/korn-3-5-ssl-update.pl39
-rw-r--r--korn/tdeconf_update/korn-3-5-update.upd10
7 files changed, 406 insertions, 0 deletions
diff --git a/korn/tdeconf_update/CMakeLists.txt b/korn/tdeconf_update/CMakeLists.txt
new file mode 100644
index 00000000..22d4b6a8
--- /dev/null
+++ b/korn/tdeconf_update/CMakeLists.txt
@@ -0,0 +1,38 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES
+ korn-3-4-config_change.upd korn-3-5-update.upd
+ DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
+
+install( PROGRAMS
+ korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl
+ DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
+
+
+##### korn-3-4-config_change (executable) #######
+
+tde_add_executable( korn-3-4-config_change
+ SOURCES korn-3-4-config_change.cpp
+ LINK ${TQT_LIBRARIES}
+ DESTINATION ${LIB_INSTALL_DIR}/tdeconf_update_bin
+)
diff --git a/korn/tdeconf_update/Makefile.am b/korn/tdeconf_update/Makefile.am
new file mode 100644
index 00000000..214f0c81
--- /dev/null
+++ b/korn/tdeconf_update/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES=$(all_includes)
+
+update_DATA = korn-3-4-config_change.upd korn-3-5-update.upd
+update_SCRIPTS = korn-3-5-ssl-update.pl korn-3-5-metadata-update.pl
+updatedir = $(kde_datadir)/tdeconf_update
+
+tdeconf_PROGRAMS = korn-3-4-config_change
+tdeconfdir = $(libdir)/tdeconf_update_bin
+
+korn_3_4_config_change_SOURCES = korn-3-4-config_change.cpp
+korn_3_4_config_change_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+korn_3_4_config_change_LDADD = $(LIB_QT)
diff --git a/korn/tdeconf_update/korn-3-4-config_change.cpp b/korn/tdeconf_update/korn-3-4-config_change.cpp
new file mode 100644
index 00000000..7eff3ad3
--- /dev/null
+++ b/korn/tdeconf_update/korn-3-4-config_change.cpp
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <tqstring.h>
+#include <tqregexp.h>
+#include <tqtextstream.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
+
+#include <stdio.h>
+
+TQString decodeString( const TQString &password )
+{
+ unsigned int i, val;
+ unsigned int len = password.length();
+ TQString result="";
+ for ( i=0; i < len; i++ )
+ {
+ val = password[i].latin1() - ' ';
+ val = (255-' ') - val;
+ result += (char)(val + ' ');
+ }
+ return result;
+}
+
+void printToprint( TQTextStream &out, TQMap<TQString,TQString> &to_printed, const TQString type )
+{
+ out << "printToprint( " << type << " )" << endl;
+
+ if( type == "mbox" )
+ {
+ out << "mailbox=" << to_printed[ "file" ] << endl;
+ }
+ else if( type == "qmail" )
+ {
+ out << "mailbox=" << to_printed[ "maildir" ] << endl;
+ }
+ else if( type == "pop3" )
+ {
+ out << "host=" << to_printed[ "host" ] << endl;
+ out << "port=" << to_printed[ "port" ] << endl;
+ out << "username=" << to_printed[ "user" ] << endl;
+ if( to_printed[ "APOP" ] == "true" )
+ out << "auth=APOP" << endl;
+ else
+ out << "auth=" << endl;
+ }
+ else if( type == "imap4" )
+ {
+ out << "host=" << to_printed[ "host" ] << endl;
+ out << "port=" << to_printed[ "port" ] << endl;
+ out << "username=" << to_printed[ "user" ] << endl;
+ out << "mailbox=" << to_printed[ "mailbox" ] << endl;
+ }
+ else if( type == "nntp" )
+ {
+ out << "host=" << to_printed[ "host" ] << endl;
+ out << "port=" << to_printed[ "port" ] << endl;
+ out << "mailbox=" << to_printed[ "group" ] << endl;
+ }
+ else if( type == "process" )
+ {
+ out << "mailbox=" << to_printed[ "command" ] << endl;
+ }
+ else if( type == "kio" )
+ {
+ out << "host=" << to_printed[ "host" ] << endl;
+ out << "port=" << to_printed[ "port" ] << endl;
+ out << "username=" << to_printed[ "username" ] << endl;
+ out << "mailbox=" << to_printed[ "mailbox" ] << endl;
+ out << "password=" << decodeString( to_printed[ "password" ] ) << endl;
+ }
+
+ if( type == "pop3" || type == "imap4" )
+ {
+ out << "password=" << to_printed[ "pass" ] << endl;
+ if( to_printed[ "pass" ].isEmpty() )
+ out << "savepassword=false" << endl;
+ else
+ out << "savepassword=true" << endl;
+ }
+
+ if( to_printed[ "resetcounter" ] != "-1" )
+ out << "reset=" << to_printed[ "resetcounter" ] << endl;
+ else
+ out << "reset=0" << endl;
+ out << "interval=" << to_printed[ "poll" ] << endl;
+}
+
+int main( int, char** )
+{
+ TQString line = TQString();
+ TQString currentGroup1 = TQString();
+ TQString currentGroup2 = TQString();
+ TQString type = TQString();
+ TQString password = TQString();
+ TQRegExp interesting_group( "^\\[box-(\\d+)\\]" );
+ TQRegExp key_value( "^(\\w*)=(.*)$" );
+ TQValueList<TQString> tobe_deleted;
+ int numboxes = -1;
+ bool isKey = false;
+
+ TQTextStream in( stdin, IO_ReadOnly );
+ TQTextStream out( stdout, IO_WriteOnly );
+
+ in.setEncoding( TQTextStream::UnicodeUTF8 );
+ out.setEncoding( TQTextStream::UnicodeUTF8 );
+
+ TQMap<TQString,TQString> mapping1;
+ TQValueList<TQString> mapping2;
+ TQMap<TQString,TQString> to_printed;
+
+ mapping1.insert( "caption", "name" );
+ mapping1.insert( "onclick", "command" );
+ mapping1.insert( "onnewmail", "newcommand" );
+ mapping1.insert( "soundfile", "sound" );
+ mapping1.insert( "passive_popup", "passivepopup" );
+ mapping1.insert( "passive_data", "passivedata" );
+ mapping1.insert( "reset", "reset" );
+ mapping1.insert( "fgcolour", "normalfgcolour" );
+ mapping1.insert( "bgcolour", "normalbgcolour" );
+ mapping1.insert( "newmailfgcolour", "newfgcolour" );
+ mapping1.insert( "newmailbgcolour", "newbgcolour" );
+ mapping1.insert( "icon", "normalicon" );
+ mapping1.insert( "newmailicon", "newicon" );
+
+ mapping2.append( "file" );
+ mapping2.append( "maildir" );
+ mapping2.append( "host" );
+ mapping2.append( "port" );
+ mapping2.append( "user" );
+ mapping2.append( "APOP" );
+ mapping2.append( "mailbox" );
+ mapping2.append( "group" );
+ mapping2.append( "command" );
+ mapping2.append( "protocol" );
+ mapping2.append( "pass" );
+ mapping2.append( "password" );
+ mapping2.append( "resetcounter" );
+ mapping2.append( "poll" );
+
+ while( !in.atEnd() )
+ {
+ line = in.readLine();
+
+ isKey = key_value.search( line ) >= 0;
+
+ if( line.left( 1 ) == "[" )
+ {
+ if( !currentGroup1.isNull() )
+ {
+ out << currentGroup2 << endl;
+ printToprint( out, to_printed, type );
+ }
+
+ currentGroup1 = TQString();
+ }
+
+ if( interesting_group.search( line ) >= 0 )
+ {
+ if( numboxes > -1 && interesting_group.cap( 1 ).toInt() < numboxes )
+ {
+ currentGroup1 = TQString( "[korn-%1]" ).arg( interesting_group.cap( 1 ) );
+ currentGroup2 = TQString( "[korn-%1-0]" ).arg( interesting_group.cap( 1 ) );
+ }
+ tobe_deleted.append( line );
+ continue;
+ }
+ else if( isKey && key_value.cap( 1 ) == "numboxes" )
+ {
+ numboxes = key_value.cap( 2 ).toInt();
+ continue;
+ }
+ else if( currentGroup1.isNull() || !isKey )
+ continue;
+ if( mapping1.contains( key_value.cap( 1 ) ) )
+ {
+ out << currentGroup1 << endl;
+ out << mapping1[ key_value.cap( 1 ) ] << "=" << key_value.cap( 2 ) << endl;
+ if( key_value.cap( 1 ) == "caption" )
+ {
+ out << currentGroup2 << endl;
+ out << "name=" << key_value.cap( 2 ) << endl;
+ }
+ }
+ else if( mapping2.contains( key_value.cap( 1 ) ) )
+ {
+ to_printed.insert( key_value.cap( 1 ), key_value.cap( 2 ) );
+ }
+ else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) != "kio" )
+ {
+ out << currentGroup2 << endl;
+ if( key_value.cap( 2 ) == "imap4" )
+ out << "protocol=imap" << endl;
+ else
+ out << "protocol=" << key_value.cap( 2 ) << endl;
+ type = key_value.cap( 2 );
+
+ }
+ else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) == "kio" )
+ {
+ type = "kio";
+ }
+ else if( key_value.cap( 1 ) == "displaystyle" )
+ {
+ out << currentGroup1 << endl;
+ if( key_value.cap( 2 ) == "2" )
+ {
+ out << "hasnormalfgcolour=false" << endl;
+ out << "hasnormalbgcolour=false" << endl;
+ out << "hasnewfgcolour=false" << endl;
+ out << "hasnewbgcolour=false" << endl;
+ out << "hasnormalicon=true" << endl;
+ out << "hasnormalanim=false" << endl;
+ out << "hasnewicon=true" << endl;
+ out << "hasnewanim=false" << endl;
+ }
+ else
+ {
+ out << "hasnormalfgcolour=true" << endl;
+ out << "hasnormalbgcolour=true" << endl;
+ out << "hasnewfgcolour=true" << endl;
+ out << "hasnewbgcolour=true" << endl;
+ out << "hasnormalicon=false" << endl;
+ out << "hasnormalanim=false" << endl;
+ out << "hasnewicon=false" << endl;
+ out << "hasnewanim=false" << endl;
+ }
+ }
+ }
+
+ if( !currentGroup1.isNull() )
+ {
+ out << currentGroup2 << endl;
+ printToprint( out, to_printed, type );
+ }
+
+ TQValueList<TQString>::Iterator it1 = tobe_deleted.begin();
+ TQValueList<TQString>::Iterator it1_end = tobe_deleted.end();
+
+ for( ; it1 != it1_end; ++it1 )
+ out << "# DELETEGROUP " << *it1 << endl;
+
+ return 0;
+}
+
diff --git a/korn/tdeconf_update/korn-3-4-config_change.upd b/korn/tdeconf_update/korn-3-4-config_change.upd
new file mode 100644
index 00000000..530304fa
--- /dev/null
+++ b/korn/tdeconf_update/korn-3-4-config_change.upd
@@ -0,0 +1,3 @@
+Id=korn_kde_3_4_config_change
+File=kornrc
+Script=korn-3-4-config_change
diff --git a/korn/tdeconf_update/korn-3-5-metadata-update.pl b/korn/tdeconf_update/korn-3-5-metadata-update.pl
new file mode 100644
index 00000000..95723c4e
--- /dev/null
+++ b/korn/tdeconf_update/korn-3-5-metadata-update.pl
@@ -0,0 +1,43 @@
+my $input;
+my $group;
+my $auth = "";
+my $tls = "";
+my $metadata = "";
+
+while( $input = <STDIN> )
+{
+ chop $input;
+ if( $input =~ /^\[.*\]$/ )
+ {
+ if( $metadata )
+ {
+ print "[$group]\n";
+ print "metadata=$metadata\n";
+ $metadata="";
+ }
+
+ if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ )
+ {
+ $group = $1;
+ }
+ else
+ {
+ $group = "";
+ }
+ $auth="";
+ $tls="";
+ }
+
+ if( $input =~ /^auth\=(.*)/ )
+ {
+ $metadata=$tls ? "auth=$1,tls=$tls" : "auth=$1";
+ $auth=$1;
+ print "# DELETE [$group]auth\n";
+ }
+ elsif( $input =~ /^tls\=(.*)/ )
+ {
+ $metadata=$auth ? "auth=$auth,tls=$1" : "tls=$1";
+ $tls=$1;
+ print "# DELETE [$tls]tls\n";
+ }
+}
diff --git a/korn/tdeconf_update/korn-3-5-ssl-update.pl b/korn/tdeconf_update/korn-3-5-ssl-update.pl
new file mode 100644
index 00000000..b44ce10f
--- /dev/null
+++ b/korn/tdeconf_update/korn-3-5-ssl-update.pl
@@ -0,0 +1,39 @@
+my $input;
+my $group;
+my $protocol;
+
+while( $input = <STDIN> )
+{
+ chop $input;
+ if( $input =~ /^\[.*\]$/ )
+ {
+ if( $input =~ /^\[(korn-(\d+)-\d+)\]$/ )
+ {
+ $group = $1;
+ }
+ else
+ {
+ $group = "";
+ }
+ }
+
+ if( $input =~ /^protocol\=(.*)/ )
+ {
+ $protocol=$1;
+ print "[$group]\n";
+ if( $protocol eq "imaps" )
+ {
+ print "protocol=imap\n";
+ print "ssl=true\n";
+ }
+ elsif( $protocol eq "pop3s" )
+ {
+ print "protocol=pop3\n";
+ print "ssl=true\n";
+ }
+ else
+ {
+ print "ssl=false\n";
+ }
+ }
+}
diff --git a/korn/tdeconf_update/korn-3-5-update.upd b/korn/tdeconf_update/korn-3-5-update.upd
new file mode 100644
index 00000000..d954d782
--- /dev/null
+++ b/korn/tdeconf_update/korn-3-5-update.upd
@@ -0,0 +1,10 @@
+Id=korn-3-5-ssl-update
+File=kornrc
+Options=overwrite
+Script=korn-3-5-ssl-update.pl,perl
+
+Id=korn-3-5-metadata-update
+File=kornrc
+Options=overwrite
+Script=korn-3-5-metadata-update.pl,perl
+