[Tkabber-dev] r924 - in trunk/tkabber: . jabberlib-tclxml plugins/chat plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Feb 11 15:40:26 MSK 2007


Author: sergei
Date: 2007-02-11 15:40:21 +0300 (Sun, 11 Feb 2007)
New Revision: 924

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/jabberlib-tclxml/jabberlib.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/plugins/chat/draw_timestamp.tcl
   trunk/tkabber/plugins/chat/irc_commands.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/general/headlines.tcl
   trunk/tkabber/plugins/general/message_archive.tcl
Log:
	* jabberlib-tclxml/jabberlib.tcl: Added jlib::x_delay command to
	  calculate message time (and to workaround a bug with timestamp
	  format in some unknown Jabber client).

	* plugins/chat/logger.tcl, plugins/chat/draw_timestamp.tcl,
	  plugins/general/message_archive.tcl, plugins/general/headlines.tcl:
	  Use jlib::x_delay command.

	* muc.tcl, plugins/chat/irc_commands.tcl: Always include <password/>
	  element when joining a conference. Otherwise it becomes impossible
	  to join a password-protected room with empty password.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/ChangeLog	2007-02-11 12:40:21 UTC (rev 924)
@@ -19,6 +19,18 @@
 	* plugins/richtext/emoticons.tcl: Fixed (mitigated) bug with crash
 	  during emoticons menu constructing.
 
+	* jabberlib-tclxml/jabberlib.tcl: Added jlib::x_delay command to
+	  calculate message time (and to workaround a bug with timestamp
+	  format in some unknown Jabber client).
+
+	* plugins/chat/logger.tcl, plugins/chat/draw_timestamp.tcl,
+	  plugins/general/message_archive.tcl, plugins/general/headlines.tcl:
+	  Use jlib::x_delay command.
+
+	* muc.tcl, plugins/chat/irc_commands.tcl: Always include <password/>
+	  element when joining a conference. Otherwise it becomes impossible
+	  to join a password-protected room with empty password.
+
 2007-02-10  Sergei Golovan  <sgolovan at nes.ru>
 
 	* pixmaps/default/services/aim*, pixmaps/default/services/gg*,

Modified: trunk/tkabber/jabberlib-tclxml/jabberlib.tcl
===================================================================
--- trunk/tkabber/jabberlib-tclxml/jabberlib.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/jabberlib-tclxml/jabberlib.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -1767,6 +1767,25 @@
 
 ######################################################################
 #
+proc jlib::x_delay {xml} {
+    foreach xelem $xml {
+	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
+	
+	if {[jlib::wrapper:getattr $vars xmlns] == "jabber:x:delay"} {
+	    # 20060717T05:29:12
+	    # 20061118T03:35:56.415699
+	    if {[regexp {\d+\d\d\d\dT\d+:\d+:\d+} \
+			[jlib::wrapper:getattr $vars stamp] \
+			stamp]} {
+		return [clock scan $stamp -gmt 1]
+	    }
+	}
+    }
+    return [clock seconds]
+}
+
+######################################################################
+#
 proc ::LOG {text} {
 #
 # For debugging purposes.

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/muc.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -1310,9 +1310,8 @@
     request_negotiation $connid $group
 
     set x_subtags {}
-    if {$password != ""} {
-	lappend x_subtags [jlib::wrapper:createtag password -chdata $password]
-    }
+
+    lappend x_subtags [jlib::wrapper:createtag password -chdata $password]
     set muc_password($chatid) $password
 
     set history_vars {}

Modified: trunk/tkabber/plugins/chat/draw_timestamp.tcl
===================================================================
--- trunk/tkabber/plugins/chat/draw_timestamp.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/plugins/chat/draw_timestamp.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -19,19 +19,12 @@
 
     set chatw [chat::chat_win $chatid]
 
-    set seconds [clock seconds]
-    set format $options(timestamp_format)
-
-    set seconds1 [clock scan "-23 hours 59 minutes" -base $seconds]
-    foreach xelem $x {
-	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
-	
-	if {[cequal [jlib::wrapper:getattr $vars xmlns] jabber:x:delay]} {
-	    set seconds [clock scan [jlib::wrapper:getattr $vars stamp] -gmt 1]
-	    if {$seconds <= $seconds1} {
-		set format $options(delayed_timestamp_format)
-	    }
-	}
+    set seconds [jlib::x_delay $x]
+    set seconds1 [clock scan "-23 hours 59 minutes" -base [clock seconds]]
+    if {$seconds <= $seconds1} {
+	set format $options(delayed_timestamp_format)
+    } else {
+	set format $options(timestamp_format)
     }
 
     $chatw insert end [clock format $seconds -format $format]

Modified: trunk/tkabber/plugins/chat/irc_commands.tcl
===================================================================
--- trunk/tkabber/plugins/chat/irc_commands.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/plugins/chat/irc_commands.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -58,12 +58,12 @@
 	nick {
 	    if {![cequal $type groupchat]} return
 	    if {$chat::chats(status,$chatid) == "disconnected"} {
-		if {[info exists muc::muc_password($chatid)]} {
-		    muc::join_group $connid $jid $nick \
-				    $muc::muc_password($chatid)
+		if {[info exists ::muc::muc_password($chatid)]} {
+		    set password $::muc::muc_password($chatid)
 		} else {
-		    muc::join_group $connid $jid $nick
+		    set password ""
 		}
+		muc::join_group $connid $jid $nick $password
 		debugmsg plugins "NICK -> JOIN: $nick"
 	    } else {
 		muc::change_nick $chatid $nick

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/plugins/chat/logger.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -194,7 +194,7 @@
 
     set nick [chat::get_nick $connid $from $type]
 
-    set seconds [clock seconds]
+    set seconds [jlib::x_delay $x]
     foreach xelem $x {
 	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
 	
@@ -204,9 +204,6 @@
 		[cequal [jlib::wrapper:getattr $vars xmlns] tkabber:x:nolog]} {
 	    return
 	}
-	if {[cequal [jlib::wrapper:getattr $vars xmlns] jabber:x:delay]} {
-	    set seconds [clock scan [jlib::wrapper:getattr $vars stamp] -gmt 1]
-	}
     }
     set ts [clock format $seconds -format "%Y%m%dT%H%M%S" -gmt 1]
     set year [clock format $seconds -format %Y]

Modified: trunk/tkabber/plugins/general/headlines.tcl
===================================================================
--- trunk/tkabber/plugins/general/headlines.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/plugins/general/headlines.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -225,7 +225,7 @@
 
     set desc ""
     set url ""
-    set seconds [clock seconds]
+    set seconds [jlib::x_delay $x]
     foreach extra $x {
         jlib::wrapper:splitxml $extra tag vars isempty chdata children
 	switch -- [jlib::wrapper:getattr $vars xmlns] {
@@ -241,10 +241,6 @@
 		    }
 		}
 	    }
-	    jabber:x:delay {
-		set stamp [jlib::wrapper:getattr $vars stamp]
-		catch { set seconds [clock scan $stamp -gmt 1] }
-	    }
 	}
     }
 

Modified: trunk/tkabber/plugins/general/message_archive.tcl
===================================================================
--- trunk/tkabber/plugins/general/message_archive.tcl	2007-02-11 11:42:44 UTC (rev 923)
+++ trunk/tkabber/plugins/general/message_archive.tcl	2007-02-11 12:40:21 UTC (rev 924)
@@ -33,14 +33,7 @@
 proc ::message_archive::log_message {from to subject body x} {
     variable archive_file
 
-    set seconds [clock seconds]
-    foreach xelem $x {
-	jlib::wrapper:splitxml $xelem tag vars isempty chdata children
-	
-	if {[cequal [jlib::wrapper:getattr $vars xmlns] jabber:x:delay]} {
-	    set seconds [clock scan [jlib::wrapper:getattr $vars stamp] -gmt 1]
-	}
-    }
+    set seconds [jlib::x_delay $x]
     set ts [clock format $seconds -format "%Y%m%dT%H%M%S"]
 
     set fd [open $archive_file a]



More information about the Tkabber-dev mailing list