Commit 7839f208 authored by worlword's avatar worlword

fixed sendMessage for so that tests will work again

parent 76d6b947
...@@ -813,7 +813,7 @@ ...@@ -813,7 +813,7 @@
return stanza; return stanza;
}, },
sendMessage (message) { sendMessage (message, file=null) {
/* Responsible for sending off a text message. /* Responsible for sending off a text message.
* *
* Parameters: * Parameters:
...@@ -821,7 +821,14 @@ ...@@ -821,7 +821,14 @@
*/ */
// TODO: We might want to send to specfic resources. // TODO: We might want to send to specfic resources.
// Especially in the OTR case. // Especially in the OTR case.
_converse.connection.send(message); var messageStanza;
if(file !== null){
messageStanza = this.createFileMessageStanza(message);
}
else {
messageStanza = this.createMessageStanza(message);
}
_converse.connection.send(messageStanza);
if (_converse.forward_messages) { if (_converse.forward_messages) {
// Forward the message, so that other connected resources are also aware of it. // Forward the message, so that other connected resources are also aware of it.
_converse.connection.send( _converse.connection.send(
...@@ -878,14 +885,7 @@ ...@@ -878,14 +885,7 @@
const message = this.model.messages.create(attrs); const message = this.model.messages.create(attrs);
/* check, if a file was send. If true it will send the file with XEP-0066. */ /* check, if a file was send. If true it will send the file with XEP-0066. */
var messageStanza; this.sendMessage(message, file);
if(file !== null){
messageStanza = this.createFileMessageStanza(message);
}
else {
messageStanza = this.createMessageStanza(message);
}
this.sendMessage(messageStanza);
}, },
getOutgoingMessageAttributes (text, spoiler_hint) { getOutgoingMessageAttributes (text, spoiler_hint) {
......
...@@ -747,7 +747,9 @@ ...@@ -747,7 +747,9 @@
this.showStatusNotification(__("Error: could not execute the command"), true); this.showStatusNotification(__("Error: could not execute the command"), true);
}, },
onMessageSubmitted (text, notNeeded, file = null) { // the notNeeded-Parameter is there so this method has the same amount of parameters as converse-chatview.js->onMessageSubmitted
// this allows to call the same method from diffrent plugins
onMessageSubmitted (text, notNeeded = null, file = null) {
/* Gets called when the user presses enter to send off a /* Gets called when the user presses enter to send off a
* message in a chat room. * message in a chat room.
* *
......
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