<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="lt">
	<id>https://wiki.eofnet.lt/w//index.php?action=history&amp;feed=atom&amp;title=IRCBotas</id>
	<title>IRCBotas - Versijų istorija</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.eofnet.lt/w//index.php?action=history&amp;feed=atom&amp;title=IRCBotas"/>
	<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=IRCBotas&amp;action=history"/>
	<updated>2026-04-15T16:58:21Z</updated>
	<subtitle>Šio puslapio versijų istorija projekte</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.eofnet.lt/w//index.php?title=IRCBotas&amp;diff=3180&amp;oldid=prev</id>
		<title>\dev\null: sintaksės sutvarkymas ir teksto suformavimas</title>
		<link rel="alternate" type="text/html" href="https://wiki.eofnet.lt/w//index.php?title=IRCBotas&amp;diff=3180&amp;oldid=prev"/>
		<updated>2013-10-11T06:14:07Z</updated>

		<summary type="html">&lt;p&gt;sintaksės sutvarkymas ir teksto suformavimas&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Naujas puslapis&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is  [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] integration scripts  intergrating '''IRC''' between [http://www.mediawiki.org/wiki/MediaWiki MediaWiki]/[http://www.php.net/ php] and [http://en.wikipedia.org/wiki/Eggdrop eggdrop] with [http://en.wikipedia.org/wiki/Tcl tcl] script. Copyright (c) 2013 [[Naudotojas:\dev\null|\dev\null]]. Licensed under GPLv2. Script reports all article/talk or other changes to specified IRC Channel.&lt;br /&gt;
&lt;br /&gt;
It's usually a hack by replacing '''UDP''' (User Datagram Protocol) to Transmission Control Protocol '''TCP''', because all the tcl libs for support to UDP are outdated and not supported. By default [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] still uses UDP as official version, so we changed it and written a simple tcl script for [http://en.wikipedia.org/wiki/Eggdrop eggdrop] to handle the incoming connections from [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] and put them on the [[IRC]] Channel. Everything works! ;-)&lt;br /&gt;
&lt;br /&gt;
''We are planning to do much more work on integrating MediaWiki with IRC''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--\dev\null 08:19, 11 spalio 2013 (EEST)&lt;br /&gt;
&lt;br /&gt;
== Output to IRC ==&lt;br /&gt;
[http://www.mediawiki.org/wiki/MediaWiki MediaWiki] already outputs text with colors like this&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;[[File has modification time in the future]]  http://wiki.eofnet.lt/w/index.php?diff=3161&amp;amp;oldid=3160&amp;amp;rcid=3579 * \dev\null * (+5) &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
If your IRC Client does not support colors then you will see something like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;14[[07File has modification time in the future14]]4 10 02http://wiki.eofnet.lt/w/index.php?diff=3162&amp;amp;oldid=3161&amp;amp;rcid=3580 5* 03\dev\null 5* (-6) 10&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mediawiki ==&lt;br /&gt;
'''You will need to open includes/RecentChange.php and do search for a function'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &lt;br /&gt;
        public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) {&lt;br /&gt;
                global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort;&lt;br /&gt;
                # Assume default for standard RC case&lt;br /&gt;
                $address = $address ? $address : $wgRC2UDPAddress;&lt;br /&gt;
                $prefix = $prefix ? $prefix : $wgRC2UDPPrefix;&lt;br /&gt;
                $port = $port ? $port : $wgRC2UDPPort;&lt;br /&gt;
                # Notify external application via UDP&lt;br /&gt;
                if ( $address ) {&lt;br /&gt;
                        $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );&lt;br /&gt;
                        if ( $conn ) {&lt;br /&gt;
                                $line = $prefix . $line;&lt;br /&gt;
                                wfDebug( __METHOD__ . &amp;quot;: sending UDP line: $line\n&amp;quot; );&lt;br /&gt;
                                socket_sendto( $conn, $line, strlen( $line ), 0, $address, $port );&lt;br /&gt;
                                socket_close( $conn );&lt;br /&gt;
                                return true;&lt;br /&gt;
                        } else {&lt;br /&gt;
                                wfDebug( __METHOD__ . &amp;quot;: failed to create UDP socket\n&amp;quot; );&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
                return false;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
'''And replace it with this function:'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &lt;br /&gt;
        public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) {&lt;br /&gt;
                global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort;&lt;br /&gt;
                # Assume default for standard RC case&lt;br /&gt;
                $address = $address ? $address : $wgRC2UDPAddress;&lt;br /&gt;
                $prefix = $prefix ? $prefix : $wgRC2UDPPrefix;&lt;br /&gt;
                $port = $port ? $port : $wgRC2UDPPort;&lt;br /&gt;
                # Notify external application via UDP&lt;br /&gt;
                if ( $address ) {&lt;br /&gt;
                        $conn = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );&lt;br /&gt;
                        socket_connect($conn, $address, $port);&lt;br /&gt;
                        if ($conn) {&lt;br /&gt;
                                $line = $prefix . $line;   &lt;br /&gt;
                                socket_write($conn, $line);&lt;br /&gt;
                                wfDebug( __METHOD__ . &amp;quot;: sending UDP line: $line\n&amp;quot; );&lt;br /&gt;
                                socket_close( $conn );&lt;br /&gt;
                                return true;&lt;br /&gt;
                        } else { &lt;br /&gt;
                                wfDebug( __METHOD__ . &amp;quot;: failed to create UDP socket\n&amp;quot; );&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
                return false;&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Now open LocalSettings.php add these line, just change port with whatever you want:&lt;br /&gt;
 # IRC&lt;br /&gt;
 $wgRC2UDPAddress = '127.0.0.1'; # the host where the IRC client is running&lt;br /&gt;
 $wgRC2UDPPort = 4013; # or whatever&lt;br /&gt;
 $wgRC2UDPPrefix = '';&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TCL for eggdrop (version &amp;gt;=1.8) ==&lt;br /&gt;
&lt;br /&gt;
To install put it eggdrop/scripts directory and load from [[eggdrop.conf]], just change parameters if you need. It's very simple script. Sorry no any security mechanisms implemented yet, but if you use it on your own local machine/server host everything will be okay, also you can use [[iptables]]/[[packet filter]] to block applications/connections to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
 # This script dedicated for displaying recent changes from http://wiki.eofnet.lt using tcp socket&lt;br /&gt;
 # Can work with any MediaWiki or other service, just use it at your own rist!&lt;br /&gt;
 # (c) 2013 \dev\null, EofNET LAB07.&lt;br /&gt;
 # v1.0 - Initial Release &lt;br /&gt;
 ##################### CONFIGURATION #######################&lt;br /&gt;
 # port to bind&lt;br /&gt;
 set port 4013&lt;br /&gt;
 # ip to bind&lt;br /&gt;
 set host 127.0.0.1  &lt;br /&gt;
 # in what channel it will be used ?&lt;br /&gt;
 set channel #ubuntu&lt;br /&gt;
 ###########################################################&lt;br /&gt;
&lt;br /&gt;
 set TcpSocket [socket -server main -myaddr $host $port]&lt;br /&gt;
 &lt;br /&gt;
 proc main { sock host port } {&lt;br /&gt;
   fconfigure $sock -buffering line&lt;br /&gt;
   fileevent $sock readable [action $sock $host $port]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 proc action { sock host port } {&lt;br /&gt;
   global channel&lt;br /&gt;
   if {![eof $sock]} {&lt;br /&gt;
   set data [gets $sock]&lt;br /&gt;
   if {$data != &amp;quot;&amp;quot;} {&lt;br /&gt;
   putquick &amp;quot;PRIVMSG $channel :$data&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
   }  {&lt;br /&gt;
   close $sock&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 putlog &amp;quot;tcport.tcl loaded&amp;quot;&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Puslapis]]&lt;/div&gt;</summary>
		<author><name>\dev\null</name></author>
	</entry>
</feed>