diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-04-15 11:23:47 +0000 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2020-04-15 13:56:59 +0200 |
commit | 3663d7365bf8b1e91cccf367326a23acd7db0161 (patch) | |
tree | 920c71db5ce4ab03ff89ebcd17b91dc417acd073 /contrib/msuck | |
parent | 99b7d47a10d38b990badf2ea57c7032f12d7cdb5 (diff) | |
download | mblaze-3663d7365bf8b1e91cccf367326a23acd7db0161.tar.gz mblaze-3663d7365bf8b1e91cccf367326a23acd7db0161.tar.xz mblaze-3663d7365bf8b1e91cccf367326a23acd7db0161.zip |
msuck: don't init maildir until connected
Previously, a typo in the newsgroup name would leave an empty mailbox for a non-existent newsgroup. This can be avoided by delaying maildir initialization until after the NNTP server has 221ed the group.
Diffstat (limited to 'contrib/msuck')
-rwxr-xr-x | contrib/msuck | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/msuck b/contrib/msuck index d75591f..4ba4464 100755 --- a/contrib/msuck +++ b/contrib/msuck @@ -57,10 +57,6 @@ STDOUT.sync = true ARGV.each { |group| - FileUtils.mkdir_p(File.join(dir, group, "cur")) - FileUtils.mkdir_p(File.join(dir, group, "new")) - FileUtils.mkdir_p(File.join(dir, group, "tmp")) - nntp.write("GROUP #{group}\r\n") msg = nntp.gets @@ -79,6 +75,10 @@ ARGV.each { |group| low = high - LIMIT + 1 if number > LIMIT - 1 low = 1 if low <= 0 + FileUtils.mkdir_p(File.join(dir, group, "cur")) + FileUtils.mkdir_p(File.join(dir, group, "new")) + FileUtils.mkdir_p(File.join(dir, group, "tmp")) + have = Dir.entries(File.join(dir, group, "cur")). map { |f| $1.to_i if f =~ /N=(\d+)/ }.compact |