Subject: Re: [sup-devel] [PATCH] Handle drafts with high ID numbers.

From: "Edward Z. Yang" <[email-masked]>
Date: Tue, 28 Aug 2012 20:41:15 -0400

If you've ever suffered from saving a draft message, and then
suddenly asking, "Where did it go?" because it didn't show up
in your INBOX, try this patch.

Edward

Excerpts from Edward Z. Yang's message of Tue Aug 28 20:35:01 -0400 2012:
> From: "Edward Z. Yang" <[email-masked]>
> 
> Signed-off-by: Edward Z. Yang <[email-masked]>
> ---
>  lib/sup/draft.rb | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
> index 58c45db..1f33dc1 100644
> --- a/lib/sup/draft.rb
> +++ b/lib/sup/draft.rb
> @@ -37,7 +37,6 @@ class DraftLoader < Source
>      Dir.mkdir dir unless File.exists? dir
>      super DraftManager.source_name, true, false
>      @dir = dir
> -    @cur_offset = 0
>    end
>  
>    def id; DraftManager.source_id; end
> @@ -46,14 +45,13 @@ class DraftLoader < Source
>  
>    def poll
>      ids = get_ids
> -    ids.each do |id|
> -      if id >= @cur_offset
> -        @cur_offset = id + 1
> -        yield :add,
> -          :info => id,
> -          :labels => [:draft, :inbox],
> -          :progress => 0.0
> -      end
> +    old_ids = Enumerator.new(Index.instance, :each_source_info, self.id).to_a
> +    new_ids = ids - old_ids
> +    new_ids.each do |id|
> +      yield :add,
> +        :info => id,
> +        :labels => [:draft, :inbox],
> +        :progress => 0.0
>      end
>    end
>  
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: "Edward Z. Yang" <[email-masked]>
Date: Tue, 28 Aug 2012 20:35:01 -0400

def poll
     ids = get_ids
-    ids.each do |id|
-      if id >= @cur_offset
-        @cur_offset = id + 1
-        yield :add,
-          :info => id,
 
-- 
1.7.11.3