[jim++] clean logic on for handling the incoming msg, make pm special checks fixes ##1764
This commit is contained in:
parent
4311f7fe0a
commit
2099e3baa8
19
src/gajim.py
19
src/gajim.py
|
@ -458,7 +458,7 @@ class Interface:
|
|||
|
||||
jid = gajim.get_jid_without_resource(array[0])
|
||||
resource = gajim.get_resource_from_jid(array[0])
|
||||
fjid = jid + '/' + resource
|
||||
fjid = array[0]
|
||||
msg_type = array[4]
|
||||
chatstate = array[6]
|
||||
msg_id = array[7]
|
||||
|
@ -495,9 +495,16 @@ class Interface:
|
|||
return
|
||||
|
||||
first = False
|
||||
pm = False
|
||||
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
|
||||
|
||||
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',
|
||||
'enabled') and first:
|
||||
helpers.play_sound('first_message_received')
|
||||
|
@ -506,11 +513,9 @@ class Interface:
|
|||
helpers.play_sound('next_message_received')
|
||||
|
||||
jid_of_control = jid
|
||||
if chat_control and chat_control.type_id == message_control.TYPE_GC:
|
||||
# it's a Private Message
|
||||
if pm:
|
||||
room_jid, nick = gajim.get_room_and_nick_from_fjid(fjid)
|
||||
if not self.msg_win_mgr.has_window(fjid, account) and \
|
||||
not gajim.awaiting_events[account].has_key(fjid):
|
||||
if first:
|
||||
if helpers.allow_showing_notification(account):
|
||||
room_name,t = gajim.get_room_name_and_server_from_room_jid(
|
||||
room_jid)
|
||||
|
@ -545,7 +550,7 @@ class Interface:
|
|||
chat_control = None
|
||||
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 helpers.allow_showing_notification(account):
|
||||
txt = _('%s has sent you a new message.') % gajim.get_name_from_jid(account, jid)
|
||||
|
|
120
src/gtkgui.glade
120
src/gtkgui.glade
|
@ -330,36 +330,92 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="border_width">2</property>
|
||||
<widget class="GtkHBox" id="roster_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="roster_treeview">
|
||||
<widget class="GtkVBox" id="roster_treeview_status_combobox_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
<signal name="button_press_event" handler="on_roster_treeview_button_press_event" last_modification_time="Mon, 28 Feb 2005 14:16:44 GMT"/>
|
||||
<signal name="row_activated" handler="on_roster_treeview_row_activated" last_modification_time="Mon, 28 Feb 2005 14:18:06 GMT"/>
|
||||
<signal name="row_expanded" handler="on_roster_treeview_row_expanded" last_modification_time="Mon, 28 Feb 2005 14:18:14 GMT"/>
|
||||
<signal name="row_collapsed" handler="on_roster_treeview_row_collapsed" last_modification_time="Mon, 28 Feb 2005 14:18:33 GMT"/>
|
||||
<signal name="key_press_event" handler="on_roster_treeview_key_press_event" last_modification_time="Sat, 26 Mar 2005 20:39:36 GMT"/>
|
||||
<signal name="motion_notify_event" handler="on_roster_treeview_motion_notify_event" last_modification_time="Wed, 06 Jul 2005 14:38:58 GMT"/>
|
||||
<signal name="leave_notify_event" handler="on_roster_treeview_leave_notify_event" last_modification_time="Wed, 06 Jul 2005 14:39:06 GMT"/>
|
||||
<signal name="scroll_event" handler="on_roster_treeview_scroll_event" last_modification_time="Fri, 08 Jul 2005 22:09:03 GMT"/>
|
||||
<signal name="style_set" handler="on_roster_treeview_style_set" last_modification_time="Tue, 08 Nov 2005 14:03:30 GMT"/>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="roster_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
<signal name="button_press_event" handler="on_roster_treeview_button_press_event" last_modification_time="Mon, 28 Feb 2005 14:16:44 GMT"/>
|
||||
<signal name="row_activated" handler="on_roster_treeview_row_activated" last_modification_time="Mon, 28 Feb 2005 14:18:06 GMT"/>
|
||||
<signal name="row_expanded" handler="on_roster_treeview_row_expanded" last_modification_time="Mon, 28 Feb 2005 14:18:14 GMT"/>
|
||||
<signal name="row_collapsed" handler="on_roster_treeview_row_collapsed" last_modification_time="Mon, 28 Feb 2005 14:18:33 GMT"/>
|
||||
<signal name="key_press_event" handler="on_roster_treeview_key_press_event" last_modification_time="Sat, 26 Mar 2005 20:39:36 GMT"/>
|
||||
<signal name="motion_notify_event" handler="on_roster_treeview_motion_notify_event" last_modification_time="Wed, 06 Jul 2005 14:38:58 GMT"/>
|
||||
<signal name="leave_notify_event" handler="on_roster_treeview_leave_notify_event" last_modification_time="Wed, 06 Jul 2005 14:39:06 GMT"/>
|
||||
<signal name="scroll_event" handler="on_roster_treeview_scroll_event" last_modification_time="Fri, 08 Jul 2005 22:09:03 GMT"/>
|
||||
<signal name="style_set" handler="on_roster_treeview_style_set" last_modification_time="Tue, 08 Nov 2005 14:03:30 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="status_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="changed" handler="on_status_combobox_changed" last_modification_time="Sat, 05 Nov 2005 18:07:49 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</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>
|
||||
|
||||
<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>
|
||||
|
@ -368,20 +424,6 @@
|
|||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="status_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="changed" handler="on_status_combobox_changed" last_modification_time="Sat, 05 Nov 2005 18:07:49 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -2344,7 +2344,16 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
|||
# last message is long time ago
|
||||
gajim.last_message_time[account][ctrl.get_full_jid()] = 0
|
||||
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):
|
||||
'''When an iter is double clicked: open the first event window'''
|
||||
|
|
Loading…
Reference in New Issue