Posted to tcl by mookie at Sun Jul 30 16:52:27 GMT 2023view raw

  1. ###
  2. namespace eval sparkle {
  3. #
  4. set myDomain "neoncrystal.com" ;# Where these files exist
  5. set myForest "/srv/.forest./.:." ;#Forest location, shouldnt need to change
  6. #
  7. set myCrystal "$myForest/$myDomain/crystal" ;#CrystalLocation
  8. set myNeonSys "$myCrystal/neonSys"
  9. #
  10. set mySparkle "$myCrystal/neonSparkle"
  11. set myModules "$mySparkle/modules"
  12. #
  13. source $sparkle::myModules/system.ix ;# sources: profile, timeclock
  14. }
  15.  
  16. proc sparkle::client { crystal socket_hexkey action args } {
  17. # Procedure to handle client actions
  18. variable $socket_hexkey ;# Gain access to variable for hexkkey
  19. set base32_submenu [lindex $args 0]
  20. set base16_socket [lindex $args 1]
  21. try {
  22.  
  23. ;# Switch
  24. # store_client - Stores the client UUID (fetches mainmenu from genMenu.ix)
  25. # recall_client - Recalls the client UUID
  26. # my_profile - Displays the profile information based on the hexkey given
  27. # display_image - Displays an image
  28. # timeclock - Used for the timeclock
  29.  
  30. ;# timeclock Args
  31. # 1 - Used to display the submenu | Adjust TimeZone / Colour
  32. # 2 - Displays the timezone menu
  33. # 3 - Shows the time_colourmenu
  34.  
  35. switch $action {
  36.  
  37. store_client { sparkle::store_client $socket_hexkey ; sparkle::sock(send) $crystal [sparkle::genMenu $socket_hexkey mainmenu]
  38. close $crystal }
  39.  
  40. recall_client { sparkle::sock(send) $crystal [sparkle::recall_client $socket_hexkey]
  41. close $crystal }
  42.  
  43. display_image { set a_bird [sparkle::2Hex "[sparkle::base64 "image" [sparkle::2Base "[dict get $sparkle::img site a_bird]"]]"]
  44. sparkle::sock(send) $crystal "$a_bird" ; close $crystal }
  45.  
  46. my_profile { sparkle::sock(send) $crystal [profile::display $socket_hexkey] ; close $crystal }
  47.  
  48. under_construction {
  49. set base16_nofeature [sparkle::2Hex "This feature is under construction"]
  50. sparkle::sock(send) $crystal $base16_nofeature ; close $crystal }
  51.  
  52. timeclock {
  53. # Sub Menu
  54. ;# Sources from: sparks/timeclock.ix
  55. ;# - proc timebar requires: hexkey, menu
  56. ;# 1 - Displays the sub menu options
  57. ;# 2 - Displays the timezone options
  58. ;# 3 - Displays the Time Colour Menu options
  59. ;# 4 - Africa Timezones - Triggered from timeSwitch as packet (switches within neonSparkle loaded by sparkle.ix)
  60. ;# 5 - South Amercia Timezones - Triggered from timeSwitch as packet
  61. switch $base32_submenu {
  62. 1 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_submenu] ; close $crystal }
  63. 2 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_zonemenu] ; close $crystal }
  64. 3 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_colourmenu] ; close $crystal }
  65. 4 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timezone_africa $base16_socket] ; close $crystal }
  66. 5 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timezone_amercia $base16_socket] ; close $crystal }
  67. default { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timedate] ; close $crystal }
  68. }
  69. }
  70.  
  71. default {
  72. set base16_default [sparkle::2Hex "feature or request unavailable"]
  73. sparkle::sock(send) $crystal $base16_default ; close $crystal }
  74.  
  75. } ;#end switch action
  76. } on error {err options} {
  77. puts $options
  78. sparkle::sock(send) $crystal [sparkle::2Hex "client error :: $err"] ; close $crystal
  79. } ;#end try
  80. } ;#end procedure
  81.  
  82.