|
@@ -529,6 +529,31 @@ module.exports = function(XMPP, eventEmitter) {
|
529
|
529
|
.c('current').t(this.presMap['prezicurrent']).up().up();
|
530
|
530
|
}
|
531
|
531
|
|
|
532
|
+ // This is only for backward compatibility with clients which
|
|
533
|
+ // don't support getting sources from Jingle (i.e. jirecon).
|
|
534
|
+ if (this.presMap['medians']) {
|
|
535
|
+ pres.c('media', {xmlns: this.presMap['medians']});
|
|
536
|
+ var sourceNumber = 0;
|
|
537
|
+ Object.keys(this.presMap).forEach(function (key) {
|
|
538
|
+ if (key.indexOf('source') >= 0) {
|
|
539
|
+ sourceNumber++;
|
|
540
|
+ }
|
|
541
|
+ });
|
|
542
|
+ if (sourceNumber > 0) {
|
|
543
|
+ for (var i = 1; i <= sourceNumber / 3; i++) {
|
|
544
|
+ pres.c('source',
|
|
545
|
+ {
|
|
546
|
+ type: this.presMap['source' + i + '_type'],
|
|
547
|
+ ssrc: this.presMap['source' + i + '_ssrc'],
|
|
548
|
+ direction: this.presMap['source' + i + '_direction']
|
|
549
|
+ || 'sendrecv'
|
|
550
|
+ }
|
|
551
|
+ ).up();
|
|
552
|
+ }
|
|
553
|
+ }
|
|
554
|
+ pres.up();
|
|
555
|
+ }
|
|
556
|
+
|
532
|
557
|
if(this.presMap["startMuted"] !== undefined)
|
533
|
558
|
{
|
534
|
559
|
pres.c("startmuted", {audio: this.presMap["startMuted"].audio,
|
|
@@ -543,6 +568,26 @@ module.exports = function(XMPP, eventEmitter) {
|
543
|
568
|
addDisplayNameToPresence: function (displayName) {
|
544
|
569
|
this.presMap['displayName'] = displayName;
|
545
|
570
|
},
|
|
571
|
+ // This is only for backward compatibility with clients which
|
|
572
|
+ // don't support getting sources from Jingle (i.e. jirecon).
|
|
573
|
+ addMediaToPresence: function (sourceNumber, mtype, ssrcs, direction) {
|
|
574
|
+ if (!this.presMap['medians'])
|
|
575
|
+ this.presMap['medians'] = 'http://estos.de/ns/mjs';
|
|
576
|
+
|
|
577
|
+ this.presMap['source' + sourceNumber + '_type'] = mtype;
|
|
578
|
+ this.presMap['source' + sourceNumber + '_ssrc'] = ssrcs;
|
|
579
|
+ this.presMap['source' + sourceNumber + '_direction'] = direction;
|
|
580
|
+ },
|
|
581
|
+ // This is only for backward compatibility with clients which
|
|
582
|
+ // don't support getting sources from Jingle (i.e. jirecon).
|
|
583
|
+ clearPresenceMedia: function () {
|
|
584
|
+ var self = this;
|
|
585
|
+ Object.keys(this.presMap).forEach(function (key) {
|
|
586
|
+ if (key.indexOf('source') != -1) {
|
|
587
|
+ delete self.presMap[key];
|
|
588
|
+ }
|
|
589
|
+ });
|
|
590
|
+ },
|
546
|
591
|
addDevicesToPresence: function (devices) {
|
547
|
592
|
this.presMap['devices'] = devices;
|
548
|
593
|
},
|