home *** CD-ROM | disk | FTP | other *** search
/ Univers Interactif 3 / INTERACTIF.BIN / pc / planeten / internet / hyperfin.ger / background_2669.txt < prev    next >
Text File  |  1993-12-30  |  5KB  |  216 lines

  1. -- background: 2669 from stack: in.ger
  2. -- bmap block id: 3713
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Main
  6. ----- HyperTalk script -----
  7. -- HyperFinger (Pro?)
  8. -- Frank D Tito
  9. -- Thu 30 Dec 93
  10.  
  11. -- I modified the original HyperFinger to learn how it worked.  In
  12. -- the process, I untangled and streamlined the code.  One no longer
  13. -- needs to be a codehead to understand it.  Enjoy.
  14.  
  15. -- Please send comments and job offers to:
  16. -- ftito@dcseq.uscga.edu     until 1/15/93
  17. -- ftito@delphi.com
  18.  
  19.  
  20. -- HyperFinger original comments:
  21. -- -- HyperFinger
  22. -- -- September 1991 J. Michael Cherry (cherry@frodo.mgh.harvard.edu)
  23. -- --
  24. -- -- About 99% of the HyperTalk code in this stack is
  25. -- -- from HyperFTP by Douglas Hornig ┬⌐ 1990 Cornell University
  26. -- --
  27. -- -- The XCMDs and XFCNs used here are:
  28. -- -- TCPNameToAddr, TCPSend, TCPRecvUpTo, TCPState, TCPRelease, TCPClose,
  29. -- -- and TCPPassiveOpen by Harry Chesley ┬⌐ 1989 Apple Computer, Inc.
  30. -- --
  31. -- -- Any praise you have for this stack should go to Douglas Hornig and
  32. -- -- Harry Chesley.
  33.  
  34.  
  35. on closeStack
  36.   global connectionID
  37.  
  38.   -- make sure TCP connection is closed properly
  39.   if connectionID is not empty
  40.   then
  41.   TCPClose connectionID
  42.   TCPRelease connectionID
  43.   put empty into connectionID
  44. end if
  45.  
  46. -- if lots of free space in stack, compact stack
  47. if the freeSize of this stack ΓëÑ 40960
  48. then
  49. put the userLevel into saveLevel
  50. if saveLevel < 3 then set the userLevel to 3
  51. send "doMenu Compact Stack" to HyperCard
  52. set the userLevel to saveLevel
  53. end if
  54.  
  55. end closeStack
  56.  
  57.  
  58.  
  59. on sendLine text
  60.   global connectionID
  61.   TCPSend connectionID, text & return & linefeed
  62. end sendLine
  63.  
  64.  
  65.  
  66. on finger what, user
  67.   global connectionID
  68.  
  69.   -- determine user and hostName
  70.   put char 1 to ( offset("@",what) -1 ) of what into user
  71.   put char ( offset("@",what) +1 ) to length(what) of what into hostName
  72.  
  73.   -- check for legal name
  74.   if (hostName is empty) or (user is what)
  75.   then
  76.   answer "Please use the format user@host."
  77.   exit finger
  78. end if
  79.  
  80. -- resolve host name
  81. set cursor to busy
  82. promptoid "Finding IP address of" && hostName & "."
  83. get TCPNameToAddr(hostName)
  84. close window "Promptoid"
  85. if char 1 of it is "┬º"
  86. then
  87. if it contains "couldn't open resource"
  88. then
  89. answer "MacTCP is not installed."
  90. else
  91.   answer "Could not get IP address for" && hostName & "."
  92. end if
  93. exit finger
  94. end if
  95.  
  96. -- open socket 79 for finger service
  97. promptoid "Opening finger serviceΓǪ"
  98. put TCPActiveOpen(item 1 of it, 79, 0) into connectionID
  99. close window "Promptoid"
  100. if connectionID contains "fail"
  101. then
  102. answer "Could not connect to" && hostName & ":" && connectionID
  103. put empty into connectionID
  104. exit finger
  105. end if
  106.  
  107. -- connection established
  108. promptoid "Connection established.  Receiving information."
  109.  
  110. -- clear field
  111. put empty into bkgnd field "Output"
  112.  
  113. -- request finger user
  114. sendLine user && return
  115.  
  116. -- receive finger information
  117. repeat forever
  118.   get TCPRecvUpTo(connectionID, linefeed, zero, empty)
  119.   if it Γëá empty
  120.   then
  121.   if char 1 of it is "┬º" then exit repeat
  122.   if char (length of it) of it is linefeed
  123.   then
  124.   put empty into char (length of it) of it
  125. end if
  126. put it after bkgnd field "Output"
  127. set cursor to busy
  128. end if
  129. end repeat
  130.  
  131. -- close the connection
  132. close window "Promptoid"
  133. Promptoid "Closing connection."
  134. TCPClose connectionID
  135. TCPRelease connectionID
  136. put empty into connectionID
  137. close window "Promptoid"
  138.  
  139. end finger
  140.  
  141.  
  142.  
  143. -- part 45 (field)
  144. -- low flags: 21
  145. -- high flags: 0007
  146. -- rect: left=1 top=40 right=199 bottom=511
  147. -- title width / last selected line: 0
  148. -- icon id / first selected line: 0 / 0
  149. -- text alignment: 0
  150. -- font id: 4
  151. -- text size: 9
  152. -- style flags: 0
  153. -- line height: 12
  154. -- part name: Output
  155. ----- HyperTalk script -----
  156. on mouseUp
  157.   put the clickText into ClickedWord
  158.   select the clickChunk
  159.  
  160. end mouseUp
  161.  
  162.  
  163.  
  164. -- part 113 (button)
  165. -- low flags: 00
  166. -- high flags: A002
  167. -- rect: left=1 top=2 right=19 bottom=51
  168. -- title width / last selected line: 0
  169. -- icon id / first selected line: 0 / 0
  170. -- text alignment: 1
  171. -- font id: 3
  172. -- text size: 9
  173. -- style flags: 0
  174. -- line height: 12
  175. -- part name: Finger╔
  176. ----- HyperTalk script -----
  177. -- FingerΓǪ
  178. on mouseUp
  179.   ask "Finger what?"
  180.   put it into what
  181.   if what is empty then exit mouseUp
  182.   put empty into bg fld "Output"
  183.   finger what
  184. end mouseUp
  185.  
  186.  
  187. -- part 114 (button)
  188. -- low flags: 00
  189. -- high flags: A002
  190. -- rect: left=1 top=21 right=38 bottom=51
  191. -- title width / last selected line: 0
  192. -- icon id / first selected line: 0 / 0
  193. -- text alignment: 1
  194. -- font id: 3
  195. -- text size: 9
  196. -- style flags: 0
  197. -- line height: 12
  198. -- part name: Copy
  199. ----- HyperTalk script -----
  200. on mouseUp
  201.   set cursor to busy
  202.   set the lockScreen to true
  203.   set cursor to busy
  204.   set the lockText of bkgnd fld "Output" to false
  205.   set cursor to busy
  206.   click at the loc of bkgnd fld "Output"
  207.   set cursor to busy
  208.   select char 1 to 39999 of bkgnd fld "Output"
  209.   set cursor to busy
  210.   doMenu "Copy Text"
  211.   set cursor to busy
  212.   set the lockText of bkgnd fld "Output" to true
  213.   set cursor to busy
  214.   set the lockScreen to false
  215. end mouseUp
  216.