fixed sendMessage for so that tests will work again

This commit is contained in:
worlword 2018-04-05 08:45:58 +02:00
parent 76d6b94703
commit 7839f20846
2 changed files with 13 additions and 11 deletions

View File

@ -813,7 +813,7 @@
return stanza;
},
sendMessage (message) {
sendMessage (message, file=null) {
/* Responsible for sending off a text message.
*
* Parameters:
@ -821,7 +821,14 @@
*/
// TODO: We might want to send to specfic resources.
// 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) {
// Forward the message, so that other connected resources are also aware of it.
_converse.connection.send(
@ -878,14 +885,7 @@
const message = this.model.messages.create(attrs);
/* check, if a file was send. If true it will send the file with XEP-0066. */
var messageStanza;
if(file !== null){
messageStanza = this.createFileMessageStanza(message);
}
else {
messageStanza = this.createMessageStanza(message);
}
this.sendMessage(messageStanza);
this.sendMessage(message, file);
},
getOutgoingMessageAttributes (text, spoiler_hint) {

View File

@ -747,7 +747,9 @@
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
* message in a chat room.
*