raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{m.id.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
Index.drop_entry docid
File.delete @source.fn_for_offset(entry[:source_info])
- UpdateManager.relay self, :deleted, m
+ UpdateManager.relay self, :single_message_deleted, m
end
end
BufferManager.draw_screen
end
+ def handle_single_message_deleted_update sender, m
+ @ts_mutex.synchronize do
+ return unless @ts.contains? m
+ @ts.remove_id m.id
+ end
+ update
+ end
+
def handle_deleted_update sender, m
@ts_mutex.synchronize do
return unless @ts.contains? m
remove_container c
p.children << c
c.parent = p
+ update_threading_for c
+ end
+ private :link
+
+ def remove_container c
+ c.parent.children.delete c if c.parent # remove from tree
+ end
+ private :remove_container
+ def update_threading_for c
## if the child was previously a top-level container, but now is not,
## ditch our thread and kill it if necessary
if c.thread && !c.root?
c.thread = nil
end
end
- private :link
-
- def remove_container c
- c.parent.children.delete c if c.parent # remove from tree
- end
- private :remove_container
-
- def prune_empty_threads; @threads.delete_if { |k, t| t.empty? } end
- private :prune_empty_threads
+ private :update_threading_for
- ## remove a single message id. not used anywhere, afaik.
def remove_id mid
return unless(c = @messages[mid])
remove_container c