add <thread/> to replies to single message that contain a <thread/>

This commit is contained in:
Brendan Taylor 2007-05-30 15:31:41 +00:00
parent 96e6b34cd7
commit ec37a97ed6
5 changed files with 19 additions and 12 deletions

View File

@ -839,7 +839,7 @@ class Connection(ConnectionHandlers):
def send_message(self, jid, msg, keyID, type = 'chat', subject='',
chatstate = None, msg_id = None, composing_jep = None, resource = None,
user_nick = None, xhtml = None):
user_nick = None, xhtml = None, thread = None):
if not self.connection:
return 1
if msg and not xhtml and gajim.config.get('rst_formatting_outgoing_messages'):
@ -883,6 +883,10 @@ class Connection(ConnectionHandlers):
if msgenc:
msg_iq.setTag(common.xmpp.NS_ENCRYPTED + ' x').setData(msgenc)
# XEP-0201
if thread:
msg_iq.setTag("thread").setData(thread)
# JEP-0172: user_nickname
if user_nick:
msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData(

View File

@ -1407,6 +1407,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
msghtml = msg.getXHTML()
mtype = msg.getType()
subject = msg.getSubject() # if not there, it's None
thread = msg.getThread()
tim = msg.getTimestamp()
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
tim = time.localtime(timegm(tim))
@ -1523,7 +1524,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if treat_as:
mtype = treat_as
self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype,
subject, chatstate, msg_id, composing_jep, user_nick, msghtml))
subject, chatstate, msg_id, composing_jep, user_nick, msghtml, thread))
# END messageCB
def _pubsubEventCB(self, con, msg):

View File

@ -1686,7 +1686,7 @@ class SingleMessageWindow:
or 'receive'.
'''
def __init__(self, account, to = '', action = '', from_whom = '',
subject = '', message = '', resource = ''):
subject = '', message = '', resource = '', thread = None):
self.account = account
self.action = action
@ -1695,6 +1695,7 @@ class SingleMessageWindow:
self.to = to
self.from_whom = from_whom
self.resource = resource
self.thread = thread
self.xml = gtkgui_helpers.get_glade('single_message_window.glade')
self.window = self.xml.get_widget('single_message_window')
@ -1896,7 +1897,7 @@ class SingleMessageWindow:
# FIXME: allow GPG message some day
gajim.connections[self.account].send_message(to_whom_jid, message,
keyID = None, type = 'normal', subject=subject)
keyID = None, type = 'normal', subject=subject, thread = self.thread)
self.subject_entry.set_text('') # we sent ok, clear the subject
self.message_tv_buffer.set_text('') # we sent ok, clear the textview
@ -1913,7 +1914,7 @@ class SingleMessageWindow:
self.window.destroy()
SingleMessageWindow(self.account, to = self.from_whom,
action = 'send', from_whom = self.from_whom, subject = self.subject,
message = self.message)
message = self.message, thread = self.thread)
def on_send_and_close_button_clicked(self, widget):
self.send_single_message()

View File

@ -665,7 +665,7 @@ class Interface:
def handle_event_msg(self, account, array):
# 'MSG' (account, (jid, msg, time, encrypted, msg_type, subject,
# chatstate, msg_id, composing_jep, user_nick, xhtml))
# chatstate, msg_id, composing_jep, user_nick, xhtml, thread))
# user_nick is JEP-0172
full_jid_with_resource = array[0]
@ -680,6 +680,7 @@ class Interface:
msg_id = array[7]
composing_jep = array[8]
xhtml = array[10]
thread = array[11]
if gajim.config.get('ignore_incoming_xhtml'):
xhtml = None
if gajim.jid_is_transport(jid):
@ -775,12 +776,12 @@ class Interface:
if encrypted:
self.roster.on_message(jid, message, array[2], account, array[3],
msg_type, subject, resource, msg_id, array[9],
advanced_notif_num)
advanced_notif_num, thread = thread)
else:
# xhtml in last element
self.roster.on_message(jid, message, array[2], account, array[3],
msg_type, subject, resource, msg_id, array[9],
advanced_notif_num, xhtml = xhtml)
advanced_notif_num, xhtml = xhtml, thread = thread)
nickname = gajim.get_name_from_jid(account, jid)
# Check and do wanted notifications
msg = message

View File

@ -3531,7 +3531,7 @@ class RosterWindow:
def on_message(self, jid, msg, tim, account, encrypted = False,
msg_type = '', subject = None, resource = '', msg_id = None,
user_nick = '', advanced_notif_num = None, xhtml = None):
user_nick = '', advanced_notif_num = None, xhtml = None, thread = None):
'''when we receive a message'''
contact = None
# if chat window will be for specific resource
@ -3588,7 +3588,7 @@ class RosterWindow:
if msg_type == 'normal' and popup: # it's single message to be autopopuped
dialogs.SingleMessageWindow(account, contact.jid,
action = 'receive', from_whom = jid, subject = subject,
message = msg, resource = resource)
message = msg, resource = resource, thread = thread)
return
# We print if window is opened and it's not a single message
@ -3611,7 +3611,7 @@ class RosterWindow:
show_in_roster = notify.get_show_in_roster(event_type, account, contact)
show_in_systray = notify.get_show_in_systray(event_type, account, contact)
event = gajim.events.create_event(type_, (msg, subject, msg_type, tim,
encrypted, resource, msg_id, xhtml), show_in_roster = show_in_roster,
encrypted, resource, msg_id, xhtml, thread), show_in_roster = show_in_roster,
show_in_systray = show_in_systray)
gajim.events.add_event(account, fjid, event)
if popup:
@ -3873,7 +3873,7 @@ class RosterWindow:
if event.type_ == 'normal':
dialogs.SingleMessageWindow(account, jid,
action = 'receive', from_whom = jid, subject = data[1],
message = data[0], resource = data[5])
message = data[0], resource = data[5], thread = data[8])
gajim.interface.remove_first_event(account, jid, event.type_)
return True
elif event.type_ == 'file-request':