Fixed posting and replying issues
This commit is contained in:
@@ -29,6 +29,13 @@ proc readfile {fname} {
|
|||||||
|
|
||||||
# main data posting function
|
# main data posting function
|
||||||
proc postiidata {rooturl authstr echoname msgto subj repto text} {
|
proc postiidata {rooturl authstr echoname msgto subj repto text} {
|
||||||
|
set rooturl [string trim $rooturl]
|
||||||
|
set authstr [string trim $authstr]
|
||||||
|
set echoname [string trim $echoname]
|
||||||
|
set repto [string trim $repto]
|
||||||
|
set msgto [string trim $msgto]
|
||||||
|
set subj [string trim $subj]
|
||||||
|
set text [string trimright $text]
|
||||||
if {$repto ne ""} {set text "@repto:$repto\r\n$text"}
|
if {$repto ne ""} {set text "@repto:$repto\r\n$text"}
|
||||||
set rawdata "$echoname\n$msgto\n$subj\n\n$text"
|
set rawdata "$echoname\n$msgto\n$subj\n\n$text"
|
||||||
set rawdata [encoding convertto utf-8 $rawdata]
|
set rawdata [encoding convertto utf-8 $rawdata]
|
||||||
|
|||||||
@@ -107,18 +107,20 @@ proc clicklink {textw msgid} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc linkinsert {textw uri is_orig} {
|
proc linkinsert {textw uri is_orig} {
|
||||||
global linkcount linklist tiix_bgcolor tiix_linkcolor
|
global linkcount linklist tiix_bgcolor tiix_linkcolor tiix_post_repto
|
||||||
if {$is_orig eq 1} {
|
if {$is_orig eq 1} {
|
||||||
set tagname "orig_tiixlink_$uri"
|
set tagname "orig_tiixlink_$uri"
|
||||||
} else {
|
} else {
|
||||||
set tagname "tiixlink_$uri"
|
set tagname "tiixlink_$uri"
|
||||||
}
|
}
|
||||||
$textw insert end $uri $tagname
|
$textw insert end $uri $tagname
|
||||||
if {$is_orig eq 0} {
|
|
||||||
$textw tag configure $tagname -underline on -foreground $tiix_linkcolor -background $tiix_bgcolor
|
$textw tag configure $tagname -underline on -foreground $tiix_linkcolor -background $tiix_bgcolor
|
||||||
$textw tag bind $tagname <Button-1> "clicklink $textw $uri"
|
|
||||||
$textw tag bind $tagname <Enter> {%W configure -cursor hand2}
|
$textw tag bind $tagname <Enter> {%W configure -cursor hand2}
|
||||||
$textw tag bind $tagname <Leave> {%W configure -cursor $contentcursor}
|
$textw tag bind $tagname <Leave> {%W configure -cursor $contentcursor}
|
||||||
|
if {$is_orig eq 0} { # scroll on click
|
||||||
|
$textw tag bind $tagname <Button-1> "clicklink $textw $uri"
|
||||||
|
} else { # insert to repto field on click
|
||||||
|
$textw tag bind $tagname <Button-1> "set tiix_post_repto $uri; updatefromreps; .tabbar select .tabbar.p"
|
||||||
}
|
}
|
||||||
incr linkcount
|
incr linkcount
|
||||||
lappend linklist $uri
|
lappend linklist $uri
|
||||||
@@ -152,15 +154,21 @@ proc tiix_viewecho {} {
|
|||||||
set tz ""
|
set tz ""
|
||||||
set renderedts ""
|
set renderedts ""
|
||||||
catch { # because some servers don't provide timestamps
|
catch { # because some servers don't provide timestamps
|
||||||
set renderedts [clock format $msg(timestamp) -format {%Y-%m-%d %H:%M:%S} -timezone $tz]
|
set renderedts [clock format [string trim $msg(timestamp)] -format {%Y-%m-%d %H:%M:%S} -timezone $tz]
|
||||||
}
|
}
|
||||||
set textw .tabbar.r.content.text
|
set textw .tabbar.r.content.text
|
||||||
$textw insert end "\[$renderedts\] "
|
$textw insert end "\[$renderedts\] "
|
||||||
linkinsert $textw $msg(msgid) 1
|
linkinsert $textw $msg(msgid) 1
|
||||||
|
set msg(echoname) [string trim $msg(echoname)]
|
||||||
|
set msg(msgfrom) [string trim $msg(msgfrom)]
|
||||||
|
set msg(msgfromaddr) [string trim $msg(msgfromaddr)]
|
||||||
|
set msg(msgto) [string trim $msg(msgto)]
|
||||||
|
set msg(repto) [string trim $msg(repto)]
|
||||||
|
set msg(subj) [string trim $msg(subj)]
|
||||||
$textw insert end "\n$msg(echoname) - $msg(msgfrom) ($msg(msgfromaddr)) to $msg(msgto)\n"
|
$textw insert end "\n$msg(echoname) - $msg(msgfrom) ($msg(msgfromaddr)) to $msg(msgto)\n"
|
||||||
if {$msg(repto) ne ""} {
|
if {$msg(repto) ne ""} {
|
||||||
$textw insert end "Replied to: "
|
$textw insert end "Replied to: "
|
||||||
linkinsert $textw "$msg(repto)" 0
|
linkinsert $textw $msg(repto) 0
|
||||||
$textw insert end "\n"
|
$textw insert end "\n"
|
||||||
}
|
}
|
||||||
set msg(body) [lmap s $msg(body) {string trimright $s}]
|
set msg(body) [lmap s $msg(body) {string trimright $s}]
|
||||||
@@ -197,6 +205,7 @@ set contentcursor "left_ptr"
|
|||||||
wm title . "tiix"
|
wm title . "tiix"
|
||||||
wm minsize . 800 600
|
wm minsize . 800 600
|
||||||
ttk::notebook .tabbar
|
ttk::notebook .tabbar
|
||||||
|
ttk::notebook::enableTraversal .tabbar
|
||||||
grid .tabbar -row 0 -column 0 -sticky nswe
|
grid .tabbar -row 0 -column 0 -sticky nswe
|
||||||
grid columnconfigure . 0 -weight 1
|
grid columnconfigure . 0 -weight 1
|
||||||
grid rowconfigure . 0 -weight 1
|
grid rowconfigure . 0 -weight 1
|
||||||
@@ -374,7 +383,28 @@ ttk::button .tabbar.c.cfgsave -text "Save configuration" -command {
|
|||||||
grid .tabbar.c.cfgsave -row $rownum -column 0 -sticky nsw -padx 5
|
grid .tabbar.c.cfgsave -row $rownum -column 0 -sticky nsw -padx 5
|
||||||
grid columnconfigure .tabbar.c 1 -weight 1
|
grid columnconfigure .tabbar.c 1 -weight 1
|
||||||
|
|
||||||
# Custom keybindings
|
# Custom bindings
|
||||||
|
|
||||||
|
proc updatefromreps {} {
|
||||||
|
global tiix_post_repto localdb tiix_post_to tiix_post_subj tiix_post_echoname
|
||||||
|
set tiix_post_repto [string trim $tiix_post_repto]
|
||||||
|
if {$tiix_post_repto ne ""} {
|
||||||
|
sqlite3 msgdb $localdb -readonly true
|
||||||
|
msgdb eval {SELECT * FROM `msg` WHERE `msgid`=$tiix_post_repto;} msg {
|
||||||
|
set tiix_post_to [string trim $msg(msgfrom)]
|
||||||
|
set tiix_post_subj [string trim $msg(subj)]
|
||||||
|
set tiix_post_echoname [string trim $msg(echoname)]
|
||||||
|
if {![string match "Re: *" $tiix_post_subj]} {
|
||||||
|
set tiix_post_subj "Re: $tiix_post_subj"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msgdb close
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bind .tabbar.p.addrframe.repto <Return> updatefromreps
|
||||||
|
bind .tabbar.p.addrframe.repto <Leave> updatefromreps
|
||||||
|
|
||||||
# general keybinding switch
|
# general keybinding switch
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user