aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-06-06 06:09:56 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-06-06 06:09:56 +0000
commit2103af8485b9ab34df483b910960fb2b64aaee2f (patch)
tree0dbf34d256e7455b4aa5430961d9790db477fa56
parentContract status/reso/issue. (diff)
downloadrbot-bugzilla-2103af8485b9ab34df483b910960fb2b64aaee2f.tar.gz
rbot-bugzilla-2103af8485b9ab34df483b910960fb2b64aaee2f.tar.bz2
rbot-bugzilla-2103af8485b9ab34df483b910960fb2b64aaee2f.zip
Contract common email addresses. Need to put this into a config array later.
-rw-r--r--bugzilla.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/bugzilla.rb b/bugzilla.rb
index 6d2a288..8d5736a 100644
--- a/bugzilla.rb
+++ b/bugzilla.rb
@@ -275,6 +275,15 @@ class BugzillaPlugin < Plugin
@client = nil
end
+
+ EMAIL_REPLACEMENTS = { 'gentoo.org' => 'g.o', 'gentooexperimental.org' => 'ge.org' }
+ def shrink_email(email)
+ domain = email.split(/@/)[1]
+ if EMAIL_REPLACEMENTS.key?(domain)
+ email.sub!(/@#{domain}$/, '@'+EMAIL_REPLACEMENTS[domain])
+ end
+ return email
+ end
# Return the summary for a given bug.
def summary(bugno)
@@ -310,13 +319,17 @@ class BugzillaPlugin < Plugin
status += ", #{reso[0..3]}" if reso and reso.length > 0
desc = bugxml.get_text("short_desc").to_s.decode_entities
+ reporter = bugxml.get_text("reporter").to_s
+ reporter = shrink_email(reporter)
+ assignee = bugxml.get_text("assigned_to").to_s
+ assignee = shrink_email(assignee)
return "" +
"Bug #{bugno}; " +
"\"#{desc}\"; " +
"#{product_component}; " +
"#{status}; " +
- "#{bugxml.get_text("reporter")} -> #{bugxml.get_text("assigned_to")}; " +
+ "#{reporter} -> #{assignee}; " +
"#{showbugurl.gsub('@BUGNO@', bugno)}"
end