[Tkabber-dev] r1901 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sat Jan 30 17:31:54 MSK 2010


Author: sergei
Date: 2010-01-30 17:31:54 +0300 (Sat, 30 Jan 2010)
New Revision: 1901

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/chats.tcl
   trunk/tkabber/muc.tcl
Log:
	* chats.tcl: Fixed changing chat partners status icons and messages
	  in chat windows.

	* muc.tcl: Don't add status message when leaving room if it's empty.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2010-01-30 14:04:53 UTC (rev 1900)
+++ trunk/tkabber/ChangeLog	2010-01-30 14:31:54 UTC (rev 1901)
@@ -27,6 +27,11 @@
 
 	* muc.tcl: Fixed reporting nickname change.
 
+	* chats.tcl: Fixed changing chat partners status icons and messages
+	  in chat windows.
+
+	* muc.tcl: Don't add status message when leaving room if it's empty.
+
 2010-01-28  Sergei Golovan  <sgolovan at nes.ru>
 
 	* userinfo.tcl: Do not add TYPE element to PHOTO vCard item if it

Modified: trunk/tkabber/chats.tcl
===================================================================
--- trunk/tkabber/chats.tcl	2010-01-30 14:04:53 UTC (rev 1900)
+++ trunk/tkabber/chats.tcl	2010-01-30 14:31:54 UTC (rev 1901)
@@ -979,21 +979,22 @@
 
 ###############################################################################
 
-proc chat::change_presence {chatid jid nick status args} {
-    variable chats
+proc chat::change_presence {xlib jid type x args} {
     variable options
     global statusdesc
 
-    set xlib [get_xlib $chatid]
-    set group [get_jid $chatid]
-
-    if {[is_opened $chatid] && [is_groupchat $chatid]} {
-	debugmsg chat "ST: $chatid $jid $status"
-	if {$nick == ""} {
-	    return
+    switch -- $type {
+	error -
+	unavailable { set status $type }
+	available {
+	    set status available
+	    foreach {key val} $args {
+		switch -- $key {
+		    -show { set status [normalize_show $val] }
+		}
+	    }
 	}
-
-	chat::redraw_roster_after_idle $chatid
+	default { return }
     }
 
     # This case traces both chat and private groupchat conversations:
@@ -1034,8 +1035,18 @@
     }
 }
 
+hook::add client_presence_hook chat::change_presence 70
+
 ###############################################################################
 
+proc chat::process_roster_event {chatid jid nick status args} {
+    debugmsg chat "ROSTER: $chatid $jid $nick $status"
+
+    if {[string equal $nick ""]} return
+
+    chat::redraw_roster_after_idle $chatid
+}
+
 namespace eval chat {
     variable g2l
     array set g2l [list 1 [::msgcat::mc "Moderators"] \

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2010-01-30 14:04:53 UTC (rev 1900)
+++ trunk/tkabber/muc.tcl	2010-01-30 14:31:54 UTC (rev 1901)
@@ -1578,7 +1578,7 @@
 	set tokens($chatid) \
 	    [::xmpp::muc::new $xlib $group \
 		    -eventcommand [list muc::report_muc_event $chatid] \
-		    -rostercommand [list chat::change_presence $chatid]]
+		    -rostercommand [list chat::process_roster_event $chatid]]
     }
 
     privacy::add_to_special_list $xlib conference [::xmpp::jid::server $group]
@@ -1645,7 +1645,11 @@
     debugmsg conference "LEAVE_GROUP: $chatid"
 
     if {[info exists tokens($chatid)]} {
-	::xmpp::muc::leave $tokens($chatid) -status $status
+	if {![string equal $status ""]} {
+	    ::xmpp::muc::leave $tokens($chatid) -status $status
+	} else {
+	    ::xmpp::muc::leave $tokens($chatid)
+	}
     }
 }
 



More information about the Tkabber-dev mailing list