we can now register to a transport in add contact window is server has such a transport. Fixes #1944
This commit is contained in:
		
							parent
							
								
									1c9b21d9d8
								
							
						
					
					
						commit
						57aeb0d0ef
					
				
					 5 changed files with 54 additions and 1 deletions
				
			
		| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
  <property name="focus_on_map">True</property>
 | 
					  <property name="focus_on_map">True</property>
 | 
				
			||||||
  <property name="urgency_hint">False</property>
 | 
					  <property name="urgency_hint">False</property>
 | 
				
			||||||
  <signal name="key_press_event" handler="on_add_new_contact_window_key_press_event" last_modification_time="Thu, 28 Apr 2005 12:59:51 GMT"/>
 | 
					  <signal name="key_press_event" handler="on_add_new_contact_window_key_press_event" last_modification_time="Thu, 28 Apr 2005 12:59:51 GMT"/>
 | 
				
			||||||
 | 
					  <signal name="destroy" handler="on_add_new_contact_window_destroy" last_modification_time="Mon, 31 Jul 2006 16:45:22 GMT"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <child>
 | 
					  <child>
 | 
				
			||||||
    <widget class="GtkVBox" id="vbox8">
 | 
					    <widget class="GtkVBox" id="vbox8">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +85,8 @@ class Connection(ConnectionHandlers):
 | 
				
			||||||
		self.retrycount = 0
 | 
							self.retrycount = 0
 | 
				
			||||||
		self.jids_for_auto_auth = [] # list of jid to auto-authorize
 | 
							self.jids_for_auto_auth = [] # list of jid to auto-authorize
 | 
				
			||||||
		self.muc_jid = None
 | 
							self.muc_jid = None
 | 
				
			||||||
 | 
							self.available_transports = {} # list of available transports on this
 | 
				
			||||||
 | 
							# server {'icq': 'icq.server.com', }
 | 
				
			||||||
		self.vcard_supported = True
 | 
							self.vcard_supported = True
 | 
				
			||||||
	# END __init__
 | 
						# END __init__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -755,6 +755,8 @@ class ConnectionDisco:
 | 
				
			||||||
				gajim.proxy65_manager.resolve(jid, self.connection, self.name)
 | 
									gajim.proxy65_manager.resolve(jid, self.connection, self.name)
 | 
				
			||||||
			if features.__contains__(common.xmpp.NS_MUC) and is_muc:
 | 
								if features.__contains__(common.xmpp.NS_MUC) and is_muc:
 | 
				
			||||||
				self.muc_jid = jid
 | 
									self.muc_jid = jid
 | 
				
			||||||
 | 
								if transport_type:
 | 
				
			||||||
 | 
									self.available_transports[transport_type] = jid
 | 
				
			||||||
		self.dispatch('AGENT_INFO_INFO', (jid, node, identities,
 | 
							self.dispatch('AGENT_INFO_INFO', (jid, node, identities,
 | 
				
			||||||
			features, data))
 | 
								features, data))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -413,6 +413,15 @@ class AddNewContactWindow:
 | 
				
			||||||
				self.account = account
 | 
									self.account = account
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			accounts = [self.account]
 | 
								accounts = [self.account]
 | 
				
			||||||
 | 
							if self.account:
 | 
				
			||||||
 | 
								location = gajim.interface.instances[self.account]
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								location = gajim.interface.instances
 | 
				
			||||||
 | 
							if location.has_key('add_contact'):
 | 
				
			||||||
 | 
								location['add_contact'].window.present()
 | 
				
			||||||
 | 
								# An instance is already opened
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							location['add_contact'] = self
 | 
				
			||||||
		self.xml = gtkgui_helpers.get_glade('add_new_contact_window.glade')
 | 
							self.xml = gtkgui_helpers.get_glade('add_new_contact_window.glade')
 | 
				
			||||||
		self.account_combobox = self.xml.get_widget('account_combobox')
 | 
							self.account_combobox = self.xml.get_widget('account_combobox')
 | 
				
			||||||
		self.account_hbox = self.xml.get_widget('account_hbox')
 | 
							self.account_hbox = self.xml.get_widget('account_hbox')
 | 
				
			||||||
| 
						 | 
					@ -450,7 +459,11 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 | 
				
			||||||
			widget = self.xml.get_widget(type_ + '_register_form')
 | 
								widget = self.xml.get_widget(type_ + '_register_form')
 | 
				
			||||||
			widget.set_no_show_all(True)
 | 
								widget.set_no_show_all(True)
 | 
				
			||||||
			widget.hide()
 | 
								widget.hide()
 | 
				
			||||||
			#TODO: make button sensitive if we can register and add callback
 | 
								if type_ in gajim.connections[self.account].available_transports:
 | 
				
			||||||
 | 
									widget = self.xml.get_widget(type_ + '_register_button')
 | 
				
			||||||
 | 
									widget.set_sensitive(True)
 | 
				
			||||||
 | 
									widget.connect('clicked', self.on_register_button_clicked,
 | 
				
			||||||
 | 
										gajim.connections[self.account].available_transports[type_])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if jid:
 | 
							if jid:
 | 
				
			||||||
			type_ = gajim.get_transport_name_from_jid(jid)
 | 
								type_ = gajim.get_transport_name_from_jid(jid)
 | 
				
			||||||
| 
						 | 
					@ -489,6 +502,16 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 | 
				
			||||||
		self.xml.signal_autoconnect(self)
 | 
							self.xml.signal_autoconnect(self)
 | 
				
			||||||
		self.window.show_all()
 | 
							self.window.show_all()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def on_add_new_contact_window_destroy(self, widget):
 | 
				
			||||||
 | 
							if self.account:
 | 
				
			||||||
 | 
								location = gajim.interface.instances[self.account]
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								location = gajim.interface.instances
 | 
				
			||||||
 | 
							del location['add_contact']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def on_register_button_clicked(self, widget, jid):
 | 
				
			||||||
 | 
							gajim.connections[self.account].request_register_agent_info(jid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def on_add_new_contact_window_key_press_event(self, widget, event):
 | 
						def on_add_new_contact_window_key_press_event(self, widget, event):
 | 
				
			||||||
		if event.keyval == gtk.keysyms.Escape: # ESCAPE
 | 
							if event.keyval == gtk.keysyms.Escape: # ESCAPE
 | 
				
			||||||
			self.window.destroy()
 | 
								self.window.destroy()
 | 
				
			||||||
| 
						 | 
					@ -558,6 +581,22 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 | 
				
			||||||
			group = group, pseudo = nickname, auto_auth = auto_auth)
 | 
								group = group, pseudo = nickname, auto_auth = auto_auth)
 | 
				
			||||||
		self.window.destroy()
 | 
							self.window.destroy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def transport_signed_in(self, jid):
 | 
				
			||||||
 | 
							type_ = gajim.get_transport_name_from_jid(jid)
 | 
				
			||||||
 | 
							self.xml.get_widget(type_ + '_register_button').hide()
 | 
				
			||||||
 | 
							self.agents[type_] = jid
 | 
				
			||||||
 | 
							widget = self.xml.get_widget(type_ + '_register_form')
 | 
				
			||||||
 | 
							widget.set_no_show_all(False)
 | 
				
			||||||
 | 
							widget.show_all()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def transport_signed_out(self, jid):
 | 
				
			||||||
 | 
							type_ = gajim.get_transport_name_from_jid(jid)
 | 
				
			||||||
 | 
							widget = self.xml.get_widget(type_ + '_register_button')
 | 
				
			||||||
 | 
							widget.set_no_show_all(False)
 | 
				
			||||||
 | 
							widget.show_all()
 | 
				
			||||||
 | 
							del self.agents[type_]
 | 
				
			||||||
 | 
							self.xml.get_widget(type_ + '_register_form').hide()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AboutDialog:
 | 
					class AboutDialog:
 | 
				
			||||||
	'''Class for about dialog'''
 | 
						'''Class for about dialog'''
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -439,6 +439,15 @@ class Interface:
 | 
				
			||||||
				gajim.block_signed_in_notifications[account_ji] = True
 | 
									gajim.block_signed_in_notifications[account_ji] = True
 | 
				
			||||||
				gobject.timeout_add(30000, self.unblock_signed_in_notifications,
 | 
									gobject.timeout_add(30000, self.unblock_signed_in_notifications,
 | 
				
			||||||
					account_ji)
 | 
										account_ji)
 | 
				
			||||||
 | 
								locations = (self.instances, self.instances[account])
 | 
				
			||||||
 | 
								for location in locations:
 | 
				
			||||||
 | 
									if location.has_key('add_contact'):
 | 
				
			||||||
 | 
										if old_show == 0 and new_show > 1:
 | 
				
			||||||
 | 
											location['add_contact'].transport_signed_in(jid)
 | 
				
			||||||
 | 
											break
 | 
				
			||||||
 | 
										elif old_show > 1 and new_show == 0:
 | 
				
			||||||
 | 
											location['add_contact'].transport_signed_out(jid)
 | 
				
			||||||
 | 
											break
 | 
				
			||||||
		elif ji in jid_list:
 | 
							elif ji in jid_list:
 | 
				
			||||||
			# It isn't an agent
 | 
								# It isn't an agent
 | 
				
			||||||
			# reset chatstate if needed:
 | 
								# reset chatstate if needed:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue