@@ -739,11 +739,15 @@ ChatProxy.prototype = {
739
739
// get the roster and save
740
740
self . roster . get ( function ( contacts ) {
741
741
self . roster . contacts = contacts ;
742
+ // send first presence if user is online
743
+ self . connection . send ( $pres ( ) ) ;
742
744
} ) ;
743
745
} else {
744
746
// get the roster and save
745
747
self . roster . get ( function ( contacts ) {
746
748
self . roster . contacts = contacts ;
749
+ // send first presence if user is online
750
+ self . connection . send ( $pres ( ) ) ;
747
751
// connected and return roster as result
748
752
callback ( null , self . roster . contacts ) ;
749
753
} ) ;
@@ -762,9 +766,6 @@ ChatProxy.prototype = {
762
766
}
763
767
}
764
768
765
- // chat server will close your connection if you are not active in chat during one minute
766
- // initial presence and an automatic reminder of it each 55 seconds
767
- self . connection . send ( $pres ( ) ) ;
768
769
break ;
769
770
case Strophe . Status . DISCONNECTING :
770
771
Utils . QBLog ( '[Chat]' , 'Status.DISCONNECTING' ) ;
@@ -817,12 +818,31 @@ ChatProxy.prototype = {
817
818
818
819
self . helpers . setUserCurrentJid ( self . helpers . userCurrentJid ( self . Client ) ) ;
819
820
820
- /** Send first presence if user is online */
821
- var presence = chatUtils . createStanza ( XMPP . Stanza , null , 'presence' ) ;
822
- self . Client . send ( presence ) ;
821
+ // enable carbons
822
+ self . _enableCarbons ( ) ;
823
823
824
824
if ( typeof callback === 'function' ) {
825
- callback ( null , true ) ;
825
+ var presence = chatUtils . createStanza ( XMPP . Stanza , null , 'presence' ) ;
826
+
827
+ if ( params . connectWithoutGettingRoster ) {
828
+ // connected and return nothing as result
829
+ callback ( null , undefined ) ;
830
+ // get the roster and save
831
+ self . roster . get ( function ( contacts ) {
832
+ self . roster . contacts = contacts ;
833
+ // send first presence if user is online
834
+ self . Client . send ( presence ) ;
835
+ } ) ;
836
+ } else {
837
+ // get the roster and save
838
+ self . roster . get ( function ( contacts ) {
839
+ self . roster . contacts = contacts ;
840
+ // send first presence if user is online
841
+ self . Client . send ( presence ) ;
842
+ // connected and return roster as result
843
+ callback ( null , self . roster . contacts ) ;
844
+ } ) ;
845
+ }
826
846
}
827
847
} ) ;
828
848
0 commit comments