]> git.babelmonkeys.de Git - socialXMPP.git/commitdiff
Check if there is a nick specified or not
authorFlorian Zeitz <florob@babelmonkeys.de>
Wed, 18 Mar 2009 23:00:50 +0000 (00:00 +0100)
committerFlorian Zeitz <florob@babelmonkeys.de>
Wed, 18 Mar 2009 23:00:50 +0000 (00:00 +0100)
scripts/basic.js

index e0d2c38c8dd25ff26b4df61c39aa091a4a707fd1..35719aca0b88d1bf72480e73d3d83251f0d66033 100644 (file)
@@ -56,7 +56,11 @@ function _cbRoster(e) {
     var query = e.getElementsByTagName('query')[0];
     var entries = query.getElementsByTagName('item');
     for (var item=0; item<entries.length; item++) {
-       addFriend(entries[item].getAttribute('jid'), entries[item].getAttribute('name'));
+       nick = entries[item].getAttribute('name');
+       if (!nick) {
+           nick = entries[item].getAttribute('jid').split('@')[0];
+       }
+       addFriend(entries[item].getAttribute('jid'), nick);
     }
     return false;
 }