Commit 9225b79d authored by Philipp Hörist's avatar Philipp Hörist

SingleMessage: Remove displaying forms

parent 5ea40d75
......@@ -203,7 +203,7 @@ class CommonConnection:
'rst_formatting_outgoing_messages'):
from gajim.common.rst_xhtml_generator import create_xhtml
obj.xhtml = create_xhtml(obj.message)
if not obj.message and obj.chatstate is None and obj.form_node is None:
if not obj.message and obj.chatstate is None:
return
self._build_message_stanza(obj)
......@@ -235,8 +235,6 @@ class CommonConnection:
if obj.message:
msg_iq.setOriginID(obj.stanza_id)
if obj.form_node:
msg_iq.addChild(node=obj.form_node)
if obj.label:
msg_iq.addChild(node=obj.label)
......
......@@ -605,7 +605,6 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
self.xhtml = None
self.label = None
self.session = None
self.form_node = None
self.delayed = None
self.callback = None
self.callback_args = []
......
......@@ -62,7 +62,7 @@ class Event:
class ChatEvent(Event):
type_ = 'chat'
def __init__(self, message, subject, kind, time_, encrypted, resource,
msg_log_id, correct_id=None, message_id=None, xhtml=None, session=None, form_node=None,
msg_log_id, correct_id=None, message_id=None, xhtml=None, session=None,
displaymarking=None, sent_forwarded=False, show_in_roster=False,
show_in_systray=True, additional_data=None):
Event.__init__(self, time_, show_in_roster=show_in_roster,
......@@ -78,7 +78,6 @@ class ChatEvent(Event):
self.correct_id = correct_id
self.xhtml = xhtml
self.session = session
self.form_node = form_node
self.displaymarking = displaymarking
self.sent_forwarded = sent_forwarded
if additional_data is None:
......
......@@ -31,7 +31,6 @@ from gajim.common.modules.util import get_eme_message
from gajim.common.modules.security_labels import parse_securitylabel
from gajim.common.modules.user_nickname import parse_nickname
from gajim.common.modules.misc import parse_correction
from gajim.common.modules.misc import parse_form
from gajim.common.modules.misc import parse_oob
from gajim.common.modules.misc import parse_xhtml
from gajim.common.connection_handlers_events import MessageErrorEvent
......@@ -211,7 +210,6 @@ class Message(BaseModule):
'subject': subject,
'displaymarking': parse_securitylabel(event.stanza),
'user_nick': '' if event.sent else parse_nickname(event.stanza),
'form_node': parse_form(event.stanza),
'xhtml': parse_xhtml(event.stanza),
}
......
......@@ -16,8 +16,6 @@
import logging
import nbxmpp
from gajim.common import app
log = logging.getLogger('gajim.c.m.misc')
......@@ -43,12 +41,6 @@ def parse_correction(properties):
return properties.correction.id
# XEP-0004: Data Forms
def parse_form(stanza):
return stanza.getTag('x', namespace=nbxmpp.NS_DATA)
# XEP-0071: XHTML-IM
def parse_xhtml(stanza):
......
......@@ -143,7 +143,6 @@ class ConnectionHandlersZeroconf(connection_handlers.ConnectionHandlersBase):
'msg_log_id': None,
'subject': None,
'displaymarking': None,
'form_node': None,
'user_nick': parse_nickname(event.stanza),
'xhtml': parse_xhtml(event.stanza),
'stanza_id': event.unique_id
......
......@@ -860,7 +860,6 @@ class GroupchatControl(ChatControlBase):
msg_log_id,
xhtml=xhtml,
session=session,
form_node=None,
displaymarking=displaymarking,
sent_forwarded=sent)
app.events.add_event(self.account, fjid, event)
......
......@@ -26,7 +26,6 @@ from gajim.common.connection_handlers_events import MessageOutgoingEvent
from gajim.conversation_textview import ConversationTextview
from gajim.gtk.dataform import DataFormWidget
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import AspellDictError
from gajim.gtk.util import get_builder
......@@ -45,7 +44,7 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
action argument which can be 'send' or 'receive'
"""
def __init__(self, account, to='', action='', from_whom='', subject='',
message='', resource='', session=None, form_node=None):
message='', resource='', session=None):
Gtk.ApplicationWindow.__init__(self)
self.set_application(app.app)
self.set_title(_('Send Single Message'))
......@@ -73,19 +72,6 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
self._ui.conversation_scrolledwindow.add(
self.conversation_textview.tv)
self.form_widget = None
parent_box = self._ui.conversation_scrolledwindow.get_parent()
if form_node:
self.form_widget = DataFormWidget(form_node)
self.form_widget.show_all()
self._ui.conversation_scrolledwindow.hide()
self._ui.message_label_received.hide()
parent_box.add(self.form_widget)
parent_box.child_set_property(self.form_widget, 'top-attach', 2)
parent_box.child_set_property(self.form_widget, 'left-attach', 0)
parent_box.child_set_property(self.form_widget, 'width', 2)
self.action = 'form'
self.message_tv_buffer.connect('changed', self.update_char_counter)
if isinstance(to, list):
jid = ', '.join([i[0].get_full_jid() for i in to])
......@@ -241,22 +227,6 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
fjid += '/' + self.resource # Full jid of sender (with resource)
self._ui.from_entry_label.set_text(fjid)
elif action == 'form': # prepare UI for Receiving
title = self.form_widget.title
title = _('Form: %s') % title
self._ui.send_button.hide()
self._ui.send_and_close_button.hide()
self._ui.reply_button.show()
self._ui.close_button.show()
self._ui.send_grid.hide()
self._ui.received_grid.show()
fjid = self.from_whom
if self.resource:
fjid += '/' + self.resource # Full jid of sender (with resource)
self._ui.from_entry_label.set_text(fjid)
self._ui.single_message_window.set_title(title)
def on_close_button_clicked(self, widget):
......@@ -289,11 +259,6 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
begin, end = self.message_tv_buffer.get_bounds()
message = self.message_tv_buffer.get_text(begin, end, True)
if self.form_widget:
form_node = self.form_widget.get_submit_form()
else:
form_node = None
recipient_list = []
for to_whom_jid in sender_list:
......@@ -317,7 +282,7 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
app.nec.push_outgoing_event(MessageOutgoingEvent(None,
account=self.account, jid=recipient_list, message=message,
type_='normal', subject=subject, form_node=form_node))
type_='normal', subject=subject))
self._ui.subject_entry.set_text('') # we sent ok, clear the subject
self.message_tv_buffer.set_text('') # we sent ok, clear the textview
......
......@@ -376,7 +376,7 @@ class GajimRemote(Server):
self.raise_signal('NewMessage', (
obj.conn.name, [obj.fjid, obj.msgtxt, obj.timestamp,
obj.encrypted, obj.mtype, obj.subject,
obj.msg_log_id, obj.user_nick, obj.xhtml, obj.form_node]))
obj.msg_log_id, obj.user_nick, obj.xhtml]))
def on_our_status(self, obj):
self.raise_signal('AccountPresence', (obj.show, obj.conn.name))
......
......@@ -1928,8 +1928,7 @@ class RosterWindow:
if event.type_ == 'normal':
SingleMessageWindow(account, jid,
action='receive', from_whom=jid, subject=event.subject,
message=event.message, resource=event.resource,
session=event.session, form_node=event.form_node)
message=event.message, resource=event.resource)
app.events.remove_events(account, jid, event)
return True
......@@ -2659,8 +2658,7 @@ class RosterWindow:
# it's single message to be autopopuped
SingleMessageWindow(obj.conn.name, obj.jid,
action='receive', from_whom=obj.jid, subject=obj.subject,
message=obj.msgtxt, resource=obj.resource, session=obj.session,
form_node=obj.form_node)
message=obj.msgtxt, resource=obj.resource, session=obj.session)
return
if obj.popup and obj.mtype == 'chat' and not obj.session.control:
......
......@@ -256,7 +256,7 @@ class ChatControlSession:
correct_id=obj.correct_id,
message_id=obj.message_id,
xhtml=obj.xhtml,
session=self, form_node=obj.form_node,
session=self,
displaymarking=obj.displaymarking,
sent_forwarded=obj.forwarded and obj.sent,
show_in_roster=obj.show_in_roster,
......@@ -267,7 +267,7 @@ class ChatControlSession:
def roster_message(self, jid, msg, tim, encrypted=False, msg_type='',
subject=None, resource='', msg_log_id=None, user_nick='', xhtml=None,
form_node=None, displaymarking=None, additional_data=None):
displaymarking=None, additional_data=None):
"""
Display the message or show notification in the roster
"""
......@@ -325,7 +325,7 @@ class ChatControlSession:
if msg_type == 'normal' and popup: # it's single message to be autopopuped
SingleMessageWindow(self.conn.name, contact.jid,
action='receive', from_whom=jid, subject=subject, message=msg,
resource=resource, session=self, form_node=form_node)
resource=resource, session=self)
return
# We print if window is opened and it's not a single message
......@@ -356,7 +356,7 @@ class ChatControlSession:
show_in_systray = get_show_in_systray(event_type, contact.jid)
event = event_t(msg, subject, msg_type, tim, encrypted, resource,
msg_log_id, xhtml=xhtml, session=self, form_node=form_node,
msg_log_id, xhtml=xhtml, session=self,
displaymarking=displaymarking, sent_forwarded=False,
show_in_roster=show_in_roster, show_in_systray=show_in_systray,
additional_data=additional_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment