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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Apr 26 12:21:57 MSD 2009


Author: sergei
Date: 2009-04-26 12:21:56 +0400 (Sun, 26 Apr 2009)
New Revision: 1796

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/msgs/de.msg
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/chat/muc_ignore.tcl
   trunk/tkabber/userinfo.tcl
Log:
	* plugins/chat/logger.tcl: Fixed logging messages with empty from
	  address (thanks to Konstantin Khomoutov).

	* plugins/chat/muc_ignore.tcl, userinfo.tcl: Fixed doubling of % symbol
	  in event bindings (thanks to Konstantin Khomoutov).

	* muc.tcl: Added MUC submenu to chat windows if it corresponds to a
	  participant of a conference.

	* msgs/de.msg: Updated German translation (thanks to Roger Sondermann).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/ChangeLog	2009-04-26 08:21:56 UTC (rev 1796)
@@ -1,3 +1,16 @@
+2009-04-26  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/chat/logger.tcl: Fixed logging messages with empty from
+	  address (thanks to Konstantin Khomoutov).
+
+	* plugins/chat/muc_ignore.tcl, userinfo.tcl: Fixed doubling of % symbol
+	  in event bindings (thanks to Konstantin Khomoutov).
+
+	* muc.tcl: Added MUC submenu to chat windows if it corresponds to a
+	  participant of a conference.
+
+	* msgs/de.msg: Updated German translation (thanks to Roger Sondermann).
+
 2009-04-23  Sergei Golovan  <sgolovan at nes.ru>
 
 	* chats.tcl: Added JID argument to chat::opened procedure to make it

Modified: trunk/tkabber/msgs/de.msg
===================================================================
--- trunk/tkabber/msgs/de.msg	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/msgs/de.msg	2009-04-26 08:21:56 UTC (rev 1796)
@@ -1,6 +1,6 @@
 
 # German messages file
-# Roger Sondermann 05.04.2009
+# Roger Sondermann 17.04.2009
 
 # .../chats.tcl
 ::msgcat::mcset de "%s has changed nick to %s."                             "%s hat seinen Nicknamen geändert in %s"
@@ -513,6 +513,7 @@
 ::msgcat::mcset de "Subscriptions to pubsub nodes at %s"                    "Autorisierungen für 'Pubsub'-Knoten bei %s"
 ::msgcat::mcset de "Success"                                                "Erfolg"
 ::msgcat::mcset de "Unconfigured"                                           "Nicht konfiguriert"
+::msgcat::mcset de "Unsubscribe"                                            "Abmelden/Zurückziehen"
 
 # .../register.tcl
 ::msgcat::mcset de "Change password for %s"                                 "Kennwort für %s ändern"
@@ -1453,7 +1454,6 @@
 ::msgcat::mcset de "Unpublish user mood..."                                 "Eigene Stimmung zurückziehen..."
 ::msgcat::mcset de "Publishing is only possible while being online"         "Veröffentlichung nur möglich wenn 'Online'"
 ::msgcat::mcset de "Unpublishing is only possible while being online"       "Zurückziehen nur möglich wenn 'Online'"
-::msgcat::mcset de "Unsubscribe"                                            "Abmelden/Zurückziehen"
 ::msgcat::mcset de "Use connection:"                                        "Benutze Verbindung:"
 ::msgcat::mcset de "User mood"                                              "Stimmung"
 ::msgcat::mcset de "User mood publishing failed: %s"                        "Veröffentlichen der Stimmung misslungen: %s"
@@ -1722,7 +1722,7 @@
 ::msgcat::mcset de "Connection via proxy aborted"                           "Verbindung über Proxy abgebrochen"
 ::msgcat::mcset de "Connection via proxy timed out"                         "Wartezeit-Überschreitung bei Verbindung über Proxy"
 ::msgcat::mcset de "Date"                                                   "Datum"
-::msgcat::mcset de "Failed to conect to HTTPS proxy"                        "Verbindung zu HTTPS-Proxy misslungen"
+::msgcat::mcset de "Failed to connect to HTTPS proxy"                       "Verbindung zu HTTPS-Proxy misslungen"
 ::msgcat::mcset de "Failed to read SOCKS4a destination address"             "Lesen der SOCKS4a-Zieladresse misslungen"
 ::msgcat::mcset de "Failed to read SOCKS4a response"                        "Lesen der SOCKS4a-Antwort misslungen"
 ::msgcat::mcset de "Failed to read SOCKS5 authorization methods response"   "Lesen der SOCKS5-Autorisierungs-Methoden-Antwort misslungen"

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/muc.tcl	2009-04-26 08:21:56 UTC (rev 1796)
@@ -65,56 +65,69 @@
 
 ###############################################################################
 
-proc muc::add_groupchat_user_menu_items {m xlib jid} {
+proc muc::add_groupchat_user_menu_items {type m xlib jid} {
     set group [::xmpp::jid::stripResource $jid]
 
     if {![is_compatible $group]} return
 
+    set chatid [chat::chatid $xlib $group]
+
+    if {![chat::is_groupchat $chatid]} {
+	return
+    }
+
+    switch -- $type {
+	chat { set reschatid [chat::chatid $xlib $jid] }
+	roster { set reschatid $chatid }
+    }
+
     set mm [menu $m.muc -tearoff 0]
     $mm add command -label [::msgcat::mc "Whois"] \
-	-command [list muc::whois $xlib $jid]
+	-command [list muc::whois $xlib $jid $reschatid]
     $mm add command -label [::msgcat::mc "Kick"] \
 	-command [list muc::change_item_param \
-		      {role none} down $xlib $jid ""]
+		      {role none} down $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Ban"] \
 	-command [list muc::change_item_param \
-		      {affiliation outcast} down $xlib $jid ""]
+		      {affiliation outcast} down $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Grant Voice"] \
 	-command [list muc::change_item_param \
-		      {role participant} up $xlib $jid ""]
+		      {role participant} up $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Revoke Voice"] \
 	-command [list muc::change_item_param \
-		      {role visitor} down $xlib $jid ""]
+		      {role visitor} down $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Grant Membership"] \
 	-command [list muc::change_item_param \
-		      {affiliation member} up $xlib $jid ""]
+		      {affiliation member} up $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Revoke Membership"] \
 	-command [list muc::change_item_param \
-		      {affiliation none} down $xlib $jid ""]
+		      {affiliation none} down $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Grant Moderator Privileges"] \
 	-command [list muc::change_item_param \
-		      {role moderator} up $xlib $jid ""]
+		      {role moderator} up $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Revoke Moderator Privileges"] \
 	-command [list muc::change_item_param \
-		      {role participant} down $xlib $jid ""]
+		      {role participant} down $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Grant Admin Privileges"] \
 	-command [list muc::change_item_param \
-		      {affiliation admin} up $xlib $jid ""]
+		      {affiliation admin} up $xlib $jid "" $reschatid]
     $mm add command -label [::msgcat::mc "Revoke Admin Privileges"] \
 	-command [list muc::change_item_param \
-		      {affiliation member} down $xlib $jid ""]
+		      {affiliation member} down $xlib $jid "" $reschatid]
     #$mm add command -label [::msgcat::mc "Grant Owner Privileges"] \
     #    -command [list muc::change_item_param \
-    #    	      {affiliation owner} up $xlib $jid ""]
+    #    	      {affiliation owner} up $xlib $jid "" $reschatid]
     #$mm add command -label [::msgcat::mc "Revoke Owner Privileges"] \
     #    -command [list muc::change_item_param \
-    #		      {affiliation admin} down $xlib $jid ""]
+    #		      {affiliation admin} down $xlib $jid "" $reschatid]
 
     $m add cascade -label [::msgcat::mc "MUC"] -menu $mm
 }
 
+hook::add chat_create_user_menu_hook \
+	  [list muc::add_groupchat_user_menu_items chat] 43
 hook::add roster_create_groupchat_user_menu_hook \
-	  muc::add_groupchat_user_menu_items 39
+	  [list muc::add_groupchat_user_menu_items roster] 39
 
 ###############################################################################
 
@@ -210,7 +223,7 @@
 	return stop
     } elseif {[cequal [crange $body 0 6] "/whois "]} {
 	set nick [parse_nick $body 7]
-	whois $xlib $group/$nick
+	whois $xlib $group/$nick $chatid
 	return stop
     } elseif {[cequal [crange $body 0 6] "/voice "]} {
 	set params {role participant}
@@ -248,7 +261,7 @@
 	return
     }
     
-    change_item_param $params $dir $xlib $group/$nick $reason
+    change_item_param $params $dir $xlib $group/$nick $reason $chatid
 
     return stop
 }
@@ -306,7 +319,7 @@
     } 
 }
 
-proc muc::whois {xlib user} {
+proc muc::whois {xlib user reschatid} {
     set group [::xmpp::jid::stripResource $user]
     set chatid [chat::chatid $xlib $group]
     set nick [chat::get_nick $xlib $user groupchat]
@@ -314,10 +327,10 @@
     set real_jid [get_real_jid $xlib $user]
 
     if {$real_jid != ""} {
-	chat::add_message $chatid $group info \
+	chat::add_message $reschatid $group info \
 	    [::msgcat::mc "whois '%s': %s" $nick $real_jid] {}
     } else {
-	chat::add_message $chatid $group error \
+	chat::add_message $reschatid $group error \
 	    [::msgcat::mc "whois '%s': no info" $nick] {}
     }
 }
@@ -340,7 +353,7 @@
     expr {$idx1 - $idx2}
 }
 
-proc muc::change_item_param {params dir xlib user reason} {
+proc muc::change_item_param {params dir xlib user reason reschatid} {
     variable users
 
     set group [::xmpp::jid::stripResource $user]
@@ -353,7 +366,7 @@
 	switch -- $key/$dir {
 	    affiliation/up {
 		if {[compare_affs $aff $val] >= 0} {
-		    chat::add_message $chatid $group error \
+		    chat::add_message $reschatid $group error \
 			"affiliation $val '$nick':\
 			 [::msgcat::mc {User already %s} $aff]" {}
 		    return
@@ -361,7 +374,7 @@
 	    }
 	    affiliation/down {
 		if {[compare_affs $aff $val] <= 0} {
-		    chat::add_message $chatid $group error \
+		    chat::add_message $reschatid $group error \
 			"affiliation $val '$nick':\
 			 [::msgcat::mc {User already %s} $aff]" {}
 		    return
@@ -369,7 +382,7 @@
 	    }
 	    role/up {
 		if {[compare_roles $role $val] >= 0} {
-		    chat::add_message $chatid $group error \
+		    chat::add_message $reschatid $group error \
 			"role $val '$nick':\
 			 [::msgcat::mc {User already %s} $role]" {}
 		    return
@@ -377,7 +390,7 @@
 	    }
 	    role/down {
 		if {[compare_roles $role $val] <= 0} {
-		    chat::add_message $chatid $group error \
+		    chat::add_message $reschatid $group error \
 			"role $val '$nick':\
 			 [::msgcat::mc {User already %s} $role]" {}
 		    return
@@ -412,7 +425,7 @@
 			-xmlns $::NS(muc#admin) \
 			-subelement $item] \
 	-to $group \
-	-command [list muc::test_error_res "$params '$nick'" $xlib $group]
+	-command [list muc::test_error_res "$params '$nick'" $xlib $group $reschatid]
 }
 
 ###############################################################################
@@ -516,7 +529,7 @@
 					-subelement [::xmpp::xml::create reason \
 							    -cdata $reason]]] \
 	-to $group \
-	-command [list muc::test_error_res "destroy" $xlib $group]
+	-command [list muc::test_error_res "destroy" $xlib $group $chatid]
 }
 
 ###############################################################################
@@ -875,7 +888,7 @@
 	    -to $group \
 	    -command [list muc::test_error_res \
 			   [::msgcat::mc "Sending %s %s list" $attr $val] \
-			   $xlib $group]
+			   $xlib $group $chatid]
     }
     destroy $w
 }
@@ -964,7 +977,7 @@
 			   -subelements $restags] \
 	-to $group \
 	-command [list muc::test_error_res \
-		       [::msgcat::mc "Sending configure form"] $xlib $group]
+		       [::msgcat::mc "Sending configure form"] $xlib $group $chatid]
     destroy $w
 }
 
@@ -979,16 +992,16 @@
 			   -subelement [::xmpp::data::cancelForm]] \
 	-to $group \
 	-command [list muc::test_error_res \
-		       [::msgcat::mc "Cancelling configure form"] $xlib $group]
+		       [::msgcat::mc "Cancelling configure form"] $xlib $group $chatid]
     destroy $w
 }
 
 ###############################################################################
 
-proc muc::test_error_res {op xlib group res child} {
+proc muc::test_error_res {op xlib group reschatid res child} {
     if {![string equal $res ok]} {
 	set chatid [chat::chatid $xlib $group]
-	chat::add_message $chatid $group error \
+	chat::add_message $reschatid $group error \
 	    [format "%s: %s" $op [error_to_string $child]] {}
 	return
     }

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/plugins/chat/logger.tcl	2009-04-26 08:21:56 UTC (rev 1796)
@@ -111,6 +111,9 @@
 #############################################################################
 
 proc ::logger::jid_to_filename {jid} {
+    if {$jid == ""} {
+	set jid @@empty
+    }
     set utf8_jid [encoding convertto utf-8 $jid]
     set len [string length $utf8_jid]
     set filename ""
@@ -151,25 +154,29 @@
 #############################################################################
 
 proc ::logger::filename_to_jid {filename} {
-    set len [string length $filename]
-    set utf8_jid ""
-    for {set i 0} {$i < $len} {incr i} {
-	catch {
-	    binary scan $filename @${i}a sym
-	    switch -- $sym {
-		"%" {
-		    incr i
-		    binary scan $filename @${i}a2 num
-		    append utf8_jid [binary format c 0x$num]
-		    incr i
+    if {$filename == "@@empty"} {
+	return $filename
+    } else {
+	set len [string length $filename]
+	set utf8_jid ""
+	for {set i 0} {$i < $len} {incr i} {
+	    catch {
+		binary scan $filename @${i}a sym
+		switch -- $sym {
+		    "%" {
+			incr i
+			binary scan $filename @${i}a2 num
+			append utf8_jid [binary format c 0x$num]
+			incr i
+		    }
+		    default {
+			append utf8_jid $sym
+		    }
 		}
-		default {
-		    append utf8_jid $sym
-		}
 	    }
 	}
+	return [encoding convertfrom utf-8 $utf8_jid]
     }
-    return [encoding convertfrom utf-8 $utf8_jid]
 }
 
 #############################################################################

Modified: trunk/tkabber/plugins/chat/muc_ignore.tcl
===================================================================
--- trunk/tkabber/plugins/chat/muc_ignore.tcl	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/plugins/chat/muc_ignore.tcl	2009-04-26 08:21:56 UTC (rev 1796)
@@ -235,8 +235,8 @@
 	-command [list [namespace current]::menu_toggle_ignoring \
 		       $xlib $jid chat]
 
-    bind $m <Destroy> +[list \
-	[namespace current]::menu_cleanup_state $xlib $jid]
+    bind $m <Destroy> +[double% [list \
+	[namespace current]::menu_cleanup_state $xlib $jid]]
 }
 
 proc mucignore::menu_toggle_ignoring {xlib jid type} {

Modified: trunk/tkabber/userinfo.tcl
===================================================================
--- trunk/tkabber/userinfo.tcl	2009-04-23 15:41:15 UTC (rev 1795)
+++ trunk/tkabber/userinfo.tcl	2009-04-26 08:21:56 UTC (rev 1796)
@@ -131,9 +131,9 @@
     trace variable [namespace current]::userinfo($name,$jid) w \
 	[list userinfo::fill_user_description $g.$name userinfo($name,$jid) 0]
     bind $g.$name <Destroy> \
-	+[list trace vdelete [namespace current]::userinfo($name,$jid) w \
+	+[double% [list trace vdelete [namespace current]::userinfo($name,$jid) w \
 	       [list userinfo::fill_user_description $g.$name \
-		     userinfo($name,$jid) 0]]
+		     userinfo($name,$jid) 0]]]
 }
 
 proc userinfo::pack_spinbox {jid g row col name low high text} {
@@ -159,8 +159,8 @@
     if {$editable} {
 	upvar $tab t
 	set userinfo(focus_$tab,$jid) $w
-	bind $t <Map> "+focus \$[list [namespace current]::userinfo(focus_$tab,$jid)]"
-	bind $t <Unmap> "+set [list [namespace current]::userinfo(focus_$tab,$jid)] \[focus\]"
+	bind $t <Map> +[double% "focus \$[list [namespace current]::userinfo(focus_$tab,$jid)]"]
+	bind $t <Unmap> +[double% "set [list [namespace current]::userinfo(focus_$tab,$jid)] \[focus\]"]
     }
 }
 
@@ -330,9 +330,9 @@
 	[list userinfo::fill_user_description $a.text \
 	      userinfo(desc,$jid) $editable]
     bind $a.text <Destroy> \
-	+[list trace vdelete [namespace current]::userinfo(desc,$jid) w \
+	+[double% [list trace vdelete [namespace current]::userinfo(desc,$jid) w \
 	       [list userinfo::fill_user_description $a.text \
-		     userinfo(desc,$jid) $editable]]
+		     userinfo(desc,$jid) $editable]]]
     set userinfo(descfield,$jid) $a.text
 
     manage_focus $jid about $b.bday[expr {$editable ? "year" : ""}] $editable
@@ -397,8 +397,8 @@
 	trace variable [namespace current]::userinfo(photo_use,$jid) w \
 	    [list userinfo::enable_active_photo $p $jid]
 	bind $p <Destroy> \
-	    +[list trace vdelete [namespace current]::userinfo(photo_use,$jid) w \
-		   [list userinfo::enable_active_photo $p $jid]]
+	    +[double% [list trace vdelete [namespace current]::userinfo(photo_use,$jid) w \
+		   [list userinfo::enable_active_photo $p $jid]]]
     }
 
 



More information about the Tkabber-dev mailing list