<commit_before>/*

Copyright 2007-2008 OGG, LLC
See LICENSE.txt

*/

Speeqe.CHAT_MESSAGE_HISTORY     = 1000;
Speeqe.NS_MUC_OWNER = Strophe.NS.MUC + "#owner";
Speeqe.NS_MUC_ADMIN = Strophe.NS.MUC + "#admin";

//class used to send xmpp chat specific requests via libstrophe
Speeqe.Chat.prototype = {
    
    //join a multi user chat room by sending presence to the room
    join: function (onMessage, onPresence)
    {
	var password = <PASSWORD>;
	if(arguments.length > 0)
	{
	    password = arguments[0];
	}
	this._nick = this._nick.replace("@"+Speeqe.XMPP_DOMAIN,"");
        this._connection.muc.join(this._from, 
                                  this._nick,
                                  onMessage,
                                  onPresence);
    },

    //leave a multi user chat room by sending unavailable presence
    leave: function (call_back)
    {
        this._connection.muc.leave(this._from, this._nick, call_back);
    },
    //private function to send xmpp message
    _buildAndSendMessage: function(to, message, type) {
        if (type !== "groupchat")
        {
            var msgid = this._connection.getUniqueId();
	    var msg = $msg({to: to,
                            from: this._connection.jid,
                            type: type,
                            id: msgid})
                .c("body",
                   {xmlns: Strophe.NS.CLIENT}).t(message);
            msg.up().c("x", {xmlns: "jabber:x:event"}).c("composing");
            this._connection.send(msg);
        }
        else
        {
            this._connection.muc.message(to, null, message);
        }
	this._messages.push(message);<commit_msg>prevent blank messages<commit_after>/*

Copyright 2007-2008 OGG, LLC
See LICENSE.txt

*/

Speeqe.CHAT_MESSAGE_HISTORY     = 1000;
Speeqe.NS_MUC_OWNER = Strophe.NS.MUC + "#owner";
Speeqe.NS_MUC_ADMIN = Strophe.NS.MUC + "#admin";

//class used to send xmpp chat specific requests via libstrophe
Speeqe.Chat.prototype = {
    
    //join a multi user chat room by sending presence to the room
    join: function (onMessage, onPresence)
    {
	var password = null;
	if(arguments.length > 0)
	{
	    password = arguments[0];
	}
	this._nick = this._nick.replace("@"+Speeqe.XMPP_DOMAIN,"");
        this._connection.muc.join(this._from, 
                                  this._nick,
                                  onMessage,
                                  onPresence);
    },

    //leave a multi user chat room by sending unavailable presence
    leave: function (call_back)
    {
        this._connection.muc.leave(this._from, this._nick, call_back);
    },
    //private function to send xmpp message
    _buildAndSendMessage: function(to, message, type) {
        // don't send blank messages
        if ($.trim(message) === "")
        {
            return;
        }
        if (type !== "groupchat")
        {
            var msgid = this._connection.getUniqueId();
	    var msg = $msg({to: to,
                            from: this._connection.jid,
                            type: type,
                            id: msgid})
                .c("body",
                   {xmlns: Strophe.NS.CLIENT}).t(message);
            msg.up().c("x", {xmlns: "jabber:x:event"}).c("composing");
            this._connection.send(msg);
        }
        else
        {
            this._connection.muc.message(to, null, message);
        }
	this._messages.push(message);
{'fraction_non_alphanumeric': 0.1206896551724138, 'fraction_numerical': 0.008182349503214495, 'mean_word_length': 1.747191011235955, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '904488', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1013, 'n_words': 226}