From s23
Jump to navigation Jump to search

How to search ((Mediawiki)) wiki pages from IRC (current).[edit]

--> see TclScripts/Mediawiki


Go to Efnet #wiki and use the triggers:

.title <string>

To search the titles of Wiki pages.

Example: .title Debian

.content <string>

To search the full text content of Wiki pages.

Example: .content Sex

Additional triggers include (.stats (statistics) .sysops (sysop emails) and .rc (show last 5 changes).

will be extended with source code of scripts etc..

How to search (UseMod) wiki pages from IRC (outdated & the ugly way)[edit]



set data10 [exec bash -c "/home/kallisti/egg/scripts/ $text"];

is a security risk, as everyone can run commands on your box. Don't do that. The code below is untested, but it should protect from exploits. -- thanks for your input, updated that.

bind pub - !wiki wikisearch

proc wikisearch {nick host hand chan text} {
  set quotedtext [string map {\' \'\\\'\'} $text];
  set data [exec bash -c "/home/kallisti/egg/scripts/ '$quotedtext'"];
  regsub -all {
} $data {} output;
  putlog "$output";   
putserv "PRIVMSG $chan :$output";



Yup,(almost) all it does is execute a shell script (, thats the ugly part about it ,because one could also do the whole job inside the .tcl (please add here if you like)

  • add the



echo "`grep -i -R -l -h $1 /var/www/wiki/page/* | cut -d/ -f7 | cut -d. -f1`" > $tempfile
wcount=`less $tempfile | wc -l`
echo "Found '$1' in $wcount wiki pages. Outputting 1 random hit:`rl -c1 $tempfile` Find the rest on$1&dosearch=Go!"


This greps recursively thru /var/www/wiki/page/* (the place all the wiki pages are stored), uses "cut" to get the right piece of text and dumps it to a tempfile. Then it counts the number of hits using "wc" and outputs 1 random hit (using 'rl' = randomline command) and adds the link to the wiki search function.

The result is :

If you type !wiki <keyword> on a channel you can search the wiki pages for your keyword and click the right link without having to first go to the wiki search function.

thats it so far,, make it more elegant if you like..