4

ストローフィプラグインを使用してopenfireサーバーに新しいユーザーを登録しようとしていますが、登録に接続できません。ここでの説明https://github.com/metajack/strophejs-plugins/tree/master/registerはそれ以上私を連れて来ません:(私は前に接続を確立する必要がありますか?これは私がボタンをクリックするときに試みるものです登録:

$("#RegButton").click(function () {
var callback = function (status) {
if (status === Strophe.Status.REGISTER) {
    connection.register.fields.username = "juliet";
    connection.register.fields.password = "R0m30";
    connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
    console.log("registered!");
    connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
    console.log("logged in!");
} else {
    // every other status a connection.connect would receive
}
};
connection.register.connect("http://localhost:7070/http-bind/", callback);
});
4

2 に答える 2

4

私の場合、プラグインを変更しました。215行目の「if(register.length === 0)」で、常に登録の意図を終了するため、これらの行にコメントを付け、スタンザを取り込むよりもタグ「x」を削除しました。レジスターは可能でした。これがお役に立てば幸いです。

    /*
      if (register.length === 0) {
        console.log('En tra if de linea 220');
        //that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
        //return;
    } else */
    this.enabled = true;
于 2012-05-03T18:43:24.630 に答える
4

この行で:

connection.register.connect("http://localhost:7070/http-bind/", callback);

connectionサービスURL()ですでに作成されているStrophe.Connectionオブジェクトである必要があります"http://localhost:7070/http-bind/"

の最初のパラメータconnection.register.connect()は、アカウントを登録するホストです。つまり、user @ example.comのJIDの場合"example.com"、コードではなく、に設定"http://localhost:7070/http-bind/"します。

于 2012-05-03T00:30:11.920 に答える