;;; request-tracker.el --- Functions for dealing with RT tickets ;; Copyright (C) 2004 by Free Software Foundation, Inc. ;; Author: Angus Lees ;; Keywords: RT ;; This file is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with XEmacs; see the file COPYING. If not, write to the Free ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ;; 02111-1307, USA. ;;; Commentary: ;; Various functions for dealing with Request Tracker. ;; ;; Customise `rt-web-server-alist' and possibly `rt-default-rtname'. ;; ;; RT hyperlinks in wanderlust: ;; ;; (autoload 'rt-web-ticket-button "request-tracker") ;; (autoload 'rt-reply-to-originator "request-tracker") ;; (set-alist 'wl-message-header-button-alist "^RT-Ticket:" ;; '("[^ ]* +#[0-9]+" 0 rt-web-ticket-button 0 25)) ;; (set-alist 'wl-message-header-button-alist "^RT-Originator:" ;; '("[^ address@hidden" 0 rt-reply-to-originator 0 25)) ;;; Code: (require 'browse-url) (defvar rt-web-server-alist '(("busibox.com.au" . "http://rt.urnet.com.au/Ticket/Display.html?id=%s") ("cpan" . "http://rt.cpan.org/NoAuth/Bug.html?id=%s") ("fsck.com" . "http://rt3.fsck.com/Ticket/Display.html?id=%s")) "Alist of RT ticket \"rtnames\" and their corresponding web server") (defvar rt-default-rtname "busibox.com.au" "Default RT ticket \"rtname\" to use if no other is specified") (defun rt-web-ticket-url (ticket &optional rtname) "Return a web URL for this ticket." (let* ((r (or rtname rt-default-rtname)) (server (assoc r rt-web-server-alist))) (if server (format (cdr server) ticket)))) ;;;###autoload (defun rt-web-ticket (ticket &optional rtname) "Jump to a Request Tracker ticket via browse-url" (interactive "sTicket: ") (if (string-equal rtname "") (setq rtname nil)) (if (string-equal ticket "") (error "No ticket to look up.") (let* ((r (or rtname rt-default-rtname)) (url (rt-web-ticket-url ticket r))) (unless url (error (format "No server known for `%s'" r))) (browse-url url) (message "Looking up ticket %s/%s via browse-url" r ticket)))) (defun rt-web-ticket-button (string) "Call `rt-web-ticket' after splitting STRING into rtname and ticket id" (save-match-data (string-match "\\([^ ]*\\) +#\\([0-9]+\\)" string) (rt-web-ticket (match-string 2 string) (match-string 1 string)))) ;; FIXME needs to be a reply to current-buffer. ;; In particular needs to keep RT-Ticket header. (defun rt-reply-to-originator (originator) "Compose reply to ORIGINATOR." ;(wl-draft-reply (current-buffer) t SUMMARY-BUF?) (compose-mail originator)) (provide 'request-tracker) ;;; request-tracker.el ends here