XEP-0077:带内注册

时间:2011-04-24 13:53:54

标签: xmpp registration

我是xmpp的新手。我打算开始一个'聊天'web application.at客户端,我准备使用'Strophe',但我发现strophe不能支持注册模块。

有人说可以使用'XEP-0077:带内注册'。你能告诉我我能做什么吗?

感谢

1 个答案:

答案 0 :(得分:4)

XEP-0077是前往这里的方式。确保你已经彻底阅读了它。接下来,查看strophejs-plugins项目,了解如何编写strophe插件的示例。然后,您将需要创建一个可以创建XEP-0077的协议,从以下内容开始:

Strophe.addConnectionPlugin('register', {
    _connection: null,

    init: function(conn) {
        this._connection = conn;
        Strophe.addNamespace('REGISTER', 'jabber:iq:register');
    },
    get: function(callback) {
        var stanza = $iq({type: "get"}).c("query",
                                          {xmlns: Strophe.NS.REGISTER});
        return this._connection.sendIQ(stanza.tree(), callback, function(){});
    }
});

确保将补丁贡献给github上的strophejs-plugins。