diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-20 18:12:56 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-20 18:12:56 -0400 |
| commit | f7be6930cf3ed6b768deb18da5f0e80f5b01d570 (patch) | |
| tree | 38eec3a85d5a91c35f842e6369c815bf4d3e7557 /alias-angular/app/js | |
| parent | e6f2a945a4fb0b3c44f6e6876f511400ca7ee8bc (diff) | |
| download | alias-f7be6930cf3ed6b768deb18da5f0e80f5b01d570.tar.gz | |
Tentative implementation of the tabs
almost there!
Diffstat (limited to 'alias-angular/app/js')
| -rw-r--r-- | alias-angular/app/js/controllers.js | 22 | ||||
| -rw-r--r-- | alias-angular/app/js/filters.js | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index 1eb53e7..8768915 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -36,7 +36,7 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { ConnectCtl.$inject = ['$scope', 'StropheSrv', '$log', '$rootScope']; -function RosterCtl($scope, StropheSrv, $log) { +function RosterCtl($scope, StropheSrv, $log, $rootScope) { $scope.contacts = {}; $scope.get_contacts = function() { return _.toArray($scope.contacts); @@ -82,10 +82,26 @@ function RosterCtl($scope, StropheSrv, $log) { $scope.getRoster(); }); - $scope.getRoster = function () { + $scope.getRoster = function() { var query = $iq({type : 'get'}).c('query', {xmlns : Strophe.NS.ROSTER}); StropheSrv.sendIQ(query, onRoster); }; + + $scope.chatWith = function(contact) { + $rootScope.$broadcast('msgrequest', {jid: contact.jid, name:contact.name}); + }; } -RosterCtl.$inject = ['$scope','StropheSrv','$log']; +RosterCtl.$inject = ['$scope','StropheSrv','$log', '$rootScope']; + +function MsgCtl($scope, $log) { + $scope.conversations = []; + $scope.$on('msgrequest', function(event, contact){ + $log.log(contact); + if (_.indexOf($scope.conversations, contact)) { + $scope.conversations.push(contact); + } + }); +} + +MsgCtl.$inject = ['$scope','$log'];
\ No newline at end of file diff --git a/alias-angular/app/js/filters.js b/alias-angular/app/js/filters.js index 6b77998..772e523 100644 --- a/alias-angular/app/js/filters.js +++ b/alias-angular/app/js/filters.js @@ -15,7 +15,7 @@ angular.module('Alias.filters', []). }); } }; - }).filter('hideoffline', function() { + }).filter('showoffline', function() { return function(contacts, checkoffline) { if(checkoffline) { return contacts; |
