#!/bin/sh
# MetaCard 2.4 stack
# The following is not ASCII text,
# so now would be a good time to q out of more
exec mc $0 "$@"
P ChatRev M19 3"0on closeStackRequest
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) or
(the target is "card" && quote & "register" & quote) or (the target is "card" && quote & "settings" & quote) then
answer warning "Are you sure you want to close this stack (and disconnect)?" with "Okay" or "Cancel"
if it is "Okay" then
send "disconnect" to btn "Connect" of cd 1
if the environment is "development" then
save this stack
pass closestackrequest
end if
cleanUp
quit
end if
else
pass closestackrequest
end if
end closeStackRequest
on preOpenStack
global gChatRevShortName, gMainStackRect
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) or
(the target is "card" && quote & "register" & quote) or (the target is "card" && quote & "settings" & quote) then
put the short name of this stack into gChatRevShortName
send "restoreStyleMenu" to btn "Style Storage" of cd "Chat" of stack gChatRevShortName
readPrefs
get the result
if gMainStackRect is a rect then
set the rect of stack gChatRevShortName to gMainStackRect
else
set the rect of this stack to 1,1,640,480
set the loc of me to the screenLoc
end if
set the label of btn "Status" of cd 2 of stack gChatRevShortName to "Disconnect"
lock messages
set the menuHistory of btn "Go" to 1
set the label of btn "Connect" to "Connect"
setFieldBackColor
if the platform is not "MacOS" then
hide btn "iTunes" of cd "Settings" of stack gChatRevShortName
end if
unlock messages
end if
pass preOpenStack
end preOpenStack
-- handler added by Mark S
on openStack
global gChatRevShortName
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) then
choose browse tool
checkLastMessageSentTime
send "setMenus" to btn "Style Storage" cd "Chat" of stack gChatRevShortName
if the platform is "MacOS" then
show btn "iTunes" of cd "Settings" of stack gChatRevShortName
else
hide btn "iTunes" of cd "Settings" of stack gChatRevShortName
end if
end if
pass openStack
end openStack
-- handler added by Mark S
on checkLastMessageSentTime
global gChatRevShortName
if the cLastMessageSentTime of cd 2 is empty then
set the cLastMessageSentTime of cd 2 to the long time
end if
put the cLastMessageSentTime of cd 2 into myIdleTime
put ((fld "Idle Time" of cd 4 of stack gChatRevShortName)*60) into myTimeLimit
convert myIdleTime to seconds
if the label of btn "Status" of cd 2 of stack gChatRevShortName is not "Disconnect" then
if (the seconds - myidleTime) > myTimeLimit then
set the label of btn "Status" of cd 2 of stack gChatRevShortName to "Away"
end if
end if
put ((fld "Idle Time" of cd 4 of stack gChatRevShortName) * 60) - 1 into myIdleTimeSecs
send "checkLastMessageSentTime" to me in myIdleTimeSecs seconds
end checkLastMessageSentTime
on preOpenCard
lock screen
revUpdateGeometry
pass preOpenCard
end preOpenCard
-- handler by Mark S
-- replace smileys
function replaceSmileys theMsg
put smileyServer() into mySmileServer
put false into mySmileyFound
if the hilite of btn "Replace smileys" of cd 4 is true then
implementedSmileys smiley
put mySmileysList() into mySmileys
repeat with x = 1 to (number of lines of mySmileys)
put smiley[x] into tempVar --for debugging
if smiley[x] is in theMsg then
put true into mySmileyFound
put the length of smiley[x] into mySmileyLength
repeat until smiley[x] is not in theMsg
put offset(smiley[x],theMsg) into c
delete char (c+1) to (c+mySmileyLength-1) of theMsg
put ("") into char c of theMsg
end repeat
end if
end repeat
if mySmileyFound then put "
" after theMsg
end if
return (theMsg & numToChar(11) & mySmileyFound)
end replaceSmileys
function smileyServer
global gChatRevShortName
put line lineoffset(the label of btn "Smile Server" of cd 4 of stack gChatRevShortName,btn "Smile Server" of cd 4 of stack gChatRevShortName) of the cServers of btn "Smile Server" of cd 4 of stack gChatRevShortName into mySmileServer
if last char of mySmileServer is not "/" then put "/" after mySmileServer
return mySmileServer
end smileyServer
function mySmileysList
put "smile.gif" & return &
"wink.gif" & return &
"sad.gif" & return &
"cry.gif" & return &
"rasp.gif" & return &
"grin.gif" & return &
"shock.gif" & return &
"love.gif" & return &
"rolleyes.gif" & return &
"cool.gif" & return &
"sneaky.gif" & return &
"bored.gif" into mySmileys
return mySmileys
end mySmileysList
on implementedSmileys @smiley
put ":-)" into smiley[1]
put ";-)" into smiley[2]
put ":-(" into smiley[3]
put ":'-(" into smiley[4]
put ":-p" into smiley[5]
put ":-D" into smiley[6]
put "=:-o" into smiley[7]
put ":-*" into smiley[8]
put ":-/" into smiley[9]
put "8-)" into smiley[10]
put ":^)" into smiley[11]
put ":-|" into smiley[12]
end implementedSmileys
on saveStackRequest
global gChatRevShortName
cleanUp
pass saveStackRequest
end saveStackRequest
on cleanUp
global gChatRevShortName,gLogViewerApp
set the cursor to watch
set the itemDelimiter to numToChar(11)
put btn "IP List" of cd 1 of stack gChatRevShortName into item 1 of myPrefs
put the label of btn "IP List" of cd 1 of stack gChatRevShortName into item 2 of myPrefs
put fld "Name" of cd 1 of stack gChatRevShortName into item 3 of myPrefs
put fld "Pass" of cd 1 of stack gChatRevShortName into item 4 of myPrefs
put fld "Port" of cd 1 of stack gChatRevShortName into item 5 of myPrefs
put fld "Nickname" of cd 3 of stack gChatRevShortName into item 6 of myPrefs
put fld "Password" of cd 3 of stack gChatRevShortName into item 7 of myPrefs
put fld "E-Mail" of cd 3 of stack gChatRevShortName into item 8 of myPrefs
put fld "MouseOver" of cd 3 of stack gChatRevShortName into item 9 of myPrefs
put fld "About" of cd 3 of stack gChatRevShortName into item 10 of myPrefs
put fld "Message Sound" of cd 4 of stack gChatRevShortName into item 11 of myPrefs
put fld "Login Sound" of cd 4 of stack gChatRevShortName into item 12 of myPrefs
put fld "Path" of cd 4 of stack gChatRevShortName into item 13 of myPrefs
put fld "Autoreply Message" of cd 4 of stack gChatRevShortName into item 14 of myPrefs
put fld "Idle Time" of cd 4 of stack gChatRevShortName into item 15 of myPrefs
-- put fld "Login Sound" of cd 4 of stack gChatRevShortName into item 16 of myPrefs
put the hilite of btn "Receive HTML" of cd 4 of stack gChatRevShortName into item 17 of myPrefs
put the hilite of btn "Replace Smileys" of cd 4 of stack gChatRevShortName into item 18 of myPrefs
put the hilite of btn "Press enter for multiple lines" of cd 4 of stack gChatRevShortName into item 19 of myPrefs
put the label of btn "Smile Server" of cd 4 of stack gChatRevShortName into item 20 of myPrefs
put btn "IP URL" of cd 1 of stack gChatRevShortName into item 21 of myPrefs
put the label of btn "IP URL" of cd 1 of stack gChatRevShortName into item 22 of myPrefs
put the rect of this stack into item 23 of myPrefs
put fld "IP" of cd 1 of stack gChatRevShortName into item 24 of myPrefs
put the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName into item 25 of myPrefs
put the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName into item 26 of myPrefs
put the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName into item 27 of myPrefs
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to 75
put the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName into item 28 of myPrefs
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to false
put gLogViewerApp into item 29 of myPrefs
put the thumbposition of scrollbar "sound level" of cd 4 into item 30 of myPrefs
put the hilite of btn "Enable Speech" of cd 4 into item 31 of myPrefs
put the loc of window "Colour Palette" into item 32 of myPrefs
put the textSize of fld "Chat" of cd "Chat" of stack gChatRevShortName into item 33 of myPrefs
put the textFont of fld "Chat" of cd "Chat" of stack gChatRevShortName into item 34 of myPrefs
if there is a window "Colour Palette" then
put the bottomLeft of window "Colour Palette" into item 35 of myPrefs
else
put the cCustomLoc of stack "Colour Palette" into item 35 of myPrefs
end if
if there is a window "Smileys" then
put the bottomLeft of window "Smileys" into item 36 of myPrefs
else
put the cCustomLoc of stack "Smileys" into item 36 of myPrefs
end if
put the short name of this stack & return & myPrefs into myPrefs
put myPrefs into url ("file:" & stackToFilename("User Data/User Data"))
put empty into btn "IP List" of cd 1 of stack gChatRevShortName
set the fileName of image "Default Smile" of cd 2 of stack gChatRevShortName to empty
set the icon of btn "Insert Smile" of cd 2 of stack gChatRevShortName to empty
put empty into fld "Enter" of cd 2 of stack gChatRevShortName
put empty into fld "Chat" of cd 2 of stack gChatRevShortName
put empty into fld "Members" of cd 2 of stack gChatRevShortName
put empty into fld "Log" of cd 1 of stack gChatRevShortName
put empty into fld "Name" of cd 1 of stack gChatRevShortName
put empty into fld "Pass" of cd 1 of stack gChatRevShortName
put empty into fld "IP" of cd 1 of stack gChatRevShortName
put empty into fld "Port" of cd 1 of stack gChatRevShortName
put empty into fld "Nickname" of cd 3 of stack gChatRevShortName
put empty into fld "Password" of cd 3 of stack gChatRevShortName
put empty into fld "E-Mail" of cd 3 of stack gChatRevShortName
put empty into fld "MouseOver" of cd 3 of stack gChatRevShortName
put empty into fld "About" of cd 3 of stack gChatRevShortName
put empty into fld "Message Sound" of cd 4 of stack gChatRevShortName
put empty into fld "Login Sound" of cd 4 of stack gChatRevShortName
put empty into fld "Path" of cd 4 of stack gChatRevShortName
put empty into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" of cd 1 of stack gChatRevShortName to empty
repeat for each char x in "pbiu"
set the hilite of btn x of cd 2 of stack gChatRevShortName to false
end repeat
set the cTextStyle of fld "Enter" of cd 2 of stack gChatRevShortName to empty
set the itemDel to comma
put "Threads,Text,Edit,Thread,Create" into myForumFields
repeat for each item x in myForumFields
put empty into fld x of cd "Forum"
end repeat
set the backgroundColor of graphic "Selected Colour" of cd 1 of stack "Colour Palette" to 0,0,0
set the backgroundColor of graphic "Old Colour" of cd 1 of stack "Colour Palette" to 0,0,0
set the fileName of image "Smiley" of cd 4 to empty
if there is a window "Smileys" then close window "Smileys"
if there is a window "Colour Palette" then close window "Colour Palette"
end cleanUp
on readPrefs
global gChatRevShortName,gMainStackRect,gLogViewerApp
put "http://www.revolutionboard.de/bvg/ip.txt" into myDfltURL
put empty into myPrefs
set the cursor to watch
put stackToFilename("User Data") into myUserDataFolder
if there is not a folder myUserDataFolder then create folder myUserDataFolder
if there is not a folder (myUserDataFolder & "/Smileys") then
put "(Local" into line 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName
else
put "Local" into line 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
put stackToFilename("User Data/User Data") into myPrefsFilePath
put "file:" before myPrefsFilePath
put url myPrefsFilePath into myPrefs
if myPrefs is not empty then
if line 1 of myPrefs is not (the short name of this stack) then
beep
answer warning "Sorry, the user data are incompatible with this version" & return & " of ChatRev." &&
"Please enter your user data again." with "Okay"
end if
end if
delete line 1 of myPrefs
set the cServers of btn "Smile Server" of cd 4 of stack gChatRevShortName to allSmileServers()
set the itemDelimiter to numToChar(11)
put item 1 of myPrefs into btn "IP List" of cd 1 of stack gChatRevShortName
set the label of btn "IP List" of cd 1 of stack gChatRevShortName to item 2 of myPrefs
put item 3 of myPrefs into fld "Name" of cd 1 of stack gChatRevShortName
put item 4 of myPrefs into fld "Pass" of cd 1 of stack gChatRevShortName
if item 5 of myPrefs is not empty then
put item 5 of myPrefs into fld "Port" of cd 1 of stack gChatRevShortName
else
put "80" into fld "Port" of cd 1 of stack gChatRevShortName
end if
put item 6 of myPrefs into fld "Nickname" of cd 3 of stack gChatRevShortName
put item 7 of myPrefs into fld "Password" of cd 3 of stack gChatRevShortName
put item 8 of myPrefs into fld "E-Mail" of cd 3 of stack gChatRevShortName
put item 9 of myPrefs into fld "MouseOver" of cd 3 of stack gChatRevShortName
put item 10 of myPrefs into fld "About" of cd 3 of stack gChatRevShortName
put item 11 of myPrefs into fld "Message Sound" of cd 4 of stack gChatRevShortName
if there is a file (item 11 of myPrefs) then
set the filename of player "message sound" of card "chat" to (item 11 of myPrefs)
set the filename of player "message sound" of cd "Settings" to (item 11 of myPrefs)
else
set the filename of player "message sound" of card "chat" to empty
set the filename of player "message sound" of cd "Settings" to empty
end if
if item 12 of myPrefs is not empty then
put item 12 of myPrefs into fld "Login Sound" of cd 4 of stack gChatRevShortName
if there is a file (item 12 of myPrefs) then
set the filename of player "login sound" of card "chat" to (item 12 of myPrefs)
set the filename of player "login sound" to (item 12 of myPrefs)
else
set the filename of player "login sound" of card "chat" to empty
set the filename of player "login sound" of cd "Settings" to empty
end if
else
put "beep" into fld "Login Sound" of cd 4 of stack gChatRevShortName
end if
put item 13 of myPrefs into fld "Path" of cd 4 of stack gChatRevShortName
if item 14 of myPrefs is not empty then
put item 14 of myPrefs into fld "Autoreply Message" of cd 4 of stack gChatRevShortName
else
put "I am currently away from my computer." into fld "Autoreply Message" of cd 4 of stack gChatRevShortName
end if
if item 15 of myPrefs is not empty then
put item 15 of myPrefs into fld "Idle Time" of cd 4 of stack gChatRevShortName
else
put 20 into fld "Idle Time" of cd 4 of stack gChatRevShortName
end if
--put item 16 of myPrefs into fld "Login Sound" of cd 4 of stack gChatRevShortName
if item 17 of myPrefs is not empty then set the hilite of btn "Receive HTML" of cd 4 of stack gChatRevShortName to item 17 of myPrefs
if item 18 of myPrefs is not empty then
set the hilite of btn "Replace Smileys" of cd 4 of stack gChatRevShortName to item 18 of myPrefs
set the enabled of btn "Smile Server" of cd 4 of stack gChatRevShortName to item 18 of myPrefs
end if
if item 19 of myPrefs is not empty then set the hilite of btn "Press enter for multiple lines" of cd 4 of stack gChatRevShortName to item 19 of myPrefs
if item 20 of myPrefs is not empty then
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to item 20 of myPrefs
else
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to line 1 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
if item 21 of myPrefs is not empty then
put item 21 of myPrefs into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" of cd 1 of stack gChatRevShortName to item 22 of myPrefs
else
put myDfltURL into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" to myDfltURL
end if
put item 23 of myPrefs into gMainStackRect
put the itemDelimiter into myOldDel
set the itemDelimiter to comma
add 20 to last item of gMainStackRect
set the itemDelimiter to myOldDel
put item 24 of myPrefs into fld "IP" of cd 1 of stack gChatRevShortName
if item 25 of myPrefs is not empty then
set the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName to item 25 of myPrefs
else
set the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName to 255,0,0
end if
if item 26 of myPrefs is not empty then
set the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName to item 26 of myPrefs
else
set the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName to "30,58,238"
end if
if item 27 of myPrefs is a number then
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to item 27 of myPrefs
else
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to 75
end if
if item 28 of myPrefs is not empty then
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to item 28 of myPrefs
else
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to false
end if
if (char 1 of menuItem 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName is "(") and
(the label of btn "Smile Server" of cd 4 of stack gChatRevShortName is "Local") then
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to line 1 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
put (line (lineoffset(the label of btn "Smile Server" of cd 4,btn "Smile Server" of cd 4)) of the cServers of cd btn "Smile Server" of cd 4) into mySmileServer
if char 1 to 8 of mySmileServer is "binfile:" then delete char 1 to 8 of mySmileServer
set the fileName of image "Default Smile" of cd 2 to mySmileServer & "smile.gif"
get the result
set the icon of btn "Insert Smile" of cd 2 to the short id of image "Default Smile" of cd 2
set the fileName of image "Smiley" of cd 4 to mySmileServer & "smile.gif"
put item 29 of myPrefs into gLogViewerApp
if item 30 of myPrefs is not empty then
set the thumbposition of scrollbar "sound level" of cd 4 to item 30 of myPrefs
else
set the thumbposition of scrollbar "sound level" of cd 4 to 50
end if
if item 31 of myPrefs is in "true,false" then
set the hilite of btn "Enable Speech" of cd 4 to item 31 of myPrefs
else
set the hilite of btn "Enable Speech" of cd 4 to false
end if
if item 32 of myPrefs is a point then
put the loc of window "Colour Palette" into item 32 of myPrefs
end if
set the textSize of fld "Chat" of cd "Chat" of stack gChatRevShortName to item 33 of myPrefs
set the textFont of fld "Chat" of cd "Chat" of stack gChatRevShortName to item 34 of myPrefs
if item 35 of myPrefs is a point then
set the cCustomLoc of stack "Colour Palette" to item 35 of myPrefs
else
set the cCustomLoc of stack "Colour Palette" to empty
end if
if item 36 of myPrefs is a point then
set the cCustomLoc of stack "Smileys" to item 36 of myPrefs
else
set the cCustomLoc of stack "Smileys" to empty
end if
end readPrefs
function smileURL theSmiley
put smileyServer() into mySmileServer
implementedSmileys smiley
put mySmileysList() into mySmileys
repeat with x = 1 to number of lines of mySmileys
if smiley[x] is theSmiley then
return mySmileServer & line x of mySmileys
end if
end repeat
end smileURL
function stackToFilename theFile
set the itemDelimiter to "/"
if the platform is "MacOS" then
put macSysVersion() into myMacSysVersion
else
put 0 into myMacSysVersion
end if
if myMacSysVersion < 10 then
-- Mac Classic, Linux, Windows
put item 1 to -2 of value(word 2 of the long name of stack (the mainStack of this stack)) into myPath
-- put item 1 to -2 of value(word 2 of long name of stack (the mainStack of this stack)) into myPath
else if myMacSysVersion >= 10 then
-- Mac OS X
put item 1 to -5 of value(word 2 of the long name of stack (the mainStack of this stack)) into myPath
--put item 1 to -5 of value(word 2 of long name of stack (the mainStack of this stack)) into myPath
end if
if char 1 of theFile is not "/" then put "/" after myPath
return myPath & theFile
end stackToFilename
function macSysVersion
put the itemDelimiter into myOldDel
set the itemdelimiter to "."
put item 1 of the systemVersion into myOSVersion
set itemDelimiter to myOldDel
return myOSVersion
end macSysVersion
on commandKeyDown k
switch k
case "S"
if the environment is "development" then
save this stack
readPrefs
end if
break
case (k is in "'?/")
send ("commandKeyDown" && quote & "/" & quote) to this cd
break
default
pass commandKeyDown
beak
end switch
end commandKeyDown
function allSmileServers
return "http://home.wanadoo.nl/mark.sch/smile/" & return &
"http://www.ihug.org/ehug/smile/" & return &
"http://www.ihug.org/ehug/smile2/" & return &
"http://homepage.mac.com/bvg/smilies/" & return &
"binfile:" & stackToFilename("User Data/Smileys/")
end allSmileServers
function removeFinalEmptyLines theHtmlData
repeat until (char -7 to -1 of last word of theHtmlData) is not "
on closeStackRequest
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) or ¬
(the target is "card" && quote & "register" & quote) or (the target is "card" && quote & "settings" & quote) then
answer warning "Are you sure you want to close this stack (and disconnect)?" with "Okay" or "Cancel"
if it is "Okay" then
send "disconnect" to btn "Connect" of cd 1
if the environment is "development" then
save this stack
pass closestackrequest
end if
cleanUp
quit
end if
else
pass closestackrequest
end if
end closeStackRequest
on preOpenStack
global gChatRevShortName, gMainStackRect
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) or ¬
(the target is "card" && quote & "register" & quote) or (the target is "card" && quote & "settings" & quote) then
put the short name of this stack into gChatRevShortName
send "restoreStyleMenu" to btn "Style Storage" of cd "Chat" of stack gChatRevShortName
readPrefs
get the result
if gMainStackRect is a rect then
set the rect of stack gChatRevShortName to gMainStackRect
else
set the rect of this stack to 1,1,640,480
set the loc of me to the screenLoc
end if
set the label of btn "Status" of cd 2 of stack gChatRevShortName to "Disconnect"
lock messages
set the menuHistory of btn "Go" to 1
set the label of btn "Connect" to "Connect"
setFieldBackColor
if the platform is not "MacOS" then
hide btn "iTunes" of cd "Settings" of stack gChatRevShortName
end if
unlock messages
end if
pass preOpenStack
end preOpenStack
-- handler added by Mark S
on openStack
global gChatRevShortName
if (the target is "card" && quote & "chat" & quote) or (the target is "card" && quote & "login" & quote) then
choose browse tool
checkLastMessageSentTime
send "setMenus" to btn "Style Storage" cd "Chat" of stack gChatRevShortName
if the platform is "MacOS" then
show btn "iTunes" of cd "Settings" of stack gChatRevShortName
else
hide btn "iTunes" of cd "Settings" of stack gChatRevShortName
end if
end if
pass openStack
end openStack
-- handler added by Mark S
on checkLastMessageSentTime
global gChatRevShortName
if the cLastMessageSentTime of cd 2 is empty then
set the cLastMessageSentTime of cd 2 to the long time
end if
put the cLastMessageSentTime of cd 2 into myIdleTime
put ((fld "Idle Time" of cd 4 of stack gChatRevShortName)*60) into myTimeLimit
convert myIdleTime to seconds
if the label of btn "Status" of cd 2 of stack gChatRevShortName is not "Disconnect" then
if (the seconds - myidleTime) > myTimeLimit then
set the label of btn "Status" of cd 2 of stack gChatRevShortName to "Away"
end if
end if
put ((fld "Idle Time" of cd 4 of stack gChatRevShortName) * 60) - 1 into myIdleTimeSecs
send "checkLastMessageSentTime" to me in myIdleTimeSecs seconds
end checkLastMessageSentTime
on preOpenCard
lock screen
revUpdateGeometry
pass preOpenCard
end preOpenCard
-- handler by Mark S
-- replace smileys
function replaceSmileys theMsg
put smileyServer() into mySmileServer
put false into mySmileyFound
if the hilite of btn "Replace smileys" of cd 4 is true then
implementedSmileys smiley
put mySmileysList() into mySmileys
repeat with x = 1 to (number of lines of mySmileys)
put smiley[x] into tempVar --for debugging
if smiley[x] is in theMsg then
put true into mySmileyFound
put the length of smiley[x] into mySmileyLength
repeat until smiley[x] is not in theMsg
put offset(smiley[x],theMsg) into c
delete char (c+1) to (c+mySmileyLength-1) of theMsg
put ("<img src=" & quote & mySmileServer & line x of mySmileys & quote & ">") into char c of theMsg
end repeat
end if
end repeat
if mySmileyFound then put "<br> " after theMsg
end if
return (theMsg & numToChar(11) & mySmileyFound)
end replaceSmileys
function smileyServer
global gChatRevShortName
put line lineoffset(the label of btn "Smile Server" of cd 4 of stack gChatRevShortName,btn "Smile Server" of cd 4 of stack gChatRevShortName) of the cServers of btn "Smile Server" of cd 4 of stack gChatRevShortName into mySmileServer
if last char of mySmileServer is not "/" then put "/" after mySmileServer
return mySmileServer
end smileyServer
function mySmileysList
put "smile.gif" & return & ¬
"wink.gif" & return & ¬
"sad.gif" & return & ¬
"cry.gif" & return & ¬
"rasp.gif" & return & ¬
"grin.gif" & return & ¬
"shock.gif" & return & ¬
"love.gif" & return & ¬
"rolleyes.gif" & return & ¬
"cool.gif" & return & ¬
"sneaky.gif" & return & ¬
"bored.gif" into mySmileys
return mySmileys
end mySmileysList
on implementedSmileys @smiley
put ":-)" into smiley[1]
put ";-)" into smiley[2]
put ":-(" into smiley[3]
put ":'-(" into smiley[4]
put ":-p" into smiley[5]
put ":-D" into smiley[6]
put "=:-o" into smiley[7]
put ":-*" into smiley[8]
put ":-/" into smiley[9]
put "8-)" into smiley[10]
put ":^)" into smiley[11]
put ":-|" into smiley[12]
end implementedSmileys
on saveStackRequest
global gChatRevShortName
cleanUp
pass saveStackRequest
end saveStackRequest
on cleanUp
global gChatRevShortName,gLogViewerApp
set the cursor to watch
set the itemDelimiter to numToChar(11)
put btn "IP List" of cd 1 of stack gChatRevShortName into item 1 of myPrefs
put the label of btn "IP List" of cd 1 of stack gChatRevShortName into item 2 of myPrefs
put fld "Name" of cd 1 of stack gChatRevShortName into item 3 of myPrefs
put fld "Pass" of cd 1 of stack gChatRevShortName into item 4 of myPrefs
put fld "Port" of cd 1 of stack gChatRevShortName into item 5 of myPrefs
put fld "Nickname" of cd 3 of stack gChatRevShortName into item 6 of myPrefs
put fld "Password" of cd 3 of stack gChatRevShortName into item 7 of myPrefs
put fld "E-Mail" of cd 3 of stack gChatRevShortName into item 8 of myPrefs
put fld "MouseOver" of cd 3 of stack gChatRevShortName into item 9 of myPrefs
put fld "About" of cd 3 of stack gChatRevShortName into item 10 of myPrefs
put fld "Message Sound" of cd 4 of stack gChatRevShortName into item 11 of myPrefs
put fld "Login Sound" of cd 4 of stack gChatRevShortName into item 12 of myPrefs
put fld "Path" of cd 4 of stack gChatRevShortName into item 13 of myPrefs
put fld "Autoreply Message" of cd 4 of stack gChatRevShortName into item 14 of myPrefs
put fld "Idle Time" of cd 4 of stack gChatRevShortName into item 15 of myPrefs
-- put fld "Login Sound" of cd 4 of stack gChatRevShortName into item 16 of myPrefs
put the hilite of btn "Receive HTML" of cd 4 of stack gChatRevShortName into item 17 of myPrefs
put the hilite of btn "Replace Smileys" of cd 4 of stack gChatRevShortName into item 18 of myPrefs
put the hilite of btn "Press enter for multiple lines" of cd 4 of stack gChatRevShortName into item 19 of myPrefs
put the label of btn "Smile Server" of cd 4 of stack gChatRevShortName into item 20 of myPrefs
put btn "IP URL" of cd 1 of stack gChatRevShortName into item 21 of myPrefs
put the label of btn "IP URL" of cd 1 of stack gChatRevShortName into item 22 of myPrefs
put the rect of this stack into item 23 of myPrefs
put fld "IP" of cd 1 of stack gChatRevShortName into item 24 of myPrefs
put the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName into item 25 of myPrefs
put the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName into item 26 of myPrefs
put the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName into item 27 of myPrefs
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to 75
put the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName into item 28 of myPrefs
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to false
put gLogViewerApp into item 29 of myPrefs
put the thumbposition of scrollbar "sound level" of cd 4 into item 30 of myPrefs
put the hilite of btn "Enable Speech" of cd 4 into item 31 of myPrefs
put the loc of window "Colour Palette" into item 32 of myPrefs
put the textSize of fld "Chat" of cd "Chat" of stack gChatRevShortName into item 33 of myPrefs
put the textFont of fld "Chat" of cd "Chat" of stack gChatRevShortName into item 34 of myPrefs
if there is a window "Colour Palette" then
put the bottomLeft of window "Colour Palette" into item 35 of myPrefs
else
put the cCustomLoc of stack "Colour Palette" into item 35 of myPrefs
end if
if there is a window "Smileys" then
put the bottomLeft of window "Smileys" into item 36 of myPrefs
else
put the cCustomLoc of stack "Smileys" into item 36 of myPrefs
end if
put the short name of this stack & return & myPrefs into myPrefs
put myPrefs into url ("file:" & stackToFilename("User Data/User Data"))
put empty into btn "IP List" of cd 1 of stack gChatRevShortName
set the fileName of image "Default Smile" of cd 2 of stack gChatRevShortName to empty
set the icon of btn "Insert Smile" of cd 2 of stack gChatRevShortName to empty
put empty into fld "Enter" of cd 2 of stack gChatRevShortName
put empty into fld "Chat" of cd 2 of stack gChatRevShortName
put empty into fld "Members" of cd 2 of stack gChatRevShortName
put empty into fld "Log" of cd 1 of stack gChatRevShortName
put empty into fld "Name" of cd 1 of stack gChatRevShortName
put empty into fld "Pass" of cd 1 of stack gChatRevShortName
put empty into fld "IP" of cd 1 of stack gChatRevShortName
put empty into fld "Port" of cd 1 of stack gChatRevShortName
put empty into fld "Nickname" of cd 3 of stack gChatRevShortName
put empty into fld "Password" of cd 3 of stack gChatRevShortName
put empty into fld "E-Mail" of cd 3 of stack gChatRevShortName
put empty into fld "MouseOver" of cd 3 of stack gChatRevShortName
put empty into fld "About" of cd 3 of stack gChatRevShortName
put empty into fld "Message Sound" of cd 4 of stack gChatRevShortName
put empty into fld "Login Sound" of cd 4 of stack gChatRevShortName
put empty into fld "Path" of cd 4 of stack gChatRevShortName
put empty into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" of cd 1 of stack gChatRevShortName to empty
repeat for each char x in "pbiu"
set the hilite of btn x of cd 2 of stack gChatRevShortName to false
end repeat
set the cTextStyle of fld "Enter" of cd 2 of stack gChatRevShortName to empty
set the itemDel to comma
put "Threads,Text,Edit,Thread,Create" into myForumFields
repeat for each item x in myForumFields
put empty into fld x of cd "Forum"
end repeat
set the backgroundColor of graphic "Selected Colour" of cd 1 of stack "Colour Palette" to 0,0,0
set the backgroundColor of graphic "Old Colour" of cd 1 of stack "Colour Palette" to 0,0,0
set the fileName of image "Smiley" of cd 4 to empty
if there is a window "Smileys" then close window "Smileys"
if there is a window "Colour Palette" then close window "Colour Palette"
end cleanUp
on readPrefs
global gChatRevShortName,gMainStackRect,gLogViewerApp
put "http://www.revolutionboard.de/bvg/ip.txt" into myDfltURL
put empty into myPrefs
set the cursor to watch
put stackToFilename("User Data") into myUserDataFolder
if there is not a folder myUserDataFolder then create folder myUserDataFolder
if there is not a folder (myUserDataFolder & "/Smileys") then
put "(Local" into line 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName
else
put "Local" into line 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
put stackToFilename("User Data/User Data") into myPrefsFilePath
put "file:" before myPrefsFilePath
put url myPrefsFilePath into myPrefs
if myPrefs is not empty then
if line 1 of myPrefs is not (the short name of this stack) then
beep
answer warning "Sorry, the user data are incompatible with this version" & return & " of ChatRev." && ¬
"Please enter your user data again." with "Okay"
end if
end if
delete line 1 of myPrefs
set the cServers of btn "Smile Server" of cd 4 of stack gChatRevShortName to allSmileServers()
set the itemDelimiter to numToChar(11)
put item 1 of myPrefs into btn "IP List" of cd 1 of stack gChatRevShortName
set the label of btn "IP List" of cd 1 of stack gChatRevShortName to item 2 of myPrefs
put item 3 of myPrefs into fld "Name" of cd 1 of stack gChatRevShortName
put item 4 of myPrefs into fld "Pass" of cd 1 of stack gChatRevShortName
if item 5 of myPrefs is not empty then
put item 5 of myPrefs into fld "Port" of cd 1 of stack gChatRevShortName
else
put "80" into fld "Port" of cd 1 of stack gChatRevShortName
end if
put item 6 of myPrefs into fld "Nickname" of cd 3 of stack gChatRevShortName
put item 7 of myPrefs into fld "Password" of cd 3 of stack gChatRevShortName
put item 8 of myPrefs into fld "E-Mail" of cd 3 of stack gChatRevShortName
put item 9 of myPrefs into fld "MouseOver" of cd 3 of stack gChatRevShortName
put item 10 of myPrefs into fld "About" of cd 3 of stack gChatRevShortName
put item 11 of myPrefs into fld "Message Sound" of cd 4 of stack gChatRevShortName
if there is a file (item 11 of myPrefs) then
set the filename of player "message sound" of card "chat" to (item 11 of myPrefs)
set the filename of player "message sound" of cd "Settings" to (item 11 of myPrefs)
else
set the filename of player "message sound" of card "chat" to empty
set the filename of player "message sound" of cd "Settings" to empty
end if
if item 12 of myPrefs is not empty then
put item 12 of myPrefs into fld "Login Sound" of cd 4 of stack gChatRevShortName
if there is a file (item 12 of myPrefs) then
set the filename of player "login sound" of card "chat" to (item 12 of myPrefs)
set the filename of player "login sound" to (item 12 of myPrefs)
else
set the filename of player "login sound" of card "chat" to empty
set the filename of player "login sound" of cd "Settings" to empty
end if
else
put "beep" into fld "Login Sound" of cd 4 of stack gChatRevShortName
end if
put item 13 of myPrefs into fld "Path" of cd 4 of stack gChatRevShortName
if item 14 of myPrefs is not empty then
put item 14 of myPrefs into fld "Autoreply Message" of cd 4 of stack gChatRevShortName
else
put "I am currently away from my computer." into fld "Autoreply Message" of cd 4 of stack gChatRevShortName
end if
if item 15 of myPrefs is not empty then
put item 15 of myPrefs into fld "Idle Time" of cd 4 of stack gChatRevShortName
else
put 20 into fld "Idle Time" of cd 4 of stack gChatRevShortName
end if
--put item 16 of myPrefs into fld "Login Sound" of cd 4 of stack gChatRevShortName
if item 17 of myPrefs is not empty then set the hilite of btn "Receive HTML" of cd 4 of stack gChatRevShortName to item 17 of myPrefs
if item 18 of myPrefs is not empty then
set the hilite of btn "Replace Smileys" of cd 4 of stack gChatRevShortName to item 18 of myPrefs
set the enabled of btn "Smile Server" of cd 4 of stack gChatRevShortName to item 18 of myPrefs
end if
if item 19 of myPrefs is not empty then set the hilite of btn "Press enter for multiple lines" of cd 4 of stack gChatRevShortName to item 19 of myPrefs
if item 20 of myPrefs is not empty then
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to item 20 of myPrefs
else
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to line 1 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
if item 21 of myPrefs is not empty then
put item 21 of myPrefs into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" of cd 1 of stack gChatRevShortName to item 22 of myPrefs
else
put myDfltURL into btn "IP URL" of cd 1 of stack gChatRevShortName
set the label of btn "IP URL" to myDfltURL
end if
put item 23 of myPrefs into gMainStackRect
put the itemDelimiter into myOldDel
set the itemDelimiter to comma
add 20 to last item of gMainStackRect
set the itemDelimiter to myOldDel
put item 24 of myPrefs into fld "IP" of cd 1 of stack gChatRevShortName
if item 25 of myPrefs is not empty then
set the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName to item 25 of myPrefs
else
set the backgroundcolor of grc "message" of cd 4 of stack gChatRevShortName to 255,0,0
end if
if item 26 of myPrefs is not empty then
set the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName to item 26 of myPrefs
else
set the backgroundcolor of grc "privmessage" of cd 4 of stack gChatRevShortName to "30,58,238"
end if
if item 27 of myPrefs is a number then
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to item 27 of myPrefs
else
set the thumbPosition of scrollbar "Sound Level" of cd 4 of stack gChatRevShortName to 75
end if
if item 28 of myPrefs is not empty then
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to item 28 of myPrefs
else
set the hilite of btn "Save to file" of cd 4 of stack gChatRevShortName to false
end if
if (char 1 of menuItem 5 of btn "Smile Server" of cd 4 of stack gChatRevShortName is "(") and ¬
(the label of btn "Smile Server" of cd 4 of stack gChatRevShortName is "Local") then
set the label of btn "Smile Server" of cd 4 of stack gChatRevShortName to line 1 of btn "Smile Server" of cd 4 of stack gChatRevShortName
end if
put (line (lineoffset(the label of btn "Smile Server" of cd 4,btn "Smile Server" of cd 4)) of the cServers of cd btn "Smile Server" of cd 4) into mySmileServer
if char 1 to 8 of mySmileServer is "binfile:" then delete char 1 to 8 of mySmileServer
set the fileName of image "Default Smile" of cd 2 to mySmileServer & "smile.gif"
get the result
set the icon of btn "Insert Smile" of cd 2 to the short id of image "Default Smile" of cd 2
set the fileName of image "Smiley" of cd 4 to mySmileServer & "smile.gif"
put item 29 of myPrefs into gLogViewerApp
if item 30 of myPrefs is not empty then
set the thumbposition of scrollbar "sound level" of cd 4 to item 30 of myPrefs
else
set the thumbposition of scrollbar "sound level" of cd 4 to 50
end if
if item 31 of myPrefs is in "true,false" then
set the hilite of btn "Enable Speech" of cd 4 to item 31 of myPrefs
else
set the hilite of btn "Enable Speech" of cd 4 to false
end if
if item 32 of myPrefs is a point then
put the loc of window "Colour Palette" into item 32 of myPrefs
end if
set the textSize of fld "Chat" of cd "Chat" of stack gChatRevShortName to item 33 of myPrefs
set the textFont of fld "Chat" of cd "Chat" of stack gChatRevShortName to item 34 of myPrefs
if item 35 of myPrefs is a point then
set the cCustomLoc of stack "Colour Palette" to item 35 of myPrefs
else
set the cCustomLoc of stack "Colour Palette" to empty
end if
if item 36 of myPrefs is a point then
set the cCustomLoc of stack "Smileys" to item 36 of myPrefs
else
set the cCustomLoc of stack "Smileys" to empty
end if
end readPrefs
function smileURL theSmiley
put smileyServer() into mySmileServer
implementedSmileys smiley
put mySmileysList() into mySmileys
repeat with x = 1 to number of lines of mySmileys
if smiley[x] is theSmiley then
return mySmileServer & line x of mySmileys
end if
end repeat
end smileURL
function stackToFilename theFile
set the itemDelimiter to "/"
if the platform is "MacOS" then
put macSysVersion() into myMacSysVersion
else
put 0 into myMacSysVersion
end if
if myMacSysVersion < 10 then
-- Mac Classic, Linux, Windows
put item 1 to -2 of value(word 2 of the long name of stack (the mainStack of this stack)) into myPath
-- put item 1 to -2 of value(word 2 of long name of stack (the mainStack of this stack)) into myPath
else if myMacSysVersion >= 10 then
-- Mac OS X
put item 1 to -5 of value(word 2 of the long name of stack (the mainStack of this stack)) into myPath
--put item 1 to -5 of value(word 2 of long name of stack (the mainStack of this stack)) into myPath
end if
if char 1 of theFile is not "/" then put "/" after myPath
return myPath & theFile
end stackToFilename
function macSysVersion
put the itemDelimiter into myOldDel
set the itemdelimiter to "."
put item 1 of the systemVersion into myOSVersion
set itemDelimiter to myOldDel
return myOSVersion
end macSysVersion
on commandKeyDown k
switch k
case "S"
if the environment is "development" then
save this stack
readPrefs
end if
break
case (k is in "'?/")
send ("commandKeyDown" && quote & "/" & quote) to this cd
break
default
pass commandKeyDown
beak
end switch
end commandKeyDown
function allSmileServers
return "http://home.wanadoo.nl/mark.sch/smile/" & return & ¬
"http://www.ihug.org/ehug/smile/" & return & ¬
"http://www.ihug.org/ehug/smile2/" & return & ¬
"http://homepage.mac.com/bvg/smilies/" & return & ¬
"binfile:" & stackToFilename("User Data/Smileys/")
end allSmileServers
function removeFinalEmptyLines theHtmlData
repeat until (char -7 to -1 of last word of theHtmlData) is not "<p></p>"
delete char -7 to -1 of last word of theHtmlData
if last char of theMessage is space then delete last char of theHtmlData
end repeat
return theHtmlData
end removeFinalEmptyLines
on setFieldBackColor
global gChatRevShortName
put "237,243,254" into myBackColor
if the platForm is "MacOS" then
if macSysversion() < 10 then put "232,232,232" into myBackColor
end if
set the backgroundColor of fld "Members" of cd 2 of stack gChatRevShortName to myBackColor
end setFieldBackColor
-- this function uses above AppleScript to
-- retrieve the song information
function iTunesTrack
-- the stackToFilename function puts the path to the script
-- into the variable myScriptFile. This lines needs
-- adjustment if you implement this in your own stack
put stackToFilename("User Data/iTunes track.scpt") into myScriptFile
if there is a file myScriptFile then
if the platForm is "MacOS" then
if macSysVersion() <= 9 then
put ("run script" && quote & revMacFromUnixPath(myScriptFile) & quote) into myScript
wait 1
else
put ("run script" && quote & myScriptFile & quote) into myScript
end if
do myScript as AppleScript
return the result
end if
end if
return empty
end iTunesTrack
-- gets info from above function and
-- updates tooltip
on setTooltip2iTunes
global gChatRevShortName
set the itemDelimiter to tab
if the hilite of btn "iTunes" of cd 4 of stack gChatRevShortName is true then
put fld "Members" of cd 2 of stack gChatRevShortName into myMemberList
put field "Name" of cd 1 of stack gChatRevShortName into myUserName
put 1 into myNumber
repeat until ((item 1 of line myNumber of myMemberList is myUserName) or (item 1 of line myNumber of myMemberList is empty))
put lineOffset(myUserName,myMemberList) into myNumber
end repeat
if (myNumber > 0) and (myNumber <= number of lines of myMemberList) then
put iTunesTrack() into myTrack
if myTrack is not "execution error" then
put char 2 to -2 of myTrack into myTrack
else
put empty into myTrack
end if
if item 2 of line myNumber of myMemberList is not myTrack then
write "setMouse" & return & myTrack & return to socket field "IP" of card 1
end if
end if
send setTooltip2iTunes to me in 5 seconds
end if
end setTooltip2iTunes
on savetofile theLines
if field "message sound" of card "settings" = "beep" then
beep
else if field "message sound" of card "settings" = "" then
--do nothing here
else
set the currentTime of player "message sound" of card "chat" to 1
start player "message sound" of card "chat"
end if
lock screen
--set the textstyle of line -1 of field "chat" of card "chat" to empty
if line -1 of field "chat" of card "chat" contains "http://" then
put word wordoffset("http://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" into theURL
set the linktext of word wordoffset("http://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to theURL
set the textstyle of word wordoffset("http://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to "Link"
else if line -1 of field "chat" of card "chat" contains " www." then
put "http://" & word wordoffset("www.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" into theURL
set the linktext of word wordoffset("www.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to theURL
set the textstyle of word wordoffset("www.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to "Link"
else if line -1 of field "chat" of card "chat" contains " ftp." then
put "ftp://" & word wordoffset("ftp.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" into theURL
set the linktext of word wordoffset("ftp.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to theURL
set the textstyle of word wordoffset("ftp.",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to "Link"
else if line -theLines to -1 of field "chat" of card "chat" contains "ftp://" then
put word wordoffset("ftp://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" into theURL
set the linktext of word wordoffset("ftp://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to theURL
set the textstyle of word wordoffset("ftp://",line -1 of field "chat" of card "chat") of line -1 of field "chat" of card "chat" to "Link"
else if line -theLines to -1 of field "chat" of card "chat" contains "@" then
put offset("@",line -theLines to -1 of field "chat" of card "chat") into c
if charToNum(char (c-1) of line -theLines to -1 of field "chat" of card "chat") > 32 and charToNum(char (c-1) of line -theLines to -1 of field "chat" of card "chat") < 122 and charToNum(char (c+1) of line -theLines to -1 of field "chat" of card "chat") > 32 and charToNum(char (c+1) of line -theLines to -1 of field "chat" of card "chat") < 123 then
put word wordoffset("@",line -theLines to -1 of field "chat" of card "chat") of line -theLines to -1 of field "chat" of card "chat" into theURL
set the linktext of word wordoffset("@",line -theLines to -1 of field "chat" of card "chat") of line -theLines to -1 of field "chat" of card "chat" to theURL
set the textstyle of word wordoffset("@",line -theLines to -1 of field "chat" of card "chat") of line -theLines to -1 of field "chat" of card "chat" to "Link"
end if
else if line -1 of field "chat" of cd "Chat" contains "bug " then
put wordoffset("bug",line -1 of field "Chat" of card "Chat") into w
if word (w+1) of line -1 of field "Chat" of card "Chat" is a number then
put word w to (w+1) of line -1 of field "Chat" of card "Chat" into theURL
set the linktext of word w to (w+1) of line -1 of field "chat" of card "chat" to theURL
set the textstyle of word w to (w+1) of line -1 of field "chat" of card "chat" to "Link"
end if
end if
if the textstyle of char -1 of field "chat" of card "chat" contains "link" then
put " " after line -1 of field "chat" of card "chat"
set the textstyle of char -1 field "chat" of card "chat" to "plain"
end if
if the hilite of button "save to file" of card "settings" = true then
if field "path" of card "settings" <> "" then
put field "path" of card "settings" into thepath
open file thePath for append
write return & line -thelines of field "chat" of card "chat" to file thePath
close file thePath
--put return & line -thelines of field "chat" of card "chat" after url ("file:" & the path of button "save to file" of card "chat")
end if
end if
end savetofile
on handleThisLink theUrl
if the optionKey is down then
saveURL theURL
else if char -4 to -1 of theurl = ".rev" or char -3 to -1 of theUrl = ".mc" then
if the environment is "development" then
put "Revolution" into myApp
else
put "ChatRev" into myApp
end if
answer question "Do you want to open this stack in" && myApp && "or save it to disk?" with "Open" or "Save" or "Cancel"
if it is "Open" then
if char 1 to 4 of theURL is "ftp." then put "ftp://" before theURL
go stack url theurl
else if it is "Save" then
saveURL theURL
end if
else if ("@" is not in theUrl) and (word 1 of theURL is not "bug") then
if (char -4 to -1 of theURL is not ".htm") and (char -5 to -1 of theURL is not ".html") ¬
and ("." is in char -5 to -1 of theURL) and (last char of theURL is not "/") then
answer "Open this file in your browser or save to disk?" with "Open" or "Save"
if it is "Save" then
saveURL theURL
else
if char 1 to 4 of theUrl is "ftp." then put "ftp://" before theUrl
revgoURL theUrl
end if
else
if char 1 to 4 of theURL is "ftp." then put "ftp://" before theURL
revgoURL theURL
end if
else if (theURL contains "@") and ("http://" is not in theURL) and ("ftp://" is not in theURL) and (word 1 of theURL is not "bug") then
put offset("@",theURL) into c
if charToNum(char (c-1) of theURL) > 32 and charToNum(char (c-1) of theURL) < 122 and charToNum(char (c+1) of theURL) > 32 and charToNum(char (c+1) of theURL) < 123 then
if char 1 to 7 of theURL is not "mailto:" then
revGoURL "mailto:" & theURL
else
revGoURL theURL
end if
end if
else if (word 1 of theURL is "bug") and (word 2 of theURL is a number) then
revGoURL ("http://support.runrev.com/bugdatabase/show_bug.cgi?id=" & word 2 of theURL)
else
-- this last option is probably no longer necessary
if char 1 to 4 of theURL is "ftp." then put "ftp://" before theURL
revgoURL theURL
end if
end handleThisLink
on saveURL theURL
if char 1 to 4 of theURL is "ftp." then put "ftp://" before theURL
set the itemDelimiter to "/"
put last item of theURL into myFileName
ask file "Save file as..." with myFileName
if it is not empty then
put it into myNewFile
put the fileType into myOldFileType
set the fileType to "????????"
put url theURL into url ("binfile:" & myNewFile)
set the fileType to myOldFileType
end if
end saveURL
on makeLinks theField
if (" www." is in fld theField) or (" ftp." is in fld theField) or ("http://" is in fld theField) or (" ftp://" is in fld theField) or ("@" is in fld theField) then
repeat with x = 1 to number of words in fld theField
put "www.,ftp.,http://,ftp://,@" into myList
repeat for each item y in myList
if y is in word x of fld theField then
switch y
case "www."
set the linkText of word x of fld theField to ("http://" & word x of fld theField)
set the textStyle of word x of fld theField to "link"
break
case "ftp."
if char 1 to 4 of word x of fld theField is "ftp." then set the linkText of word x of fld theField to ("ftp://" & word x of fld theField)
set the textStyle of word x of fld theField to "link"
break
case "http://"
set the linkText of word x of fld theField to (word x of fld theField)
set the textStyle of word x of fld theField to "link"
break
case "ftp://"
set the linkText of word x of fld theField to (word x of fld theField)
set the textStyle of word x of fld theField to "link"
break
case "@"
put offset("@",word x of fld theField) into c
if not ((char (c-1) of word x of fld theField is in (return & space)) or (char (c+1) of word x of fld theField is in (return & space))) then
if char 1 to 7 of word x of fld theField is not "mailto:" then
set the linkText of word x of fld theField to ("mailto:" & word x of fld theField)
else
set the linkText of word x of fld theField to (word x of fld theField)
end if
set the textStyle of word x of fld theField to "link"
end if
break
end switch
end if
end repeat
end repeat
end if
end makeLinks
function validIP theIP
put false into rslt
set the itemDelimiter to "."
if the number of items of theIP is 4 then
repeat for each item x in theIP
if x is an integer then
put true into rslt
else
put false into rslt
exit repeat
end if
end repeat
end if
return rslt
end validIP
on setAbout
ask "Pease enter a new text about yourself..."
if it is not empty then
lock screen
put "/setAbout" && it into fld "Enter"
send "returnInField" to fld "Enter"
end if
end setAbout
on setEmail
ask "Pease enter your e-mail address..."
if it is not empty then
lock screen
put "/setmail" && it into fld "Enter"
send "returnInField" to fld "Enter"
end if
end setEmail
on setLabel
ask "Pease enter a new label (tooltip text)"
if it is not empty then
lock screen
put "/l" && it into fld "Enter"
send "returnInField" to fld "Enter"
end if
end setLabel
function noPendingTransfers
if ("sendFile" is in the pendingMessages) or ("getFile" is in the pendingMessages) then
return false
end if
return true
end noPendingTransfers
login P on preOpenCard revupdategeometry select text of fld "Name" end preOpenCard on commandKeyDown k if k = "/" then go cd 1 of stack "Help" as modeless else pass commandKeyDown end commandKeyDown # cREVGeneral scriptChecksum ryRQm bookmarks handlerList preOpenCard commandKeyDownscriptSelection char 113 to 112prevHandler preOpenCardtempScript scripton preOpenCard
revupdategeometry
select text of fld "Name"
end preOpenCard
on commandKeyDown k
if k = "/" then go cd 1 of stack "Help" as modeless
else pass commandKeyDown
end commandKeyDown
cREVGeometryCacheIDs )1093556362001 16331093553957003 16261090155872438 10051093783776002 17681093109324984 15801093555358001 16301101213411519 19941093452874282 15871101213200222 19931093776992003 17591101823891403 20971101823588061 20841101823588773 20881090338436578 10081090416199820 10111090155882974 10061101823590518 20961100988480597 19651093553953002 16251101471904019 20301092836262465 15481093777078001 17621101823588402 20861093783792002 17691101823587751 20821090155867286 10041090155855947 10031100294247139 18921093771355003 17511092394114380 15021093771355004 17521093771355005 17531093771355006 17541093107629144 15781101823903687 20981090416205814 10121101823590309 20951101823590067 20941090155894748 10071101823587613 20811101823587457 2080 cREVGeometrycache order 1093107629144 1090338436578 1090416199820 1101213200222 1092394114380 1093452874282 1090155855947 1090155867286 1090155872438 1093553953002 1093553957003 1093555358001 1093556362001 1093777078001 1100294247139 total 41 , 3 d ! " $ & ( . / 0 1 2 chat P on preOpenCard revupdategeometry set the vScroll of field "chat" of card "chat" to the formattedHeight of field "chat" of card "chat" set the icon of btn "Insert Smile" to 1737 select text of fld "Enter" end preOpenCard on setStyle theFlag,theStyle put theStyle into myNewStyle put the selectedChunk into mySelectedChunk put "bold,italic,underline" into myStyleList put the cTextStyle of fld "enter" into myTextStyle put number of chars of fld "Enter" into myOldNrOfChars if theFlag is "remove" then delete item itemoffset(myNewStyle,myTextStyle) of myTextStyle if the optionKey is down then if the short name of the selectedField is "Enter" then put (item itemOffset(theStyle,myStyleList) of ",,") after the selection set the textStyle of char (myOldNrOfChars + 1) to (myOldNrOfChars+4) of fld "Enter" to the cTextStyle of fld "enter" end if end if set the cTextStyle of fld "enter" to myTextStyle else if myNewStyle is not in myTextStyle then if myTextStyle is not empty then put comma after myTextStyle put myNewStyle after myTextStyle set the cTextStyle of fld "enter" to myTextStyle if the optionKey is down then if the short name of the selectedField is "Enter" then put (item itemOffset(theStyle,myStyleList) of ",,") after the selection set the textStyle of char (myOldNrOfChars + 1) to (myOldNrOfChars+3) of fld "Enter" to the cTextStyle of fld "enter" end if end if end if end if if the selection is not empty then set the textStyle of mySelectedChunk to the cTextStyle of fld "Enter" end setStyle on commandKeyDown k if k = "/" then go cd 2 of stack "Help" as modeless else pass commandKeyDown end commandKeyDown on userAction theAction,theMember lock screen switch theAction case "Send Private Message" put "/msg" && theMember & space into field "enter" select after text of fld "Enter" break case "See Profile" put "/about" && theMember & space into field "enter" send "returnInField" to fld "Enter" put empty into fld "Enter" select after text of fld "Enter" break case "Send E-Mail" put "/mail" && theMember & space into field "enter" send "returnInField" to fld "Enter" put empty into fld "Enter" select after text of fld "Enter" break case "Send File" send "sendRequest theMember" to stack "Send File Request" put empty into fld "Enter" break end switch end userAction cLastMessageSentTime 1:09:41 PM cREVGeneral scriptChecksum J80㩙v bookmarks breakPoints handlerList .preOpenCard setStyle commandKeyDown userActionscriptSelection char 184 to 183prevHandler preOpenCardtempScript scripton preOpenCard
revupdategeometry
set the vScroll of field "chat" of card "chat" to the formattedHeight of field "chat" of card "chat"
set the icon of btn "Insert Smile" to 1737
select text of fld "Enter"
end preOpenCard
on setStyle theFlag,theStyle
put theStyle into myNewStyle
put the selectedChunk into mySelectedChunk
put "bold,italic,underline" into myStyleList
put the cTextStyle of fld "enter" into myTextStyle
put number of chars of fld "Enter" into myOldNrOfChars
if theFlag is "remove" then
delete item itemoffset(myNewStyle,myTextStyle) of myTextStyle
if the optionKey is down then
if the short name of the selectedField is "Enter" then
put (item itemOffset(theStyle,myStyleList) of "</b>,</i>,</u>") after the selection
set the textStyle of char (myOldNrOfChars + 1) to (myOldNrOfChars+4) of fld "Enter" to the cTextStyle of fld "enter"
end if
end if
set the cTextStyle of fld "enter" to myTextStyle
else
if myNewStyle is not in myTextStyle then
if myTextStyle is not empty then put comma after myTextStyle
put myNewStyle after myTextStyle
set the cTextStyle of fld "enter" to myTextStyle
if the optionKey is down then
if the short name of the selectedField is "Enter" then
put (item itemOffset(theStyle,myStyleList) of "<b>,<i>,<u>") after the selection
set the textStyle of char (myOldNrOfChars + 1) to (myOldNrOfChars+3) of fld "Enter" to the cTextStyle of fld "enter"
end if
end if
end if
end if
if the selection is not empty then set the textStyle of mySelectedChunk to the cTextStyle of fld "Enter"
end setStyle
on commandKeyDown k
if k = "/" then go cd 2 of stack "Help" as modeless
else pass commandKeyDown
end commandKeyDown
on userAction theAction,theMember
lock screen
switch theAction
case "Send Private Message"
put "/msg" && theMember & space into field "enter"
select after text of fld "Enter"
break
case "See Profile"
put "/about" && theMember & space into field "enter"
send "returnInField" to fld "Enter"
put empty into fld "Enter"
select after text of fld "Enter"
break
case "Send E-Mail"
put "/mail" && theMember & space into field "enter"
send "returnInField" to fld "Enter"
put empty into fld "Enter"
select after text of fld "Enter"
break
case "Send File"
send "sendRequest theMember" to stack "Send File Request"
put empty into fld "Enter"
break
end switch
end userAction
cREVGeometryCacheIDs 1093616321943 16491093701633071 17371090841017477 10201090841017478 10221090841017479 10241093109324984 15801093615625262 16441093616325320 16501101007601334 19701093548210002 16141101527816048 20421093771355003 17511093771355004 17521093771355005 17531093771355006 17541092838076425 15091093107629144 15781092838076426 15111093616302225 16471101309562663 19951100993656228 19671093616319563 16481100916244641 19541101527806306 20411093534411001 16071101476429671 20321092836735950 15491093536877001 16111093702048001 17381100988480597 19651101471904019 2030 cREVGeometrycache total 31order 1093107629144 1090841017477 1090841017478 1090841017479 1093616302225 1093616319563 1093616321943 1093616325320 1093702048001 1101007601334 1092836735950 1093534411001 1093536877001 1100993656228 1101309562663 , N l o p q r register Pon transferLoginInfo put fld "Nickname" into fld "Name" of cd 1 put fld "Password" into fld "Pass" of cd 1 end transferLoginInfo on enterInField set the hilite of btn "OK" to true wait 6 set the hilite of btn "OK" to false send "mouseUp" to btn "OK" end enterInField on returnInField beep end returnInField on commandKeyDown k if k = "/" then go cd 3 of stack "Help" as modeless else pass commandKeyDown end commandKeyDown on preOpenCard select text of fld "Nickname" end preOpenCard cREVGeneral scriptChecksum BD@27PY bookmarks handlerList GtransferLoginInfo enterInField returnInField commandKeyDown preOpenCardtempScript prevHandler transferLoginInfoscriptSelection char 462 to 492scripton transferLoginInfo
put fld "Nickname" into fld "Name" of cd 1
put fld "Password" into fld "Pass" of cd 1
end transferLoginInfo
on enterInField
set the hilite of btn "OK" to true
wait 6
set the hilite of btn "OK" to false
send "mouseUp" to btn "OK"
end enterInField
on returnInField
beep
end returnInField
on commandKeyDown k
if k = "/" then go cd 3 of stack "Help" as modeless
else pass commandKeyDown
end commandKeyDown
on preOpenCard
select text of fld "Nickname"
end preOpenCard
cREVGeometryCacheIDs 1093002084643 15561093002084644 15571093002084645 15581093002084646 15591093002084647 15601093183364779 15821093002084648 15611093183480341 15851093002084649 15621093182675426 15811093002084650 15631093002084651 15641093684808002 17191093771355003 17511093771355004 17521093771355005 17531093771355006 17541093183547681 15861093684888002 17201093183463119 15831093002475596 15661093002475561 15651093183463832 15841100988480597 19651101471904019 20301093002084642 1554 cREVGeometrycache order ~1093002084643 1093002084644 1093002084642 1093183547681 1093182675426 1093002084650 1093002475561 1093002084648 1093002084645 total 26 - 4 settings P on openCard select text of fld "Autoreply Message" pass openCard end openCard on commandKeyDown k if k = "/" then go cd 4 of stack "Help" as modeless else pass commandKeyDown end commandKeyDown cREVGeneral scriptChecksum {5zKD bookmarks handlerList openCard commandKeyDowntempScript prevHandler openCardscriptSelection char 130 to 129scripton openCard
select text of fld "Autoreply Message"
pass openCard
end openCard
on commandKeyDown k
if k = "/" then go cd 4 of stack "Help" as modeless
else pass commandKeyDown
end commandKeyDown
cREVGeometryCacheIDs ,1100305989476 19311093109324984 15801093551504002 16221093551864002 16241093962932002 18341093548812068 16171093534635001 16091093655878002 16781094415369771 18821100988480597 19651101471904019 20301093526660782 14991093641933671 16531093551626002 16231093529734087 15511093529734088 15521093771355003 17511093771355004 17521093526212600 16001093538856049 16131093526212590 15901093526212589 15891093771355005 17531093526212601 16011093526212591 15911093613006001 16421093771355006 17541093526212602 16021093107629144 15781093950334002 18071093526212592 15921093526212593 15931093526212594 15941093526212595 15951093526212596 15961093526212597 15971093526212598 15981093526212599 15991093551462002 16211093555173002 16281093526808404 16061093946759002 18051093555009002 16271093526766189 1605 cREVGeometrycache order 1093107629144 1093538856049 1093526212597 1093526212600 1093526212602 1093526212595 1093526212599 1093526212601 1093526766189 1093534635001 1093613006001 1093641933671 1093655878002 1093962932002 1094415369771 1100305989476 1093548812068 1093526660782total 44 , W X [ \ * Z h Forum P yon commandKeyDown k if k = "/" then go cd 5 of stack "Help" as modeless else pass commandKeyDown end commandKeyDown cREVGeneral scriptChecksum '}.gUl bookmarks handlerList commandKeyDowntempScript prevHandler commandKeyDownscriptSelection char 32 to 31scripton commandKeyDown k
if k = "/" then go cd 5 of stack "Help" as modeless
else pass commandKeyDown
end commandKeyDown
cREVGeometryCacheIDs 1100365112724 19451093109324984 15801100301722419 19161100301892755 19181093771355003 17511092394114380 19411093771355004 17521093771355005 17531100301835800 19171100345063853 19381093771355006 17541093107629144 15781100301657718 18981100301657720 19021100301657719 19001100302355669 19281100301657721 19031100301657725 19071100301657726 19091100301657727 19101100301657728 19111100301657729 19131100301657730 19141100301657731 19151100302354916 19271100988480597 19651100302314563 19241100301929561 19201100302314564 19251101471904019 2030 cREVGeometrycache total 30order 1100365112724 1093107629144 1100301657728 1100301657719 1100301657725 1100301657729 1100301657730 1100301657731 1100301657718 1100301657720 1100301657721 1100301657726 1100301657727 1092394114380 , | } ~ log )` @ cREVGeometry Master,scaleBottomObjectSide BottomMaster,movehDistance falseMaster,scaleRightscaleBottom trueMaster trueMaster,scaleBottomObjectRef cardMaster,scaleBottomAbsolute trueMaster,scaleBottom trueMaster,movevDistance falseMaster,scalebottomDistance -53Master,expectedRect 120,227,420,404Master,scaleRightAbsolute trueMaster,scaleRight trueMaster,scalerightDistance -114Master,scaleRightObjectRef cardMaster,scaleRightObjectSide RightMaster,cardRanking 2Master,scaletopDistance Master,scaleleftDistance cREVGeneral revUniqueID 1090338436578 ` 'A ip HHHH @ cREVGeometry Master,moveVObjectSide bottomMaster,movehDistance -145Master trueMaster,moveVObjectRef cardMaster,moveHObjectRef cardMaster,moveVAbsolute true Master,moveV trueMaster,expectedRect 344,559,577,578Master,scalebottomDistance Master,movevDistance -38Master,moveHObjectSide rightMaster,scalerightDistance Master,cardRanking 2Master,scaleleftDistance Master,moveHAbsolute trueMaster,scaletopDistance Master,moveH true cREVGeneral revUniqueID 1090416199820 ? bC &