imported>MattisManzel m (despam) |
imported>Kunda m (Obsolete ? can you use anything from this page at all ?) |
||
(10 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
How to search ( |
=== How to search (([[Mediawiki]])) wiki pages from [[IRC]] (current). === |
||
--> see [[TclScripts/Mediawiki]] |
|||
⚫ | |||
== OBSOLETE == |
|||
Go to [[Efnet]] <nowiki>#wiki</nowiki> 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) === |
|||
⚫ | |||
*Load a [http://wiki.s23.org/wiki.pl?TCLScripts tcl script] like this: |
*Load a [http://wiki.s23.org/wiki.pl?TCLScripts tcl script] like this: |
||
Line 19: | Line 44: | ||
proc wikisearch {nick host hand chan text} { |
proc wikisearch {nick host hand chan text} { |
||
set quotedtext [string map { |
set quotedtext [string map {\' \'\\\'\'} $text]; |
||
set data [exec bash -c "/home/kallisti/egg/scripts/wiki.sh '$quotedtext'"]; |
set data [exec bash -c "/home/kallisti/egg/scripts/wiki.sh '$quotedtext'"]; |
||
regsub -all { |
regsub -all { |
||
Line 60: | Line 85: | ||
mutante |
mutante |
||
[[Category:IRC]] |
|||
[[Category:Computer]] |
|||
[[Category:Bots]] |
|||
[[Category:Wiki]] |
|||
[[Category:TCL]] |
Latest revision as of 02:17, 25 October 2005
How to search ((Mediawiki)) wiki pages from IRC (current).[edit]
--> see TclScripts/Mediawiki
OBSOLETE[edit]
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]
- Load a tcl script like this:
---
Using
set data10 [exec bash -c "/home/kallisti/egg/scripts/wiki.sh $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/wiki.sh '$quotedtext'"]; regsub -all { } $data {} output; putlog "$output"; putserv "PRIVMSG $chan :$output"; }
---
Yup,(almost) all it does is execute a shell script (wiki.sh), 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 wiki.sh
---
#/bin/bash tempfile="wikisearch.tmp" 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: http://wiki.s23.org/wiki.pl?`rl -c1 $tempfile` Find the rest on http://wiki.s23.org/wiki.pl?search=$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..
mutante