[cvsspam-devel] Patch to add XPlanner link support

Charles Duffy cduffy at spamcop.net
Sat May 27 17:43:09 UTC 2006


See attached.
-------------- next part --------------
diff -ru3 cvsspam-0.2.12.orig/cvsspam.conf cvsspam-0.2.12.xplanner-support/cvsspam.conf
--- cvsspam-0.2.12.orig/cvsspam.conf	2005-07-11 10:53:30.000000000 -0500
+++ cvsspam-0.2.12.xplanner-support/cvsspam.conf	2006-05-27 12:39:57.000000000 -0500
@@ -34,11 +34,19 @@
 #
 #     When $jiraURL is given, text of the form 'project-1234' will be linked
 #   to this issue in JIRA.
+#
+#     When $xplannerStoryURL, $xplannerIterationURL and $xplannerProjectURL are
+#   given, text of the form XS1234 will be linked to XPlanner stories; text of
+#   the form XI1234 will be linked to XPlanner iterations; and text of the form
+#   XP1234 will be linked to XPlanner projects.
 
 #$bugzillaURL = "http://bugzilla.mozilla.org/show_bug.cgi?id=%s"
 
 #$jiraURL = "http://jira.atlassian.com/secure/ViewIssue.jspa?key=%s"
 
+#$xplannerStoryURL = "http://www.example.com/xplanner/do/view/userstory?oid=%s"
+#$xplannerIterationURL = "http://www.example.com/xplanner/do/view/iteration?oid=%s"
+#$xplannerProjectURL = "http://www.example.com/xplanner/do/view/project?oid=%s"
 
 # Link to Wiki systems
 # 
diff -ru3 cvsspam-0.2.12.orig/cvsspam.rb cvsspam-0.2.12.xplanner-support/cvsspam.rb
--- cvsspam-0.2.12.orig/cvsspam.rb	2005-07-11 10:53:29.000000000 -0500
+++ cvsspam-0.2.12.xplanner-support/cvsspam.rb	2006-05-27 12:37:55.000000000 -0500
@@ -549,6 +549,18 @@
   raw = $1
   "<a href=\"#{$wikiURL.sub(/%s/, urlEncode(raw))}\">[[#{raw}]]</a>"
 }
+xplannerIterationSub = proc { |match|
+  match =~ /([0-9]+)/
+  "<a href=\"#{$xplannerIterationURL.sub(/%s/, $1)}\">#{match}</a>"
+}
+xplannerProjectSub = proc { |match|
+  match =~ /([0-9]+)/
+  "<a href=\"#{$xplannerProjectURL.sub(/%s/, $1)}\">#{match}</a>"
+}
+xplannerStorySub = proc { |match|
+  match =~ /([0-9]+)/
+  "<a href=\"#{$xplannerStoryURL.sub(/%s/, $1)}\">#{match}</a>"
+}
 commentSubstitutions = {
 		'(?:mailto:)?[\w\.\-\+\=]+\@[\w\-]+(?:\.[\w\-]+)+\b' => mailSub,
 		'\b(?:http|https|ftp):[^ \t\n<>"]+[\w/]' => urlSub
@@ -1251,6 +1263,9 @@
 $jiraURL = nil
 $ticketURL = nil
 $viewcvsURL = nil
+$xplannerIterationURL = nil
+$xplannerProjectURL = nil
+$xplannerStoryURL = nil
 $choraURL = nil
 $cvswebURL = nil
 $from_address = nil
@@ -1364,6 +1379,15 @@
 if $wikiURL != nil
   commentSubstitutions['\[\[.+\]\]'] = wikiSub
 end
+if $xplannerIterationURL != nil
+  commentSubstitutions['\bXI\[?[0-9]+\]?'] = xplannerIterationSub
+end
+if $xplannerProjectURL != nil
+  commentSubstitutions['\bXP\[?[0-9]+\]?'] = xplannerProjectSub
+end
+if $xplannerStoryURL != nil
+  commentSubstitutions['\bXS\[?[0-9]+\]?'] = xplannerStorySub
+end
 $commentEncoder = MultiSub.new(commentSubstitutions)
 
 


More information about the cvsspam-devel mailing list