Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2012-04-01 21:39:26 +0400
committerYann Leboulanger <asterix@lagaule.org>2012-04-01 21:39:26 +0400
commit794a66e43578297e5c4a2d4e59e91d9293bdb2eb (patch)
treeec54edc78cea1ed41aaad55136380762c3d47c0d
parent6fbb0b78477e60dc026996be6b3bce572fc43cc2 (diff)
correctly forward unread printed messages to other resources. Fixes #7094
-rw-r--r--src/chat_control.py14
-rw-r--r--src/common/commands.py18
-rw-r--r--src/common/events.py2
-rw-r--r--src/common/stanza_session.py2
-rw-r--r--src/gui_interface.py4
-rw-r--r--src/roster_window.py4
6 files changed, 24 insertions, 20 deletions
diff --git a/src/chat_control.py b/src/chat_control.py
index 9f38b7676..8f36e225c 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -981,8 +981,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
show_in_systray = notify.get_show_in_systray(event,
self.account, self.contact, type_)
- event = gajim.events.create_event(type_, (self, msg_id),
- show_in_roster=show_in_roster,
+ event = gajim.events.create_event(type_, (text, subject, self,
+ msg_id), show_in_roster=show_in_roster,
show_in_systray=show_in_systray)
gajim.events.add_event(self.account, full_jid, event)
# We need to redraw contact if we show in roster
@@ -1649,15 +1649,15 @@ class ChatControl(ChatControlBase):
self.restore_conversation()
self.msg_textview.grab_focus()
- # change tooltip text for audio and video buttons if python-farsight is
+ # change tooltip text for audio and video buttons if python-farstream is
# not installed
- if not gajim.HAVE_FARSIGHT:
+ if not gajim.HAVE_FARSTREAM:
tooltip_text = self._audio_button.get_tooltip_text()
self._audio_button.set_tooltip_text(
- '%s\n%s' % (tooltip_text, _('Requires python-farsight.')))
+ '%s\n%s' % (tooltip_text, _('Requires python-farstream.')))
tooltip_text = self._video_button.get_tooltip_text()
self._video_button.set_tooltip_text(
- '%s\n%s' % (tooltip_text, _('Requires python-farsight.')))
+ '%s\n%s' % (tooltip_text, _('Requires python-farstream.')))
gajim.ged.register_event_handler('pep-received', ged.GUI1,
self._nec_pep_received)
@@ -1705,7 +1705,7 @@ class ChatControl(ChatControlBase):
# Jingle detection
if self.contact.supports(NS_JINGLE_ICE_UDP) and \
- gajim.HAVE_FARSIGHT and self.contact.resource:
+ gajim.HAVE_FARSTREAM and self.contact.resource:
self.audio_available = self.contact.supports(NS_JINGLE_RTP_AUDIO)
self.video_available = self.contact.supports(NS_JINGLE_RTP_VIDEO)
else:
diff --git a/src/common/commands.py b/src/common/commands.py
index d7650057a..969d0e81a 100644
--- a/src/common/commands.py
+++ b/src/common/commands.py
@@ -56,10 +56,10 @@ class AdHocCommand:
assert status in ('executing', 'completed', 'canceled')
response = request.buildReply('result')
- cmd = response.addChild('command', namespace=xmpp.NS_COMMANDS, attrs={
- 'sessionid': self.sessionid,
- 'node': self.commandnode,
- 'status': status})
+ cmd = response.getTag('command', namespace=xmpp.NS_COMMANDS)
+ cmd.setAttr('sessionid', self.sessionid)
+ cmd.setAttr('node', self.commandnode)
+ cmd.setAttr('status', status)
if defaultaction is not None or actions is not None:
if defaultaction is not None:
assert defaultaction in ('cancel', 'execute', 'prev', 'next',
@@ -277,13 +277,17 @@ class ForwardMessagesCommand(AdHocCommand):
def execute(self, request):
account = self.connection.name
# Forward messages
- events = gajim.events.get_events(account, types=['chat', 'normal'])
+ events = gajim.events.get_events(account, types=['chat', 'normal',
+ 'printed_chat'])
j, resource = gajim.get_room_and_nick_from_fjid(self.jid)
for jid in events:
for event in events[jid]:
+ ev_typ = event.type_
+ if ev_typ == 'printed_chat':
+ ev_typ = 'chat'
self.connection.send_message(j, event.parameters[0], '',
- type_=event.type_, subject=event.parameters[1],
- resource=resource, forward_from=jid, delayed=event.time_)
+ type_=ev_typ, subject=event.parameters[1],
+ resource=resource, forward_from=jid, delayed=event.time_)
# Inform other client of completion
response, cmd = self.buildResponse(request, status = 'completed')
diff --git a/src/common/events.py b/src/common/events.py
index 65dab2770..b1909a49c 100644
--- a/src/common/events.py
+++ b/src/common/events.py
@@ -45,7 +45,7 @@ class Event:
where kind in error, incoming
file-*: file_props
gc_msg: None
- printed_chat: control
+ printed_chat: [message, subject, control, msg_id]
printed_*: None
messages that are already printed in chat, but not read
gc-invitation: [room_jid, reason, password, is_continued]
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 98e4eea95..618dd744a 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -99,7 +99,7 @@ class StanzaSession(object):
for event in gajim.events.get_events(self.conn.name, j, types=types):
# the event wasn't in this session
if (event.type_ == 'chat' and event.parameters[8] != self) or \
- (event.type_ == 'printed_chat' and event.parameters[0].session != \
+ (event.type_ == 'printed_chat' and event.parameters[2].session != \
self):
continue
diff --git a/src/gui_interface.py b/src/gui_interface.py
index 726ce527c..895898127 100644
--- a/src/gui_interface.py
+++ b/src/gui_interface.py
@@ -1560,7 +1560,7 @@ class Interface:
return
if type_ == 'printed_chat':
- ctrl = event.parameters[0]
+ ctrl = event.parameters[2]
elif type_ == 'chat':
session = event.parameters[8]
ctrl = session.control
@@ -1598,7 +1598,7 @@ class Interface:
event = gajim.events.get_first_event(account, jid, type_)
if type_ == 'printed_pm':
- ctrl = event.parameters[0]
+ ctrl = event.parameters[2]
elif type_ == 'pm':
session = event.parameters[8]
diff --git a/src/roster_window.py b/src/roster_window.py
index dd0111db3..85b943c13 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1871,9 +1871,9 @@ class RosterWindow:
for ev in event_list:
if ev.type_ != 'printed_chat':
continue
- if len(ev.parameters) > 1 and ev.parameters[1]:
+ if len(ev.parameters) > 3 and ev.parameters[3]:
# There is a msg_id
- msg_ids.append(ev.parameters[1])
+ msg_ids.append(ev.parameters[3])
if msg_ids:
gajim.logger.set_read_messages(msg_ids)