tiix dev started

This commit is contained in:
Luxferre
2024-10-23 15:06:24 +03:00
parent f255d39dee
commit 5f77e76d18
2 changed files with 403 additions and 5 deletions
+3 -5
View File
@@ -28,12 +28,10 @@ proc readfile {fname} {
}
# main data posting function
proc postiidata {rooturl authstr echoname msgto subj repto text add_enc} {
proc postiidata {rooturl authstr echoname msgto subj repto text} {
if {$repto ne ""} {set text "@repto:$repto\r\n$text"}
set rawdata "$echoname\n$msgto\n$subj\n\n$text"
if {$add_enc eq 1} {
set rawdata [encoding convertto utf-8 $rawdata]
}
set rawdata [encoding convertto utf-8 $rawdata]
set based [binary encode base64 $rawdata]
# perform the posting if the length fits
if {[string length $based] <= 87382} {
@@ -95,7 +93,7 @@ if {$argc > 3} {
}
set msgtext [readfile stdin]
puts "Posting the message to $sturl..."
set res [postiidata $sturl $authstr $echoname $msgto $subj $repto $msgtext 1]
set res [postiidata $sturl $authstr $echoname $msgto $subj $repto $msgtext]
set status [dict get $res status]
set result [dict get $res result]
if {$status} {puts "Success: $result"} else {puts "Error: $result"}