Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: marcus-sup@bar-coded.net (Marcus Williams)
Subject: [sup-talk] [PATCH] Fix for some warnings on faked addresses and ids
Date: Tue, 15 Jan 2008 14:02:27 +0000	[thread overview]
Message-ID: <1200405667-sup-9034@tomsk> (raw)
In-Reply-To: <1200248339-sup-5704@tomsk>

Fixes a few unitialised variable warnings when logging faked message
addresses or faked message ids. Also initialises the @lines var when the
message is not text.
---
 lib/sup/message-chunks.rb |    1 +
 lib/sup/message.rb        |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 2fcf8f9..08dcf27 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -82,6 +82,7 @@ EOS
                           :sibling_types => sibling_types
         end
 
+      @lines = nil
       if text
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
         @quotable = true
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 65aebd5..bd37162 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -60,25 +60,28 @@ class Message
 
   def parse_header header
     header.each { |k, v| header[k.downcase] = v }
-    
+
+    fakeid = nil
+    fakename = nil
+
     @id =
       if header["message-id"]
         sanitize_message_id header["message-id"]
       else
-        returning("sup-faked-" + Digest::MD5.hexdigest(raw_header)) do |id|
-          Redwood::log "faking message-id for message from #@from: #{id}"
-        end
+        fakeid = "sup-faked-" + Digest::MD5.hexdigest(raw_header)
       end
     
     @from =
       if header["from"]
         PersonManager.person_for header["from"]
       else
-        name = "Sup Auto-generated Fake Sender <sup at fake.sender.example.com>"
-        Redwood::log "faking from for message #@id: #{name}"
-        PersonManager.person_for name
+        fakename = "Sup Auto-generated Fake Sender <sup at fake.sender.example.com>"
+        PersonManager.person_for fakename
       end
 
+    Redwood::log "faking message-id for message from #@from: #{id}" if fakeid
+    Redwood::log "faking from for message #@id: #{fakename}" if fakename
+
     date = header["date"]
     @date =
       case date
-- 
1.5.3.7



  reply	other threads:[~2008-01-15 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 11:09 [sup-talk] [PATCH] Fix for some warnings Marcus Williams
2008-01-13  2:32 ` William Morgan
2008-01-13  3:32   ` William Morgan
2008-01-14  2:17     ` William Morgan
2008-01-13 18:19   ` Marcus Williams
2008-01-15 14:02     ` Marcus Williams [this message]
2008-01-16  1:32       ` [sup-talk] [PATCH] Fix for some warnings on faked addresses and ids William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1200405667-sup-9034@tomsk \
    --to=marcus-sup@bar-coded.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox