aboutsummaryrefslogtreecommitdiffstats
path: root/app/js/controllers.js
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2012-04-02 02:13:32 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2012-04-02 02:13:32 -0400
commit9b142c6dc7d5736acc45142a5d42c4511fc49edc (patch)
treec236e9ec0dcc67e6809bd7addad012e41d5bf9b7 /app/js/controllers.js
parenta5edfb4b0a960307cdabcfab87d8bdae94f06b74 (diff)
downloadalias-9b142c6dc7d5736acc45142a5d42c4511fc49edc.tar.gz
new angular branch
Diffstat (limited to 'app/js/controllers.js')
-rw-r--r--app/js/controllers.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/js/controllers.js b/app/js/controllers.js
new file mode 100644
index 0000000..4199c7f
--- /dev/null
+++ b/app/js/controllers.js
@@ -0,0 +1,21 @@
+'use strict';
+/* App Controllers */
+
+function RosterCtl($scope, connection) {
+ $scope.contacts = [];
+ $scope.init = function() {
+ var query = $iq({type : 'get'}).c('query', {xmlns : Strophe.NS.ROSTER});
+ connection.sendIQ(query, success);
+ };
+ $scope.onRoster = function(iq) {
+ var elems = iq.getElementsByTagName('query');
+ var query = elems[0];
+ Strophe.forEachChild(query, 'item', function(item){
+ var jid = item.getAttribute('jid');
+ var name = item.getAttribute('name') || jid;
+ $scope.contacts.push(name);
+ });
+ return true;
+ };
+};
+RosterCtl.$inject = ['$scope','connection']; \ No newline at end of file