diff -urN konversation-0.15/src/konversation/commit.h konvi-fixed/src/konversation/commit.h --- konversation-0.15/src/konversation/commit.h 2004-11-28 11:04:17.000000000 +0200 +++ konvi-fixed/src/konversation/commit.h 2005-01-19 16:48:24.000000000 +0200 @@ -1 +1 @@ -#define COMMIT 2000 +#define COMMIT 2001 diff -urN konversation-0.15/src/konversation/server.cpp konvi-fixed/src/konversation/server.cpp --- konversation-0.15/src/konversation/server.cpp 2004-11-25 04:12:36.000000000 +0200 +++ konvi-fixed/src/konversation/server.cpp 2005-01-19 09:17:38.000000000 +0200 @@ -82,8 +82,9 @@ } Server::Server(KonversationMainWindow* mainWindow,const QString& hostName,const QString& port, - const QString& channel,const QString& password, QString nick) + const QString& channel,const QString& _nick, QString password) { + QString nick( _nick ); m_serverGroup.setName(hostName); m_serverGroup.setIdentityId(KonversationApplication::preferences.getIdentityByName("Default")->id()); @@ -2733,37 +2734,48 @@ // TODO: parameter handling. // since parameters are not functional yet - // make a copy to work with - QString out(toParse); - // define default separator and regular expression for definition + // store the parsed version + QString out; + + // default separator QString separator(" "); - QRegExp separatorRegExp("%s[^%]*%"); - // separator definition found? - int pos=out.find(separatorRegExp); - if(pos!=-1) - { - // TODO: This could be better done with .cap() and proper RegExp ... - // skip "%s" at the beginning - pos+=2; - // copy out all text to the next "%" as new separator - separator=out.mid(pos,out.find("%",pos+1)-pos); - // remove separator definition from string - out.replace(separatorRegExp, QString::null); - } - - out.replace("%u",nickList.join(separator)); - if(!channelName.isEmpty()) out.replace("%c",channelName); - out.replace("%o",sender); - if(!channelKey.isEmpty()) out.replace("%k",channelKey); - if(!m_serverGroup.serverByIndex(m_currentServerIndex).password().isEmpty()) { - out.replace("%K", m_serverGroup.serverByIndex(m_currentServerIndex).password()); - } + int index = 0, found = 0; + QChar toExpand; - out.replace("%n","\n"); - // finally replace all "%p" with "%" - out.replace("%p","%"); + while ((found = toParse.find('%',index)) != -1) { + out.append(toParse.mid(index,found-index)); // append part before the % + index = found + 1; // skip the part before, including % + if (index >= toParse.length()) + break; // % was the last char (not valid) + toExpand = toParse.at(index++); + if (toExpand == 's') { + found = toParse.find('%',index); + if (found == -1) // no other % (not valid) + break; + separator = toParse.mid(index,found-index); + index = found + 1; // skip separator, including % + } else if (toExpand == 'u') { + out.append(nickList.join(separator)); + } else if (toExpand == 'c') { + if(!channelName.isEmpty()) + out.append(channelName); + } else if (toExpand == 'o') { + out.append(sender); + } else if (toExpand == 'k') { + if(!channelKey.isEmpty()) + out.append(channelKey); + } else if (toExpand == 'K') { + if(!m_serverGroup.serverByIndex(m_currentServerIndex).password().isEmpty()) + out.append(m_serverGroup.serverByIndex(m_currentServerIndex).password()); + } else if (toExpand == 'n') { + out.append("\n"); + } else if (toExpand == 'p') { + out.append("%"); + } + } + out.append(toParse.mid(index,toParse.length()-index)); // append last part return out; } diff -urN konversation-0.15/src/konversation/server.h konvi-fixed/src/konversation/server.h --- konversation-0.15/src/konversation/server.h 2004-11-22 22:55:07.000000000 +0200 +++ konvi-fixed/src/konversation/server.h 2005-01-19 16:07:49.000000000 +0200 @@ -67,7 +67,7 @@ * The details are passed in. Used for example when the user does "/server irc.somewhere.net" */ Server::Server(KonversationMainWindow* mainWindow,const QString& hostName,const QString& port, - const QString& channel,const QString& password, QString nick); + const QString& channel,const QString& nick, QString password); ~Server(); QString getServerName() const; diff -urN konversation-0.15/src/konversation/version.h konvi-fixed/src/konversation/version.h --- konversation-0.15/src/konversation/version.h 2004-08-11 01:52:27.000000000 +0300 +++ konvi-fixed/src/konversation/version.h 2005-01-19 15:54:14.000000000 +0200 @@ -1,3 +1,3 @@ #ifndef VERSION -#define VERSION "0.15" +#define VERSION "0.15.1" #endif diff -urN konversation-0.15/src/scripts/cmd konvi-fixed/src/scripts/cmd --- konversation-0.15/src/scripts/cmd 2004-10-15 11:25:39.000000000 +0300 +++ konvi-fixed/src/scripts/cmd 2005-01-19 09:10:19.000000000 +0200 @@ -6,17 +6,21 @@ $SERVER= shift; $TARGET= shift; +my $i; + +if( $ARGV[0] eq "yes" ){ + exec 'dcop', $PORT, 'Konversation', 'error', 'Requested command is not executed!'; +} + $ARG_MESSAGE = `@ARGV`; foreach $entry (split(/\n/, $ARG_MESSAGE)) { chomp $entry; - unless($i) { - system("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Output Of Command : %B @ARGV %B\" "); - $i=1; - } - system ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"$entry\" "); + $i=1; + $entry =~ s/^\//\/\//; + system 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, $entry; } unless($i) { - exec("dcop $PORT Konversation error \"Command @ARGV doesn't exist\!\""); + exec 'dcop', $PORT, 'Konversation', 'error', 'Command @ARGV doesn\'t exist!'; } diff -urN konversation-0.15/src/scripts/colorizer konvi-fixed/src/scripts/colorizer --- konversation-0.15/src/scripts/colorizer 2004-10-15 11:25:39.000000000 +0300 +++ konvi-fixed/src/scripts/colorizer 2005-01-19 09:10:39.000000000 +0200 @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# Copyright (C) 2004 by İsmail Dönmez +# Copyright (C) 2004 by İsmail Dönmez, Wouter Coekaerts # Licensed under GPL v2 or later at your option use warnings; @@ -9,30 +9,22 @@ my $SERVER= shift; my $TARGET= shift; -my $message; -my $random; -my $input; -my @chars; my $i = 0; if(!@ARGV){ - exec ("dcop $PORT Konversation error \"Colorizer script needs a message argument!\" "); + exec 'dcop', $PORT, 'Konversation', 'error', 'Colorizer script needs a message argument!'; } -$input = join " ", @ARGV; +my $input = join " ", @ARGV; if( utf8::valid($input) ) { utf8::decode($input); } -@chars = split //, $input; +my ($command, $arguments) = ($input =~ /^(\/\S*\s|)(.*)/); +my @chars = split //, $arguments; +@chars = map { "%C" . ((($i++)%15)+1) . $_ } @chars; +$arguments = join "", @chars; -srand(time()); - -foreach (@chars) { - $random = int(rand(15))+1; - $message = $message."%C".$random.$_; -} - -system ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"$message\" "); +system 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, $command . $arguments; diff -urN konversation-0.15/src/scripts/fortune konvi-fixed/src/scripts/fortune --- konversation-0.15/src/scripts/fortune 2004-10-15 11:25:39.000000000 +0300 +++ konvi-fixed/src/scripts/fortune 2005-01-19 09:10:47.000000000 +0200 @@ -51,4 +51,4 @@ } } close(FORTUNES); -exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"$MESSAGE\" "); +exec 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, $MESSAGE; diff -urN konversation-0.15/src/scripts/uptime konvi-fixed/src/scripts/uptime --- konversation-0.15/src/scripts/uptime 2004-10-12 20:54:33.000000000 +0300 +++ konvi-fixed/src/scripts/uptime 2005-01-19 09:11:15.000000000 +0200 @@ -21,7 +21,7 @@ } else { $UPTIME = `cat /proc/uptime`; if (not $UPTIME) { - exec ("dcop $PORT Konversation info \"Could not read uptime. Check that /proc/uptime exists.\""); + exec 'dcop', $PORT, 'Konversation', 'info', 'Could not read uptime. Check that /proc/uptime exists.'; } @uparray = split(/\./, $UPTIME); $seconds = $uparray[0]; @@ -42,15 +42,15 @@ $minutes = int($seconds/60); } if( $days && $hours ) { - exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Uptime: $days days, $hours hours and $minutes minutes\""); + exec 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, "Uptime: $days days, $hours hours and $minutes minutes"; } elsif( !$days && $hours ) { - exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Uptime: $hours hours and $minutes minutes\""); + exec 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, "Uptime: $hours hours and $minutes minutes"; } elsif( $days && !$hours ) { - exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Uptime: $days days and $minutes minutes\""); + exec 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, "Uptime: $days days and $minutes minutes"; } elsif( !$days && !$hours ) { - exec ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"Uptime: $minutes minutes\""); + exec 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, "Uptime: $minutes minutes"; } diff -urN konversation-0.15/src/scripts/weather konvi-fixed/src/scripts/weather --- konversation-0.15/src/scripts/weather 2004-10-15 11:25:39.000000000 +0300 +++ konvi-fixed/src/scripts/weather 2005-01-19 09:11:19.000000000 +0200 @@ -10,7 +10,7 @@ @stations = `dcop KWeatherService WeatherService listStations`; if( ! @stations ) { - exec ("dcop $PORT Konversation error \"KWeather is not installed or not running!\" "); + exec 'dcop', $PORT, 'Konversation', 'error', 'KWeather is not installed or not running!'; } if( $OPTION && $stations[$OPTION-1] ) { @@ -58,6 +58,6 @@ $MESSAGE = "Current Weather for %B$city%B : Temperature: %B$temperature%B, Pressure: %B$pressure%B, Wind: %B$wind%B"; } - system ("dcop $PORT Konversation say $SERVER \"$TARGET\" \"$MESSAGE\" "); + system 'dcop', $PORT, 'Konversation', 'say', $SERVER, $TARGET, $MESSAGE; }