add multiwebsearch Actions script
authorPaul Mangan <paul@claws-mail.org>
Thu, 13 Mar 2003 19:38:21 +0000 (19:38 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 13 Mar 2003 19:38:21 +0000 (19:38 +0000)
ChangeLog.claws
configure.ac
tools/Makefile.am
tools/README
tools/multiwebsearch.conf [new file with mode: 0644]
tools/multiwebsearch.pl [new file with mode: 0644]

index bfd4ee2dc8b7dc6305b544151a0a850241f97773..047ddd491163e3a5f7ff6221320d9c3319e3bb81 100644 (file)
@@ -1,3 +1,11 @@
+2003-03-13 [paul]      0.8.11claws10
+
+       * tools/Makefile.am
+         tools/README
+         tools/multiwebsearch.conf     ** NEW FILE **
+         tools/multiwebsearch.pl       ** NEW FILE **
+               add multiwebsearch Actions script
+
 2003-03-13 [colin]     0.8.11claws9
 
        * src/compose.c
 2003-03-13 [colin]     0.8.11claws9
 
        * src/compose.c
index 7bcf58da7d76d1c774c962968d1988acadb48346..2a30b857d70af9c4b1487792a27fd8fcdfc84918 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws9
+EXTRA_VERSION=claws10
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 298dd7fb58c1ef75f1ac8d0eb7b6e536237abab4..c550071ac625f42d992c1060ae2eb19e20dea723 100644 (file)
@@ -11,6 +11,7 @@ EXTRA_TOOLS = \
        kmail2sylpheed.pl \
        kmail2sylpheed_v2.pl \
        launch_phoenix \
        kmail2sylpheed.pl \
        kmail2sylpheed_v2.pl \
        launch_phoenix \
+       multiwebsearch.pl \
        newscache_clean.pl \
        outlook2sylpheed.pl \
        sylpheed-switcher \
        newscache_clean.pl \
        outlook2sylpheed.pl \
        sylpheed-switcher \
@@ -23,6 +24,7 @@ EXTRA_TOOLS = \
 EXTRA_DIST = \
        README \
        README.sylprint \
 EXTRA_DIST = \
        README \
        README.sylprint \
+       multiwebsearch.conf \
        $(EXTRA_TOOLS)
 
 MAKE_EXE = chmod u+x $(EXTRA_TOOLS)
        $(EXTRA_TOOLS)
 
 MAKE_EXE = chmod u+x $(EXTRA_TOOLS)
index 4d2beb854fe46e58105823e660498e2262160b43..10b49a4d92751c88e61985aed6b0ea4b899898a6 100644 (file)
@@ -8,6 +8,7 @@ Action scripts:
   gpg-sign-syl                  Clear-sign current selection
   google_msgid.pl               Search groups.google.com for selected message-id
   google_search.pl             Search google.com for selected text
   gpg-sign-syl                  Clear-sign current selection
   google_msgid.pl               Search groups.google.com for selected message-id
   google_search.pl             Search google.com for selected text
+  multiwebsearch.pl            Search any search engine for the selected text
   uudec                         Decode and display uuencoded images
 
 Addressbook conversion:
   uudec                         Decode and display uuencoded images
 
 Addressbook conversion:
@@ -60,6 +61,10 @@ Action scripts
   COMMAND: |gpg-sign-syl|
   Clear-sign current selection using gpg.
 
   COMMAND: |gpg-sign-syl|
   Clear-sign current selection using gpg.
 
+* multiwebsearch.pl
+  WORKS ON: selection
+  see further down for details
+
 * uudec
   WORKS ON: current message (or part of multipart message)
   COMMAND: uudec %f&
 * uudec
   WORKS ON: current message (or part of multipart message)
   COMMAND: uudec %f&
@@ -68,6 +73,44 @@ Action scripts
 * More action examples can be found at
   http://melvin.hadasht.free.fr/home/sylpheed/actions/
 
 * More action examples can be found at
   http://melvin.hadasht.free.fr/home/sylpheed/actions/
 
+** multiwebsearch.pl **
+
+  WHAT IT DOES
+       This is an Actions script that allows you to search
+       websites for the selected text. It uses the default
+       Sylpheed browser as configured through Sylpheed's
+       GUI and specified in ~/.sylpheed/sylpheedrc, and a
+       configuration file called multiwebsearch.conf.
+       
+  CONFIGURATION
+       The configuration file takes the following format:
+       
+       ALIAS|URL PART|URL PART
+       
+       ALIAS is a user-defined name; the first URL PART is the
+       url before the search term; the second URL PART is
+       optional and contains the remaining part of the url which
+       comes after the search term. A sample configuration file
+       is included.
+       
+  HOW TO USE IT
+       Copy 'multiwebsearch.conf' to ~/.sylpheed/
+       
+       Configure an Action:
+       a) pre-configured website 
+          Command: multiwebsearch.pl --where="google" --what="%s"
+       b) dynamic
+          Command: multiwebsearch.pl --where="%u" --what="%s"
+          
+       In type a) "google" refers to one of the configured aliases,
+       this Action will always search the website referred to by
+       the alias "google".
+       
+       In type b) you will be presented with a dialog box into
+       which you type one of your configured aliases
+
+  
+  Contact: Paul Mangan <claws@thewildbeast.co.uk>
 --------------------------------------------------------------------------------
 
 Address book conversion
 --------------------------------------------------------------------------------
 
 Address book conversion
diff --git a/tools/multiwebsearch.conf b/tools/multiwebsearch.conf
new file mode 100644 (file)
index 0000000..3611e94
--- /dev/null
@@ -0,0 +1,6 @@
+cpan|http://search.cpan.org/search?mode=module&query=
+fm|http://freshmeat.net/search?q=
+google|http://www.google.com/search?q=
+rfc|http://www.ietf.org/rfc/rfc|.txt
+sf|http://sourceforge.net/search/?type_of_search=soft&words=
+usenet|http://groups.google.com/groups?q=|&meta=site%3Dgroups
diff --git a/tools/multiwebsearch.pl b/tools/multiwebsearch.pl
new file mode 100644 (file)
index 0000000..cbfbf31
--- /dev/null
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+#  * Copyright © 2003 Paul Mangan <claws@thewildbeast.co.uk>
+#  *
+#  * This file 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.
+#  *
+
+use Getopt::Long;
+
+my $where = '';
+my $what  = '';
+
+GetOptions("where=s"   => \$where,
+          "what=s"     => \$what);
+
+chdir($ENV{HOME} . "/.sylpheed") 
+       || die("Can't find your ~/.sylpheed directory\n");
+
+open (CONF, "<multisearch.conf") 
+       || die("Can't open ~/.sylpheed/multisearch.conf\n");
+       @conflines = <CONF>;
+close CONF;
+
+foreach $confline (@conflines) {
+       if ($confline =~ m/^$where\|/) {
+               chomp $confline;
+               @parts = split(/\|/, $confline);
+               $url = $parts[1];
+               if ($parts[2]) {
+                       $what .= $parts[2];
+               }
+       }
+}
+
+if (!$url) {
+       die("No url found with the alias \"$where\"\n");
+} 
+
+open (SYLRC, "<sylpheedrc") 
+       || die("Can't open ~/.sylpheed/sylpheedrc\n");
+       @rclines = <SYLRC>;
+close SYLRC;
+
+foreach $rcline (@rclines) {
+       if ($rcline =~ m/^uri_open_command/) {
+               chomp $rcline;
+               @browser = split(/=/, $rcline);
+               $browser[1] =~ s/%s/$url$what/;
+       }
+}
+system("$browser[1]&");
+exit;