[commit-gajim] r11237 - in branches/gajim_0.12: . data/other debian src src/common src/common/xmpp src/common/zeroconf

asterix at gajim.org asterix at gajim.org
Sat Apr 25 12:10:20 CEST 2009


Author: asterix
Date: 2009-04-25 12:10:20 +0200 (Sat, 25 Apr 2009)
New Revision: 11237

Modified:
   branches/gajim_0.12/README.html
   branches/gajim_0.12/data/other/servers.xml
   branches/gajim_0.12/debian/control
   branches/gajim_0.12/debian/copyright
   branches/gajim_0.12/src/advanced.py
   branches/gajim_0.12/src/chat_control.py
   branches/gajim_0.12/src/common/connection.py
   branches/gajim_0.12/src/common/connection_handlers.py
   branches/gajim_0.12/src/common/gajim.py
   branches/gajim_0.12/src/common/logger.py
   branches/gajim_0.12/src/common/xmpp/auth_nb.py
   branches/gajim_0.12/src/common/zeroconf/connection_zeroconf.py
   branches/gajim_0.12/src/config.py
   branches/gajim_0.12/src/conversation_textview.py
   branches/gajim_0.12/src/dialogs.py
   branches/gajim_0.12/src/filetransfers_window.py
   branches/gajim_0.12/src/gajim.py
   branches/gajim_0.12/src/groupchat_control.py
   branches/gajim_0.12/src/history_window.py
   branches/gajim_0.12/src/roster_window.py
   branches/gajim_0.12/src/session.py
   branches/gajim_0.12/src/systray.py
Log:
import bugfixes from trunk: [11164] [11165] [11167] [11169] [11172] [11176] [11177] [11178] [11179] [11181] [11182] [11183] [11184] [11188] [11189] [11191] [11192] [11193] [11194] [11195] [11196] [11212] [11213] [11215] [11217] [11219] [11220] [11222] [11224] [11226] [11227] [11232] [11233] [11235]

Fixes #4702 #4891 #4880 #4913 #4582 #4888 #4884 #4938 #4948 #4950 #4938 #4937 #4936 #3597 #4852 #4867 #4957 #4685 #4746 #4964 #4978 #4977 #4727


Modified: branches/gajim_0.12/README.html
===================================================================
--- branches/gajim_0.12/README.html	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/README.html	2009-04-25 10:10:20 UTC (rev 11237)
@@ -56,7 +56,7 @@
 <li>libxss-dev (for idle detection module; some distributions such as Debian split xscreensaver)</li>
 <li>libgtkspell-dev	(for the gtkspell module)</li>
 <li>libdbus-1-dev	(for the remote control module)</li>
-<li>intltool</li>
+<li>intltool (>= 0.40.1)</li>
 </ul>
 
 <p>
@@ -96,7 +96,7 @@
 <li>automake &gt;= 1.8 </li>
 <li>autoconf &gt;= 2.59 </li>
 <li>libtool</li>
-<li>intltool-0.35.0 </li>
+<li>intltool-0.40.1 </li>
 <li>pkgconfig &gt;= 0.19</li>
 </ul>
 </p>

Modified: branches/gajim_0.12/data/other/servers.xml
===================================================================
--- branches/gajim_0.12/data/other/servers.xml	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/data/other/servers.xml	2009-04-25 10:10:20 UTC (rev 11237)
@@ -40,6 +40,9 @@
   <item jid="aszlig.net" name="">
     <active port="5222"/>
   </item>
+  <item jid="blabla.kz" name="">
+    <active port="5222"/>
+  </item>
   <item jid="bloodyxml.com" name="Hosted by Chote Networks (http://www.chote.com)">
     <active port="5222"/>
   </item>

Modified: branches/gajim_0.12/debian/control
===================================================================
--- branches/gajim_0.12/debian/control	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/debian/control	2009-04-25 10:10:20 UTC (rev 11237)
@@ -2,7 +2,7 @@
 Section: net
 Priority: optional
 Maintainer: Yann Le Boulanger <asterix at lagaule.org>
-Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.43), python-support (>= 0.7.1), python-dev, libgtk2.0-dev, python-gtk2-dev, libgtkspell-dev, gettext (>= 0.17-4), libxss-dev, intltool, imagemagick, python-central (>= 0.5), libdbus-1-dev
+Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.43), python-support (>= 0.7.1), python-dev, libgtk2.0-dev, python-gtk2-dev, libgtkspell-dev, gettext (>= 0.17-4), libxss-dev, intltool (>= 0.40.1), imagemagick, python-central (>= 0.5), libdbus-1-dev
 Build-Conflicts: python2.3
 XS-Python-Version: >= 2.4
 Standards-Version: 3.7.3

Modified: branches/gajim_0.12/debian/copyright
===================================================================
--- branches/gajim_0.12/debian/copyright	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/debian/copyright	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1,4 +1,4 @@
-This package was debianized by Yann L.B. asterix at lagaule.org on
+This package was debianized by Yann Leboulanger asterix at lagaule.org on
 Wed, 16 Jun 2005 20:00:00 +0100.
 
 It was downloaded from:
@@ -10,12 +10,11 @@
       - Travis Shirk <travis at pobox.com>
  
 
-Copyright: (c) 2003-2006 Gajim Team
+Copyright: (c) 2003-2009 Gajim Team
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; version 3
  
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of

Modified: branches/gajim_0.12/src/advanced.py
===================================================================
--- branches/gajim_0.12/src/advanced.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/advanced.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -267,9 +267,19 @@
 				self.model.append(parent, [name, value, type_])
 
 	def visible_func(self, model, treeiter):
-		search_string  = self.entry.get_text()
-		return any(search_string in model[it][C_PREFNAME] for it in
-			tree_model_pre_order(model, treeiter) if model[it][C_TYPE] != '')
+		search_string  = self.entry.get_text().lower()
+		for it in tree_model_pre_order(model,treeiter): 
+			if model[it][C_TYPE] != '': 
+				opt_path = self.get_option_path(model, it) 
+				if len(opt_path) == 3: 
+					desc = gajim.config.get_desc_per(opt_path[2], opt_path[1], 
+						opt_path[0]) 
+				elif len(opt_path) == 1: 
+					desc = gajim.config.get_desc(opt_path[0]) 
+				if search_string in model[it][C_PREFNAME] or (desc and \
+				search_string in desc.lower()):
+					return True
+		return False
 
 	@rate_limit(3)
 	def on_advanced_entry_changed(self, widget):

Modified: branches/gajim_0.12/src/chat_control.py
===================================================================
--- branches/gajim_0.12/src/chat_control.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/chat_control.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1189,7 +1189,8 @@
 			self._add_to_roster_button.hide()
 
 		# Send file
-		if gajim.capscache.is_supported(self.contact, NS_FILE):
+		if gajim.capscache.is_supported(self.contact, NS_FILE) and \
+		self.contact.resource:
 			self._send_file_button.set_sensitive(True)
 		else:
 			self._send_file_button.set_sensitive(False)

Modified: branches/gajim_0.12/src/common/connection.py
===================================================================
--- branches/gajim_0.12/src/common/connection.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/connection.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1581,7 +1581,7 @@
 				resp.getTag('unique').getData()))
 		self.connection.SendAndCallForResponse(iq, _on_response)
 
-	def join_gc(self, nick, room_jid, password):
+	def join_gc(self, nick, room_jid, password, change_nick=False):
 		# FIXME: This room JID needs to be normalized; see #1364
 		if not self.connection:
 			return
@@ -1594,7 +1594,8 @@
 		if gajim.config.get('send_sha_in_gc_presence'):
 			p = self.add_sha(p)
 		self.add_lang(p)
-		t = p.setTag(common.xmpp.NS_MUC + ' x')
+		if not change_nick:
+			t = p.setTag(common.xmpp.NS_MUC + ' x')
 		if password:
 			t.setTagData('password', password)
 		self.connection.send(p)

Modified: branches/gajim_0.12/src/common/connection_handlers.py
===================================================================
--- branches/gajim_0.12/src/common/connection_handlers.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/connection_handlers.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1515,9 +1515,8 @@
 			self.dispatch('ROSTER_INFO', (jid, name, sub, ask, groups))
 		if not self.connection or self.connected < 2:
 			raise common.xmpp.NodeProcessed
-		server = gajim.config.get_per('accounts', self.name, 'hostname')
 		reply = common.xmpp.Iq(typ='result', attrs={'id': iq_obj.getID()},
-			to=server, frm=iq_obj.getTo(), xmlns=None)
+			to=iq_obj.getFrom(), frm=iq_obj.getTo(), xmlns=None)
 		self.connection.send(reply)
 		raise common.xmpp.NodeProcessed
 	

Modified: branches/gajim_0.12/src/common/gajim.py
===================================================================
--- branches/gajim_0.12/src/common/gajim.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/gajim.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -154,6 +154,15 @@
 # zeroconf account name
 ZEROCONF_ACC_NAME = 'Local'
 
+HAVE_ZEROCONF = True
+try:
+	import avahi
+except ImportError:
+	try:
+		import pybonjour
+	except ImportError:
+		HAVE_ZEROCONF = False
+
 HAVE_PYCRYPTO = True
 try:
 	import Crypto

Modified: branches/gajim_0.12/src/common/logger.py
===================================================================
--- branches/gajim_0.12/src/common/logger.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/logger.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -586,8 +586,12 @@
 		seconds_in_a_day = 86400 # 60 * 60 * 24
 		last_second_of_month = start_of_month + (seconds_in_a_day * max_day) - 1
 
+		# Select times and 'floor' them to time 0:00
+		# (by dividing, they are integers)
+		# and take only one of the same values (distinct)
+		# Now we have timestamps of time 0:00 of every day with logs
 		self.cur.execute('''
-			SELECT time FROM logs
+			SELECT DISTINCT time/(86400)*86400 FROM logs
 			WHERE (%s)
 			AND time BETWEEN %d AND %d
 			AND kind NOT IN (%d, %d)
@@ -596,34 +600,10 @@
 			constants.KIND_STATUS, constants.KIND_GCSTATUS))
 		result = self.cur.fetchall()
 
-		# Copy all interesting times in a temporary table
-		try:
-			self.cur.execute('CREATE TEMPORARY TABLE temp_table(time,INTEGER)')
-		except sqlite.OperationalError, e:
-			raise exceptions.PysqliteOperationalError(str(e))
+		# convert timestamps to day of month
 		for line in result:
-			self.cur.execute('''
-				INSERT INTO temp_table (time) VALUES (%d)
-				''' % (line[0]))
+			days_with_logs[0:0]=[time.gmtime(line[0])[2]]
 
-		# then search in this small temp table for each day
-		for day in xrange(1, max_day + 1):  # count from 1 to 28 or to 30 or to 31
-			start_of_day = self.get_unix_time_from_date(year, month, day)
-			last_second_of_day = start_of_day + seconds_in_a_day - 1
-
-			# just ask one row to see if we have sth for this date
-			self.cur.execute('''
-				SELECT time FROM temp_table
-				WHERE time BETWEEN %d AND %d
-				LIMIT 1
-				''' % (start_of_day, last_second_of_day))
-			result = self.cur.fetchone()
-			if result:
-				days_with_logs[0:0]=[day]
-
-		# Delete temporary table
-		self.cur.execute('DROP TABLE temp_table')
-		result = self.cur.fetchone()
 		return days_with_logs
 
 	def get_last_date_that_has_logs(self, jid, account = None, is_room = False):

Modified: branches/gajim_0.12/src/common/xmpp/auth_nb.py
===================================================================
--- branches/gajim_0.12/src/common/xmpp/auth_nb.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/xmpp/auth_nb.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -144,29 +144,32 @@
 		self.MechanismHandler()
 
 	def MechanismHandler(self):
-		if "GSSAPI" in self.mecs and have_kerberos:
-			self.mecs.remove("GSSAPI")
-			rc, self.gss_vc = kerberos.authGSSClientInit('xmpp@' +
-				self._owner.socket._hostfqdn)
-			rc = kerberos.authGSSClientStep(self.gss_vc, '')
-			response = kerberos.authGSSClientResponse(self.gss_vc)
-			node=Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'},
-                   payload=(response or ""))
-			self.mechanism = "GSSAPI"
-			self.gss_step = GSS_STATE_STEP
-		elif "DIGEST-MD5" in self.mecs:
-			self.mecs.remove("DIGEST-MD5")
+		if 'GSSAPI' in self.mecs and have_kerberos:
+			self.mecs.remove('GSSAPI')
+			try:
+				self.gss_vc = kerberos.authGSSClientInit('xmpp@' + \
+					self._owner.xmpp_hostname)[1]
+				kerberos.authGSSClientStep(self.gss_vc, '')
+				response = kerberos.authGSSClientResponse(self.gss_vc)
+				node=Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'},
+					payload=(response or ''))
+				self.mechanism = 'GSSAPI'
+				self.gss_step = GSS_STATE_STEP
+			except kerberos.GSSError, e:
+				self.DEBUG('GSSAPI authentication failed: %s' % str(e), 'warn')
+		elif 'DIGEST-MD5' in self.mecs:
+			self.mecs.remove('DIGEST-MD5')
 			node=Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'DIGEST-MD5'})
-			self.mechanism = "DIGEST-MD5"
-		elif "PLAIN" in self.mecs:
-			self.mecs.remove("PLAIN")
+			self.mechanism = 'DIGEST-MD5'
+		elif 'PLAIN' in self.mecs:
+			self.mecs.remove('PLAIN')
 			sasl_data = u'%s\x00%s\x00%s' % (self.username + '@' + \
 				self._owner.Server, self.username, self.password)
 			asl_data = sasl_data.encode('utf-8').encode('base64').replace(
 				'\n','')
 			node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'PLAIN'}, 
 				payload=[sasl_data])
-			self.mechanism = "PLAIN"
+			self.mechanism = 'PLAIN'
 		else:
 			self.startsasl='failure'
 			self.DEBUG('I can only use DIGEST-MD5, GSSAPI and PLAIN mecanisms.', 'error')
@@ -397,14 +400,17 @@
 				func=self._on_bound)
 	def _on_bound(self, resp):
 		if isResultNode(resp):
-			self.bound.append(resp.getTag('bind').getTagData('jid'))
-			self.DEBUG('Successfully bound %s.'%self.bound[-1],'ok')
-			jid=JID(resp.getTag('bind').getTagData('jid'))
-			self._owner.User=jid.getNode()
-			self._owner.Resource=jid.getResource()
-			self._owner.SendAndWaitForResponse(Protocol('iq', typ='set', 
-				payload=[Node('session', attrs={'xmlns':NS_SESSION})]), func=self._on_session)
-		elif resp:
+			if resp.getTag('bind') and resp.getTag('bind').getTagData('jid'):
+				self.bound.append(resp.getTag('bind').getTagData('jid'))
+				self.DEBUG('Successfully bound %s.'%self.bound[-1],'ok')
+				jid=JID(resp.getTag('bind').getTagData('jid'))
+				self._owner.User=jid.getNode()
+				self._owner.Resource=jid.getResource()
+				self._owner.SendAndWaitForResponse(Protocol('iq', typ='set', 
+					payload=[Node('session', attrs={'xmlns':NS_SESSION})]),
+					func=self._on_session)
+				return
+		if resp:
 			self.DEBUG('Binding failed: %s.' % resp.getTag('error'),'error')
 			self.on_bound(None)
 		else:

Modified: branches/gajim_0.12/src/common/zeroconf/connection_zeroconf.py
===================================================================
--- branches/gajim_0.12/src/common/zeroconf/connection_zeroconf.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/common/zeroconf/connection_zeroconf.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -66,8 +66,10 @@
 			self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
 		self.is_zeroconf = True
 		self.privacy_rules_supported = False
+		self.blocked_list = []
 		self.blocked_contacts = []
 		self.blocked_groups = []
+		self.blocked_all = False
 		self.status = ''
 		self.old_show = ''
 		self.priority = 0

Modified: branches/gajim_0.12/src/config.py
===================================================================
--- branches/gajim_0.12/src/config.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/config.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -394,22 +394,27 @@
 
 		# Default Status messages
 		self.default_msg_tree = self.xml.get_widget('default_msg_treeview')
+		col2 = self.default_msg_tree.rc_get_style().bg[gtk.STATE_ACTIVE]
 		# (status, translated_status, message, enabled)
 		model = gtk.ListStore(str, str, str, bool)
 		self.default_msg_tree.set_model(model)
 		col = gtk.TreeViewColumn(_('Status'))
+		col.set_resizable(True)
 		self.default_msg_tree.append_column(col)
 		renderer = gtk.CellRendererText()
 		col.pack_start(renderer, False)
 		col.set_attributes(renderer, text = 1)
 		col = gtk.TreeViewColumn(_('Default Message'))
+		col.set_resizable(True)
 		self.default_msg_tree.append_column(col)
 		renderer = gtk.CellRendererText()
 		col.pack_start(renderer, True)
 		col.set_attributes(renderer, text = 2)
 		renderer.connect('edited', self.on_default_msg_cell_edited)
 		renderer.set_property('editable', True)
+		renderer.set_property('cell-background', col2)
 		col = gtk.TreeViewColumn(_('Enabled'))
+		col.set_resizable(True)
 		self.default_msg_tree.append_column(col)
 		renderer = gtk.CellRendererToggle()
 		col.pack_start(renderer, False)
@@ -1529,8 +1534,11 @@
 		self.notebook.set_current_page(1)
 
 	def init_zeroconf_account(self):
-		enable = gajim.config.get('enable_zeroconf')
+		enable = gajim.config.get('enable_zeroconf') and gajim.HAVE_ZEROCONF
 		self.xml.get_widget('enable_zeroconf_checkbutton2').set_active(enable)
+		if not gajim.HAVE_ZEROCONF:
+			self.xml.get_widget('enable_zeroconf_checkbutton2').set_sensitive(
+				False)
 		self.xml.get_widget('zeroconf_notebook').set_sensitive(enable)
 		# General tab
 		st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME,
@@ -3143,18 +3151,6 @@
 				dialogs.ErrorDialog(pritext, str(s))
 				return
 
-			already_in_jids = []
-			for account in gajim.connections:
-				j = gajim.config.get_per('accounts', account, 'name')
-				j += '@' + gajim.config.get_per('accounts', account, 'hostname')
-				already_in_jids.append(j)
-
-			if jid in already_in_jids:
-				pritext = _('Duplicate Jabber ID')
-				sectext = _('This account is already configured in Gajim.')
-				dialogs.ErrorDialog(pritext, sectext)
-				return
-
 			self.account = server
 			i = 1
 			while self.account in gajim.connections:

Modified: branches/gajim_0.12/src/conversation_textview.py
===================================================================
--- branches/gajim_0.12/src/conversation_textview.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/conversation_textview.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1208,7 +1208,7 @@
 		if xhtml:
 			try:
 				if name and (text.startswith('/me ') or text.startswith('/me\n')):
-					xhtml = xhtml.replace('/me', '<dfn>%s</dfn>' % (name,), 1)
+					xhtml = xhtml.replace('/me', '<i>* %s</i>' % (name,), 1)
 				self.tv.display_html(xhtml.encode('utf-8'))
 				return
 			except Exception, e:

Modified: branches/gajim_0.12/src/dialogs.py
===================================================================
--- branches/gajim_0.12/src/dialogs.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/dialogs.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -218,6 +218,7 @@
 		cancelbutton.connect('clicked', self.on_cancelbutton_clicked)
 
 		self.xml.signal_autoconnect(self)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.window.show_all()
 
 		self.check = bool(checkbuttontext)
@@ -283,6 +284,7 @@
 		self.keys_treeview.set_search_column(1)
 		self.fill_tree(secret_keys, selected)
 		self.window.connect('response', self.on_dialog_response)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.window.show_all()
 
 	def sort_keys(self, model, iter1, iter2):
@@ -418,6 +420,7 @@
 			self.entry.set_text(con.activity['text'])
 
 		self.xml.signal_autoconnect(self)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.window.show_all()
 
 	def on_enable_checkbutton_toggled(self, widget):
@@ -510,6 +513,7 @@
 			self.entry.set_text(con.mood['text'])
 
 		self.xml.signal_autoconnect(self)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.window.show_all()
 
 	def on_mood_button_clicked(self, widget, data):
@@ -585,6 +589,7 @@
 			self.countdown()
 			gobject.timeout_add(1000, self.countdown)
 		self.window.connect('response', self.on_dialog_response)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.window.show_all()
 
 	def countdown(self):
@@ -986,7 +991,7 @@
 		dlg.set_transient_for(gajim.interface.roster.window)
 		dlg.set_name('Gajim')
 		dlg.set_version(gajim.version)
-		s = u'Copyright © 2003-2008 Gajim Team'
+		s = u'Copyright © 2003-2009 Gajim Team'
 		dlg.set_copyright(s)
 		copying_file_path = self.get_path('COPYING')
 		if copying_file_path:
@@ -1621,7 +1626,8 @@
 		'''accept the request'''
 		gajim.connections[self.account].send_authorization(self.jid)
 		self.window.destroy()
-		if self.jid not in gajim.contacts.get_jid_list(self.account):
+		contact = gajim.contacts.get_contact(self.account, self.jid)
+		if not contact or _('Not in Roster') in contact.groups:
 			AddNewContactWindow(self.account, self.jid, self.user_nick)
 
 	def on_contact_info_activate(self, widget):
@@ -2420,9 +2426,14 @@
 		self.tagIn = buffer.create_tag('incoming')
 		color = gajim.config.get('inmsgcolor')
 		self.tagIn.set_property('foreground', color)
+		self.tagInComment = buffer_.create_tag('in_comment')
+		self.tagInComment.set_property('foreground', color)
+
 		self.tagOut = buffer.create_tag('outgoing')
 		color = gajim.config.get('outmsgcolor')
 		self.tagOut.set_property('foreground', color)
+		self.tagOutComment = buffer_.create_tag('out_comment')
+		self.tagOutComment.set_property('foreground', color)
 
 		self.enabled = False
 
@@ -2476,6 +2487,13 @@
 		if end_rect.y <= (visible_rect.y + visible_rect.height):
 			at_the_end = True
 		end_iter = buffer.get_end_iter()
+		if kind == 'incoming':
+			buffer.insert_with_tags_by_name(end_iter, '<!-- In -->\n',
+				'in_comment')
+		elif kind == 'outgoing':
+			buffer.insert_with_tags_by_name(end_iter, '<!-- Out -->\n',
+				'out_comment')
+		end_iter = buffer.get_end_iter()
 		buffer.insert_with_tags_by_name(end_iter, stanza.replace('><', '>\n<') + \
 			'\n\n', kind)
 		if at_the_end:
@@ -2992,6 +3010,7 @@
 		self.progressbar = self.xml.get_widget('progressbar')
 		self.dialog.set_title(title_text)
 		self.dialog.set_default_size(450, 250)
+		self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 		self.dialog.show_all()
 		self.xml.signal_autoconnect(self)
 

Modified: branches/gajim_0.12/src/filetransfers_window.py
===================================================================
--- branches/gajim_0.12/src/filetransfers_window.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/filetransfers_window.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -308,7 +308,8 @@
 		file requested by a contact'''
 		if file_props is None or 'name' not in file_props:
 			return
-		sec_text = '\t' + _('File: %s') % file_props['name']
+		sec_text = '\t' + _('File: %s') % gobject.markup_escape_text(
+			file_props['name'])
 		if 'size' in file_props:
 			sec_text += '\n\t' + _('Size: %s') % \
 				helpers.convert_bytes(file_props['size'])

Modified: branches/gajim_0.12/src/gajim.py
===================================================================
--- branches/gajim_0.12/src/gajim.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/gajim.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -489,8 +489,13 @@
 		self.keyid = keyid
 		self.callbacks = []
 		self.dialog_created = False
+		self.dialog = None
 		self.completed = False
 
+	def interrupt(self):
+		self.dialog.window.destroy()
+		self.callbacks = []
+
 	def run_callback(self, account, callback):
 		gajim.connections[account].gpg_passphrase(self.passphrase)
 		callback()
@@ -546,7 +551,7 @@
 				# user failed 3 times, continue without GPG
 				self.complete(None)
 
-		dialogs.PassphraseDialog(title, second, ok_handler=(_ok, 1),
+		self.dialog = dialogs.PassphraseDialog(title, second, ok_handler=(_ok, 1),
 			cancel_handler=_cancel)
 		self.dialog_created = True
 
@@ -669,6 +674,9 @@
 				# iteration error
 				self.instances[account]['online_dialog'][name].destroy()
 				del self.instances[account]['online_dialog'][name]
+			for request in self.gpg_passphrase.values():
+				if request:
+					request.interrupt()
 		if status == 'offline':
 			# sensitivity for this menuitem
 			if gajim.get_number_of_connected_accounts() == 0:
@@ -785,6 +793,9 @@
 					# Create self contact and add to roster
 					if resource == conn.server_resource:
 						return
+					# Ignore offline presence of unknown self resource
+					if new_show < 2:
+						return
 					contact1 = gajim.contacts.create_contact(jid=ji,
 						name=gajim.nicks[account], groups=['self_contact'],
 						show=array[1], status=status_message, sub='both', ask='none',
@@ -1245,13 +1256,14 @@
 			win = self.instances[account]['infos'][array[0]]
 		elif array[0] + '/' + array[1] in self.instances[account]['infos']:
 			win = self.instances[account]['infos'][array[0] + '/' + array[1]]
+		c = gajim.contacts.get_contact(account, array[0], array[1])
+		if c: # c can be none if it's a gc contact
+			c.last_status_time = time.localtime(time.time() - tim)
+			if array[3]:
+				c.status = array[3]
+				self.roster.draw_contact(c.jid, account) # draw offline status
 		if win:
-			c = gajim.contacts.get_contact(account, array[0], array[1])
-			if c: # c can be none if it's a gc contact
-				c.last_status_time = time.localtime(time.time() - tim)
-				if array[3]:
-					c.status = array[3]
-				win.set_last_status_time()
+			win.set_last_status_time()
 		if self.remote_ctrl:
 			self.remote_ctrl.raise_signal('LastStatusTime', (account, array))
 
@@ -2358,8 +2370,15 @@
 			else:
 				self.roster.draw_contact(jid, account)
 
-		# Select the contact in roster, it's visible because it has events.
-		self.roster.select_contact(jid, account)
+		# Select the big brother contact in roster, it's visible because it has
+		# events.
+		family = gajim.contacts.get_metacontacts_family(account, jid)
+		if family:
+			nearby_family, bb_jid, bb_account = \
+				self.roster._get_nearby_family_and_big_brother(family, account)
+		else:
+			bb_jid, bb_account = jid, account
+		self.roster.select_contact(bb_jid, bb_account)
 
 	def handle_event(self, account, fjid, type_):
 		w = None
@@ -3295,7 +3314,7 @@
 		gajim.proxy65_manager = proxy65_manager.Proxy65Manager(gajim.idlequeue)
 		gajim.default_session_type = ChatControlSession
 		self.register_handlers()
-		if gajim.config.get('enable_zeroconf'):
+		if gajim.config.get('enable_zeroconf') and gajim.HAVE_ZEROCONF:
 			gajim.connections[gajim.ZEROCONF_ACC_NAME] = common.zeroconf.connection_zeroconf.ConnectionZeroconf(gajim.ZEROCONF_ACC_NAME)
 		for account in gajim.config.get_per('accounts'):
 			if not gajim.config.get_per('accounts', account, 'is_zeroconf'):

Modified: branches/gajim_0.12/src/groupchat_control.py
===================================================================
--- branches/gajim_0.12/src/groupchat_control.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/groupchat_control.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1455,7 +1455,8 @@
 					dialogs.ErrorDialog(_('Invalid nickname'),
 					_('The nickname has not allowed characters.'))
 					return True
-				gajim.connections[self.account].join_gc(nick, self.room_jid, None)
+				gajim.connections[self.account].join_gc(nick, self.room_jid, None,
+					change_nick=True)
 				self.new_nick = nick
 				self.clear(self.msg_textview)
 			else:
@@ -1736,7 +1737,8 @@
 				dialogs.ErrorDialog(_('Invalid nickname'),
 				_('The nickname has not allowed characters.'))
 				return
-			gajim.connections[self.account].join_gc(nick, self.room_jid, None)
+			gajim.connections[self.account].join_gc(nick, self.room_jid, None,
+				change_nick=True)
 			if gajim.gc_connected[self.account][self.room_jid]:
 				# We are changing nick, we will change self.nick when we receive
 				# presence that inform that it works

Modified: branches/gajim_0.12/src/history_window.py
===================================================================
--- branches/gajim_0.12/src/history_window.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/history_window.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -429,22 +429,26 @@
 					helpers.get_uf_show(show) }
 			tag_msg = 'status'
 
-		# do not do this if gcstats, avoid dupping contact_name
-		# eg. nkour: nkour is now Offline
-		if contact_name and kind != constants.KIND_GCSTATUS:
-			# add stuff before and after contact name
-			before_str = gajim.config.get('before_nickname')
-			before_str = helpers.from_one_line(before_str)
-			after_str = gajim.config.get('after_nickname')
-			after_str = helpers.from_one_line(after_str)
-			format = before_str + contact_name + after_str + ' '
-			buf.insert_with_tags_by_name(end_iter, format, tag_name)
+		if message.startswith('/me ') or message.startswith('/me\n'):
+			tag_msg = tag_name
+		else:
+			# do not do this if gcstats, avoid dupping contact_name
+			# eg. nkour: nkour is now Offline
+			if contact_name and kind != constants.KIND_GCSTATUS:
+				# add stuff before and after contact name
+				before_str = gajim.config.get('before_nickname')
+				before_str = helpers.from_one_line(before_str)
+				after_str = gajim.config.get('after_nickname')
+				after_str = helpers.from_one_line(after_str)
+				format = before_str + contact_name + after_str + ' '
+				buf.insert_with_tags_by_name(end_iter, format, tag_name)
 
 		message = message + '\n'
 		if tag_msg:
-			self.history_textview.print_real_text(message, [tag_msg])
+			self.history_textview.print_real_text(message, [tag_msg],
+				name=contact_name)
 		else:
-			self.history_textview.print_real_text(message)
+			self.history_textview.print_real_text(message, name=contact_name)
 
 	def on_query_entry_activate(self, widget):
 		text = self.query_entry.get_text()

Modified: branches/gajim_0.12/src/roster_window.py
===================================================================
--- branches/gajim_0.12/src/roster_window.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/roster_window.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -1379,7 +1379,8 @@
 		if self.dragging or not gajim.config.get('scroll_roster_to_last_message'):
 			# do not change selection while DND'ing
 			return
-		self.tree.expand_to_path(path)
+		# Expand his parent, so this path is visible, don't expand it.
+		self.tree.expand_to_path(path[:-1])
 		self.tree.scroll_to_cell(path)
 		self.tree.set_cursor(path)
 
@@ -2034,7 +2035,7 @@
 
 		# print status in chat window and update status/GPG image
 		ctrl = gajim.interface.msg_win_mgr.get_control(contact.jid, account)
-		if ctrl:
+		if ctrl and ctrl.type_id != message_control.TYPE_GC:
 			ctrl.contact = gajim.contacts.get_contact_with_highest_priority(
 				account, contact.jid)
 			ctrl.update_status_display(name, uf_show, status)
@@ -2681,7 +2682,8 @@
 				return
 			old_text = jid
 			title = _('Rename Group')
-			message = _('Enter a new name for group %s') % jid
+			message = _('Enter a new name for group %s') % \
+				gobject.markup_escape_text(jid)
 
 		def on_renamed(new_text, account, row_type, jid, old_text):
 			if 'rename' in gajim.interface.instances:

Modified: branches/gajim_0.12/src/session.py
===================================================================
--- branches/gajim_0.12/src/session.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/session.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -365,8 +365,16 @@
 				gajim.interface.roster.draw_contact(jid, self.conn.name)
 
 			gajim.interface.roster.show_title() # we show the * or [n]
-		# Select contact row in roster.
-		gajim.interface.roster.select_contact(jid, self.conn.name)
+		# Select the big brother contact in roster, it's visible because it has
+		# events.
+		family = gajim.contacts.get_metacontacts_family(self.conn.name, jid)
+		if family:
+			nearby_family, bb_jid, bb_account = \
+				gajim.interface.roster._get_nearby_family_and_big_brother(family,
+				self.conn.name)
+		else:
+			bb_jid, bb_account = jid, self.conn.name
+		gajim.interface.roster.select_contact(bb_jid, bb_account)
 
 	# ---- ESessions stuff ---
 

Modified: branches/gajim_0.12/src/systray.py
===================================================================
--- branches/gajim_0.12/src/systray.py	2009-04-23 07:26:08 UTC (rev 11236)
+++ branches/gajim_0.12/src/systray.py	2009-04-25 10:10:20 UTC (rev 11237)
@@ -322,20 +322,21 @@
 		win = gajim.interface.roster.window
 		if len(gajim.events.get_systray_events()) == 0:
 			# No pending events, so toggle visible/hidden for roster window
-			if win.get_property('visible') and (win.get_property(
-			'has-toplevel-focus')):
+			if not win.iconify_initially and (win.get_property(
+			'has-toplevel-focus') or os.name == 'nt'):
 				# visible in ANY virtual desktop?
 
 				# we could be in another VD right now. eg vd2
 				# and we want to show it in vd2
 				if not gtkgui_helpers.possibly_move_window_in_current_desktop(win):
-					win.hide() # else we hide it from VD that was visible in
+					win.set_property('skip-taskbar-hint', False)
+					win.iconify() # else we hide it from VD that was visible in
+					win.set_property('skip-taskbar-hint', True)
 			else:
-				# in Windows (perhaps other Window Managers too) minimize state
-				# is remembered, so make sure it's not minimized (iconified)
-				# because user wants to see roster
 				win.deiconify()
-				win.present()
+				if not gajim.config.get('roster_window_skip_taskbar'):
+					win.set_property('skip-taskbar-hint', False)
+				win.present_with_time(gtk.get_current_event_time())
 		else:
 			self.handle_first_event()
 



More information about the Commits mailing list