does not work as it should, does not traceback either though
This commit is contained in:
parent
28b9a37333
commit
9c102c421b
|
@ -885,14 +885,18 @@ class PopupNotificationWindow:
|
||||||
# set colors [ http://www.w3schools.com/html/html_colornames.asp ]
|
# set colors [ http://www.w3schools.com/html/html_colornames.asp ]
|
||||||
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
|
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
|
||||||
if event_type == _('Contact Signed In'):
|
if event_type == _('Contact Signed In'):
|
||||||
close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('limegreen'))
|
limegreen = gtk.gdk.color_parse('limegreen')
|
||||||
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('limegreen'))
|
close_button.modify_bg(gtk.STATE_NORMAL, limegreen)
|
||||||
|
eventbox.modify_bg(gtk.STATE_NORMAL, limegreen)
|
||||||
elif event_type == _('Contact Signed Out'):
|
elif event_type == _('Contact Signed Out'):
|
||||||
close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('red'))
|
red = gtk.gdk.color_parse('red')
|
||||||
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('red'))
|
close_button.modify_bg(gtk.STATE_NORMAL, red)
|
||||||
elif event_type == _('New Message'):
|
eventbox.modify_bg(gtk.STATE_NORMAL, red)
|
||||||
close_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
|
elif event_type == _('New Message') or\
|
||||||
eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('dodgerblue'))
|
event_type == _('New Single Message'):
|
||||||
|
dodgerblue = gtk.gdk.color_parse('dodgerblue')
|
||||||
|
close_button.modify_bg(gtk.STATE_NORMAL, dodgerblue)
|
||||||
|
eventbox.modify_bg(gtk.STATE_NORMAL, dodgerblue)
|
||||||
txt = _('From %s') % txt
|
txt = _('From %s') % txt
|
||||||
|
|
||||||
# position the window to bottom-right of screen
|
# position the window to bottom-right of screen
|
||||||
|
@ -932,23 +936,27 @@ class PopupNotificationWindow:
|
||||||
# use Contact class, new_chat expects it that way
|
# use Contact class, new_chat expects it that way
|
||||||
# is it in the roster?
|
# is it in the roster?
|
||||||
if self.plugin.roster.contacts[self.account].has_key(self.jid):
|
if self.plugin.roster.contacts[self.account].has_key(self.jid):
|
||||||
user = self.plugin.roster.contacts[self.account][self.jid][0]
|
contact = self.plugin.roster.contacts[self.account][self.jid][0]
|
||||||
else:
|
else:
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', self.account,
|
attached_keys = gajim.config.get_per('accounts', self.account,
|
||||||
'attached_gpg_keys').split()
|
'attached_gpg_keys').split()
|
||||||
if jid in attached_keys:
|
if jid in attached_keys:
|
||||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||||
user = Contact(jid = self.jid, name = self.jid.split('@')[0],
|
contact = Contact(jid = self.jid, name = self.jid.split('@')[0],
|
||||||
groups = [_('not in the roster')], show = 'not in the roster',
|
groups = [_('not in the roster')], show = 'not in the roster',
|
||||||
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
||||||
self.plugin.roster.contacts[self.account][self.jid] = [user]
|
self.plugin.roster.contacts[self.account][self.jid] = [contact]
|
||||||
self.plugin.roster.add_contact_to_roster(user.self.jid, self.account)
|
self.plugin.roster.add_contact_to_roster(contact.self.jid,
|
||||||
|
self.account) # FIXME: contact.self.jid ???
|
||||||
|
|
||||||
if self.msg_type == 'normal': # it's single message
|
if self.msg_type == 'normal': # it's single message
|
||||||
pass
|
return # FIXME: I think I should not print here but in new_chat?
|
||||||
|
contact = self.contacts[account][jid][0]
|
||||||
|
dialogs.SingleMessageWindow(self.plugin, self.account, contact,
|
||||||
|
action = 'receive', from_whom = jid, subject = subject, message = msg)
|
||||||
else: # 'chat'
|
else: # 'chat'
|
||||||
self.plugin.roster.new_chat(user, self.account)
|
self.plugin.roster.new_chat(contact, self.account)
|
||||||
chats_window = self.plugin.windows[self.account]['chats'][self.jid]
|
chats_window = self.plugin.windows[self.account]['chats'][self.jid]
|
||||||
chats_window.set_active_tab(self.jid)
|
chats_window.set_active_tab(self.jid)
|
||||||
chats_window.window.present()
|
chats_window.window.present()
|
||||||
|
|
10
src/gajim.py
10
src/gajim.py
|
@ -336,6 +336,7 @@ class Interface:
|
||||||
def handle_event_msg(self, account, array):
|
def handle_event_msg(self, account, array):
|
||||||
#('MSG', account, (contact, msg, time, encrypted, msg_type, subject))
|
#('MSG', account, (contact, msg, time, encrypted, msg_type, subject))
|
||||||
jid = array[0].split('/')[0]
|
jid = array[0].split('/')[0]
|
||||||
|
msg_type = array[4]
|
||||||
if jid.find('@') <= 0:
|
if jid.find('@') <= 0:
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
|
|
||||||
|
@ -375,8 +376,13 @@ class Interface:
|
||||||
elif gajim.connections[account].connected in (2, 3): # we're online or chat
|
elif gajim.connections[account].connected in (2, 3): # we're online or chat
|
||||||
show_notification = True
|
show_notification = True
|
||||||
if show_notification:
|
if show_notification:
|
||||||
instance = dialogs.PopupNotificationWindow(self,
|
if msg_type == 'normal': # single message
|
||||||
_('New Message'), jid, account, array[4]) #[4] is msg_type
|
instance = dialogs.PopupNotificationWindow(self,
|
||||||
|
_('New Single Message'), jid, account, msg_type)
|
||||||
|
else: # chat message
|
||||||
|
instance = dialogs.PopupNotificationWindow(self,
|
||||||
|
_('New Message'), jid, account, msg_type)
|
||||||
|
|
||||||
self.roster.popup_notification_windows.append(instance)
|
self.roster.popup_notification_windows.append(instance)
|
||||||
|
|
||||||
# array : (contact, msg, time, encrypted, msg_type, subject)
|
# array : (contact, msg, time, encrypted, msg_type, subject)
|
||||||
|
|
Loading…
Reference in New Issue