* [sup-talk] [PATCH] Fix for some warnings
@ 2008-01-11 11:09 Marcus Williams
2008-01-13 2:32 ` William Morgan
0 siblings, 1 reply; 7+ messages in thread
From: Marcus Williams @ 2008-01-11 11:09 UTC (permalink / raw)
This patch fixes a couple of warnings in message and message-chunks.
The first is because a log message uses the from address before it is
assigned, the second is because @lines is uninitialised in some cases
(a sourceforge message in my case that didnt have any text content)
This stops the console getting filled with warnings on spam.
Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warnings-patch
Type: application/octet-stream
Size: 1668 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20080111/07581dd7/attachment.obj
^ permalink raw reply [flat|nested] 7+ messages in thread
* [sup-talk] [PATCH] Fix for some warnings
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-13 18:19 ` Marcus Williams
0 siblings, 2 replies; 7+ messages in thread
From: William Morgan @ 2008-01-13 2:32 UTC (permalink / raw)
Hi Marcus,
> returning("sup-faked-" + Digest::MD5.hexdigest(raw_header)) do |id|
> - Redwood::log "faking message-id for message from #@from: #{id}"
> + fakeid = id
> end
In this case, we can just assign the result directly to fakeid rather
than using the k-combinator (aka "returning"). Also there was a bit of
extraneous whitespace introduced at the end of one line in that patch,
which became obvious when I did a git diff --color.
Can you try using git-format-patch to send the patch? It will create a
nice email out of a commit for you, which I can then apply without too
much effort. (Or if you're feeling courageous, use git-send-email, which
will also do the emailing for you.)
I'm going to add a page to the wiki with an overview of git, branching,
and submitting patches.
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [sup-talk] [PATCH] Fix for some warnings
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
1 sibling, 1 reply; 7+ messages in thread
From: William Morgan @ 2008-01-13 3:32 UTC (permalink / raw)
Excerpts from William Morgan's message of Sat Jan 12 18:32:20 -0800 2008:
> I'm going to add a page to the wiki with an overview of git,
> branching, and submitting patches.
http://sup.rubyforge.org/wiki/wiki.pl?Contributing
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [sup-talk] [PATCH] Fix for some warnings
2008-01-13 2:32 ` William Morgan
2008-01-13 3:32 ` William Morgan
@ 2008-01-13 18:19 ` Marcus Williams
2008-01-15 14:02 ` [sup-talk] [PATCH] Fix for some warnings on faked addresses and ids Marcus Williams
1 sibling, 1 reply; 7+ messages in thread
From: Marcus Williams @ 2008-01-13 18:19 UTC (permalink / raw)
On 13.1.2008, William Morgan wrote:
> In this case, we can just assign the result directly to fakeid rather
> than using the k-combinator (aka "returning"). Also there was a bit of
> extraneous whitespace introduced at the end of one line in that patch,
> which became obvious when I did a git diff --color.
Yep, sorry sent the patch in half cocked and realised this afterwards.
Will resubmit tonight sometime.
MArcus
^ permalink raw reply [flat|nested] 7+ messages in thread
* [sup-talk] [PATCH] Fix for some warnings on faked addresses and ids
2008-01-13 18:19 ` Marcus Williams
@ 2008-01-15 14:02 ` Marcus Williams
2008-01-16 1:32 ` William Morgan
0 siblings, 1 reply; 7+ messages in thread
From: Marcus Williams @ 2008-01-15 14:02 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-01-16 1:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [sup-talk] [PATCH] Fix for some warnings on faked addresses and ids Marcus Williams
2008-01-16 1:32 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox