[Tkabber-dev] r2068 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Jan 20 22:13:55 MSK 2014


Author: sergei
Date: 2014-01-20 22:13:55 +0400 (Mon, 20 Jan 2014)
New Revision: 2068

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/messages.tcl
Log:
	* messages.tcl: Don't send the message if its destination JID is
	  rewritten into an emty string in rewrite_outgoing_message_hook.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2014-01-20 15:07:43 UTC (rev 2067)
+++ trunk/tkabber/ChangeLog	2014-01-20 18:13:55 UTC (rev 2068)
@@ -1,3 +1,8 @@
+2014-01-20  Sergei Golovan  <sgolovan at nes.ru>
+
+	* messages.tcl: Don't send the message if its destination JID is
+	  rewritten into an emty string in rewrite_outgoing_message_hook.
+
 2014-01-19  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/chat/open_window.tcl: Open a chat (and not a groupchat)

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2014-01-20 15:07:43 UTC (rev 2067)
+++ trunk/tkabber/messages.tcl	2014-01-20 18:13:55 UTC (rev 2068)
@@ -521,22 +521,26 @@
     hook::run rewrite_outgoing_message_hook \
 	      xlib to id type subject body err thread x
 
-    set command [list ::xmpp::sendMessage $xlib $to]
+    if {![string equal $to ""]} {
+	# To abort sending the hook has to rewrite to jid to empty string
 
-    if {[info exists from]}    { lappend command -from $from }
-    if {[info exists type]}    { lappend command -type $type }
-    if {[info exists id]}      { lappend command -id $id }
-    if {[info exists subject]} { lappend command -subject $subject }
-    if {[info exists thread]}  { lappend command -thread $thread }
-    if {[info exists body]}    { lappend command -body $body }
-    if {[info exists err]}     { lappend command -error $err }
-    if {[info exists x]}       { lappend command -xlist $x }
+	set command [list ::xmpp::sendMessage $xlib $to]
 
-    eval $command
+	if {[info exists from]}    { lappend command -from $from }
+	if {[info exists type]}    { lappend command -type $type }
+	if {[info exists id]}      { lappend command -id $id }
+	if {[info exists subject]} { lappend command -subject $subject }
+	if {[info exists thread]}  { lappend command -thread $thread }
+	if {[info exists body]}    { lappend command -body $body }
+	if {[info exists err]}     { lappend command -error $err }
+	if {[info exists x]}       { lappend command -xlist $x }
 
-    if {(![info exists type] || $type == "normal") && $log_body != ""} {
-        ::message_archive::log_message [connection_jid $xlib] \
-				       $to $log_subject $log_body $x
+	eval $command
+
+	if {(![info exists type] || $type == "normal") && $log_body != ""} {
+	    ::message_archive::log_message [connection_jid $xlib] \
+					   $to $log_subject $log_body $x
+	}
     }
 
     return [list success $x]



More information about the Tkabber-dev mailing list