unite room and server name resulting in a room jid interface [so it aligns with add new contact]. fixes #2504
This commit is contained in:
		
							parent
							
								
									4797fcce88
								
							
						
					
					
						commit
						8dfb1a5a66
					
				
					 11 changed files with 107 additions and 193 deletions
				
			
		| 
						 | 
				
			
			@ -17,6 +17,7 @@
 | 
			
		|||
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
 | 
			
		||||
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
 | 
			
		||||
  <property name="focus_on_map">True</property>
 | 
			
		||||
  <property name="urgency_hint">False</property>
 | 
			
		||||
  <signal name="destroy" handler="on_join_groupchat_window_destroy" last_modification_time="Wed, 02 Mar 2005 12:20:14 GMT"/>
 | 
			
		||||
  <signal name="key_press_event" handler="on_join_groupchat_window_key_press_event" last_modification_time="Tue, 05 Apr 2005 13:13:40 GMT"/>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,58 +30,14 @@
 | 
			
		|||
      <child>
 | 
			
		||||
	<widget class="GtkTable" id="table15">
 | 
			
		||||
	  <property name="visible">True</property>
 | 
			
		||||
	  <property name="n_rows">5</property>
 | 
			
		||||
	  <property name="n_rows">4</property>
 | 
			
		||||
	  <property name="n_columns">2</property>
 | 
			
		||||
	  <property name="homogeneous">False</property>
 | 
			
		||||
	  <property name="row_spacing">6</property>
 | 
			
		||||
	  <property name="column_spacing">12</property>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkEntry" id="password_entry">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="can_focus">True</property>
 | 
			
		||||
	      <property name="editable">True</property>
 | 
			
		||||
	      <property name="visibility">False</property>
 | 
			
		||||
	      <property name="max_length">0</property>
 | 
			
		||||
	      <property name="text" translatable="yes"></property>
 | 
			
		||||
	      <property name="has_frame">True</property>
 | 
			
		||||
	      <property name="invisible_char">*</property>
 | 
			
		||||
	      <property name="activates_default">True</property>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">1</property>
 | 
			
		||||
	      <property name="right_attach">2</property>
 | 
			
		||||
	      <property name="top_attach">4</property>
 | 
			
		||||
	      <property name="bottom_attach">5</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkEntry" id="server_entry">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="can_focus">True</property>
 | 
			
		||||
	      <property name="editable">True</property>
 | 
			
		||||
	      <property name="visibility">True</property>
 | 
			
		||||
	      <property name="max_length">0</property>
 | 
			
		||||
	      <property name="text" translatable="yes"></property>
 | 
			
		||||
	      <property name="has_frame">True</property>
 | 
			
		||||
	      <property name="invisible_char">*</property>
 | 
			
		||||
	      <property name="activates_default">True</property>
 | 
			
		||||
	      <signal name="key_press_event" handler="on_server_entry_key_press_event" last_modification_time="Fri, 25 Nov 2005 22:09:39 GMT"/>
 | 
			
		||||
	      <signal name="changed" handler="on_required_entry_changed" last_modification_time="Sat, 14 Jan 2006 21:51:55 GMT"/>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">1</property>
 | 
			
		||||
	      <property name="right_attach">2</property>
 | 
			
		||||
	      <property name="top_attach">3</property>
 | 
			
		||||
	      <property name="bottom_attach">4</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkEntry" id="room_entry">
 | 
			
		||||
	    <widget class="GtkEntry" id="room_jid_entry">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="can_focus">True</property>
 | 
			
		||||
	      <property name="has_focus">True</property>
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +48,6 @@
 | 
			
		|||
	      <property name="has_frame">True</property>
 | 
			
		||||
	      <property name="invisible_char">*</property>
 | 
			
		||||
	      <property name="activates_default">True</property>
 | 
			
		||||
	      <signal name="key_press_event" handler="on_room_entry_key_press_event" last_modification_time="Fri, 25 Nov 2005 22:07:30 GMT"/>
 | 
			
		||||
	      <signal name="changed" handler="on_required_entry_changed" last_modification_time="Sat, 14 Jan 2006 21:51:39 GMT"/>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
| 
						 | 
				
			
			@ -125,62 +81,6 @@
 | 
			
		|||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkLabel" id="label145">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="label" translatable="yes">Password:</property>
 | 
			
		||||
	      <property name="use_underline">False</property>
 | 
			
		||||
	      <property name="use_markup">False</property>
 | 
			
		||||
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
 | 
			
		||||
	      <property name="wrap">False</property>
 | 
			
		||||
	      <property name="selectable">False</property>
 | 
			
		||||
	      <property name="xalign">0</property>
 | 
			
		||||
	      <property name="yalign">0.5</property>
 | 
			
		||||
	      <property name="xpad">0</property>
 | 
			
		||||
	      <property name="ypad">0</property>
 | 
			
		||||
	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 | 
			
		||||
	      <property name="width_chars">-1</property>
 | 
			
		||||
	      <property name="single_line_mode">False</property>
 | 
			
		||||
	      <property name="angle">0</property>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">0</property>
 | 
			
		||||
	      <property name="right_attach">1</property>
 | 
			
		||||
	      <property name="top_attach">4</property>
 | 
			
		||||
	      <property name="bottom_attach">5</property>
 | 
			
		||||
	      <property name="x_options">fill</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkLabel" id="label144">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="label" translatable="yes">Server:</property>
 | 
			
		||||
	      <property name="use_underline">False</property>
 | 
			
		||||
	      <property name="use_markup">False</property>
 | 
			
		||||
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
 | 
			
		||||
	      <property name="wrap">False</property>
 | 
			
		||||
	      <property name="selectable">False</property>
 | 
			
		||||
	      <property name="xalign">0</property>
 | 
			
		||||
	      <property name="yalign">0.5</property>
 | 
			
		||||
	      <property name="xpad">0</property>
 | 
			
		||||
	      <property name="ypad">0</property>
 | 
			
		||||
	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 | 
			
		||||
	      <property name="width_chars">-1</property>
 | 
			
		||||
	      <property name="single_line_mode">False</property>
 | 
			
		||||
	      <property name="angle">0</property>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">0</property>
 | 
			
		||||
	      <property name="right_attach">1</property>
 | 
			
		||||
	      <property name="top_attach">3</property>
 | 
			
		||||
	      <property name="bottom_attach">4</property>
 | 
			
		||||
	      <property name="x_options">fill</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkLabel" id="label143">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
| 
						 | 
				
			
			@ -281,6 +181,55 @@
 | 
			
		|||
	      <property name="y_options">fill</property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkLabel" id="label145">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="label" translatable="yes">Password:</property>
 | 
			
		||||
	      <property name="use_underline">False</property>
 | 
			
		||||
	      <property name="use_markup">False</property>
 | 
			
		||||
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
 | 
			
		||||
	      <property name="wrap">False</property>
 | 
			
		||||
	      <property name="selectable">False</property>
 | 
			
		||||
	      <property name="xalign">0</property>
 | 
			
		||||
	      <property name="yalign">0.5</property>
 | 
			
		||||
	      <property name="xpad">0</property>
 | 
			
		||||
	      <property name="ypad">0</property>
 | 
			
		||||
	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 | 
			
		||||
	      <property name="width_chars">-1</property>
 | 
			
		||||
	      <property name="single_line_mode">False</property>
 | 
			
		||||
	      <property name="angle">0</property>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">0</property>
 | 
			
		||||
	      <property name="right_attach">1</property>
 | 
			
		||||
	      <property name="top_attach">3</property>
 | 
			
		||||
	      <property name="bottom_attach">4</property>
 | 
			
		||||
	      <property name="x_options">fill</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
 | 
			
		||||
	  <child>
 | 
			
		||||
	    <widget class="GtkEntry" id="password_entry">
 | 
			
		||||
	      <property name="visible">True</property>
 | 
			
		||||
	      <property name="can_focus">True</property>
 | 
			
		||||
	      <property name="editable">True</property>
 | 
			
		||||
	      <property name="visibility">False</property>
 | 
			
		||||
	      <property name="max_length">0</property>
 | 
			
		||||
	      <property name="text" translatable="yes"></property>
 | 
			
		||||
	      <property name="has_frame">True</property>
 | 
			
		||||
	      <property name="invisible_char">*</property>
 | 
			
		||||
	      <property name="activates_default">True</property>
 | 
			
		||||
	    </widget>
 | 
			
		||||
	    <packing>
 | 
			
		||||
	      <property name="left_attach">1</property>
 | 
			
		||||
	      <property name="right_attach">2</property>
 | 
			
		||||
	      <property name="top_attach">3</property>
 | 
			
		||||
	      <property name="bottom_attach">4</property>
 | 
			
		||||
	      <property name="y_options"></property>
 | 
			
		||||
	    </packing>
 | 
			
		||||
	  </child>
 | 
			
		||||
	</widget>
 | 
			
		||||
	<packing>
 | 
			
		||||
	  <property name="padding">0</property>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -969,14 +969,15 @@ class Connection(ConnectionHandlers):
 | 
			
		|||
		p = self.add_sha(p, ptype != 'unavailable')
 | 
			
		||||
		self.connection.send(p)
 | 
			
		||||
 | 
			
		||||
	def join_gc(self, nick, room, server, password):
 | 
			
		||||
	def join_gc(self, nick, room_jid, password):
 | 
			
		||||
		# FIXME: This room JID needs to be normalized; see #1364
 | 
			
		||||
		if not self.connection:
 | 
			
		||||
			return
 | 
			
		||||
		show = helpers.get_xmpp_show(STATUS_LIST[self.connected])
 | 
			
		||||
		if show == 'invisible':
 | 
			
		||||
			# Never join a room when invisible
 | 
			
		||||
			return
 | 
			
		||||
		p = common.xmpp.Presence(to = '%s@%s/%s' % (room, server, nick),
 | 
			
		||||
		p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick),
 | 
			
		||||
			show = show, status = self.status)
 | 
			
		||||
		if gajim.config.get('send_sha_in_gc_presence'):
 | 
			
		||||
			p = self.add_sha(p)
 | 
			
		||||
| 
						 | 
				
			
			@ -985,12 +986,11 @@ class Connection(ConnectionHandlers):
 | 
			
		|||
			t.setTagData('password', password)
 | 
			
		||||
		self.connection.send(p)
 | 
			
		||||
		#last date/time in history to avoid duplicate
 | 
			
		||||
		# FIXME: This JID needs to be normalized; see #1364
 | 
			
		||||
		jid='%s@%s' % (room, server)
 | 
			
		||||
		last_log = gajim.logger.get_last_date_that_has_logs(jid, is_room = True)
 | 
			
		||||
		last_log = gajim.logger.get_last_date_that_has_logs(room_jid,
 | 
			
		||||
			is_room = True)
 | 
			
		||||
		if last_log is None:
 | 
			
		||||
			last_log = 0
 | 
			
		||||
		self.last_history_line[jid]= last_log
 | 
			
		||||
		self.last_history_line[room_jid]= last_log
 | 
			
		||||
 | 
			
		||||
	def send_gc_message(self, jid, msg, xhtml = None):
 | 
			
		||||
		if not self.connection:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,10 +137,10 @@ def get_nick_from_fjid(jid):
 | 
			
		|||
	# gaim@conference.jabber.no/nick/nick-continued
 | 
			
		||||
	return jid.split('/', 1)[1]
 | 
			
		||||
 | 
			
		||||
def get_room_name_and_server_from_room_jid(jid):
 | 
			
		||||
	room_name = get_nick_from_jid(jid)
 | 
			
		||||
def get_name_and_server_from_jid(jid):
 | 
			
		||||
	name = get_nick_from_jid(jid)
 | 
			
		||||
	server = get_server_from_jid(jid)
 | 
			
		||||
	return room_name, server
 | 
			
		||||
	return name, server
 | 
			
		||||
 | 
			
		||||
def get_room_and_nick_from_fjid(jid):
 | 
			
		||||
	# fake jid is the jid for a contact in a room
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2846,7 +2846,7 @@ class AccountCreationWizardWindow:
 | 
			
		|||
				self.account = server + str(i)
 | 
			
		||||
				i += 1
 | 
			
		||||
 | 
			
		||||
			username, server = gajim.get_room_name_and_server_from_room_jid(jid)
 | 
			
		||||
			username, server = gajim.get_name_and_server_from_jid(jid)
 | 
			
		||||
			self.save_account(username, server, savepass, password)
 | 
			
		||||
			self.cancel_button.hide()
 | 
			
		||||
			self.back_button.hide()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -430,17 +430,15 @@ class ConversationTextview:
 | 
			
		|||
	def on_start_chat_activate(self, widget, jid):
 | 
			
		||||
		gajim.interface.roster.new_chat_from_jid(self.account, jid)
 | 
			
		||||
 | 
			
		||||
	def on_join_group_chat_menuitem_activate(self, widget, jid):
 | 
			
		||||
		room, server = jid.split('@')
 | 
			
		||||
	def on_join_group_chat_menuitem_activate(self, widget, room_jid):
 | 
			
		||||
		if gajim.interface.instances[self.account].has_key('join_gc'):
 | 
			
		||||
			instance = gajim.interface.instances[self.account]['join_gc']
 | 
			
		||||
			instance.xml.get_widget('server_entry').set_text(server)
 | 
			
		||||
			instance.xml.get_widget('room_entry').set_text(room)
 | 
			
		||||
			instance.xml.get_widget('room_jid_entry').set_text(room_jid)
 | 
			
		||||
			gajim.interface.instances[self.account]['join_gc'].window.present()
 | 
			
		||||
		else:
 | 
			
		||||
			try:
 | 
			
		||||
				gajim.interface.instances[self.account]['join_gc'] = \
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, server, room)
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, room_jid)
 | 
			
		||||
			except RuntimeError:
 | 
			
		||||
				pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -511,7 +511,7 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 | 
			
		|||
			if type_ == 'jabber':
 | 
			
		||||
				self.uid_entry.set_text(jid)
 | 
			
		||||
			else:
 | 
			
		||||
				uid, transport = gajim.get_room_name_and_server_from_room_jid(jid)
 | 
			
		||||
				uid, transport = gajim.get_name_and_server_from_jid(jid)
 | 
			
		||||
				self.uid_entry.set_text(uid.replace('%', '@', 1))
 | 
			
		||||
			#set protocol_combobox
 | 
			
		||||
			model = self.protocol_combobox.get_model()
 | 
			
		||||
| 
						 | 
				
			
			@ -1081,15 +1081,14 @@ class SubscriptionRequestWindow:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class JoinGroupchatWindow:
 | 
			
		||||
	def __init__(self, account, server = '', room = '', nick = '',
 | 
			
		||||
	automatic = False):
 | 
			
		||||
	def __init__(self, account, room_jid = '', nick = '', automatic = False):
 | 
			
		||||
		'''automatic is a dict like {'invities': []}
 | 
			
		||||
		If automatic is not empty, this means room must be automaticaly configured
 | 
			
		||||
		and when done, invities must be automatically invited'''
 | 
			
		||||
		if server and room:
 | 
			
		||||
			jid = room + '@' + server
 | 
			
		||||
			if jid in gajim.gc_connected[account] and gajim.gc_connected[account][jid]:
 | 
			
		||||
				ErrorDialog(_('You are already in room %s') % jid)
 | 
			
		||||
		if room_jid != '':
 | 
			
		||||
			if room_jid in gajim.gc_connected[account] and\
 | 
			
		||||
			gajim.gc_connected[account][room_jid]:
 | 
			
		||||
				ErrorDialog(_('You are already in room %s') % room_jid)
 | 
			
		||||
				raise RuntimeError, 'You are already in this room'
 | 
			
		||||
		self.account = account
 | 
			
		||||
		self.automatic = automatic
 | 
			
		||||
| 
						 | 
				
			
			@ -1097,16 +1096,18 @@ class JoinGroupchatWindow:
 | 
			
		|||
			nick = gajim.nicks[self.account]
 | 
			
		||||
		if gajim.connections[account].connected < 2:
 | 
			
		||||
			ErrorDialog(_('You are not connected to the server'),
 | 
			
		||||
_('You can not join a group chat unless you are connected.'))
 | 
			
		||||
				_('You can not join a group chat unless you are connected.'))
 | 
			
		||||
			raise RuntimeError, 'You must be connected to join a groupchat'
 | 
			
		||||
 | 
			
		||||
		self._empty_required_widgets = []
 | 
			
		||||
 | 
			
		||||
		self.xml = gtkgui_helpers.get_glade('join_groupchat_window.glade')
 | 
			
		||||
		self.window = self.xml.get_widget('join_groupchat_window')
 | 
			
		||||
		self.xml.get_widget('server_entry').set_text(server)
 | 
			
		||||
		self.xml.get_widget('room_entry').set_text(room)
 | 
			
		||||
		self.xml.get_widget('nickname_entry').set_text(nick)
 | 
			
		||||
		self._room_jid_entry = self.xml.get_widget('room_jid_entry')
 | 
			
		||||
		self._nickname_entry = self.xml.get_widget('nickname_entry')
 | 
			
		||||
		
 | 
			
		||||
		self._room_jid_entry.set_text(room_jid)
 | 
			
		||||
		self._nickname_entry.set_text(nick)
 | 
			
		||||
		self.xml.signal_autoconnect(self)
 | 
			
		||||
		gajim.interface.instances[account]['join_gc'] = self #now add us to open windows
 | 
			
		||||
		if len(gajim.connections) > 1:
 | 
			
		||||
| 
						 | 
				
			
			@ -1126,18 +1127,13 @@ _('You can not join a group chat unless you are connected.'))
 | 
			
		|||
			self.recently_combobox.append_text(g)
 | 
			
		||||
		if len(self.recently_groupchat) == 0:
 | 
			
		||||
			self.recently_combobox.set_sensitive(False)
 | 
			
		||||
		elif server == '' and room == '':
 | 
			
		||||
		elif room_jid == '':
 | 
			
		||||
			self.recently_combobox.set_active(0)
 | 
			
		||||
			self.xml.get_widget('room_entry').select_region(0, -1)
 | 
			
		||||
		elif room and server:
 | 
			
		||||
			self._room_jid_entry.select_region(0, -1)
 | 
			
		||||
		elif room_jid != '':
 | 
			
		||||
			self.xml.get_widget('join_button').grab_focus()
 | 
			
		||||
 | 
			
		||||
		self._server_entry = self.xml.get_widget('server_entry')
 | 
			
		||||
		self._room_entry = self.xml.get_widget('room_entry')
 | 
			
		||||
		self._nickname_entry = self.xml.get_widget('nickname_entry')
 | 
			
		||||
		if not self._server_entry.get_text():
 | 
			
		||||
			self._empty_required_widgets.append(self._server_entry)
 | 
			
		||||
		if not self._room_entry.get_text():
 | 
			
		||||
		if not self._room_jid_entry.get_text():
 | 
			
		||||
			self._empty_required_widgets.append(self._room_entry)
 | 
			
		||||
		if not self._nickname_entry.get_text():
 | 
			
		||||
			self._empty_required_widgets.append(self._nickname_entry)
 | 
			
		||||
| 
						 | 
				
			
			@ -1165,27 +1161,11 @@ _('You can not join a group chat unless you are connected.'))
 | 
			
		|||
				if len(self._empty_required_widgets) == 0:
 | 
			
		||||
					self.xml.get_widget('join_button').set_sensitive(True)
 | 
			
		||||
 | 
			
		||||
	def on_room_entry_key_press_event(self, widget, event):
 | 
			
		||||
		# Check for pressed @ and jump to server_entry if found
 | 
			
		||||
		if event.keyval == gtk.keysyms.at:
 | 
			
		||||
			self.xml.get_widget('server_entry').grab_focus()
 | 
			
		||||
			return True
 | 
			
		||||
 | 
			
		||||
	def on_server_entry_key_press_event(self, widget, event):
 | 
			
		||||
		# If backspace is pressed in empty server_entry, return to the room entry
 | 
			
		||||
		backspace = event.keyval == gtk.keysyms.BackSpace
 | 
			
		||||
		server_entry = self.xml.get_widget('server_entry')
 | 
			
		||||
		empty = len(server_entry.get_text()) == 0
 | 
			
		||||
		if backspace and empty:
 | 
			
		||||
			self.xml.get_widget('room_entry').grab_focus()
 | 
			
		||||
			return True
 | 
			
		||||
 | 
			
		||||
	def on_recently_combobox_changed(self, widget):
 | 
			
		||||
		model = widget.get_model()
 | 
			
		||||
		iter = widget.get_active_iter()
 | 
			
		||||
		gid = model[iter][0].decode('utf-8')
 | 
			
		||||
		self.xml.get_widget('room_entry').set_text(gid.split('@')[0])
 | 
			
		||||
		self.xml.get_widget('server_entry').set_text(gid.split('@')[1])
 | 
			
		||||
		iter_ = widget.get_active_iter()
 | 
			
		||||
		room_jid = model[iter_][0].decode('utf-8')
 | 
			
		||||
		self._room_jid_entry.set_text(room_jid)
 | 
			
		||||
 | 
			
		||||
	def on_cancel_button_clicked(self, widget):
 | 
			
		||||
		'''When Cancel button is clicked'''
 | 
			
		||||
| 
						 | 
				
			
			@ -1193,30 +1173,29 @@ _('You can not join a group chat unless you are connected.'))
 | 
			
		|||
 | 
			
		||||
	def on_join_button_clicked(self, widget):
 | 
			
		||||
		'''When Join button is clicked'''
 | 
			
		||||
		nickname = self.xml.get_widget('nickname_entry').get_text().decode(
 | 
			
		||||
			'utf-8')
 | 
			
		||||
		room = self.xml.get_widget('room_entry').get_text().decode('utf-8')
 | 
			
		||||
		server = self.xml.get_widget('server_entry').get_text().decode('utf-8')
 | 
			
		||||
		nickname = self._nickname_entry.get_text().decode('utf-8')
 | 
			
		||||
		room_jid = self._room_jid_entry.get_text().decode('utf-8')
 | 
			
		||||
		password = self.xml.get_widget('password_entry').get_text().decode(
 | 
			
		||||
			'utf-8')
 | 
			
		||||
		jid = '%s@%s' % (room, server)
 | 
			
		||||
		try:
 | 
			
		||||
			jid = helpers.parse_jid(jid)
 | 
			
		||||
			room_jid = helpers.parse_jid(room_jid)
 | 
			
		||||
		except:
 | 
			
		||||
			ErrorDialog(_('Invalid room or server name'),
 | 
			
		||||
				_('The room name or server name has not allowed characters.'))
 | 
			
		||||
			ErrorDialog(_('Invalid room Jabber ID'),
 | 
			
		||||
				_('The room Jabber ID has not allowed characters.'))
 | 
			
		||||
			return
 | 
			
		||||
 | 
			
		||||
		if jid in self.recently_groupchat:
 | 
			
		||||
			self.recently_groupchat.remove(jid)
 | 
			
		||||
		self.recently_groupchat.insert(0, jid)
 | 
			
		||||
		if room_jid in self.recently_groupchat:
 | 
			
		||||
			self.recently_groupchat.remove(room_jid)
 | 
			
		||||
		self.recently_groupchat.insert(0, room_jid)
 | 
			
		||||
		if len(self.recently_groupchat) > 10:
 | 
			
		||||
			self.recently_groupchat = self.recently_groupchat[0:10]
 | 
			
		||||
		gajim.config.set('recently_groupchat', ' '.join(self.recently_groupchat))
 | 
			
		||||
		gajim.config.set('recently_groupchat',
 | 
			
		||||
			' '.join(self.recently_groupchat))
 | 
			
		||||
 | 
			
		||||
		if self.automatic:
 | 
			
		||||
			gajim.automatic_rooms[self.account][jid] = self.automatic
 | 
			
		||||
		gajim.interface.roster.join_gc_room(self.account, jid, nickname, password)
 | 
			
		||||
			gajim.automatic_rooms[self.account][room_jid] = self.automatic
 | 
			
		||||
		gajim.interface.roster.join_gc_room(self.account, room_jid, nickname,
 | 
			
		||||
			password)
 | 
			
		||||
 | 
			
		||||
		self.window.destroy()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2194,9 +2173,8 @@ class InvitationReceivedDialog:
 | 
			
		|||
	
 | 
			
		||||
	def on_accept_button_clicked(self, widget):
 | 
			
		||||
		self.dialog.destroy()
 | 
			
		||||
		room, server = gajim.get_room_name_and_server_from_room_jid(self.room_jid)
 | 
			
		||||
		try:
 | 
			
		||||
			JoinGroupchatWindow(self.account, server = server, room = room)
 | 
			
		||||
			JoinGroupchatWindow(self.account, self.room_jid)
 | 
			
		||||
		except RuntimeError:
 | 
			
		||||
			pass
 | 
			
		||||
			
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								src/disco.py
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/disco.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1191,15 +1191,9 @@ class ToplevelAgentBrowser(AgentBrowser):
 | 
			
		|||
		if not iter:
 | 
			
		||||
			return
 | 
			
		||||
		service = model[iter][0].decode('utf-8')
 | 
			
		||||
		if service.find('@') != -1:
 | 
			
		||||
			services = service.split('@', 1)
 | 
			
		||||
			room = services[0]
 | 
			
		||||
			service = services[1]
 | 
			
		||||
		else:
 | 
			
		||||
			room = ''
 | 
			
		||||
		if not gajim.interface.instances[self.account].has_key('join_gc'):
 | 
			
		||||
			try:
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, service, room)
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, service)
 | 
			
		||||
			except RuntimeError:
 | 
			
		||||
				pass
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			@ -1502,7 +1496,8 @@ class MucBrowser(AgentBrowser):
 | 
			
		|||
		self.vadj = self.window.services_scrollwin.get_property('vadjustment')
 | 
			
		||||
		self.vadj_cbid = self.vadj.connect('value-changed', self.on_scroll)
 | 
			
		||||
		# And to size changes
 | 
			
		||||
		self.size_cbid = self.window.services_scrollwin.connect('size-allocate', self.on_scroll)
 | 
			
		||||
		self.size_cbid = self.window.services_scrollwin.connect(
 | 
			
		||||
			'size-allocate', self.on_scroll)
 | 
			
		||||
 | 
			
		||||
	def _clean_treemodel(self):
 | 
			
		||||
		if self.size_cbid:
 | 
			
		||||
| 
						 | 
				
			
			@ -1531,15 +1526,10 @@ class MucBrowser(AgentBrowser):
 | 
			
		|||
		if not iter:
 | 
			
		||||
			return
 | 
			
		||||
		service = model[iter][0].decode('utf-8')
 | 
			
		||||
		if service.find('@') != -1:
 | 
			
		||||
			services = service.split('@', 1)
 | 
			
		||||
			room = services[0]
 | 
			
		||||
			service = services[1]
 | 
			
		||||
		else:
 | 
			
		||||
			room = model[iter][1].decode('utf-8')
 | 
			
		||||
		if 'join_gc' not in gajim.interface.instances[self.account]:
 | 
			
		||||
			try:
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, service, room)
 | 
			
		||||
				room_jid = '%s@%s' % (service, room)
 | 
			
		||||
				dialogs.JoinGroupchatWindow(self.account, service)
 | 
			
		||||
			except RuntimeError:
 | 
			
		||||
				pass
 | 
			
		||||
		else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1370,12 +1370,11 @@ class Interface:
 | 
			
		|||
			if gajim.gc_connected[account].has_key(room_jid) and\
 | 
			
		||||
					gajim.gc_connected[account][room_jid]:
 | 
			
		||||
				continue
 | 
			
		||||
			room, server = gajim.get_room_name_and_server_from_room_jid(room_jid)
 | 
			
		||||
			nick = gc_control.nick
 | 
			
		||||
			password = ''
 | 
			
		||||
			if gajim.gc_passwords.has_key(room_jid):
 | 
			
		||||
				password = gajim.gc_passwords[room_jid]
 | 
			
		||||
			gajim.connections[account].join_gc(nick, room, server, password)
 | 
			
		||||
			gajim.connections[account].join_gc(nick, room_jid, password)
 | 
			
		||||
 | 
			
		||||
	def handle_event_metacontacts(self, account, tags_list):
 | 
			
		||||
		gajim.contacts.define_metacontacts(account, tags_list)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -924,7 +924,7 @@ class GroupchatControl(ChatControlBase):
 | 
			
		|||
		self.draw_contact(nick)
 | 
			
		||||
		self.draw_avatar(nick)
 | 
			
		||||
		# Do not ask avatar to irc rooms as irc transports reply with messages
 | 
			
		||||
		r, server = gajim.get_room_name_and_server_from_room_jid(self.room_jid)
 | 
			
		||||
		server = gajim.get_server_from_jid(self.room_jid)
 | 
			
		||||
		if gajim.config.get('ask_avatars_on_startup') and \
 | 
			
		||||
		not server.startswith('irc'):
 | 
			
		||||
			fjid = self.room_jid + '/' + nick
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,7 +228,7 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
 | 
			
		|||
				text = message
 | 
			
		||||
			elif message_type == 'pm': # private message
 | 
			
		||||
				event_type = _('New Private Message')
 | 
			
		||||
				room_name, t = gajim.get_room_name_and_server_from_room_jid(jid)
 | 
			
		||||
				room_name = gajim.get_nick_from_jid(jid)
 | 
			
		||||
				img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
 | 
			
		||||
					'priv_msg_recv.png')
 | 
			
		||||
				title = _('New Private Message from room %s') % room_name
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1572,7 +1572,7 @@ class RosterWindow:
 | 
			
		|||
				try:
 | 
			
		||||
					gajim.interface.instances[account]['join_gc'] = \
 | 
			
		||||
						dialogs.JoinGroupchatWindow(account,
 | 
			
		||||
							server = gajim.connections[account].muc_jid[type_],
 | 
			
		||||
							gajim.connections[account].muc_jid[type_],
 | 
			
		||||
							automatic = {'invities': jid_list})
 | 
			
		||||
				except RuntimeError:
 | 
			
		||||
					continue
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue