From 472156a41b1348c714986c772759ad950fffbe75 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 15:11:21 -0600 Subject: Rename kioslaves --- tdeioslave/finger/CMakeLists.txt | 8 +- tdeioslave/finger/Makefile.am | 18 +-- tdeioslave/finger/finger.protocol | 2 +- tdeioslave/finger/kio_finger.cpp | 266 ------------------------------------- tdeioslave/finger/kio_finger.css | 69 ---------- tdeioslave/finger/kio_finger.h | 64 --------- tdeioslave/finger/kio_finger.pl | 175 ------------------------ tdeioslave/finger/tdeio_finger.cpp | 266 +++++++++++++++++++++++++++++++++++++ tdeioslave/finger/tdeio_finger.css | 69 ++++++++++ tdeioslave/finger/tdeio_finger.h | 64 +++++++++ tdeioslave/finger/tdeio_finger.pl | 175 ++++++++++++++++++++++++ 11 files changed, 588 insertions(+), 588 deletions(-) delete mode 100644 tdeioslave/finger/kio_finger.cpp delete mode 100644 tdeioslave/finger/kio_finger.css delete mode 100644 tdeioslave/finger/kio_finger.h delete mode 100644 tdeioslave/finger/kio_finger.pl create mode 100644 tdeioslave/finger/tdeio_finger.cpp create mode 100644 tdeioslave/finger/tdeio_finger.css create mode 100644 tdeioslave/finger/tdeio_finger.h create mode 100644 tdeioslave/finger/tdeio_finger.pl (limited to 'tdeioslave/finger') diff --git a/tdeioslave/finger/CMakeLists.txt b/tdeioslave/finger/CMakeLists.txt index 096b483d0..65088aaf4 100644 --- a/tdeioslave/finger/CMakeLists.txt +++ b/tdeioslave/finger/CMakeLists.txt @@ -23,15 +23,15 @@ link_directories( ##### other data ################################ install( FILES finger.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) -install( FILES kio_finger.pl kio_finger.css DESTINATION ${DATA_INSTALL_DIR}/tdeio_finger ) +install( FILES tdeio_finger.pl tdeio_finger.css DESTINATION ${DATA_INSTALL_DIR}/tdeio_finger ) -##### kio_finger (module) ####################### +##### tdeio_finger (module) ####################### -set( target kio_finger ) +set( target tdeio_finger ) tde_add_kpart( ${target} AUTOMOC - SOURCES kio_finger.cpp + SOURCES tdeio_finger.cpp LINK tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/tdeioslave/finger/Makefile.am b/tdeioslave/finger/Makefile.am index 9c2792df3..46e0ff69c 100644 --- a/tdeioslave/finger/Makefile.am +++ b/tdeioslave/finger/Makefile.am @@ -1,4 +1,4 @@ -## Makfile.am for kio_finger +## Makfile.am for tdeio_finger ## Edit from Makefile.am of tdebase/tdeioslave/man INCLUDES= $(all_includes) @@ -6,20 +6,20 @@ AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB ####### Files -kde_module_LTLIBRARIES = kio_finger.la +kde_module_LTLIBRARIES = tdeio_finger.la -kio_finger_la_SOURCES = kio_finger.cpp -kio_finger_la_LIBADD = -lkio -kio_finger_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdeio_finger_la_SOURCES = tdeio_finger.cpp +tdeio_finger_la_LIBADD = -ltdeio +tdeio_finger_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -noinst_HEADERS = kio_finger.h +noinst_HEADERS = tdeio_finger.h kdelnk_DATA = finger.protocol kdelnkdir = $(kde_servicesdir) -kio_finger_data_DATA = kio_finger.pl kio_finger.css -kio_finger_datadir = $(kde_datadir)/tdeio_finger -EXTRA_DIST=$(kio_finger_data_DATA) +tdeio_finger_data_DATA = tdeio_finger.pl tdeio_finger.css +tdeio_finger_datadir = $(kde_datadir)/tdeio_finger +EXTRA_DIST=$(tdeio_finger_data_DATA) METASOURCES = AUTO diff --git a/tdeioslave/finger/finger.protocol b/tdeioslave/finger/finger.protocol index 8e2cdc80f..59bfec017 100644 --- a/tdeioslave/finger/finger.protocol +++ b/tdeioslave/finger/finger.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=kio_finger +exec=tdeio_finger protocol=finger input=none output=stream diff --git a/tdeioslave/finger/kio_finger.cpp b/tdeioslave/finger/kio_finger.cpp deleted file mode 100644 index b223e1024..000000000 --- a/tdeioslave/finger/kio_finger.cpp +++ /dev/null @@ -1,266 +0,0 @@ - -/*************************************************************************** - kio_finger.cpp - description - ------------------- - begin : Sun Aug 12 2000 - copyright : (C) 2000 by Andreas Schlapbach - email : schlpbch@iam.unibe.ch - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "kio_finger.h" - - -using namespace TDEIO; - -static const TQString defaultRefreshRate = "60"; - -extern "C" -{ - KDE_EXPORT int kdemain( int argc, char **argv ) - { - TDEInstance instance( "kio_finger" ); - - //kdDebug() << "*** Starting kio_finger " << getpid() << endl; - - if (argc != 4) - { - fprintf(stderr, "Usage: kio_finger protocol domain-socket1 domain-socket2\n"); - exit(-1); - } - - FingerProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - - //kdDebug() << "*** kio_finger Done" << endl; - return 0; - } -} - - -/* ---------------------------------------------------------------------------------- */ - - -FingerProtocol::FingerProtocol(const TQCString &pool_socket, const TQCString &app_socket) - : TQObject(), SlaveBase("finger", pool_socket, app_socket) -{ - myStdStream = new TQString(); - getProgramPath(); -} - - -/* ---------------------------------------------------------------------------------- */ - - -FingerProtocol::~FingerProtocol() -{ - //kdDebug() << "FingerProtocol::~FingerProtocol()" << endl; - delete myURL; - delete myPerlPath; - delete myFingerPath; - delete myFingerPerlScript; - delete myFingerCSSFile; - delete myStdStream; -} - - -/* ---------------------------------------------------------------------------------- */ - - -void FingerProtocol::get(const KURL& url ) -{ - //kdDebug() << "kio_finger::get(const KURL& url)" << endl ; - - this->parseCommandLine(url); - - //kdDebug() << "myURL: " << myURL->prettyURL() << endl; - - // Reset the stream - *myStdStream=""; - - TQString query = myURL->query(); - TQString refreshRate = defaultRefreshRate; - - //kdDebug() << "query: " << query << endl; - - // Check the validity of the query - - TQRegExp regExp("?refreshRate=[0-9][0-9]*", true, true); - if (query.contains(regExp)) { - //kdDebug() << "looks like a valid query" << endl; - TQRegExp regExp( "([0-9]+)" ); - regExp.search(query); - refreshRate = regExp.cap(0); - } - - //kdDebug() << "Refresh rate: " << refreshRate << endl; - - myTDEProcess = new TDEProcess(); - *myTDEProcess << *myPerlPath << *myFingerPerlScript - << *myFingerPath << *myFingerCSSFile - << refreshRate << myURL->host() << myURL->user() ; - - connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); - //connect(myTDEProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), - // this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); - - myTDEProcess->start(TDEProcess::Block, TDEProcess::All); - - data(TQCString(TQString(*myStdStream).local8Bit())); - - data(TQByteArray()); - finished(); - - //clean up - - delete myTDEProcess; -} - - -/* ---------------------------------------------------------------------------------- */ - - -void FingerProtocol::slotGetStdOutput(TDEProcess* /* p */, char *s, int len) -{ - //kdDebug() << "void FingerProtocol::slotGetStdoutOutput()" << endl; - *myStdStream += TQString::fromLocal8Bit(s, len); -} - - -/* ---------------------------------------------------------------------------------- */ - - -void FingerProtocol::mimetype(const KURL & /*url*/) -{ - mimeType("text/html"); - finished(); -} - - -/* ---------------------------------------------------------------------------------- */ - - -void FingerProtocol::getProgramPath() -{ - //kdDebug() << "kfingerMainWindow::getProgramPath()" << endl; - // Not to sure wether I'm using the right error number here. - schlpbch - - - myPerlPath = new TQString(TDEGlobal::dirs()->findExe("perl")); - if (myPerlPath->isEmpty()) - { - //kdDebug() << "Perl command not found" << endl; - this->error(ERR_CANNOT_LAUNCH_PROCESS, - i18n("Could not find the Perl program on your system, please install.")); - exit(); - } - else - { - //kdDebug() << "Perl command found:" << *myPerlPath << endl; - } - - myFingerPath = new TQString(TDEGlobal::dirs()->findExe("finger")); - if ((myFingerPath->isEmpty())) - { - //kdDebug() << "Finger command not found" << endl; - this->error(ERR_CANNOT_LAUNCH_PROCESS, - i18n("Could not find the Finger program on your system, please install.")); - exit(); - } - else - { - //kdDebug() << "Finger command found:" << *myFingerPath << endl; - } - - myFingerPerlScript = new TQString(locate("data","kio_finger/tdeio_finger.pl")); - if (myFingerPerlScript->isEmpty()) - { - //kdDebug() << "kio_finger.pl script not found" << endl; - this->error(ERR_CANNOT_LAUNCH_PROCESS, - i18n("kio_finger Perl script not found.")); - exit(); - } - else - { - //kdDebug() << "kio_finger perl script found: " << *myFingerPerlScript << endl; - } - - myFingerCSSFile = new TQString(locate("data","kio_finger/tdeio_finger.css")); - if (myFingerCSSFile->isEmpty()) - { - //kdDebug() << "kio_finger.css file not found" << endl; - this->warning(i18n("kio_finger CSS script not found. Output will look ugly.")); - } - else - { - //kdDebug() << "kio_finger CSS file found: " << *myFingerCSSFile << endl; - } -} - - -/* --------------------------------------------------------------------------- */ - - -void FingerProtocol::parseCommandLine(const KURL& url) -{ - myURL = new KURL(url); - - /* - * Generate a valid finger url - */ - - if(myURL->isEmpty() || !myURL->isValid() || - (myURL->user().isEmpty() && myURL->host().isEmpty())) - { - myURL->setProtocol("finger"); - myURL->setUser(""); - myURL->setHost("localhost"); - } - - /* - * If no specific port is specified, set it to 79. - */ - - if(myURL->port() == 0) { - myURL->setPort(79); - } - - /* - * If no refresh rate is given, set it to defaultRefreshRate - */ - - if (myURL->query().isEmpty()) { - myURL->setQuery("?refreshRate="+defaultRefreshRate); - } -} - -/* ---------------------------------------------------------------------------------- */ -#include "kio_finger.moc" -/* ---------------------------------------------------------------------------------- */ - diff --git a/tdeioslave/finger/kio_finger.css b/tdeioslave/finger/kio_finger.css deleted file mode 100644 index 06deb81aa..000000000 --- a/tdeioslave/finger/kio_finger.css +++ /dev/null @@ -1,69 +0,0 @@ -BODY { - color: #FFFFCC; - background-color: #000000; - padding: 2em; - margin: auto; -} - -A:link {color: #82A7D0} -A:visited {color: #999999} -A:active {color: #999999} - -H1 { - color: #999999; - background-color: #000000; - font: 200% Helvetica, sans-serif; - font-variant: normal; - padding: 1em; - margin: auto; -} - -.mainTable { - background-color: #000000; - border: thin solid; - margin: auto; -} - - -.courierText { - color: #FFFFCC; - background-color: #000000; - font: 120% Courier, sans-serif; - font-variant: normal; - text-align: left; - padding: 0em; -} - -.commandText { - color: #FFFFCC; - background-color: #000000; - font: 120% Courier, sans-serif; - font-variant: normal; - text-align: center; - padding: 0.5em; -} - -.niceText { - color: #009999; - background-color: #000000; - font: 120% Arial, sans-serif; - font-variant: normal; - text-align: center; - padding: 0.5em; -} - -.finger { color: #82A7D0} -.domainName { color: #D0A000} -.ipNumber { color: #D0A000} -.os { color: #82A7D0} -.username { color: #82A7D0} -.directory { color: #D0A000} -.shell { color: #D0A000} -.notLoggedIn { color: #00A000} -.loggedIn { color: #B00000} -.newMail { color: #82A7D0} -.plan { color: #D0A000} -.noNewMail { color: #BB0000} -.noPlan { color: #BB0000} - - diff --git a/tdeioslave/finger/kio_finger.h b/tdeioslave/finger/kio_finger.h deleted file mode 100644 index eac8ad291..000000000 --- a/tdeioslave/finger/kio_finger.h +++ /dev/null @@ -1,64 +0,0 @@ - -/*************************************************************************** - kio_finger.h - description - ------------------- - begin : Sun Aug 12 2000 - copyright : (C) 2000 by Andreas Schlapbach - email : schlpbch@iam.unibe.ch - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - - -#ifndef __kio_finger_h__ -#define __kio_finger_h__ - -#include -#include - -#include -#include -#include -#include - -class FingerProtocol : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - -public: - - FingerProtocol(const TQCString &pool_socket, const TQCString &app_socket); - virtual ~FingerProtocol(); - - virtual void mimetype(const KURL& url); - virtual void get(const KURL& url); - -private slots: - void slotGetStdOutput(TDEProcess*, char*, int); - -private: - KURL *myURL; - - QString *myPerlPath; - TQString *myFingerPath; - TQString *myFingerPerlScript; - TQString *myFingerCSSFile; - - QString *myStdStream; - - - TDEProcess *myTDEProcess; - - void getProgramPath(); - void parseCommandLine(const KURL& url); -}; - - -#endif diff --git a/tdeioslave/finger/kio_finger.pl b/tdeioslave/finger/kio_finger.pl deleted file mode 100644 index 8965ea523..000000000 --- a/tdeioslave/finger/kio_finger.pl +++ /dev/null @@ -1,175 +0,0 @@ -##!/usr/bin/perl -# -# Copyright Andreas Schlapbach, schlpbch@iam.unibe.ch, 2001 -# http://iamexwiwww.unibe.ch/studenten/kfinger -# -# Touch at your own risk. - - -# Highlight mail addresses or url - -$mails = '/>/g; - -$USER =~ s/&/&/g; -$USER =~ s//>/g; - -# HTML Header - -print < - - - - finger $USER\@$HOST - - - - - - - - - \n"; - -# Finger-Talk options - -if ($USER) # is $USER nil ? -{ -print < - - - -UserQuery -} -else -{ -print < -
-

finger $USER\@$HOST

-
- -HTMLHeader - -# Run finger command and save it into a buffer - -open(F, "-|") || exec $FINGERCMD, "$USER\@$HOST"; -@lines = ; -close(F); - -# Do highlighting using perl regular expressions on every line received. -# Order is important here. - -foreach $output (@lines) - { - $output =~ s/((\w)+\@((\w)+(.))*(\w)+)/$mails$1$urlspace$1$urlend/gi; # Highlight email address - $output =~ s/((http|ftp)(:\/\/)(\S)+)/$urls$1$urlspace$1$urlend/gi; # Highlight urls - $output =~ s/((\d)+\.(\d)+\.(\d)+\.(\d)+)/$ipNumber$1$close/gi; # Highlight IP number - $output =~ s/((\w)+\.(\w)+\.(\w|-)+\s)/$domainName$1$close/gi; # Highlight domain name (\s is important) - $output =~ s/(finger:)/$finger$1$close/gim; # Highlight finger - $output =~ s/(Linux)/$os$1$close/gim; # Highlight Linux - if ($USER) # is $USER nil ? - { - $output =~ s/^Login:\s*(\w*)/Login: $mails$1\@$HOST$urlspace$1$urlend/gi; - $output =~ s/^Login Name:\s*(\w*)/Login Name:$mails$1\@$HOST$urlspace$1$urlend/gi; - $output =~ s/Name:(((\s*)(\w+))+\n)/Name:$username$1$close\n/gi; # Linux - $output =~ s/In real life:(((\s*)(\w+))+\n)/In real life:$username$1$close\n/gi; # Solaris - $output =~ s/^Directory:((\s*)(\/(\w)+)+)/Directory:$directory$1$close/gi; # Highlight Directory - $output =~ s/Shell:((\s*)(\/(\w)+)+)/Shell:$shell$1$close/gi; # Highlight Shell - $output =~ s/(not presently logged)/$notLoggedIn$1$close/gi; - $output =~ s/con (\w*)/con $loggedIn$1$close/gi; - $output =~ s/^(New mail)/$newMail$1$close/gi; - $output =~ s/^(No mail.)/$noNewMail$1$close/gim; - $output =~ s/^(Plan:)/$plan$1$close/gi; - $output =~ s/^(No plan.)/$noPlan$1$close/gim; - } - else - { - $output =~ s/^(\w+)/$mails$1\@$HOST$urlspace$1$urlend/m unless ($output =~ m/$keywordlist/m); - } - # line consists of white space only? - if ($output =~ m/\S/gi) - { - print " \n"; - } - else - { - print " \n"; - } -} - -print "
$output
  
\n"; -print "
- finger -
-HostQueryHead - - @lines = split /^/m, $buffer; - foreach $output2 (@lines) - { - if ($output2 =~ m/^(\w+)/gi and not ($output2 =~ m/$keywordlist/m)) - { - $USER = $&; - print " \n"; - # - talk\n\n"; - } - else - { - print " \n"; - } - } - -print < - - -HostQueryTail -} - -# HTMLTail - -print < - - -
finger\n
  
refresh rate: $REFRESHRATE seconds.
- - -HTMLTail diff --git a/tdeioslave/finger/tdeio_finger.cpp b/tdeioslave/finger/tdeio_finger.cpp new file mode 100644 index 000000000..ba0294918 --- /dev/null +++ b/tdeioslave/finger/tdeio_finger.cpp @@ -0,0 +1,266 @@ + +/*************************************************************************** + tdeio_finger.cpp - description + ------------------- + begin : Sun Aug 12 2000 + copyright : (C) 2000 by Andreas Schlapbach + email : schlpbch@iam.unibe.ch + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "tdeio_finger.h" + + +using namespace TDEIO; + +static const TQString defaultRefreshRate = "60"; + +extern "C" +{ + KDE_EXPORT int kdemain( int argc, char **argv ) + { + TDEInstance instance( "tdeio_finger" ); + + //kdDebug() << "*** Starting tdeio_finger " << getpid() << endl; + + if (argc != 4) + { + fprintf(stderr, "Usage: tdeio_finger protocol domain-socket1 domain-socket2\n"); + exit(-1); + } + + FingerProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + //kdDebug() << "*** tdeio_finger Done" << endl; + return 0; + } +} + + +/* ---------------------------------------------------------------------------------- */ + + +FingerProtocol::FingerProtocol(const TQCString &pool_socket, const TQCString &app_socket) + : TQObject(), SlaveBase("finger", pool_socket, app_socket) +{ + myStdStream = new TQString(); + getProgramPath(); +} + + +/* ---------------------------------------------------------------------------------- */ + + +FingerProtocol::~FingerProtocol() +{ + //kdDebug() << "FingerProtocol::~FingerProtocol()" << endl; + delete myURL; + delete myPerlPath; + delete myFingerPath; + delete myFingerPerlScript; + delete myFingerCSSFile; + delete myStdStream; +} + + +/* ---------------------------------------------------------------------------------- */ + + +void FingerProtocol::get(const KURL& url ) +{ + //kdDebug() << "tdeio_finger::get(const KURL& url)" << endl ; + + this->parseCommandLine(url); + + //kdDebug() << "myURL: " << myURL->prettyURL() << endl; + + // Reset the stream + *myStdStream=""; + + TQString query = myURL->query(); + TQString refreshRate = defaultRefreshRate; + + //kdDebug() << "query: " << query << endl; + + // Check the validity of the query + + TQRegExp regExp("?refreshRate=[0-9][0-9]*", true, true); + if (query.contains(regExp)) { + //kdDebug() << "looks like a valid query" << endl; + TQRegExp regExp( "([0-9]+)" ); + regExp.search(query); + refreshRate = regExp.cap(0); + } + + //kdDebug() << "Refresh rate: " << refreshRate << endl; + + myTDEProcess = new TDEProcess(); + *myTDEProcess << *myPerlPath << *myFingerPerlScript + << *myFingerPath << *myFingerCSSFile + << refreshRate << myURL->host() << myURL->user() ; + + connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + //connect(myTDEProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), + // this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + + myTDEProcess->start(TDEProcess::Block, TDEProcess::All); + + data(TQCString(TQString(*myStdStream).local8Bit())); + + data(TQByteArray()); + finished(); + + //clean up + + delete myTDEProcess; +} + + +/* ---------------------------------------------------------------------------------- */ + + +void FingerProtocol::slotGetStdOutput(TDEProcess* /* p */, char *s, int len) +{ + //kdDebug() << "void FingerProtocol::slotGetStdoutOutput()" << endl; + *myStdStream += TQString::fromLocal8Bit(s, len); +} + + +/* ---------------------------------------------------------------------------------- */ + + +void FingerProtocol::mimetype(const KURL & /*url*/) +{ + mimeType("text/html"); + finished(); +} + + +/* ---------------------------------------------------------------------------------- */ + + +void FingerProtocol::getProgramPath() +{ + //kdDebug() << "kfingerMainWindow::getProgramPath()" << endl; + // Not to sure wether I'm using the right error number here. - schlpbch - + + myPerlPath = new TQString(TDEGlobal::dirs()->findExe("perl")); + if (myPerlPath->isEmpty()) + { + //kdDebug() << "Perl command not found" << endl; + this->error(ERR_CANNOT_LAUNCH_PROCESS, + i18n("Could not find the Perl program on your system, please install.")); + exit(); + } + else + { + //kdDebug() << "Perl command found:" << *myPerlPath << endl; + } + + myFingerPath = new TQString(TDEGlobal::dirs()->findExe("finger")); + if ((myFingerPath->isEmpty())) + { + //kdDebug() << "Finger command not found" << endl; + this->error(ERR_CANNOT_LAUNCH_PROCESS, + i18n("Could not find the Finger program on your system, please install.")); + exit(); + } + else + { + //kdDebug() << "Finger command found:" << *myFingerPath << endl; + } + + myFingerPerlScript = new TQString(locate("data","tdeio_finger/tdeio_finger.pl")); + if (myFingerPerlScript->isEmpty()) + { + //kdDebug() << "tdeio_finger.pl script not found" << endl; + this->error(ERR_CANNOT_LAUNCH_PROCESS, + i18n("tdeio_finger Perl script not found.")); + exit(); + } + else + { + //kdDebug() << "tdeio_finger perl script found: " << *myFingerPerlScript << endl; + } + + myFingerCSSFile = new TQString(locate("data","tdeio_finger/tdeio_finger.css")); + if (myFingerCSSFile->isEmpty()) + { + //kdDebug() << "tdeio_finger.css file not found" << endl; + this->warning(i18n("tdeio_finger CSS script not found. Output will look ugly.")); + } + else + { + //kdDebug() << "tdeio_finger CSS file found: " << *myFingerCSSFile << endl; + } +} + + +/* --------------------------------------------------------------------------- */ + + +void FingerProtocol::parseCommandLine(const KURL& url) +{ + myURL = new KURL(url); + + /* + * Generate a valid finger url + */ + + if(myURL->isEmpty() || !myURL->isValid() || + (myURL->user().isEmpty() && myURL->host().isEmpty())) + { + myURL->setProtocol("finger"); + myURL->setUser(""); + myURL->setHost("localhost"); + } + + /* + * If no specific port is specified, set it to 79. + */ + + if(myURL->port() == 0) { + myURL->setPort(79); + } + + /* + * If no refresh rate is given, set it to defaultRefreshRate + */ + + if (myURL->query().isEmpty()) { + myURL->setQuery("?refreshRate="+defaultRefreshRate); + } +} + +/* ---------------------------------------------------------------------------------- */ +#include "tdeio_finger.moc" +/* ---------------------------------------------------------------------------------- */ + diff --git a/tdeioslave/finger/tdeio_finger.css b/tdeioslave/finger/tdeio_finger.css new file mode 100644 index 000000000..06deb81aa --- /dev/null +++ b/tdeioslave/finger/tdeio_finger.css @@ -0,0 +1,69 @@ +BODY { + color: #FFFFCC; + background-color: #000000; + padding: 2em; + margin: auto; +} + +A:link {color: #82A7D0} +A:visited {color: #999999} +A:active {color: #999999} + +H1 { + color: #999999; + background-color: #000000; + font: 200% Helvetica, sans-serif; + font-variant: normal; + padding: 1em; + margin: auto; +} + +.mainTable { + background-color: #000000; + border: thin solid; + margin: auto; +} + + +.courierText { + color: #FFFFCC; + background-color: #000000; + font: 120% Courier, sans-serif; + font-variant: normal; + text-align: left; + padding: 0em; +} + +.commandText { + color: #FFFFCC; + background-color: #000000; + font: 120% Courier, sans-serif; + font-variant: normal; + text-align: center; + padding: 0.5em; +} + +.niceText { + color: #009999; + background-color: #000000; + font: 120% Arial, sans-serif; + font-variant: normal; + text-align: center; + padding: 0.5em; +} + +.finger { color: #82A7D0} +.domainName { color: #D0A000} +.ipNumber { color: #D0A000} +.os { color: #82A7D0} +.username { color: #82A7D0} +.directory { color: #D0A000} +.shell { color: #D0A000} +.notLoggedIn { color: #00A000} +.loggedIn { color: #B00000} +.newMail { color: #82A7D0} +.plan { color: #D0A000} +.noNewMail { color: #BB0000} +.noPlan { color: #BB0000} + + diff --git a/tdeioslave/finger/tdeio_finger.h b/tdeioslave/finger/tdeio_finger.h new file mode 100644 index 000000000..3d083d2ed --- /dev/null +++ b/tdeioslave/finger/tdeio_finger.h @@ -0,0 +1,64 @@ + +/*************************************************************************** + tdeio_finger.h - description + ------------------- + begin : Sun Aug 12 2000 + copyright : (C) 2000 by Andreas Schlapbach + email : schlpbch@iam.unibe.ch + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + + +#ifndef __tdeio_finger_h__ +#define __tdeio_finger_h__ + +#include +#include + +#include +#include +#include +#include + +class FingerProtocol : public TQObject, public TDEIO::SlaveBase +{ + Q_OBJECT + +public: + + FingerProtocol(const TQCString &pool_socket, const TQCString &app_socket); + virtual ~FingerProtocol(); + + virtual void mimetype(const KURL& url); + virtual void get(const KURL& url); + +private slots: + void slotGetStdOutput(TDEProcess*, char*, int); + +private: + KURL *myURL; + + QString *myPerlPath; + TQString *myFingerPath; + TQString *myFingerPerlScript; + TQString *myFingerCSSFile; + + QString *myStdStream; + + + TDEProcess *myTDEProcess; + + void getProgramPath(); + void parseCommandLine(const KURL& url); +}; + + +#endif diff --git a/tdeioslave/finger/tdeio_finger.pl b/tdeioslave/finger/tdeio_finger.pl new file mode 100644 index 000000000..8965ea523 --- /dev/null +++ b/tdeioslave/finger/tdeio_finger.pl @@ -0,0 +1,175 @@ +##!/usr/bin/perl +# +# Copyright Andreas Schlapbach, schlpbch@iam.unibe.ch, 2001 +# http://iamexwiwww.unibe.ch/studenten/kfinger +# +# Touch at your own risk. + + +# Highlight mail addresses or url + +$mails = '/>/g; + +$USER =~ s/&/&/g; +$USER =~ s//>/g; + +# HTML Header + +print < + + + + finger $USER\@$HOST + + + + + + + + + \n"; + +# Finger-Talk options + +if ($USER) # is $USER nil ? +{ +print < + + + +UserQuery +} +else +{ +print < +
+

finger $USER\@$HOST

+
+ +HTMLHeader + +# Run finger command and save it into a buffer + +open(F, "-|") || exec $FINGERCMD, "$USER\@$HOST"; +@lines = ; +close(F); + +# Do highlighting using perl regular expressions on every line received. +# Order is important here. + +foreach $output (@lines) + { + $output =~ s/((\w)+\@((\w)+(.))*(\w)+)/$mails$1$urlspace$1$urlend/gi; # Highlight email address + $output =~ s/((http|ftp)(:\/\/)(\S)+)/$urls$1$urlspace$1$urlend/gi; # Highlight urls + $output =~ s/((\d)+\.(\d)+\.(\d)+\.(\d)+)/$ipNumber$1$close/gi; # Highlight IP number + $output =~ s/((\w)+\.(\w)+\.(\w|-)+\s)/$domainName$1$close/gi; # Highlight domain name (\s is important) + $output =~ s/(finger:)/$finger$1$close/gim; # Highlight finger + $output =~ s/(Linux)/$os$1$close/gim; # Highlight Linux + if ($USER) # is $USER nil ? + { + $output =~ s/^Login:\s*(\w*)/Login: $mails$1\@$HOST$urlspace$1$urlend/gi; + $output =~ s/^Login Name:\s*(\w*)/Login Name:$mails$1\@$HOST$urlspace$1$urlend/gi; + $output =~ s/Name:(((\s*)(\w+))+\n)/Name:$username$1$close\n/gi; # Linux + $output =~ s/In real life:(((\s*)(\w+))+\n)/In real life:$username$1$close\n/gi; # Solaris + $output =~ s/^Directory:((\s*)(\/(\w)+)+)/Directory:$directory$1$close/gi; # Highlight Directory + $output =~ s/Shell:((\s*)(\/(\w)+)+)/Shell:$shell$1$close/gi; # Highlight Shell + $output =~ s/(not presently logged)/$notLoggedIn$1$close/gi; + $output =~ s/con (\w*)/con $loggedIn$1$close/gi; + $output =~ s/^(New mail)/$newMail$1$close/gi; + $output =~ s/^(No mail.)/$noNewMail$1$close/gim; + $output =~ s/^(Plan:)/$plan$1$close/gi; + $output =~ s/^(No plan.)/$noPlan$1$close/gim; + } + else + { + $output =~ s/^(\w+)/$mails$1\@$HOST$urlspace$1$urlend/m unless ($output =~ m/$keywordlist/m); + } + # line consists of white space only? + if ($output =~ m/\S/gi) + { + print " \n"; + } + else + { + print " \n"; + } +} + +print "
$output
  
\n"; +print "
+ finger +
+HostQueryHead + + @lines = split /^/m, $buffer; + foreach $output2 (@lines) + { + if ($output2 =~ m/^(\w+)/gi and not ($output2 =~ m/$keywordlist/m)) + { + $USER = $&; + print " \n"; + # - talk\n\n"; + } + else + { + print " \n"; + } + } + +print < + + +HostQueryTail +} + +# HTMLTail + +print < + + +
finger\n
  
refresh rate: $REFRESHRATE seconds.
+ + +HTMLTail -- cgit v1.2.1