function sendGroupMsg()
{
var room_name = $('#room').val() + '@conference.localhost';
var msg = $('#msg').val();
Chat.sendMessage(room_name, msg, "groupchat");
}
{
var room_name = $('#room').val() + '@conference.localhost';
var msg = $('#msg').val();
Chat.sendMessage(room_name, msg, "groupchat");
}
var Chat = {
sendMessage: function (messgeTo, message, type) {
var messagetype = (type) ? type : 'chat';
var reply;
if (messagetype === 'groupchat') {
reply = $msg({to: messgeTo,
from: Chat.connection.jid,
type: messagetype,
id: Chat.connection.getUniqueId()
}).c("body", {xmlns: Strophe.NS.CLIENT}).t(message);
}
else {
reply = $msg({to: messgeTo,
from: Chat.connection.jid,
type: messagetype
}).c("body").t(message);
}
Chat.connection.send(reply.tree());
Chat.log('I sent ' + messgeTo + ': ' + message, reply.tree());
}
}
sendMessage: function (messgeTo, message, type) {
var messagetype = (type) ? type : 'chat';
var reply;
if (messagetype === 'groupchat') {
reply = $msg({to: messgeTo,
from: Chat.connection.jid,
type: messagetype,
id: Chat.connection.getUniqueId()
}).c("body", {xmlns: Strophe.NS.CLIENT}).t(message);
}
else {
reply = $msg({to: messgeTo,
from: Chat.connection.jid,
type: messagetype
}).c("body").t(message);
}
Chat.connection.send(reply.tree());
Chat.log('I sent ' + messgeTo + ': ' + message, reply.tree());
}
}
What if group name contains space between words. For example "group number one", i could not send message to this group, and a tried to replace space with '_', '-' and ''.
Thank you very much for the invitation :). Best wishes.
PS: How are you? I am from France 🙂