IRC gateway: Difference between revisions

m
syntax highlighting fixup automation
(Added Wren)
m (syntax highlighting fixup automation)
Line 5:
<br>
Just a bare-bones gateway.
<langsyntaxhighlight lang="go">package main
 
import (
Line 78:
go irc2.Loop()
irc1.Loop()
}</langsyntaxhighlight>
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(notonline)-->
For use with [[Chat_server#Phix]]
<span style="color: #000080;font-style:italic;">--
Line 242:
<span style="color: #000080;font-style:italic;">--?"done"
--{} = wait_key()</span>
<!--</langsyntaxhighlight>-->
 
=={{header|Tcl}}==
This code is called as a complete script, perhaps like this:
<langsyntaxhighlight lang="sh">./ircgateway.tcl irc://hostA.org/fishing bait irc://hostB.com:6667/haxors botfly</langsyntaxhighlight>
{{tcllib|picoirc}}
<langsyntaxhighlight lang="tcl">#!/bin/env tclsh8.5
package require picoirc
 
Line 290:
set conn(1) [picoirc::connect handle1to2 $nick1 $url1]
set conn(2) [picoirc::connect handle2to1 $nick2 $url2]
vwait forever</langsyntaxhighlight>
 
=={{header|Wren}}==
Line 300:
 
As it's not possible to access command line arguments directly from Wren when it is being embedded, we instead ask the gateway user to input details of the connections needed.
<langsyntaxhighlight lang="ecmascript">/* irc_gateway.wren */
 
import "./dynamic" for Tuple
Line 356:
irc.addCallback(i, "PRIVMSG", "" , c.channel, c.nick, otherNick)
irc.connect(c.server)
}</langsyntaxhighlight>
We now embed this script in the following Go program and run it from a terminal. To close the gateway just press Ctrl-C.
<langsyntaxhighlight lang="go">/* go run irc_gateway.go */
 
package main
Line 512:
ircObjs[0].Loop()
vm.Free()
}</langsyntaxhighlight>
 
{{omit from|AWK}}
10,327

edits