[Tkabber-dev] r1151 - in trunk/tkabber: . msgs

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Jul 10 13:17:13 MSD 2007


Author: sergei
Date: 2007-07-10 13:17:13 +0400 (Tue, 10 Jul 2007)
New Revision: 1151

Modified:
   trunk/tkabber/msgs/ru.msg
   trunk/tkabber/muc.tcl
Log:
	* muc.tcl, msgs/ru.msg: Applied forgotten patch.


Modified: trunk/tkabber/msgs/ru.msg
===================================================================
--- trunk/tkabber/msgs/ru.msg	2007-07-09 17:10:45 UTC (rev 1150)
+++ trunk/tkabber/msgs/ru.msg	2007-07-10 09:17:13 UTC (rev 1151)
@@ -438,11 +438,13 @@
 ::msgcat::mcset ru "Full-text search" "Полнотекстовый поиск"
 ::msgcat::mcset ru "Generate chat messages when chat peer changes his/her status and/or status message" \
     "Генерировать сообщения о том, что собеседник сменил своё присутствие или статусное сообщение."
-::msgcat::mcset ru "Generate groupchat messages when occupant changes his/her status and/or status message" \
+::msgcat::mcset ru "Generate groupchat messages when occupant changes his/her status and/or status message." \
     "Генерировать сообщения о том, что участник конференции сменил своё присутствие или статусное сообщение."
 ::msgcat::mcset ru "Generate status messages when occupants enter/exit MUC compatible conference rooms." \
     "Генерировать статусные сообщения о входе/выходе участников в MUC-конференциях."
 ::msgcat::mcset ru "Generate enter/exit messages" "Генерирование сообщений о входе/выходе"
+::msgcat::mcset ru "Generate groupchat messages when occupant's room position (affiliation and/or role) changes." \
+	"Генерировать сообщения о том, что положение, занимаемое участником конференции (его ранг и/или роль), изменились."
 ::msgcat::mcset ru "Geographical position" "Географическое расположение"
 ::msgcat::mcset ru "general plugins" "общие плагины"
 ::msgcat::mcset ru "Generic IQ" "Общий IQ-запрос"
@@ -1489,7 +1491,20 @@
 ::msgcat::mcset ru "Your new Tkabber config directory is now:\n%s\nYou can delete the old one:\n%s" \
     "Новая директория с настройками Tkabber'а:\n%s\nВы можете удалить старую:\n%s"
 ::msgcat::mcset ru "Zip:" "Индекс:"
+::msgcat::mcset ru "%s has been assigned a new affiliation: %s" "%s присвоен ранг: %s"
+::msgcat::mcset ru "%s has been assigned a new role: %s" "%s получил роль: %s"
+::msgcat::mcset ru "%s has been assigned a new room position: %s/%s" "%s занимает положение: %s/%s"
+::msgcat::mcset ru "as %s/%s" "в качестве %s/%s"
+::msgcat::mcset ru "admin" "админ"
+::msgcat::mcset ru "member" "член"
+::msgcat::mcset ru "moderator" "модератор"
+::msgcat::mcset ru "none" "нет"
+::msgcat::mcset ru "outcast" "изгой"
+::msgcat::mcset ru "owner" "владелец"
+::msgcat::mcset ru "participant" "участник"
+::msgcat::mcset ru "visitor" "посетитель"
 
+
 namespace eval :: {
 
 proc load_russian_procs {} {

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-07-09 17:10:45 UTC (rev 1150)
+++ trunk/tkabber/muc.tcl	2007-07-10 09:17:13 UTC (rev 1151)
@@ -12,8 +12,12 @@
 	-type boolean -group Chat
     custom::defvar options(gen_muc_status_change_msgs) 0 \
 	[::msgcat::mc "Generate groupchat messages when occupant\
-	    changes his/her status and/or status message"] \
+	    changes his/her status and/or status message."] \
 	-type boolean -group Chat
+    custom::defvar options(gen_muc_position_change_msgs) 0 \
+	[::msgcat::mc "Generate groupchat messages when occupant's\
+	    room position (affiliation and/or role) changes."] \
+	-type boolean -group Chat
     custom::defvar options(propose_configure) 0 \
 	[::msgcat::mc "Propose to configure newly created MUC room.\
 		       If set to false then the default room configuration\
@@ -38,6 +42,18 @@
 	-type boolean -group IQ
 }
 
+# MUC affiliations (for translation):
+# [::msgcat::mc "owner"]
+# [::msgcat::mc "admin"]
+# [::msgcat::mc "member"]
+# [::msgcat::mc "outcast"]
+# [::msgcat::mc "none"]
+# MUC roles (for translation):
+# [::msgcat::mc "moderator"]
+# [::msgcat::mc "participant"]
+# [::msgcat::mc "visitor"]
+# (yet another "none" omitted)
+
 ###############################################################################
 
 set ::NS(muc)       http://jabber.org/protocol/muc
@@ -972,8 +988,8 @@
 	    item {
 		if {$type != "unavailable"} {
 		    set users(jid,$connid,$user) [jlib::wrapper:getattr $vars jid]
-		    set users(role,$connid,$user) [jlib::wrapper:getattr $vars role]
-		    set users(affiliation,$connid,$user) \
+		    track_room_position $connid $user \
+			[jlib::wrapper:getattr $vars role] \
 			[jlib::wrapper:getattr $vars affiliation]
 		} else {
 		    set new_nick [jlib::wrapper:getattr $vars nick]
@@ -1139,6 +1155,7 @@
 
 proc muc::report_available {chatid nick entered} {
     variable options
+    variable users
     variable ignore_available
 
     set connid [::chat::get_connid $chatid]
@@ -1161,6 +1178,11 @@
 	    set occupant $nick
 	}
 	set msg [format [::msgcat::mc "%s has entered"] $occupant]
+	if {$options(gen_muc_position_change_msgs)} {
+	    append msg " " [::msgcat::mc "as %s/%s" \
+		[::msgcat::mc $users(affiliation,$connid,$jid)] \
+		[::msgcat::mc $users(role,$connid,$jid)]]
+	}
     }
     catch { unset ignore_available }
 
@@ -1181,6 +1203,50 @@
     ::chat::add_message $chatid $group groupchat $msg {}
 }
 
+proc muc::track_room_position {connid jid role affiliation} {
+    variable options
+    variable users
+
+    upvar 0 users(role,$connid,$jid) _role \
+	users(affiliation,$connid,$jid) _aff
+
+    set group  [node_and_server_from_jid $jid]
+    if {![is_compatible $group]} return
+
+    set chatid [chat::chatid $connid $group]
+
+    if {[chat::is_opened $chatid] && $options(gen_muc_position_change_msgs)} {
+	set nick [chat::get_nick $connid $jid groupchat]
+
+	set role_changed [expr {![info exists _role] \
+	    || ![string equal $role $_role]}]
+	set aff_changed  [expr {![info exists _aff] \
+	    || ![string equal $affiliation $_aff]}]
+
+	if {$aff_changed} {
+	    if {$role_changed} {
+		set msg [::msgcat::mc "%s has been assigned a new room position: %s/%s" \
+		    $nick [::msgcat::mc $affiliation] [::msgcat::mc $role]]
+	    } else {
+		set msg [::msgcat::mc "%s has been assigned a new affiliation: %s" \
+		    $nick [::msgcat::mc $affiliation]]
+	    }
+	} elseif {$role_changed} {
+	    set msg [::msgcat::mc "%s has been assigned a new role: %s" \
+		$nick [::msgcat::mc $role]]
+	} else {
+	    set msg ""
+	}
+
+	if {$msg != ""} {
+	    ::chat::add_message $chatid $group groupchat $msg {}
+	}
+    }
+
+    set _aff  $affiliation
+    set _role $role
+}
+
 ###############################################################################
 
 proc muc::change_nick {chatid nick} {



More information about the Tkabber-dev mailing list