[Tkabber-dev] r1741 - trunk/tkabber/plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Mar 20 18:41:21 MSK 2009


Author: sergei
Date: 2009-03-20 18:41:19 +0300 (Fri, 20 Mar 2009)
New Revision: 1741

Added:
   trunk/tkabber/plugins/general/flip.tcl
Log:
	* Temporarily added flip plugin.


Added: trunk/tkabber/plugins/general/flip.tcl
===================================================================
--- trunk/tkabber/plugins/general/flip.tcl	                        (rev 0)
+++ trunk/tkabber/plugins/general/flip.tcl	2009-03-20 15:41:19 UTC (rev 1741)
@@ -0,0 +1,101 @@
+# Written by Serge Yudin xmpp:bigote at jabber.ru
+# Modified by Sergei Golovan
+# The idea and original JavaScript are from http://fliptitle.com/
+# $Id$
+
+namespace eval flip {
+    # Some letters are added compared to the original table version.
+    # For example, capital letters, cyrillic letters.
+
+    variable flipTable {
+	a \u0250
+	b q
+	c \u0254
+	d p
+	e \u01DD
+	f \u025F
+	g \u0183
+	h \u0265
+	i \u0131
+	j \u027E
+	k \u029E
+	l l
+	m \u026F
+	n u
+	r \u0279
+	t \u0287
+	v \u028C
+	w \u028D
+	y \u028E
+	\. \u02D9
+	\[ \]
+	\( \)
+	\{ \}
+	\? \u00BF
+	\! \u00A1
+	\' \,
+	\< \>
+	\_ \u203E
+	\; \u061B
+	\u203F \u2040
+	\u2045 \u2046
+	\u2234 \u2235
+	\r \n
+	A \u2200
+	C \u0186
+	D \u15E1
+	P \u0500
+	R \u1D1A
+	\u0430 \u0250
+	\u0431 g
+	\u0433 \u0279
+	\u0435 \u01DD
+	\u0438 n
+	\u043A \u029E
+	\u043B v
+	\u043C w
+	\u043F \u0446
+	\u0440 d
+	\u0441 \u0254
+	\u0443 \u028E
+	\u0447 \u04BB
+	\u0448 m
+	\u044C q
+	\u044D \u0454
+	\u044F \u0281
+	f \u025F
+	h \u0265
+	i \u0131
+	j \u027E
+	t \u0287
+	\u0411 g
+	\u0427 \u04BA
+	\u0420 \u0500
+	\u0421 \u0186
+    }
+}
+
+proc flip::flipping {nick} {
+    variable flipTable
+
+    set seconds [clock seconds]
+
+    # Probability of flipping is 50% at April, 1st
+    if {[clock format $seconds -format %m/%d] == "04/01" && [expr rand()] < 0.5} {
+	set newnick ""
+	set map [string map $flipTable $nick]
+	for {set i 0} {$i < [string length $map]} {incr i} {
+	    append newnick [string index $map end-$i]
+	}
+	return $newnick
+    } else {
+	return $nick
+    }
+}
+
+rename ::muc::join_group ::muc::join_group:saved
+
+proc ::muc::join_group {xlib group nick {password ""}} {
+    ::muc::join_group:saved $xlib $group [::plugins::flip::flipping $nick] $password
+}
+


Property changes on: trunk/tkabber/plugins/general/flip.tcl
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native



More information about the Tkabber-dev mailing list