From e019f2d0f2dc2fbfa345ab5d7ae85e67bfdd76b8 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 25 Sep 2010 09:03:53 -0400
Subject: [PATCH] - s/RoundCube/Roundcube/

---
 program/steps/addressbook/groups.inc |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc
index df44703..542628e 100644
--- a/program/steps/addressbook/groups.inc
+++ b/program/steps/addressbook/groups.inc
@@ -4,8 +4,8 @@
  +-----------------------------------------------------------------------+
  | program/steps/addressbook/groups.inc                                  |
  |                                                                       |
- | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2010, RoundCube Dev. - Switzerland                      |
+ | This file is part of the Roundcube Webmail client                     |
+ | Copyright (C) 2010, Roundcube Dev. - Switzerland                      |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -19,7 +19,6 @@
 
 */
 
-
 if ($CONTACTS->readonly || !$CONTACTS->groups) {
   $OUTPUT->show_message('sourceisreadonly', 'warning');
   $OUTPUT->send();
@@ -31,7 +30,12 @@
   if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
     $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
     
-    if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids']))
+    $CONTACTS->set_group($gid);
+    $num2add = count(explode(',', $plugin['ids']));
+    
+    if (!$plugin['abort'] && ($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum))
+      $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
+    else if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids']))
       $OUTPUT->show_message('contactaddedtogroup');
     else if ($plugin['message'])
       $OUTPUT->show_message($plugin['message'], 'warning');
@@ -57,6 +61,7 @@
   }
   
   if ($created && $OUTPUT->ajax_call) {
+    $created['source'] = $source;
     $OUTPUT->command('insert_contact_group', $created);
   }
   else if (!$created) {
@@ -72,7 +77,7 @@
   }
 
   if ($newname && $OUTPUT->ajax_call)
-    $OUTPUT->command('update_contact_group', $gid, $newname);
+    $OUTPUT->command('update_contact_group', array('source' => $source, 'id' => $gid, 'name' => $newname));
   else if (!$newname)
     $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
 }
@@ -85,7 +90,7 @@
   }
 
   if ($deleted)
-    $OUTPUT->command('remove_group_item', $gid);
+    $OUTPUT->command('remove_group_item', array('source' => $source, 'id' => $gid));
   else
     $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
 }
@@ -93,4 +98,3 @@
 // send response
 $OUTPUT->send();
 
-?>
\ No newline at end of file

--
Gitblit v1.9.1