[jim++] clean logic on for handling the incoming msg, make pm special checks fixes ##1764
This commit is contained in:
		
							parent
							
								
									4311f7fe0a
								
							
						
					
					
						commit
						2099e3baa8
					
				
					 3 changed files with 103 additions and 47 deletions
				
			
		
							
								
								
									
										19
									
								
								src/gajim.py
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/gajim.py
									
										
									
									
									
								
							|  | @ -458,7 +458,7 @@ class Interface: | ||||||
| 
 | 
 | ||||||
| 		jid = gajim.get_jid_without_resource(array[0]) | 		jid = gajim.get_jid_without_resource(array[0]) | ||||||
| 		resource = gajim.get_resource_from_jid(array[0]) | 		resource = gajim.get_resource_from_jid(array[0]) | ||||||
| 		fjid = jid + '/' + resource | 		fjid = array[0] | ||||||
| 		msg_type = array[4] | 		msg_type = array[4] | ||||||
| 		chatstate = array[6] | 		chatstate = array[6] | ||||||
| 		msg_id = array[7] | 		msg_id = array[7] | ||||||
|  | @ -495,9 +495,16 @@ class Interface: | ||||||
| 			return | 			return | ||||||
| 
 | 
 | ||||||
| 		first = False | 		first = False | ||||||
|  | 		pm = False | ||||||
| 		if not chat_control and not gajim.awaiting_events[account].has_key(jid): | 		if not chat_control and not gajim.awaiting_events[account].has_key(jid): | ||||||
|  | 			# It's a first message and not a Private Message | ||||||
| 			first = True | 			first = True | ||||||
| 		 | 		elif chat_control and chat_control.type_id == message_control.TYPE_GC:  | ||||||
|  | 			# It's a Private message | ||||||
|  | 			pm = True | ||||||
|  | 			if not self.msg_win_mgr.has_window(fjid, account) and \ | ||||||
|  | 				not gajim.awaiting_events[account].has_key(fjid): | ||||||
|  | 					first =True | ||||||
| 		if gajim.config.get_per('soundevents', 'first_message_received', | 		if gajim.config.get_per('soundevents', 'first_message_received', | ||||||
| 			'enabled') and first: | 			'enabled') and first: | ||||||
| 			helpers.play_sound('first_message_received') | 			helpers.play_sound('first_message_received') | ||||||
|  | @ -506,11 +513,9 @@ class Interface: | ||||||
| 			helpers.play_sound('next_message_received') | 			helpers.play_sound('next_message_received') | ||||||
| 
 | 
 | ||||||
| 		jid_of_control = jid | 		jid_of_control = jid | ||||||
| 		if chat_control and chat_control.type_id == message_control.TYPE_GC: | 		if pm: | ||||||
| 			# it's a Private Message |  | ||||||
| 			room_jid, nick = gajim.get_room_and_nick_from_fjid(fjid) | 			room_jid, nick = gajim.get_room_and_nick_from_fjid(fjid) | ||||||
| 			if not self.msg_win_mgr.has_window(fjid, account) and \ | 			if first: | ||||||
| 				not gajim.awaiting_events[account].has_key(fjid): |  | ||||||
| 				if helpers.allow_showing_notification(account): | 				if helpers.allow_showing_notification(account): | ||||||
| 					room_name,t = gajim.get_room_name_and_server_from_room_jid( | 					room_name,t = gajim.get_room_name_and_server_from_room_jid( | ||||||
| 						room_jid) | 						room_jid) | ||||||
|  | @ -545,7 +550,7 @@ class Interface: | ||||||
| 			chat_control = None | 			chat_control = None | ||||||
| 			jid_of_control = fjid | 			jid_of_control = fjid | ||||||
| 		 | 		 | ||||||
| 		if not chat_control and not gajim.awaiting_events[account].has_key(jid): | 		if first: | ||||||
| 			if gajim.config.get('notify_on_new_message'): | 			if gajim.config.get('notify_on_new_message'): | ||||||
| 				if helpers.allow_showing_notification(account): | 				if helpers.allow_showing_notification(account): | ||||||
| 					txt = _('%s has sent you a new message.') % gajim.get_name_from_jid(account, jid) | 					txt = _('%s has sent you a new message.') % gajim.get_name_from_jid(account, jid) | ||||||
|  |  | ||||||
|  | @ -329,9 +329,20 @@ | ||||||
| 	</packing> | 	</packing> | ||||||
|       </child> |       </child> | ||||||
| 
 | 
 | ||||||
|  |       <child> | ||||||
|  | 	<widget class="GtkHBox" id="roster_hbox"> | ||||||
|  | 	  <property name="visible">True</property> | ||||||
|  | 	  <property name="homogeneous">False</property> | ||||||
|  | 	  <property name="spacing">0</property> | ||||||
|  | 
 | ||||||
|  | 	  <child> | ||||||
|  | 	    <widget class="GtkVBox" id="roster_treeview_status_combobox_vbox"> | ||||||
|  | 	      <property name="visible">True</property> | ||||||
|  | 	      <property name="homogeneous">False</property> | ||||||
|  | 	      <property name="spacing">0</property> | ||||||
|  | 
 | ||||||
| 	      <child> | 	      <child> | ||||||
| 		<widget class="GtkScrolledWindow" id="scrolledwindow"> | 		<widget class="GtkScrolledWindow" id="scrolledwindow"> | ||||||
| 	  <property name="border_width">2</property> |  | ||||||
| 		  <property name="visible">True</property> | 		  <property name="visible">True</property> | ||||||
| 		  <property name="can_focus">True</property> | 		  <property name="can_focus">True</property> | ||||||
| 		  <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> | 		  <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> | ||||||
|  | @ -383,6 +394,37 @@ | ||||||
| 		</packing> | 		</packing> | ||||||
| 	      </child> | 	      </child> | ||||||
| 	    </widget> | 	    </widget> | ||||||
|  | 	    <packing> | ||||||
|  | 	      <property name="padding">0</property> | ||||||
|  | 	      <property name="expand">True</property> | ||||||
|  | 	      <property name="fill">True</property> | ||||||
|  | 	    </packing> | ||||||
|  | 	  </child> | ||||||
|  | 
 | ||||||
|  | 	  <child> | ||||||
|  | 	    <widget class="GtkVBox" id="possibly_hold_msg_window_vbox"> | ||||||
|  | 	      <property name="visible">True</property> | ||||||
|  | 	      <property name="homogeneous">False</property> | ||||||
|  | 	      <property name="spacing">0</property> | ||||||
|  | 
 | ||||||
|  | 	      <child> | ||||||
|  | 		<placeholder/> | ||||||
|  | 	      </child> | ||||||
|  | 	    </widget> | ||||||
|  | 	    <packing> | ||||||
|  | 	      <property name="padding">0</property> | ||||||
|  | 	      <property name="expand">True</property> | ||||||
|  | 	      <property name="fill">True</property> | ||||||
|  | 	    </packing> | ||||||
|  | 	  </child> | ||||||
|  | 	</widget> | ||||||
|  | 	<packing> | ||||||
|  | 	  <property name="padding">0</property> | ||||||
|  | 	  <property name="expand">True</property> | ||||||
|  | 	  <property name="fill">True</property> | ||||||
|  | 	</packing> | ||||||
|  |       </child> | ||||||
|  |     </widget> | ||||||
|   </child> |   </child> | ||||||
| </widget> | </widget> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2344,7 +2344,16 @@ _('If "%s" accepts this request you will know his or her status.') % jid) | ||||||
| 			# last message is long time ago | 			# last message is long time ago | ||||||
| 			gajim.last_message_time[account][ctrl.get_full_jid()] = 0 | 			gajim.last_message_time[account][ctrl.get_full_jid()] = 0 | ||||||
| 		win.set_active_tab(fjid, account) | 		win.set_active_tab(fjid, account) | ||||||
| 		win.window.present() | 		possibly_hold_msg_window_vbox = self.xml.get_widget( | ||||||
|  | 			'possibly_hold_msg_window_vbox') | ||||||
|  | 		 | ||||||
|  | 		#notebook = win.window.get_children()[0] | ||||||
|  | 		notebook = win.xml.get_widget('notebook')  | ||||||
|  | 		notebook.reparent(possibly_hold_msg_window_vbox) | ||||||
|  | 		notebook.show_all() | ||||||
|  | 		win.window.hide() | ||||||
|  | 		#win.window.present() | ||||||
|  | 		print 'reparented' | ||||||
| 
 | 
 | ||||||
| 	def on_roster_treeview_row_activated(self, widget, path, col = 0): | 	def on_roster_treeview_row_activated(self, widget, path, col = 0): | ||||||
| 		'''When an iter is double clicked: open the first event window''' | 		'''When an iter is double clicked: open the first event window''' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue