/usr/share/amsn/plugins/jake/learn.tcl is in amsn-data 0.98.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | proc learnparseArgs { string_text } {
#element 0 from list = text to add
#element 1 from list = status (ok if everything is ok, else err)
#if string starts with " and ends with " everyrhing is ok
#else string isn't well formatted.
if { [regexp -- {^"[^"]*" "[^"]*"$} $string_text] } {
set arguments [list $string_text "ok"]
} else {
set arguments [list "" "err"]
}
return $arguments
}
proc learnalterString {phrase z} {
if {$z < [string length $phrase]} {
if {[string is alpha [string range $phrase $z $z]]} {
if {[string is lower [string range $phrase $z $z]]} {
set phrase [string toupper $phrase $z $z]
return $phrase
} elseif {[string is upper [string range $phrase $z $z]]} {
set phrase [string tolower $phrase $z $z]
return $phrase
} else {
return
}
} else {
return $phrase
}
} else {
return -1
}
}
proc learnaddToDictionary { string_text } {
set originalMsg $string_text
regexp {\"(.*?)\" \"} $string_text -> originalPhrase
regsub -all {\"} $originalPhrase "\\\"" phrase
regsub -all {\$} $phrase "\\\$" phrase ;#DLH
source [file join $::HOME "jake" "dictionary.dic"]
set z 0
while {1} {
if {[info exists dictionary($phrase)] == 1} {
set phrase [learnalterString $phrase $z]
if {[string equal $phrase "-1"]} {
return 0
} else {
incr z
}
} else {
set msg [string map [list $originalPhrase $phrase] $originalMsg]
set msg [string range $msg 1 end]
regsub -all {\" \"} $msg ")\" \"" msg
set fileId [open [file join $::HOME "jake" "dictionary.dic"] "a+"]
puts $fileId "set \"dictionary($msg"
close $fileId
return 1
}
}
}
|