diff --git a/src/messenger/inprogress/webim/fgot2.php b/src/messenger/inprogress/webim/fgot2.php
index 50b4955b..91ebf92a 100644
--- a/src/messenger/inprogress/webim/fgot2.php
+++ b/src/messenger/inprogress/webim/fgot2.php
@@ -8,5 +8,5 @@
 	Your username:$username 
 	Your new password:$password 
 	click here to confirm the changes."
-Mail($to, $subj, $message);
+# mail($to, $subj, $message);
 	?>
\ No newline at end of file
diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index fe2e131c..a227ffb6 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -282,10 +282,23 @@ function setup_survey($name, $email, $groupid, $info, $referrer) {
 	$page['referrer'] = urlencode(topage($referrer));
 
 	if($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") {
-		$allgroups = get_groups(false);
+		$link = connect();
+		$allgroups = get_groups($link,true,true);
+		mysql_close($link);
 		$val = "";
-		foreach($allgroups as $k) { 
-			$val .= "<option value=\"".$k['groupid']."\"".($k['groupid'] == $groupid ? " selected=\"selected\"" : "").">".$k['vclocalname']."</option>";
+		foreach($allgroups as $k) {
+			$groupname = $k['vclocalname'];
+			if($k['inumofagents'] == 0) {
+				continue;
+			}
+			if($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) {
+				$groupname .= " (online)";
+				if(!$groupid) {
+					$groupid = $k['groupid'];
+				}
+			}
+			$isselected = $k['groupid'] == $groupid;
+			$val .= "<option value=\"".$k['groupid']."\"".($isselected ? " selected=\"selected\"" : "").">$groupname</option>";
 		}
 		$page['groups'] = $val;
 	}
diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php
index 0cbb2a05..728a9791 100644
--- a/src/messenger/webim/libs/operator.php
+++ b/src/messenger/webim/libs/operator.php
@@ -211,8 +211,7 @@ function setup_redirect_links($threadid,$token) {
 	$operators = select_multi_assoc($query, $link);
 
 	if($settings['enablegroups'] == "1") {
-		$query = "select groupid, vclocalname, vccommonname from chatgroup order by vclocalname $limit";
-		$groups = select_multi_assoc($query, $link);
+		$groups = get_groups($link, true, true);
 	}
 	
 	mysql_close($link);
@@ -233,11 +232,15 @@ function setup_redirect_links($threadid,$token) {
 	if($settings['enablegroups'] == "1") {
 		$params = array('thread' => $threadid, 'token' => $token);
 		foreach($groups as $group) {
+			if($group['inumofagents'] == 0) {
+				continue;
+			}
 			$params['nextGroup'] = $group['groupid'];
+			$online = $group['ilastseen'] < $settings['online_timeout'] ? getlocal("char.redirect.operator.online_suff") : "";
 			$group_list .= "<li><a href=\"".add_params($webimroot."/operator/redirect.php",$params).
 								"\" title=\"".topage(get_group_name($group))."\">".
 								topage(get_group_name($group)).
-							"</a></li>";
+							"</a> $online</li>";
 		}
 	}
 	$page['redirectToGroup'] = $group_list;
@@ -276,16 +279,19 @@ function prepare_menu($operator,$hasright=true) {
 	}
 }
 
-function get_groups($countagents) {
-	$link = connect();
+function get_groups($link,$countagents, $checkonline=false) {
 	$query = "select chatgroup.groupid as groupid, vclocalname, vclocaldescription".
 			($countagents 
 					? ", (SELECT count(*) from chatgroupoperator where chatgroup.groupid = chatgroupoperator.groupid) as inumofagents" 
 					: "").
+			($checkonline 
+					? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ".
+						"from chatgroupoperator, chatoperator where chatgroup.groupid = chatgroupoperator.groupid ".
+						"and chatgroupoperator.operatorid = chatoperator.operatorid) as ilastseen" 
+					: "").
+					
 			 " from chatgroup order by vclocalname";
-	$result = select_multi_assoc($query, $link);
-	mysql_close($link);
-	return $result;
+	return select_multi_assoc($query, $link);
 }
 
 function get_operator_groupids($operatorid) {
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index d091e1e5..d940cb7f 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -390,6 +390,8 @@ settings.geolinkparams.description=Window size and toolbars hiding
 settings.geolinkparams=Geolocation window options
 settings.host.description=Destination for you company name or logo link
 settings.host=URL of your website
+settings.leavemessage_captcha.description=Protection against automated spam (captcha)
+settings.leavemessage_captcha=Force visitor to enter verification code when leaving message
 settings.logo.description=Enter http address of your company logo
 settings.logo=Your company logo
 settings.no.title=Please enter your company title
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index 4365460d..10fefbaf 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -386,6 +386,8 @@ settings.geolinkparams.description=
 settings.geolinkparams=����� ��� ���� � ��������������
 settings.host.description=����� ����������� �� ������� �� ������� ��� �������� �������� � ��� ����
 settings.host=������ �� ��� ��� ����
+settings.leavemessage_captcha.description=������ �� ������������������� ����� (captcha)
+settings.leavemessage_captcha=��������� ��������� ��������� ������ ����� ����� ������������ ���� � ��������
 settings.logo.description=������� ������ �� ������� ��������
 settings.logo=���� ��������
 settings.no.title=������� ��� ����� ��������
diff --git a/src/messenger/webim/operator/canned.php b/src/messenger/webim/operator/canned.php
index ebd0ca25..2aaa0d5d 100644
--- a/src/messenger/webim/operator/canned.php
+++ b/src/messenger/webim/operator/canned.php
@@ -81,7 +81,9 @@ if($settings['enablegroups'] == '1') {
 		}
 	}
 
-	$allgroups = get_groups(false);
+	$link = connect();
+	$allgroups = get_groups($link, false);
+	mysql_close($link);
 	$page['groups'] = array();
 	$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
 	foreach($allgroups as $g) {
diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php
index b28ae987..41ec9bcc 100644
--- a/src/messenger/webim/operator/features.php
+++ b/src/messenger/webim/operator/features.php
@@ -25,7 +25,8 @@ $options = array(
 		'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics',
 		'enablessl', 'forcessl',  
 		'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage',
-		'enablepopupnotification');
+		'enablepopupnotification',
+		'enablecaptcha');
 
 loadsettings();
 $params = array();
diff --git a/src/messenger/webim/operator/getcode.php b/src/messenger/webim/operator/getcode.php
index c5639457..a6705fcd 100644
--- a/src/messenger/webim/operator/getcode.php
+++ b/src/messenger/webim/operator/getcode.php
@@ -92,7 +92,9 @@ $page['availableLocales'] = $image_locales;
 $page['availableStyles'] = $stylelist;
 
 if($settings['enablegroups'] == '1') {
-	$allgroups = get_groups(false);
+	$link = connect();
+	$allgroups = get_groups($link,false);
+	mysql_close($link);
 	$page['groups'] = array();
 	$page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group"));
 	foreach($allgroups as $g) {
diff --git a/src/messenger/webim/operator/groups.php b/src/messenger/webim/operator/groups.php
index e433c1f1..c218814f 100644
--- a/src/messenger/webim/operator/groups.php
+++ b/src/messenger/webim/operator/groups.php
@@ -40,8 +40,15 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) {
 	}
 }
 
+function is_online($group) {
+	global $settings;
+	return $group['ilastseen'] && $group['ilastseen'] < $settings['online_timeout'] ? "1" : "";	
+}
+
 $page = array();
-$page['groups'] = get_groups(true);
+$link = connect();
+$page['groups'] = get_groups($link, true, true);
+mysql_close($link);
 $page['canmodify'] = is_capable($can_administrate, $operator);
 
 prepare_menu($operator);
diff --git a/src/messenger/webim/operator/opgroups.php b/src/messenger/webim/operator/opgroups.php
index 6eafc63a..64fb04de 100644
--- a/src/messenger/webim/operator/opgroups.php
+++ b/src/messenger/webim/operator/opgroups.php
@@ -27,9 +27,12 @@ function update_operator_groups($operatorid,$newvalue) {
 	mysql_close($link);
 }
 
+
 $opId = verifyparam( "op","/^\d{1,9}$/");
 $page = array('opid' => $opId);
-$page['groups'] = get_groups(false);
+$link = connect();
+$page['groups'] = get_groups($link, false);
+mysql_close($link);
 $errors = array();
 
 $canmodify = ($opId == $operator['operatorid'] && is_capable($can_modifyprofile, $operator)) 
diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php
index 2a8b09a1..d4db1c90 100644
--- a/src/messenger/webim/view/features.php
+++ b/src/messenger/webim/view/features.php
@@ -177,6 +177,15 @@ require_once('inc_errors.php');
 			<br clear="all"/>
 		</div>
 
+		<div class="field">
+			<div class="flabel"><?php echo getlocal('settings.leavemessage_captcha') ?></div>
+			<div class="fvalue">
+				<input type="checkbox" name="enablecaptcha" value="on"<?php echo form_value_cb('enablecaptcha') ? " checked=\"checked\"" : "" ?>/>
+			</div>
+			<div class="fdescr"> &mdash; <?php echo getlocal('settings.leavemessage_captcha.description') ?></div>
+			<br clear="all"/>
+		</div>
+
 		<div class="fbutton">
 			<input type="image" name="save" value="" src='<?php echo $webimroot.getlocal("image.button.save") ?>' alt='<?php echo getlocal("button.save") ?>'/>
 		</div>
diff --git a/src/messenger/webim/view/groups.php b/src/messenger/webim/view/groups.php
index 9f40368c..a07e1cbf 100644
--- a/src/messenger/webim/view/groups.php
+++ b/src/messenger/webim/view/groups.php
@@ -49,6 +49,8 @@ require_once('inc_errors.php');
 	<?php echo getlocal("form.field.groupname") ?>
 </th><th>
 	<?php echo getlocal("form.field.groupdesc") ?>
+</th><th>
+	<?php echo getlocal("page_agents.status") ?>
 </th><th>
 	<?php echo getlocal("page.group.membersnum") ?>
 <?php if($page['canmodify']) { ?>
@@ -70,6 +72,13 @@ if(count($page['groups']) > 0) {
 	<td class="notlast">
    		<?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "&lt;none&gt;" ?>
 	</td>
+	<td class="notlast">
+<?php if(is_online($grp)) { ?>
+		<?php echo getlocal("page_agents.isonline") ?>
+<?php } else { ?>
+		<?php echo date_to_text(time() - ($grp['ilastseen'] ? $grp['ilastseen'] : time())) ?>
+<?php } ?>
+	</td>
 	<td>
    		<a href="<?php echo $webimroot ?>/operator/groupmembers.php?gid=<?php echo $grp['groupid'] ?>">
 	   		<?php echo htmlspecialchars(topage($grp['inumofagents'])) ?>