Gnus development mailing list
 help / color / mirror / Atom feed
* Patch to test message-alternative-emails do detect your posts when canceling
@ 2003-06-12 18:26 Tommi Vainikainen
  2003-06-15 12:11 ` Patch to test message-alternative-emails do detect your posts Kai Großjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Tommi Vainikainen @ 2003-06-12 18:26 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

Hello,

I've made a patch to message.el to better detect if message you are
trying to cancel (or supersede) is really yours.  Personally I got
annoyed, because I use gnus-posting-styles to change different
addresses when posting to usenet.

Now there is additional check by matching message-alternative-emails
regexp (already existing variable) agains sender (grabbed from From
field) email.  I also separated common code from message-cancel-news
and message-supersede to new function message-is-yours-p, because same
code was duplicated.

Patch is here: 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cancel.patch --]
[-- Type: text/x-patch, Size: 4981 bytes --]

Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 6.2420
diff -u -r6.2420 ChangeLog
--- ChangeLog	10 Jun 2003 17:16:51 -0000	6.2420
+++ ChangeLog	12 Jun 2003 18:34:56 -0000
@@ -1,3 +1,9 @@
+	* message.el (message-is-yours-p): New function.  Separated common
+	code from message-cancel-news and message-supersede.  Added
+	matching code which uses message-alternative-emails regexp as last
+	resort.
+	(message-cancel-news, message-supersede): Use message-is-yours-p.
+
 2003-06-10  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* spam.el (spam-check-bogofilter-headers): fix for when the score
Index: message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 6.350
diff -u -r6.350 message.el
--- message.el	8 Jun 2003 22:17:05 -0000	6.350
+++ message.el	12 Jun 2003 18:34:58 -0000
@@ -5702,6 +5702,45 @@
 
      cur)))
 
+;;;###autoload
+(defun message-is-yours-p ()
+  "Non-nil means current article is yours.
+If you have added 'cancel-messages to 'message-shoot-gnksa-feet', all articles
+are yours except those that have Cancel-Lock header not belonging to you.
+Instead of shooting GNKSA feet, you should modify 'message-alternative-emails'
+regexp to match all of yours addresses."
+  ;; Canlock-logic as suggested by Per Abrahamsen
+  ;; <abraham@dina.kvl.dk>
+  ;;
+  ;; IF article has cancel-lock THEN
+  ;;   IF we can verify it THEN
+  ;;     issue cancel
+  ;;   ELSE
+  ;;     error: cancellock: article is not yours
+  ;; ELSE
+  ;;   Use old rules, comparing sender...
+  (if (message-fetch-field "Cancel-Lock")
+      (if (null (canlock-verify))
+	  t
+	(error "Failed to verify Cancel-lock: This article is not yours"))
+    (or
+     (message-gnksa-enable-p 'cancel-messages)
+     (and sender
+	  (string-equal
+	   (downcase sender)
+	   (downcase (message-make-sender))))
+     ;; Email address in From field equals to our address
+     (string-equal
+      (downcase (cadr (mail-extract-address-components from)))
+      (downcase (cadr (mail-extract-address-components
+		       (message-make-from)))))
+     ;; Email address in From field matches
+     ;; 'message-alternative-emails' regexp
+     (and message-alternative-emails
+	  (string-match
+	   message-alternative-emails
+	   (cadr (mail-extract-address-components from)))))))
+
 
 ;;;###autoload
 (defun message-cancel-news (&optional arg)
@@ -5721,31 +5760,7 @@
 	      message-id (message-fetch-field "message-id" t)
 	      distribution (message-fetch-field "distribution")))
       ;; Make sure that this article was written by the user.
-      (unless (or
-	       ;; Canlock-logic as suggested by Per Abrahamsen
-	       ;; <abraham@dina.kvl.dk>
-	       ;;
-	       ;; IF article has cancel-lock THEN
-	       ;;   IF we can verify it THEN
-	       ;;     issue cancel
-	       ;;   ELSE
-	       ;;     error: cancellock: article is not yours
-	       ;; ELSE
-	       ;;   Use old rules, comparing sender...
-	       (if (message-fetch-field "Cancel-Lock")
-		   (if (null (canlock-verify))
-		       t
-		     (error "Failed to verify Cancel-lock: This article is not yours"))
-		 nil)
-	       (message-gnksa-enable-p 'cancel-messages)
-	       (and sender
-		    (string-equal
-		     (downcase sender)
-		     (downcase (message-make-sender))))
-	       (string-equal
-		(downcase (cadr (mail-extract-address-components from)))
-		(downcase (cadr (mail-extract-address-components
-				 (message-make-from))))))
+      (unless (message-is-yours-p)
 	(error "This article is not yours"))
       (when (yes-or-no-p "Do you really want to cancel this article? ")
 	;; Make control message.
@@ -5781,31 +5796,7 @@
 	(sender (message-fetch-field "sender"))
 	(from (message-fetch-field "from")))
     ;; Check whether the user owns the article that is to be superseded.
-    (unless (or
-	     ;; Canlock-logic as suggested by Per Abrahamsen
-	     ;; <abraham@dina.kvl.dk>
-	     ;;
-	     ;; IF article has cancel-lock THEN
-	     ;;   IF we can verify it THEN
-	     ;;     issue cancel
-	     ;;   ELSE
-	     ;;     error: cancellock: article is not yours
-	     ;; ELSE
-	     ;;   Use old rules, comparing sender...
-	     (if (message-fetch-field "Cancel-Lock")
-		 (if (null (canlock-verify))
-		     t
-		   (error "Failed to verify Cancel-lock: This article is not yours"))
-	       nil)
-	     (message-gnksa-enable-p 'cancel-messages)
-		(and sender
-		     (string-equal
-		      (downcase sender)
-		      (downcase (message-make-sender))))
-		(string-equal
-		 (downcase (cadr (mail-extract-address-components from)))
-		 (downcase (cadr (mail-extract-address-components
-				  (message-make-from))))))
+    (unless (message-is-yours-p)
       (error "This article is not yours"))
     ;; Get a normal message buffer.
     (message-pop-to-buffer (message-buffer-name "supersede"))

[-- Attachment #3: Type: text/plain, Size: 77 bytes --]


PS. Please Cc me, I do not read this list regularly.

-- 
Tommi Vainikainen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to test message-alternative-emails do detect your posts
  2003-06-12 18:26 Patch to test message-alternative-emails do detect your posts when canceling Tommi Vainikainen
@ 2003-06-15 12:11 ` Kai Großjohann
  2003-06-15 23:24   ` Katsumi Yamaoka
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Großjohann @ 2003-06-15 12:11 UTC (permalink / raw)
  Cc: Tommi Vainikainen

Tommi Vainikainen <thv+gnus@iki.fi> writes:

> I've made a patch to message.el to better detect if message you are
> trying to cancel (or supersede) is really yours.  Personally I got
> annoyed, because I use gnus-posting-styles to change different
> addresses when posting to usenet.

Committing.
-- 
This line is not blank.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to test message-alternative-emails do detect your posts
  2003-06-15 12:11 ` Patch to test message-alternative-emails do detect your posts Kai Großjohann
@ 2003-06-15 23:24   ` Katsumi Yamaoka
  2003-06-16  8:22     ` Kai Großjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2003-06-15 23:24 UTC (permalink / raw)
  Cc: Tommi Vainikainen

>>>>> In <84el1va6bk.fsf@lucy.is.informatik.uni-duisburg.de>
>>>>>	kai.grossjohann@gmx.net (Kai Großjohann) wrote:

> Tommi Vainikainen <thv+gnus@iki.fi> writes:

>> I've made a patch to message.el to better detect if message you are
>> trying to cancel (or supersede) is really yours.  Personally I got
>> annoyed, because I use gnus-posting-styles to change different
>> addresses when posting to usenet.

> Committing.

I've slightly modified your changes with the following ChangeLog
entry:

2003-06-16  Katsumi Yamaoka  <yamaoka@jpl.org>

	* message.el (message-is-yours-p): Narrow to head; extract from
	and sender by itself.
	(message-cancel-news, message-supersede): Remove useless things.
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to test message-alternative-emails do detect your posts
  2003-06-15 23:24   ` Katsumi Yamaoka
@ 2003-06-16  8:22     ` Kai Großjohann
  0 siblings, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2003-06-16  8:22 UTC (permalink / raw)


Katsumi Yamaoka <yamaoka@jpl.org> writes:

> I've slightly modified your changes with the following ChangeLog
> entry:

Thank you.
-- 
This line is not blank.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-16  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-12 18:26 Patch to test message-alternative-emails do detect your posts when canceling Tommi Vainikainen
2003-06-15 12:11 ` Patch to test message-alternative-emails do detect your posts Kai Großjohann
2003-06-15 23:24   ` Katsumi Yamaoka
2003-06-16  8:22     ` Kai Großjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).