[REBOL] IRSee.r now with ENCRYPTED white board.
From: depotcity::telus::net at: 9-May-2001 2:09
IRSee now has an "Encrypted" white board.
Available at the LFReD rebsite (may require a reload) or below.
Special thanks to Mr. Kamp for the canvas.r pane.
In theory, the "L" load button on the whiteboard canvas should start a loop that
continuously refreshes the drawing, but it doesn't. Requires hitting the "L" button again
and again.
Any ideas?
Terry Brownell
REBOL [
Title: "LFReD IRSee"
Author: "Terry Brownell"
Email: [tbrownell--yahoo--com]
Date: 09-May-2001
File: %IRSee.r
History: [{
Ver 1.4
Added encrypted white board.
Lowered encryption strength for foreign users.
Added encryption capabilities
}]
]
irc-in: http://216.232.249.87/cgi-bin/irc-in.LFReD?roomirc-out: http://216.232.249.87/cgi-bin/irc-out.LFReD?
crypted: ftp://IRSee:[LFReD--216--232--249--87]/crypt-chat/
;------ Encryption ---------------
key-maker: func [str][checksum/secure str]
crypt: func [
"Encrypts or decrypts with compression. Returns result."
data [any-string!] "Data to encrypt or decrypt"
akey [binary!] "The encryption key"
/decrypt "Decrypt the data"
/binary "Produce binary decryption result."
/local port
][
port: open [
scheme: 'crypt
direction: pick [encrypt decrypt] not decrypt
key: akey
padding: true
strength: 'export
]
if not decrypt [data: compress data]
insert port data
update port
data: copy port
close port
if decrypt [data: decompress data]
if not binary [data: to-string data]
]
;---------painter ---------------
;Canvas.r script by Allen Kamp
draw-styles: stylize [
canvas: image with [
size: 100x100
edge: [size: 2x2 effect: 'ibevel color: 110.120.130]
color: ivory
saved-area: none
line: none
reset: does [clear line append line compose [pen (pen) line]]
set-pen: func [color][old-pen: pen pen: color
if pen <> old-pen [append line compose [pen (pen) line]]
]
pen: black
old-pen: pen
feel: make feel [
engage: func [f a e] [
if find [down over] a [
append f/line e/offset - 2x2
show f
]
if a = 'up [append f/line [line]]
]
]
words: [pen [new/pen: second args next args]]
init: [
if (1 >= length? self/effect) [
self/effect: copy/deep compose/deep [draw [pen (self/pen) line]]
]
self/line: second self/effect
]
]
]
set 'make-painter func [outersize][ the-key: key-maker key-string/text
make face [
cv: none
edge: none
pnl: none
size: (outersize)
color: rebolor
pane: get in layout [
styles draw-styles origin 0
space 0x0
across cv: canvas 304x276
pnl: panel [
style toggle toggle 16x16 red [cv/set-pen face/color] of 'cols
origin 0
size 22x272
space 4x0 below
toggle red
toggle orange
toggle yellow
toggle black true
toggle mint
toggle olive
toggle leaf
toggle green
toggle blue
toggle sky
toggle maroon
toggle purple
toggle pink
toggle white
button 16x16 "C" [cv/reset show cv]
button 16x16 "S" [ the-pic: rejoin [crypted room/text ".Lpic"] done: crypt mold cv/effect
the-key save the-pic done]
get-it: button "L" 16x16 [the-pic: rejoin [crypted room/text ".Lpic"] forever [wait
3
cv/effect: load crypt/decrypt load the-pic the-key
cv/line: second cv/effect
show cv
;set pen to current col
cv/set-pen none
foreach tgl face/parent-face/pane [
if all [tgl/style = 'toggle tgl/state][cv/set-pen tgl/color exit]]
]
]
]
] 'pane
]
]
;---------Main ---------------
main: layout [
backdrop 103.134.170 effect [ grid 5x5 93.124.160 ]
origin 10x10
guide
h2 "LFReD IRSee"
h4 "Chat Room" room: field "General" ivory 100
h4 "Name/Handle" handle: field "Handle" ivory 100
h4 "Encryption String" key-string: field ivory 100
button "Enter" 100 93.124.160 75x25 [the-room: rejoin [irc-in room/text] either empty?
key-string/text
[the-room: rejoin [irc-in room/text]
forever [ m/text: copy read the-room show m wait 3]]
[the-key: key-maker key-string/text the-room: rejoin [crypted room/text ".txt"]
if error? try [read/binary the-room][write the-room crypt rejoin ["This is a previously
unused room." newline] the-key]
forever [m/text: crypt/decrypt read/binary the-room the-key show m wait 3]]
]
button "Quit" 100 93.124.160 75x25 [quit]
button 100 93.124.160 75x25 "Submit" #"^M" [either empty? key-string/text
[read rejoin [irc-out "said=" rejoin [handle/text ": " message/text]"&room=" room/text]message/text:
copy "" show message focus message]
[the-key: key-maker key-string/text the-room: rejoin [crypted room/text ".txt"]
the-whole: crypt/decrypt read/binary the-room the-key
coded1: rejoin [the-whole handle/text ": " message/text newline] coded: crypt coded1
the-key
write/binary the-room coded
message/text: copy "" show message focus message]
]
return
pad 20
panels: box 320x276 coal
across
m: info 420x150 ivory wrap
across
s4: slider 14x150 93.124.160 [scroll-para m s4]
return
message: field {Type your message here and hit "Enter" or press "Submit"} ivory 420
]
m/text: {Welcome.^/IRSee is a chat/news and whiteboard application, both of which are
encrypted.^/^/Instructions:^/1. Enter a room name.("General" is for public chat. Please
leave this room unencrypted)^/2. Enter your name or handle.^/3. Enter an encryption string
such as "The geese fly east". Send this string and the room name to your comrades. (Leave
the encryption string blank to create a public room.)^/4. Click "Enter"^/^/Using the
Whiteboard^/Once you have created and entered a room, simply make your drawing and save
it by pressing "S". To re-load the whiteboard press "R" and to clear press "C"^/^/Known
bugs: Any attempt to enter a previously created private room with the wrong encryption
string will crash the script.^/Attempting to load a pic in a new room BEFORE saving one
will crash the script as well. These will be fixed sooner or later.}
panels/pane: make-painter 320x276
view main