Posted to tcl by mookie at Sun Jul 30 16:52:27 GMT 2023view raw
- ###
- namespace eval sparkle {
- #
- set myDomain "neoncrystal.com" ;# Where these files exist
- set myForest "/srv/.forest./.:." ;#Forest location, shouldnt need to change
- #
- set myCrystal "$myForest/$myDomain/crystal" ;#CrystalLocation
- set myNeonSys "$myCrystal/neonSys"
- #
- set mySparkle "$myCrystal/neonSparkle"
- set myModules "$mySparkle/modules"
- #
- source $sparkle::myModules/system.ix ;# sources: profile, timeclock
- }
- proc sparkle::client { crystal socket_hexkey action args } {
- # Procedure to handle client actions
- variable $socket_hexkey ;# Gain access to variable for hexkkey
- set base32_submenu [lindex $args 0]
- set base16_socket [lindex $args 1]
- try {
- ;# Switch
- # store_client - Stores the client UUID (fetches mainmenu from genMenu.ix)
- # recall_client - Recalls the client UUID
- # my_profile - Displays the profile information based on the hexkey given
- # display_image - Displays an image
- # timeclock - Used for the timeclock
- ;# timeclock Args
- # 1 - Used to display the submenu | Adjust TimeZone / Colour
- # 2 - Displays the timezone menu
- # 3 - Shows the time_colourmenu
- switch $action {
- store_client { sparkle::store_client $socket_hexkey ; sparkle::sock(send) $crystal [sparkle::genMenu $socket_hexkey mainmenu]
- close $crystal }
- recall_client { sparkle::sock(send) $crystal [sparkle::recall_client $socket_hexkey]
- close $crystal }
- display_image { set a_bird [sparkle::2Hex "[sparkle::base64 "image" [sparkle::2Base "[dict get $sparkle::img site a_bird]"]]"]
- sparkle::sock(send) $crystal "$a_bird" ; close $crystal }
- my_profile { sparkle::sock(send) $crystal [profile::display $socket_hexkey] ; close $crystal }
- under_construction {
- set base16_nofeature [sparkle::2Hex "This feature is under construction"]
- sparkle::sock(send) $crystal $base16_nofeature ; close $crystal }
- timeclock {
- # Sub Menu
- ;# Sources from: sparks/timeclock.ix
- ;# - proc timebar requires: hexkey, menu
- ;# 1 - Displays the sub menu options
- ;# 2 - Displays the timezone options
- ;# 3 - Displays the Time Colour Menu options
- ;# 4 - Africa Timezones - Triggered from timeSwitch as packet (switches within neonSparkle loaded by sparkle.ix)
- ;# 5 - South Amercia Timezones - Triggered from timeSwitch as packet
- switch $base32_submenu {
- 1 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_submenu] ; close $crystal }
- 2 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_zonemenu] ; close $crystal }
- 3 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey time_colourmenu] ; close $crystal }
- 4 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timezone_africa $base16_socket] ; close $crystal }
- 5 { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timezone_amercia $base16_socket] ; close $crystal }
- default { sparkle::sock(send) $crystal [sparkle::timebar $socket_hexkey timedate] ; close $crystal }
- }
- }
- default {
- set base16_default [sparkle::2Hex "feature or request unavailable"]
- sparkle::sock(send) $crystal $base16_default ; close $crystal }
- } ;#end switch action
- } on error {err options} {
- puts $options
- sparkle::sock(send) $crystal [sparkle::2Hex "client error :: $err"] ; close $crystal
- } ;#end try
- } ;#end procedure