Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: marcus-sup@bar-coded.net (Marcus Williams)
Subject: [sup-talk] [PATCH] Simple hook that runs when thread is marked as spam
Date: Thu, 10 Apr 2008 11:31:55 +0100	[thread overview]
Message-ID: <1207823457-sup-5040@tomsk> (raw)

This hook adds the ability to configure further actions that take place
when a user marks a thread as spam in sup.

mark-as-spam
------------
File: $HOME/.sup/hooks/mark-as-spam.rb
This hook is run when a thread is marked as spam
Variables:
  thread: The message thread being marked as spam.
---
 lib/sup/modes/thread-index-mode.rb |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 7a0b815..50dabaa 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -13,6 +13,12 @@ Generates the per-thread size widget for each thread.
 Variables:
   thread: The message thread to be formatted.
 EOS
+  
+  HookManager.register "mark-as-spam", <<EOS
+This hook is run when a thread is marked as spam
+Variables:
+  thread: The message thread being marked as spam.
+EOS
 
   register_keymap do |k|
     k.add :load_threads, "Load #{LOAD_MORE_THREAD_NUM} more threads", 'M'
@@ -333,6 +339,7 @@ EOS
   def toggle_spam
     t = cursor_thread or return
     multi_toggle_spam [t]
+    HookManager.run("mark-as-spam", :thread => t) 
   end
 
   ## both spam and deleted have the curious characteristic that you
-- 
1.5.3.7




             reply	other threads:[~2008-04-10 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 10:31 Marcus Williams [this message]
2008-05-01  1:27 ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1207823457-sup-5040@tomsk \
    --to=marcus-sup@bar-coded.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox