[Tkabber-dev] r120 - trunk/plugins/singularity

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Aug 19 02:30:37 MSD 2008


Author: kostix
Date: 2008-08-19 02:30:36 +0400 (Tue, 19 Aug 2008)
New Revision: 120

Modified:
   trunk/plugins/singularity/singularity.tcl
Log:
singularity/singularity.tcl:
 * Reimplemented using open_chat_pre hook instead of
   process_message_hook -- this allows to handle both kinds of
   chat openings: local and remote.
 * Leading comment clarified.


Modified: trunk/plugins/singularity/singularity.tcl
===================================================================
--- trunk/plugins/singularity/singularity.tcl	2008-08-18 21:56:02 UTC (rev 119)
+++ trunk/plugins/singularity/singularity.tcl	2008-08-18 22:30:36 UTC (rev 120)
@@ -3,31 +3,26 @@
 # this plugin checks whether any chats with the message originator's
 # other full JIDs are currently opened and closes them all, if any.
 # In other words, it ensures that only one chat window per bare
-# JID is opened.
+# JID is opened at any given time.
 # Written by Konstantin Khomoutov <flatworm at users.sourceforge.net>
 # See license.terms for the terms of distribution.
 # See README for usage details.
 
 namespace eval singularity {
-	# Must be run after code processing chat events and stuff
-	# but before default message handler.
-	hook::add process_message_hook \
-		[namespace current]::process_message 55
+	hook::add open_chat_pre_hook \
+		[namespace current]::process_new_chat_opening
 }
 
-proc singularity::process_message {connid from id type
-		is_subject subject body err thread priority x} {
+proc singularity::process_new_chat_opening {chatid type} {
 	if {![string equal $type chat]} return
 
-	set chatid [chat::chatid $connid $from]
-	if {[chat::is_opened $chatid] || $body == ""} return
-
+	set from [chat::get_jid $chatid]
 	set barejid [node_and_server_from_jid $from]
 
 	if {$ifacetk::options(use_tabbar)} {
 		foreach page [.nb pages] {
 			upvar #0 chat::chat_id([ifacetk::nbpath $page]) cid 
-			if {![info exists cid] || [chat::is_groupchat $cid]} continue
+			if {![info exists cid]} continue
 			set jid [chat::get_jid $cid]
 			if {![string equal $from $jid] &&
 					[string equal $barejid [node_and_server_from_jid $jid]]} {
@@ -39,5 +34,6 @@
 	} else {
 		# TODO implement this for windowed interface
 	}
+
 }
 



More information about the Tkabber-dev mailing list