Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fixed a small bug in returning "can't decrypt" message. Added -discardcommand and -resendcommand options to the otr::new procedure. They allow the caling application to replace built-in storing, discarding and resending routines. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
df5f8fe66ef21101c7322587fdaaf05b |
User & Date: | sgolovan 2016-01-02 13:10:45.922 |
Context
2016-01-02
| ||
13:14 | Use own procedures to store, discard and resend messages after refreshing broken OTR conversation. Moved drawing OTR message icon for outgoing messages to draw_message_hook where it is more appropriate. check-in: 6470c20ee5 user: sgolovan tags: trunk | |
13:10 | Fixed a small bug in returning "can't decrypt" message. Added -discardcommand and -resendcommand options to the otr::new procedure. They allow the caling application to replace built-in storing, discarding and resending routines. check-in: df5f8fe66e user: sgolovan tags: trunk | |
13:04 | Adjusted priority for the icon drawing procedure. check-in: 1b27e8c663 user: sgolovan tags: trunk | |
Changes
Changes to otr/tclotr/ChangeLog.
1 2 3 4 5 6 7 | 2015-12-27 Sergei Golovan <sgolovan@nes.ru> * otr.tcl: Don't switch to plaintext message state on an OTR error message retrieving. Display a bit more meaningful error messages to a user in case of receiving OTR request with nismatched protocol version. Do not resend pending message if the peer has changed her OTR key between sessions. | > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 2016-01-02 Sergei Golovan <sgolovan@nes.ru> * otr.tcl: Fixed a small bug in returning "can't decrypt" message. Added -discardcommand and -resendcommand options to the otr::new procedure. They allow the caling application to replace built-in storing, discarding and resending routines. 2015-12-27 Sergei Golovan <sgolovan@nes.ru> * otr.tcl: Don't switch to plaintext message state on an OTR error message retrieving. Display a bit more meaningful error messages to a user in case of receiving OTR request with nismatched protocol version. Do not resend pending message if the peer has changed her OTR key between sessions. |
︙ | ︙ |
Changes to otr/tclotr/otr.tcl.
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | set maxsize 0 set authstatecommands {} set msgstatecommands {} set smpstatecommands {} set smpprogresscommands {} set infocommands {} set errorcommands {} foreach {key val} $args { switch -- $key { -policy { set policy $val } -heartbeat { set heartbeat $val } -maxsize { set maxsize $val } -sendcommand { set sendcommands [list $val] } -authstatecommand { set authstatecommands [list $val] } -msgstatecommand { set msgstatecommands [list $val] } -smpstatecommand { set smpstatecommands [list $val] } -smpprogresscommand { set smpprogresscommands [list $val] } -infocommand { set infocommands [list $val] } -errorcommand { set errorcommands [list $val] } default { | > > > > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | set maxsize 0 set authstatecommands {} set msgstatecommands {} set smpstatecommands {} set smpprogresscommands {} set infocommands {} set errorcommands {} set discardcommands {} set resendcommands {} foreach {key val} $args { switch -- $key { -policy { set policy $val } -heartbeat { set heartbeat $val } -maxsize { set maxsize $val } -sendcommand { set sendcommands [list $val] } -discardcommand { set discardcommands [list $val] } -resendcommand { set resendcommands [list $val] } -authstatecommand { set authstatecommands [list $val] } -msgstatecommand { set msgstatecommands [list $val] } -smpstatecommand { set smpstatecommands [list $val] } -smpprogresscommand { set smpprogresscommands [list $val] } -infocommand { set infocommands [list $val] } -errorcommand { set errorcommands [list $val] } default { |
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | while {[set state(sinstance) [::otr::crypto::random 32]] < 0x100} {} set state(policy) $policy set state(heartbeat) $heartbeat set state(maxsize) $maxsize set state(sendcommands) $sendcommands set state(authstatecommands) $authstatecommands set state(msgstatecommands) $msgstatecommands set state(smpstatecommands) $smpstatecommands set state(smpprogresscommands) $smpprogresscommands set state(infocommands) $infocommands set state(errorcommands) $errorcommands | > > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | while {[set state(sinstance) [::otr::crypto::random 32]] < 0x100} {} set state(policy) $policy set state(heartbeat) $heartbeat set state(maxsize) $maxsize set state(sendcommands) $sendcommands set state(discardcommands) $discardcommands set state(resendcommands) $resendcommands set state(authstatecommands) $authstatecommands set state(msgstatecommands) $msgstatecommands set state(smpstatecommands) $smpstatecommands set state(smpprogresscommands) $smpprogresscommands set state(infocommands) $infocommands set state(errorcommands) $errorcommands |
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | if {[llength $args] == 0} { switch -- $key { -policy { return $state(policy) } -heartbeat { return $state(heartbeat) } -maxsize { return $state(maxsize) } -sendcommand { return [lindex $state(sendcommands) 0] } -authstatecommand { return [lindex $state(authstatecommands) 0] } -msgstatecommand { return [lindex $state(msgstatecommands) 0] } -smpstatecommand { return [lindex $state(smpstatecommands) 0] } -infocommand { return [lindex $state(infocommands) 0] } -errorcommand { return [lindex $state(errorcommands) 0] } -smpprogresscommand { return [lindex $state(smpprogresscommands) 0] | > > | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | if {[llength $args] == 0} { switch -- $key { -policy { return $state(policy) } -heartbeat { return $state(heartbeat) } -maxsize { return $state(maxsize) } -sendcommand { return [lindex $state(sendcommands) 0] } -discardcommand { return [lindex $state(discardcommands) 0] } -resendcommand { return [lindex $state(resendcommands) 0] } -authstatecommand { return [lindex $state(authstatecommands) 0] } -msgstatecommand { return [lindex $state(msgstatecommands) 0] } -smpstatecommand { return [lindex $state(smpstatecommands) 0] } -infocommand { return [lindex $state(infocommands) 0] } -errorcommand { return [lindex $state(errorcommands) 0] } -smpprogresscommand { return [lindex $state(smpprogresscommands) 0] |
︙ | ︙ | |||
237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } set state(policy) $val } -heartbeat { set state(heartbeat) $val } -maxsize { set state(maxsize) $val } -sendcommand { set state(sendcommands) [list $val] } -authstatecommand { set state(authstatecommands) [list $val] } -msgstatecommand { set state(msgstatecommands) [list $val] } -smpstatecommand { set state(smpstatecommands) [list $val] } -smpprogresscommand { set state(smpprogresscommands) [list $val] } -infocommand { set state(infocommands) [list $val] } -errorcommand { set state(errorcommands) [list $val] } default { | > > | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | } set state(policy) $val } -heartbeat { set state(heartbeat) $val } -maxsize { set state(maxsize) $val } -sendcommand { set state(sendcommands) [list $val] } -discardcommand { set state(discardcommands) [list $val] } -resendcommand { set state(resendcommands) [list $val] } -authstatecommand { set state(authstatecommands) [list $val] } -msgstatecommand { set state(msgstatecommands) [list $val] } -smpstatecommand { set state(smpstatecommands) [list $val] } -smpprogresscommand { set state(smpprogresscommands) [list $val] } -infocommand { set state(infocommands) [list $val] } -errorcommand { set state(errorcommands) [list $val] } default { |
︙ | ︙ | |||
529 530 531 532 533 534 535 | } } MSGSTATE_ENCRYPTED { Store $token $message # Store the time of last message sent set state(lastmessage) [clock seconds] set message [CreateEncryptedMessage $token {} $message {}] | | | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | } } MSGSTATE_ENCRYPTED { Store $token $message # Store the time of last message sent set state(lastmessage) [clock seconds] set message [CreateEncryptedMessage $token {} $message {}] return [list message $message store 1] } MSGSTATE_FINISHED { # TODO: Think about resending message after AKE #Store $token $message CallBack $token info "Message is not sent. Either end your private\ conversation, or restart it" return {} |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | # ::otr::ShowCantDecipherError -- proc ::otr::ShowCantDecipherError {token flags} { variable $token upvar 0 $token state set info "Encrypted message can't be deciphered" | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | # ::otr::ShowCantDecipherError -- proc ::otr::ShowCantDecipherError {token flags} { variable $token upvar 0 $token state set info "Encrypted message can't be deciphered" set reply [::otr::data::errorMessage $info] if {"IGNORE_UNREADABLE" ni $flags} { CallBack $token info $info CallBack $token send $reply } } |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 | proc ::otr::Resend {token oldkey} { variable $token upvar 0 $token state switch -- $state(msgstate) { MSGSTATE_ENCRYPTED { if {$oldkey eq $state(publickey)} { | > > > | < | | | > > > > | > | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 | proc ::otr::Resend {token oldkey} { variable $token upvar 0 $token state switch -- $state(msgstate) { MSGSTATE_ENCRYPTED { if {$oldkey eq $state(publickey)} { if {[llength $state(resendcommands)] > 0} { CallBack $token resend } else { foreach message $state(storedmessages) { set message [CreateEncryptedMessage \ $token {} $message {}] CallBack $token send $message } } if {[llength $state(storedmessages)] > 0} { set state(lastmessage) [clock seconds] CallBack $token info "Last message has been resent" } } else { # Peer has changed his OTR key, so we can't trust him if {[llength $state(storedmessages)] > 0} { set state(storedmessages) {} CallBack $token info "Last message should have been\ resent but has not because the\ peer's OTR key has been changed" } } } } Delete $token } # ::otr::Delete -- proc ::otr::Delete {token} { variable $token upvar 0 $token state CallBack $token discard set state(storedmessages) {} } # ::otr::QueryPolicy -- proc ::otr::QueryPolicy {token item} { variable $token |
︙ | ︙ |