瀏覽代碼

Fix presence exchange.

- Added 'show' element
- 'busy' must be 'dnd'
JC Brand 12 年之前
父節點
當前提交
49fd8a7ecd
共有 2 個文件被更改,包括 17 次插入15 次删除
  1. 3 7
      converse.css
  2. 14 8
      converse.js

+ 3 - 7
converse.css

@@ -43,10 +43,6 @@
     padding: 3px 0 3px 7px;
 }
 
-.chatbox a {
-    text-decoration: none;
-}
-
 .chat-head-chatbox {
     background-color: rgb(89, 106, 114);
     background-color: rgba(89, 106, 114, 1);
@@ -356,8 +352,8 @@ form.search-xmpp-contact input {
     background: url(images/user_offline_panel.png) no-repeat 5px 2px;
 }
 
-#xmppchat-roster dd.current-xmpp-contact.busy,
-#xmppchat-roster dd.current-xmpp-contact.busy:hover {
+#xmppchat-roster dd.current-xmpp-contact.dnd,
+#xmppchat-roster dd.current-xmpp-contact.dnd:hover {
     background: url(images/user_busy_panel.png) no-repeat 5px 2px;
 }
 
@@ -634,7 +630,7 @@ input.custom-xmpp-status {
     background: url(images/user_offline_panel.png) no-repeat left;
 }
 
-.dropdown a.busy {
+.dropdown a.dnd {
     background: url(images/user_busy_panel.png) no-repeat left;
 }
 

+ 14 - 8
converse.js

@@ -559,7 +559,7 @@
                                 this.insertStatusNotification(fullname+' '+'has gone offline');
                             } else if (presence_type === 'away') {
                                 this.insertStatusNotification(fullname+' '+'has gone away');
-                            } else if ((presence_type === 'busy') || (presence_type === 'dnd')) {
+                            } else if ((presence_type === 'dnd')) {
                                 this.insertStatusNotification(fullname+' '+'is busy');
                             } else if (presence_type === 'online') {
                                 this.$el.find('div.chat-event').remove();
@@ -644,7 +644,7 @@
                 '<span id="xmpp-status-holder">'+
                     '<select id="select-xmpp-status">'+
                         '<option value="online">Online</option>'+
-                        '<option value="busy">Busy</option>'+
+                        '<option value="dnd">Busy</option>'+
                         '<option value="away">Away</option>'+
                         '<option value="offline">Offline</option>'+
                     '</select>'+
@@ -1419,10 +1419,10 @@
                 case 'unavailable':
                     rank = 1;
                     break;
-                case 'away':
+                case 'xa':
                     rank = 2;
                     break;
-                case 'busy':
+                case 'away':
                     rank = 3;
                     break;
                 case 'dnd':
@@ -1628,11 +1628,11 @@
                     if (show.text() === 'chat') {
                         presence_type = 'online';
                     } else if (show.text() === 'dnd') {
-                        presence_type = 'busy';
+                        presence_type = 'dnd';
                     } else if (show.text() === 'xa') {
                         presence_type = 'offline';
                     } else {
-                        presence_type = show.text();
+                        presence_type = show.text() || 'online';
                     }
                 }
 
@@ -1730,7 +1730,7 @@
                 $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.offline').tsort('a', crit));
                 $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.unavailable').tsort('a', crit));
                 $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.away').tsort('a', crit));
-                $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.busy').tsort('a', crit));
+                $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.dnd').tsort('a', crit));
                 $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.online').tsort('a', crit));
             }
 
@@ -1781,7 +1781,13 @@
         },
 
         sendPresence: function (type) {
-            xmppchat.connection.send($pres({'type':type}));
+            if (type === 'unavailable') {
+                xmppchat.connection.send($pres({'type':type}));
+            } else if (type === 'online') {
+                xmppchat.connection.send($pres());
+            } else {
+                xmppchat.connection.send($pres().c('show').t(type));
+            }
         },
 
         getStatus: function () {