Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit connecting with an alternative authcid #113

Merged
merged 2 commits into from
Apr 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1681,8 +1681,10 @@ Strophe.Connection.prototype = {
* number of connections the server will hold at one time. This
* should almost always be set to 1 (the default).
* (String) route - The optional route value.
* (String) authcid - The optional alternative authentication identity
* (username) if intending to impersonate another user.
*/
connect: function (jid, pass, callback, wait, hold, route)
connect: function (jid, pass, callback, wait, hold, route, authcid)
{
this.jid = jid;
/** Variable: authzid
Expand All @@ -1692,7 +1694,7 @@ Strophe.Connection.prototype = {
/** Variable: authcid
* Authentication identity (User name).
*/
this.authcid = Strophe.getNodeFromJid(this.jid);
this.authcid = authcid || Strophe.getNodeFromJid(this.jid);
/** Variable: pass
* Authentication identity (User password).
*/
Expand Down
14 changes: 5 additions & 9 deletions strophe.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-base64', function () {
return factory();
});
Expand Down Expand Up @@ -129,7 +128,6 @@

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-sha1', function () {
return factory();
});
Expand Down Expand Up @@ -325,7 +323,6 @@ return {

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-md5', function () {
return factory();
});
Expand Down Expand Up @@ -629,7 +626,6 @@ if (!Array.prototype.indexOf)

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-core', [
'strophe-sha1',
'strophe-base64',
Expand Down Expand Up @@ -716,7 +712,7 @@ Strophe = {
* The version of the Strophe library. Unreleased builds will have
* a version of head-HASH where HASH is a partial revision.
*/
VERSION: "1.2.1",
VERSION: "1.2.2",

/** Constants: XMPP Namespace Constants
* Common namespace constants from the XMPP RFCs and XEPs.
Expand Down Expand Up @@ -2301,8 +2297,10 @@ Strophe.Connection.prototype = {
* number of connections the server will hold at one time. This
* should almost always be set to 1 (the default).
* (String) route - The optional route value.
* (String) authcid - The optional alternative authentication identity
* (username) if intending to impersonate another user.
*/
connect: function (jid, pass, callback, wait, hold, route)
connect: function (jid, pass, callback, wait, hold, route, authcid)
{
this.jid = jid;
/** Variable: authzid
Expand All @@ -2312,7 +2310,7 @@ Strophe.Connection.prototype = {
/** Variable: authcid
* Authentication identity (User name).
*/
this.authcid = Strophe.getNodeFromJid(this.jid);
this.authcid = authcid || Strophe.getNodeFromJid(this.jid);
/** Variable: pass
* Authentication identity (User password).
*/
Expand Down Expand Up @@ -3926,7 +3924,6 @@ return {

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-bosh', ['strophe-core'], function (core) {
return factory(
core.Strophe,
Expand Down Expand Up @@ -4796,7 +4793,6 @@ return Strophe;

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define('strophe-websocket', ['strophe-core'], function (core) {
return factory(
core.Strophe,
Expand Down
Loading