Skip to content

Commit

Permalink
Merge pull request #113 from benlangfeld/feature/alternative-authcid
Browse files Browse the repository at this point in the history
Permit connecting with an alternative authcid
  • Loading branch information
jcbrand committed Apr 14, 2015
2 parents 55190a9 + 3ffd2e7 commit 72914b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
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

0 comments on commit 72914b8

Please sign in to comment.