]> git.cworth.org Git - sup/commitdiff
simple hook that runs when thread is marked as spam
authorMarcus Williams <marcus-sup@bar-coded.net>
Thu, 10 Apr 2008 10:31:55 +0000 (11:31 +0100)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 1 May 2008 01:25:41 +0000 (18:25 -0700)
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

index d4aedbc4112d201d0993fea52f6bd865de2aca6a..e4dc5c46822c41b89b9ab0c55d4278b4cc406fc8 100644 (file)
@@ -14,6 +14,12 @@ 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'
     k.add_multi "Load all threads (! to confirm) :", '!' do |kk|
@@ -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