Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

IRSee.r now with ENCRYPTED white board.

 [1/5] 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: 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

 [2/5] from: arolls:bigpond:au at: 10-May-2001 5:12

Look at this code: ; example 1 view layout [button "L" 16x16 [wait 2]] ; example 2 view layout [button "L" 16x16 [forever [wait 3]]] In example 1, you can press the button, then quit straight away, and you have control at the console. That makes me think that wait can be interrupted by a 'quit event (or something like that). In example 2, you press the button, it should wait forever right? No, the window is still receiving events. You can move the mouse over and away from the button and it reacts, the close button works too. I think wait listens to the window events. I think example 2 is an example you should never try to implement in your program, because you are trying to block window events ;) Anyway, I recommend, in your code below, that you use 'rate 1... First I think something like this: do-it?: no view layout [ button "L" 16x16 [do-it?: yes] rate 1 feel [engage: func [face event action][ if event = 'time [print if do-it? ["show"]] ] ] ] but I have killed button's nice and useful feel function that listens to me when I click mouse on it etc... So I get the button style code like this: probe get-style 'button Copy and paste the code inside: feel: make object! [ ... get this code here ... ] And this monster of a hack is what I end up with: do-it?: no view layout [ button "L" 16x16 [print "hello" do-it?: yes] rate 1 feel [ redraw: func [face act pos /local state][ face/edge/effect: pick [ibevel bevel] face/state if face/texts [face/text: face/texts/1] all [face/state face/texts face/text: any [face/texts/2 face/texts/1]] state: either not face/state [face/blinker] [true] if face/colors [face/color: pick face/colors not state] if face/effects [face/effect: pick face/effects not state] ] detect: none over: func [face action event][ if all [face/font face/font/colors] [ face/font/color: pick face/font/colors not action show face face/font/color: first face/font/colors ] ] engage: func [face action event][ switch action [ time [ print if do-it? ["show"] ; <-- this is our addition if not face/state [face/blinker: not face/blinker] ] down [face/state: on] alt-down [face/state: on] up [if face/state [do-face face none] face/state: off] alt-up [if face/state [do-face-alt face none] face/state: off] over [face/state: on] away [face/state: off] ] cue face action show face ] cue: none blink: none ] ] Notice the change inside the engage function... I hope this helps. Maybe someone can suggest a better way to insert that one line into the engage function. Actually, maybe I can do it. Do each line here as I have done. probe get-style 'button probe get in get-style 'button 'feel probe get in get in get-style 'button 'feel 'engage Engage is a function, so to get the function body, we use second: probe second get in get in get-style 'button 'feel 'engage We are interested in the third item, ('switch is first, 'action second). probe third second get in get in get-style 'button 'feel 'engage Finally, the 'time code is in here. probe select third second get in get in get-style 'button 'feel 'engage 'time All we have to do is modify a copy of the button style. Petr Krenzelok showed us how to copy a style back in 14-Nov-2000, in rebol list. Err... I'm losing it... can't stay awake .. any longer... Anton.

 [3/5] from: depotcity:telus at: 9-May-2001 14:01

Anton Err... You've lost me... and I'm wide awake 8). Terry

 [4/5] from: alanwall:sonic at: 9-May-2001 16:52

Hello Terry and list,Terry and I were using his program but I could not get the sound to play even thou I could get it to play when I clicked on it from the public dir.I think my problem is the path which is this: sounds: c:/programpercent20files/rebol/public/ Since I have Rebol in c:\program files what is the correct way to define the blank space between program and file? I had asssumed that the registry could point to the correct path.Also do you still need to set path in autoexec.bat like this: SET REBOL_HOME=C:\PROGRAM FILES\Rebol This is on Windows 98 first edition.Thanks! :) Regards -- The Master said, 'Clever talk and a pretentious manner' are seldom found in the Good. -- Confucius sent via Yam ver2.2 on AmigaForever verIV Be a Rebel get Rebol@ UIN#=9391028

 [5/5] from: depotcity:telus at: 9-May-2001 17:53

I think you use for spaces in long file name paths? c:\program files\rebol\public\\view\sounds\knock.wav (or .au if you wish)