Limit length of Commands sent to citserver; do multible json requests if neccessary
[citadel.git] / webcit / static / summaryview.js
index 280fe788551363d9a7153b1d8667a526be1b4f35..0dffd2416482ea75d493a79596532b6ff56aa010 100644 (file)
@@ -413,6 +413,23 @@ function deleteAllSelectedMessages() {
     var msgIds = "";
     for(msgId in currentlyMarkedRows) {
        msgIds += ","+msgId;
+
+       if (msgIds.length > 800) {
+           if (!room_is_trash) {
+               mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|_TRASH_|0");
+           }
+           else {
+               mvCommand = encodeURI("g_cmd=DELE " + msgIds);
+           }
+           new Ajax.Request("ajax_servcmd", {
+               parameters: mvCommand,
+               method: 'post',
+               onSuccess: function(transport) {
+                   WCLog(transport.responseText);
+               }
+           });
+           msgIds = "";
+       }
     }
 
     if (!room_is_trash) {