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

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Jan 30 14:29:02 MSK 2014


Author: sergei
Date: 2014-01-30 14:29:02 +0400 (Thu, 30 Jan 2014)
New Revision: 2122

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/chat/logger.tcl
Log:
	* plugins/chat/logger.tcl: Store 'me' attribute in log files and
	  use it to show the user's own messages.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2014-01-30 10:07:50 UTC (rev 2121)
+++ trunk/tkabber/ChangeLog	2014-01-30 10:29:02 UTC (rev 2122)
@@ -1,3 +1,8 @@
+2014-01-30  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/chat/logger.tcl: Store 'me' attribute in log files and
+	  use it to show the user's own messages.
+
 2014-01-27  Sergei Golovan  <sgolovan at nes.ru>
 
 	* gpgme.tcl, presence.tcl: Fixed checking message signature in case

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2014-01-30 10:07:50 UTC (rev 2121)
+++ trunk/tkabber/plugins/chat/logger.tcl	2014-01-30 10:29:02 UTC (rev 2122)
@@ -213,6 +213,11 @@
     }
 
     set nick [chat::get_nick $xlib $from $type]
+    if {[::xmpp::jid::equal $from [my_jid $xlib $jid]]} {
+	set me 1
+    } else {
+	set me 0
+    }
 
     set seconds [::xmpp::xml::getAttr [::xmpp::delay::parse $x] seconds]
     foreach xelem $x {
@@ -231,7 +236,7 @@
     file mkdir [file join $options(logdir) $year $month]
     set fd [cdopen [file join $options(logdir) $year $month [jid_to_filename $jid]] a]
     fconfigure $fd -encoding utf-8
-    puts $fd [str_to_log [list timestamp $ts jid $from nick $nick body $body]]
+    puts $fd [str_to_log [list timestamp $ts jid $from nick $nick body $body me $me]]
     close $fd
 }
 
@@ -453,7 +458,7 @@
 		set servertag server
 	    } else {
 		set nick $tmp(nick)
-		if {[string equal $nick $mynick]} {
+		if {([info exists tmp(me)] && $tmp(me)) || [string equal $nick $mynick]} {
 		    set tag me
 		} else {
 		    set tag they
@@ -609,7 +614,7 @@
 				    -cdata $timestamp]
 	}
 	if {[info exists tmp(nick)] && $tmp(nick) != ""} {
-	    if {$tmp(nick) == $mynick} {
+	    if {([info exists tmp(me)] && $tmp(me)) || $tmp(nick) == $mynick} {
 	        set tag me
 	    } else {
 	        set tag they



More information about the Tkabber-dev mailing list