[Tkabber-dev] r327 - trunk/plugins/bldjid

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Wed Mar 31 03:56:17 MSD 2010


Author: bigote
Date: 2010-03-31 03:56:16 +0400 (Wed, 31 Mar 2010)
New Revision: 327

Modified:
   trunk/plugins/bldjid/ChangeLog
   trunk/plugins/bldjid/bldjid.tcl
Log:
Added some initial caps hashes gathering (at the moment for testing only, it's not functional yet).
Timestamp format changed from Tkabber's standard one (available to change in ::plugins::options(timestamp_format) to %Y-%m-%d_%H:%M:%S


Modified: trunk/plugins/bldjid/ChangeLog
===================================================================
--- trunk/plugins/bldjid/ChangeLog	2010-03-28 17:44:30 UTC (rev 326)
+++ trunk/plugins/bldjid/ChangeLog	2010-03-30 23:56:16 UTC (rev 327)
@@ -1,3 +1,16 @@
+2010-03-31  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
+
+--- Version 0.9.9.3 of the plugin.
+
+--- Files modified:
+    bldjid.tcl, ChangeLog.
+
+--- Changes:
+	Started work on caps hash collection. Added saving this information
+	to a separate file $::configdir/bldjidver.txt for testing reasons.
+	Changed timestamp format from that you set by the option
+	::plugins::options(timestamp_format) to %Y-%m-%d_%H:%M:%S
+
 2010-03-28  Serge Yudin  <xmpp:bigote at jabber.ru> <mailto:bigote at gmail.com>
 
 --- Version 0.9.9.2 of the plugin.

Modified: trunk/plugins/bldjid/bldjid.tcl
===================================================================
--- trunk/plugins/bldjid/bldjid.tcl	2010-03-28 17:44:30 UTC (rev 326)
+++ trunk/plugins/bldjid/bldjid.tcl	2010-03-30 23:56:16 UTC (rev 327)
@@ -1,4 +1,4 @@
-# "Bldjid" plugin for Tkabber. 2010-03-28 v. 0.9.9.2
+# "Bldjid" plugin for Tkabber. 2010-03-28 v. 0.9.9.3
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # See README or README.ru file for usage.
 
@@ -118,6 +118,8 @@
 	[namespace current]::smart_enter_exit_message 69
 	hook::add room_nickname_changed_hook \
 	[namespace current]::bridge2_smart_enter_exit_message 100
+	hook::add client_presence_hook \
+	[namespace current]::caps_collector 100
 }
 
 proc bldjid::unload {} {
@@ -135,6 +137,8 @@
 	[namespace current]::smart_enter_exit_message 69
 	hook::remove room_nickname_changed_hook \
 	[namespace current]::bridge2_smart_enter_exit_message 100
+	hook::remove client_presence_hook \
+	[namespace current]::caps_collector 100
 
 	catch {unset ent_cntr}
 	catch {unset user_list}
@@ -191,7 +195,7 @@
 			}
 			set xlib [::chat::get_xlib $chatid]
 			set ts [clock format [clock seconds] \
-				-format $::plugins::options(timestamp_format)]
+				-format {%Y-%m-%d_%H:%M:%S}]
 			set real_jid [::muc::get_real_jid $xlib $group/$nick]
 			set bare_jid [::xmpp::jid::stripResource $real_jid]
 			if {$options(strip_resource)} {
@@ -1351,3 +1355,25 @@
 		incr i
 	}
 }
+
+# Taken from Clienticons plugin, thanks to Jet <megaxbit at xmpp.ru>!
+proc bldjid::caps_collector {xlib jid type x args} {
+	variable jidver
+	foreach xdata $x {
+		if {[::xmpp::xml::getAttr $xdata c] == "http://jabber.org/protocol/caps"} {
+			::xmpp::xml::split $xdata tag xmlns attrs cdata subels
+			set jidver($jid) [::xmpp::xml::getAttr $attrs ver]
+			set jidnodes($jid) [::xmpp::xml::getAttr $attrs node]
+[namespace current]::save_jidvers_to_file $jid $jidver($jid) $jidnodes($jid)
+puts "jidver: $jid -- $jidnodes($jid) -- $jidver($jid)"
+			return
+		}
+	}
+}
+
+proc bldjid::save_jidvers_to_file {jid ver node} {
+	set filename "$::configdir/bldjidver1.txt"
+	set f [open $filename a+]
+	puts $f "\n[clock format [clock seconds] -format {%Y-%m-%d_%H:%M:%S}]\tjid: $jid\tnode: $node\tver: $ver"
+	close $f
+}



More information about the Tkabber-dev mailing list