[Tkabber-dev] r2150 - in trunk/tkabber: . plugins/chat

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Mar 20 19:41:55 MSK 2014


Author: sergei
Date: 2014-03-20 19:41:55 +0400 (Thu, 20 Mar 2014)
New Revision: 2150

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/chat/muc_ignore.tcl
Log:
	* plugins/chat/muc_ignore.tcl: Added /ignore and /unignore groupchat
	  window commands (thanks to Alexey Ignatov).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2014-02-27 07:20:46 UTC (rev 2149)
+++ trunk/tkabber/ChangeLog	2014-03-20 15:41:55 UTC (rev 2150)
@@ -1,3 +1,8 @@
+2014-03-20  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/chat/muc_ignore.tcl: Added /ignore and /unignore groupchat
+	  window commands (thanks to Alexey Ignatov).
+
 2014-02-27  Sergei Golovan  <sgolovan at nes.ru>
 
 	* ifacetk/roster.tcl: Return unavailable icon instead of unsubscribed

Modified: trunk/tkabber/plugins/chat/muc_ignore.tcl
===================================================================
--- trunk/tkabber/plugins/chat/muc_ignore.tcl	2014-02-27 07:20:46 UTC (rev 2149)
+++ trunk/tkabber/plugins/chat/muc_ignore.tcl	2014-03-20 15:41:55 UTC (rev 2150)
@@ -86,6 +86,12 @@
     # NOTE: this hook must be run earlier than client_presence_hook.
     hook::add room_nickname_changed_hook \
 	[namespace current]::trace_room_nick_change
+
+    hook::add generate_completions_hook \
+	[namespace current]::add_completions
+
+    hook::add chat_send_message_hook \
+	[namespace current]::handle_commands
 }
 
 # "Ignore tags" are used to mark whole messages posted in the room
@@ -545,6 +551,36 @@
     debugmsg mucignore "RESTORED: [string map {\u0000 |} [array names ignored]]"
 }
 
+proc mucignore::add_completions {chatid compsvar wordstart line} {
+    upvar 0 $compsvar comps
+    lappend comps "/ignore " "/unignore "
+}
+
+proc mucignore::handle_commands {chatid user body type} {
+    set xlib [chat::get_xlib $chatid]
+
+    if {[string equal -length 8 $body "/ignore "]} {
+	set nick [string range $body 8 end]
+	set jid [chat::get_jid $chatid]/$nick
+	occupant_ignore $xlib $jid $type
+
+	set msg [::msgcat::mc "%s was ignored" $nick]
+	::chat::add_message $chatid "" chat $msg {}
+
+	return stop
+    }
+    if {[string equal -length 10 $body "/unignore "]} {
+	set nick [string range $body 10 end]
+	set jid [chat::get_jid $chatid]/$nick
+	occupant_attend $xlib $jid $type
+
+	set msg [::msgcat::mc "%s was unignored" $nick]
+	::chat::add_message $chatid "" chat $msg {}
+
+	return stop
+    }
+}
+
 ########################################################################
 # MUC Ignore ruleset editor
 ########################################################################



More information about the Tkabber-dev mailing list