Implemented max message ID per request customization, also added ii-doc.txt

This commit is contained in:
Luxferre
2024-10-25 10:19:12 +03:00
parent ca880cef64
commit 76143e66b0
3 changed files with 152 additions and 12 deletions
+6 -9
View File
@@ -189,7 +189,8 @@ proc listcomp {a b} {
}
# main logic proc
proc fetchiidb {url echos dbfile dolog} {
proc fetchiidb {url echos dbfile dolog maxids} {
if {$maxids < 12} {set maxids 12}
# trim the parameters
set url [string trim $url]
set echos [string trim $echos]
@@ -233,10 +234,6 @@ proc fetchiidb {url echos dbfile dolog} {
}
}
if {$dolog eq 1} {puts "Echomap built"}
# set how many message IDs we can pass in a single query
# (assuming the maximum GET length is 256 chars)
# and we assume 21 character per message ID
set maxids 12
# pass the echo list and fetch the message IDs
# now, process the map we've built
dict for {echoname msgids} $echomap {
@@ -297,12 +294,12 @@ proc massfetch {echos db dolog} {
if {$dolog eq 1} {puts "No ii/idec station URL specified, using stations.txt"}
set stfile [file join $appdir "stations.txt"]
if {[file exists $stfile]} {
set stlist [split [readfile $stfile] "\n"]
foreach station $stlist {
set stlist [readfile $stfile]
dict for {station stmaxids} $stlist {
set station [string trim $station]
if {$station ne "" && ![string match "#*" $station]} {
if {$dolog eq 1} {puts "Fetching from $station"}
fetchiidb $station $echos $db $dolog
fetchiidb $station $echos $db $dolog $stmaxids
}
}
} else {
@@ -345,7 +342,7 @@ if {$argc > 0} {
if {$sturl eq ""} {
massfetch [lindex $argv 1] $localdb 1
} else {
fetchiidb $sturl [lindex $argv 1] $localdb 1
fetchiidb $sturl [lindex $argv 1] $localdb 1 12
}
puts "Messages fetched"
} else {