Index: trunk/expressoMail1_2/setup/setup.inc.php
===================================================================
--- trunk/expressoMail1_2/setup/setup.inc.php	(revision 65)
+++ trunk/expressoMail1_2/setup/setup.inc.php	(revision 69)
@@ -12,5 +12,5 @@
 	$setup_info['expressoMail1_2']['name']      	= 'expressoMail1_2';
 	$setup_info['expressoMail1_2']['title']     	= 'ExpressoMail 1.2';
-	$setup_info['expressoMail1_2']['version']   	= '1.2102';
+	$setup_info['expressoMail1_2']['version']   	= '1.2103';
 	$setup_info['expressoMail1_2']['app_order'] 	= 2;
 //	$setup_info['expressoMail1_2']['tables'][]    	= 'phpgw_expressoMail1_2';
Index: trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 65)
+++ trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 69)
@@ -2073,4 +2073,44 @@
 		return $array_parts_attachments;
 	}	
+
+	function spam($params)
+	{
+		$is_spam = $params['spam'];
+		$folder = $params['folder'];
+		$mbox_stream = $this->open_mbox($folder);
+		$msgs_number = explode(',',$params['msgs_number']);
+
+		foreach($msgs_number as $msg_number) {
+			$header = imap_fetchheader($mbox_stream, imap_msgno($mbox_stream, $msg_number));
+			$body = imap_body($mbox_stream, imap_msgno($mbox_stream, $msg_number));
+			$msg = $header . $body;
+			$email = $_SESSION['phpgw_info']['expressomail']['user']['email'];
+			//$tmp_file = $tmp_dir . "msg." . $email . '.'. $msg_number . time();
+			// maybe we can get it faster with regex, don't know how :'(
+			$signature = trim(substr($header, strpos($header, 'X-DSPAM-Signature:') + 18));
+			strtok($email, '@');
+			$domain = strtok('@');
+
+			// feed dspam
+			if ($is_spam)
+ 				$cmd = str_replace(
+ 							array('##EMAIL##', '##USERNAME##', '##DOMAIN##', '##SIGNATURE##'), 
+ 							array($email, $this->username, $domain, $signature), $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam']
+ 						);
+ 			else
+ 				$cmd = str_replace(
+ 							array('##EMAIL##', '##USERNAME##', '##DOMAIN##', '##SIGNATURE##'),
+	          				array($email, $this->username, $domain, $signature), $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham']
+	          			);
+ 			
+ 			if(!system($cmd)){
+ 				imap_close($mbox_stream);
+ 				return false;
+ 			}
+ 			
+		}
+		imap_close($mbox_stream);
+		return false;
+	}
 }
 ?>
Index: trunk/expressoMail1_2/inc/hook_admin.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/hook_admin.inc.php	(revision 69)
+++ trunk/expressoMail1_2/inc/hook_admin.inc.php	(revision 69)
@@ -0,0 +1,22 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* Written by Joseph Engo <jengo@phpgroupware.org>                          *
+	* --------------------------------------------                             *
+	*  This program is free software; you can redistribute it and/or modify it *
+	*  under the terms of the GNU General Public License as published by the   *
+	*  Free Software Foundation; either version 2 of the License, or (at your  *
+	*  option) any later version.                                              *
+	\**************************************************************************/
+
+{
+// Only Modify the $file and $title variables.....
+	$title = $appname;
+	$file = Array(
+		'Site Configuration' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
+	);
+//Do not modify below this line
+	display_section($appname,$title,$file);
+}
+?>
Index: trunk/expressoMail1_2/inc/class.functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.functions.inc.php	(revision 56)
+++ trunk/expressoMail1_2/inc/class.functions.inc.php	(revision 69)
@@ -52,5 +52,8 @@
 		
 		function getLang($key){
-			return $_SESSION['phpgw_info']['expressomail']['lang'][$key];			
+			if ($_SESSION['phpgw_info']['expressomail']['lang'][$key])
+				return $_SESSION['phpgw_info']['expressomail']['lang'][$key];
+			else
+				return $key . '*';
 		}
 
Index: trunk/expressoMail1_2/js/search.js
===================================================================
--- trunk/expressoMail1_2/js/search.js	(revision 67)
+++ trunk/expressoMail1_2/js/search.js	(revision 69)
@@ -9,4 +9,5 @@
 		this.fields = new Array("_ass","_de","_body","_para","_cc","_cco");
 	}
+	var search_tabs = 0; // Count the number of seach tabs
 	
 	//Monta os forms dentro da janela;
@@ -54,6 +55,5 @@
 											  "<td><input type='button' value=" + get_lang('Search') + " onclick='EsearchE.func_search()'></td>"+
 											  "<td><input type='button' value=" + get_lang('Clean') + " onclick='EsearchE.func_clean()'></td>"+
-											  "<td><input type='button' value=" + get_lang('Close') + " onclick='EsearchE.func_close(\"close\")'></td>"+
-											  "<td><input type='button' value=" + get_lang('Hide Search') + " onclick='EsearchE.func_close(\"hidden\")'></td>"+
+											  "<td><input type='button' value=" + get_lang('Close') + " onclick='EsearchE.func_close(\"hidden\")'></td>"+
 											  "</tr>"+
 											  "</table>";
@@ -66,6 +66,6 @@
 		
 		if(value == "")
-			EsearchE.showWindow(Element("window_search"));	
-
+			EsearchE.showWindow(Element("window_search"));
+	
 		// Cria as caixas postais;
 		EsearchE.mount_folders();
@@ -135,5 +135,5 @@
 		connector.loadScript("TreeS");
 
-		if( document.getElementById("div_folders_search") == null){
+		if( Element("div_folders_search") == null){
 			var div_folders = document.createElement("DIV");
 				div_folders.id = "div_folders_search";
@@ -146,5 +146,5 @@
 				div_folders.style.overflow = "auto";
 				div_folders.innerHTML = "";
-				var dest_div = document.getElementById("folders");
+				var dest_div = Element("folders");
 				dest_div.appendChild(div_folders);
 		}		
@@ -161,11 +161,23 @@
 	// Form resultado;
 	searchE.prototype.mount_result = function(data){
-		
-		//this.func_clean();
-
+		//This func returns the most recent date
+		function date_comp(a,b)
+		{
+			var data1 = a.match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--\d*$/g);
+			data1 = data1[0].substr(0, data1[0].indexOf('--'))
+			with ( data1 ) 
+				data1 = Date.UTC(substr(-4), substr(-7, 2), substr(0, 2));
+			var data2 = b.match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--\d*$/g);
+			data2 = data2[0].substr(0, data2[0].indexOf('--'))
+			with ( data2 ) 
+				data2 = Date.UTC(substr(-4), substr(-7, 2), substr(0, 2));
+			return data2 - data1;
+		}
+		
 		var nw_array = new Array;
-		var var_tmp  = data.split("##");
+		data = data.substr(2, data.length - 4);
+		var var_tmp  = data.split("####");
 		var cont = parseInt(0);
-		var_tmp.sort();
+		var_tmp.sort(date_comp);
 		for(var i=0; i < var_tmp.length; i++){
 			if(var_tmp[i] != ""){
@@ -173,8 +185,4 @@
 				cont++;
 			}
-		}
-		if(document.getElementById("table_result") != null){
-			var cl = document.getElementById("table_result");
-			cl.parentNode.removeChild(cl);
 		}
 		var table = document.createElement("TABLE");
@@ -200,5 +208,22 @@
 			tr.style.background  =  color;
 
+			if (nw_array[i].match(/.*--.*--\w*--\d{2}\/\d{2}\/\d{4}--\d+? \w*b--\d*$/g) == null) //subject with "--"
+			{
+				var aux1 = nw_array[i].match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--\d*$/g);
+				aux1 = aux1[0].split("--");
+				nw_array[i] = nw_array[i].substr(0, nw_array[i].indexOf(aux1[0])-2);
+				var aux = [];
+				aux[0] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+				nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
+				aux[1] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+				aux[2] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
+				aux = aux.concat(aux1);
+			}
+			else
+			{
+				alert(nw_array[i]);
 			var aux = nw_array[i].split("--");
+			}
+			
 			for(var j=0 ; j < aux.length ; j++){
 					var mailbox = aux[0];
@@ -217,11 +242,12 @@
 					}
 					if( j == 1){
-						td.width = "35%";					
+						var subject_encode = url_encode(aux[2]);
+						td.width = "25%";					
 						var td1  = '<a href=javascript:void(0) onclick=EsearchE.open_msg(\"' + url_encode(mailbox) + '\",\"' + uid_msg + '\",\"' + subject_encode + '\")>' + aux[1].substr(0,25) + '</a>';
 					}
 					if( j == 2){
 						var subject_encode = url_encode(aux[2]);
-						td.width = "35%";					
-						var td1  = '<a href=javascript:void(0) onclick=EsearchE.open_msg(\"' + url_encode(mailbox) + '\",\"' + uid_msg + '\",\"' + subject_encode + '\")>' + aux[2].substr(0,25) + '...</a>';
+						td.width = "45%";					
+						var td1  = '<a href=javascript:void(0) onclick=EsearchE.open_msg(\"' + url_encode(mailbox) + '\",\"' + uid_msg + '\",\"' + subject_encode + '\")>' + aux[2].substr(0,60) + '...</a>';
 
 					}
@@ -246,15 +272,9 @@
 		table.appendChild(tbody);
 		
-		if(window.content_id_border_id_procurar)
-		{
-			// Remove header
-			content_id_border_id_procurar.removeChild(content_id_border_id_procurar.firstChild);
-			alternate_border("border_id_procurar");	
-		}
-		else
-			var border_id = create_border(get_lang("Search Results"), "border_id_procurar");
-	
+		search_tabs += 1;
+		var border_id = create_border(get_lang("Search Results"), "search_" + search_tabs);
+		var content = document.getElementById('content_id_' + "search_" + search_tabs);	
 		if(is_ie)
-		document.getElementById("border_table").width = "99.5%";
+		Element("border_table").width = "99.5%";
 		
 		/* Put header */
@@ -293,8 +313,8 @@
 		tbody_element.appendChild(tr_element);
 		table_element.appendChild(tbody_element);
-		content_id_border_id_procurar.appendChild(table_element);
+		content.appendChild(table_element);
 		/*end of "put header"*/
 		
-		content_id_border_id_procurar.appendChild(table);
+		content.appendChild(table);
 	}
 
@@ -312,5 +332,5 @@
 	// Adiciona caixas postais na busca;
 	searchE.prototype.add_mailboxes = function(){
-		var sel = document.getElementById("sel_search_nm_box1");
+		var sel = Element("sel_search_nm_box1");
 		var name_box     = this.name_box_search.split(cyrus_delimiter);
 		if(this.name_box_search == "")
@@ -335,5 +355,5 @@
 	// Remove as caixas postais na busca;
 	searchE.prototype.del_mailboxes = function(){
-		var sel = document.getElementById("sel_search_nm_box1");
+		var sel = Element("sel_search_nm_box1");
 		if(sel.length > 0){
 			for(var i=0; i < sel.options.length; i++){
@@ -348,5 +368,5 @@
 	// todas as caixas
 	searchE.prototype.all_mailboxes = function(){
-		var value = document.getElementById("check_all_msg").checked;
+		var value = Element("check_all_msg").checked;
 		var cont = parseInt(0);
 		if(value){
@@ -367,25 +387,23 @@
 		var fields = "##";
 			// Verifica se os campos estão preenchidos;
-			if(document.getElementById("txt_ass").value != "" && trim(document.getElementById("txt_ass").value) != ""){
-				fields += "SUBJECT " +  "<=>" +url_encode(document.getElementById("txt_ass").value) + " ";
-			}
-			if(document.getElementById("txt_body").value != "" && trim(document.getElementById("txt_body").value) != ""){
-				fields += "BODY " + "<=>" + url_encode(document.getElementById("txt_body").value) + " ";
-			}
-			if(document.getElementById("txt_de").value != "" && trim(document.getElementById("txt_de").value) != ""){	
-				fields += "FROM " + "<=>" + url_encode(document.getElementById("txt_de").value) + " ";
-			}
-			if(document.getElementById("txt_para").value != "" && trim(document.getElementById("txt_para").value) != ""){
-				fields += "TO " + "<=>" + url_encode(document.getElementById("txt_para").value) + " ";
-			}
-			if(document.getElementById("txt_cc").value != "" && trim(document.getElementById("txt_cc").value) != ""){
-				fields += "CC " + "<=>" + url_encode(document.getElementById("txt_cc").value) + " ";
+			if(trim(Element("txt_ass").value) != ""){
+				fields += "SUBJECT " +  "<=>" +url_encode(Element("txt_ass").value) + " ";
+			}
+			if(trim(Element("txt_body").value) != ""){
+				fields += "BODY " + "<=>" + url_encode(Element("txt_body").value) + " ";
+			}
+			if(trim(Element("txt_de").value) != ""){
+				fields += "FROM " + "<=>" + url_encode(Element("txt_de").value) + " ";
+			}
+			if(trim(Element("txt_para").value) != ""){
+				fields += "TO " + "<=>" + url_encode(Element("txt_para").value) + " ";
+			}
+			if(trim(Element("txt_cc").value) != ""){
+				fields += "CC " + "<=>" + url_encode(Element("txt_cc").value) + " ";
 			}
 			if(value) {
-				fields += "ALL " + "<=>" + url_encode(value) + " ";
-			}
-			/*if(document.getElementById("txt_cco").value != "" && trim(document.getElementById("txt_cco").value) != ""){
-				fields += "BCC " + "<=>" + url_encode(document.getElementById("txt_cco").value) + " ";
-			}*/
+				fields = "##ALL " +  "<=>" +url_encode(value) + " ";
+			}
+
 		fields += "##";
 		if(fields == "####"){
@@ -394,5 +412,5 @@
 		}
 		
-		if(document.getElementById("check_all_msg").checked){
+		if(Element("check_all_msg").checked){
 			var nm_box = new Array;
 			for(var i=0; i < EsearchE.all_boxes.length; i++){
@@ -401,5 +419,5 @@
 		}else{
 			var nm_box = new Array;
-			var sel_combo = document.getElementById("sel_search_nm_box1");
+			var sel_combo = Element("sel_search_nm_box1");
 			if( sel_combo.options.length <= 0){
 				alert("Defina quais as caixas para busca!");
@@ -419,5 +437,4 @@
 			if(data == "none"){alert(get_lang("None result was found."));}
 			else if(data == "many results"){alert(get_lang("More than %1 results. Please, try to refine your search.",50));}
-		//	else{EsearchE.mount_result_box(data);}
 			else{EsearchE.mount_result(data);}
 		}
@@ -428,5 +445,4 @@
 	// clean;
 	searchE.prototype.func_clean = function(){
-		delete_border("border_id_procurar",'false');
 		// Limpa os campos;
 		for(var i=0; i < this.fields.length; i++){
@@ -436,20 +452,8 @@
 
 	    EsearchE.all_boxes.splice(0,(EsearchE.all_boxes.length));
-
-	    // Limpa a select;		
-	    if(document.getElementById("sel_search_nm_box1") != null){
-		    var sel = document.getElementById("sel_search_nm_box1");
-		    if(sel.length > 0){
-		    	for(var i=0; i< sel.options.length; i++){
-		    		sel.options[i] = null;
-		    		i--;
-		    	}
-		    }
-		}	    
-	    if(document.getElementById("table_result") != null){
-			var cl = document.getElementById("table_result");
-			cl.parentNode.removeChild(cl);
-		}
-	}
+	  	EsearchE.del_mailboxes()
+		cl.parentNode.removeChild(cl);
+	}
+
 	// close
 	searchE.prototype.func_close = function(type){
Index: trunk/expressoMail1_2/js/main.js
===================================================================
--- trunk/expressoMail1_2/js/main.js	(revision 65)
+++ trunk/expressoMail1_2/js/main.js	(revision 69)
@@ -175,5 +175,6 @@
 
 		if(typeof(data) == 'string' && data.match(/^(.*)TRYCREATE(.*)$/)){
-			alert(get_lang('Its Lixeira folder is not created. It is necessary to create so that it functions correctly.'));
+			var move_to_folder = data.match(/^(.*)Spam(.*)$/) ? "Spam" : "Lixeira";
+			alert(get_lang('Its %1 folder is not created. It is necessary to create so that it functions correctly.', move_to_folder));
 			return false;
 		}
@@ -866,2 +867,40 @@
 	}
 }
+
+function nospam(msgs_number, border_ID){
+	var folder 		= 'INBOX'+cyrus_delimiter+'Spam';	
+	var new_folder 	= 'INBOX';
+	var new_folder_name = get_lang('INBOX');
+	var handler_move_msgs = function(data){
+		// debug
+		// alert(data);
+		set_messages_flag("unseen", "get_selected_messages");
+   	    move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name);
+	}
+
+    if (msgs_number == 'selected')
+	   	msgs_number = get_selected_messages();
+       
+	if (parseInt(msgs_number) > 0 || msgs_number.length > 0)
+		cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=false"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs);
+	else
+    	write_msg(get_lang('No selected message.'));
+}
+
+function spam(folder, msgs_number, border_ID){
+	if (folder == 'null')
+		folder = get_current_folder();
+    var new_folder 		= 'INBOX'+cyrus_delimiter+'Spam';
+	var new_folder_name = 'Spam';
+	var handler_move_msgs = function(data){
+		// debug
+		// alert(data);
+		move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name);
+	}
+    if(msgs_number == 'selected')
+		msgs_number = get_selected_messages();
+	if(parseInt(msgs_number) > 0 || msgs_number.length > 0)
+		cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=true"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs);
+	else
+    	write_msg(get_lang('No selected message.'));
+}
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 65)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 69)
@@ -819,4 +819,10 @@
 
 	div_other_options.innerHTML = option_mark_as + option_mark_as_unseen + option_mark_as_important + option_mark_as_normal + option_move + option_reply_to_all + option_reply_without_history + option_reply_to_all_without_history + option_source_msg;
+	if (use_spam_filter) {
+		if(get_current_folder() == 'INBOX'+cyrus_delimiter+'Spam')
+			div_other_options.innerHTML += ' | <span class="message_options" onclick="nospam(\'selected\',\'null\')";>'+get_lang("Not Spam")+'</span>';	
+		else
+			div_other_options.innerHTML += ' | <span class="message_options" onclick="spam(\'null\', \'selected\',\'null\')";>'+get_lang("Spam")+'</span>';	
+	}
 	td_other_options.appendChild(div_other_options);
 	//td_other_options.innerHTML = option_print + option_reply_to_all + option_source_msg;
@@ -2119,10 +2125,19 @@
 		span_R.appendChild(span_options);
 	}
+
 	span_options.innerHTML = 
 		'<span title="'+get_lang("Delete")+'" style="margin-left:8px" class="message_options" onclick=delete_msgs(\'null\',\'selected\',\'null\')>'+get_lang("Delete")+'</span> | '+
 		'<span title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindow(\"\",\"move_to\")>'+get_lang("Move")+'</span> | '+
-	   	'<span title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span> | '+
+   		'<span title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span> | '+
 	   	'<span title="'+get_lang("Export")+'" class="message_options" onclick="export_all_selected_msgs()">'+get_lang("Export")+'</span>';
 	
+	if (use_spam_filter) {
+		if ( get_current_folder() == 'INBOX'+cyrus_delimiter+'Spam' )	{
+			span_options.innerHTML += ' | <span title="'+get_lang("Not Spam")+'" class="message_options" onclick="nospam(\'selected\',\'null\')">'+get_lang("Not Spam")+'</span>';
+		}
+		else {
+			span_options.innerHTML += ' | <span title="'+get_lang("Spam")+'" class="message_options" onclick="spam(\'null\', \'selected\',\'null\')">'+get_lang("Spam")+'</span>';
+		}
+	}
 	var span_D = Element("span_D");	
 	if(!span_D){
Index: trunk/expressoMail1_2/js/doiMenuData.js
===================================================================
--- trunk/expressoMail1_2/js/doiMenuData.js	(revision 2)
+++ trunk/expressoMail1_2/js/doiMenuData.js	(revision 69)
@@ -10,5 +10,5 @@
 	var itens = new Array (
 							"preferences_mail()|"+get_lang("Preferences")+"|preferences.gif",
-							"search_emails()|"+get_lang("Search")+"|search.gif",
+							"search_emails(\"\")|"+get_lang("Search")+"|search.gif",
 							"filterbox()|"+get_lang("Edit filters")+"|filters.gif",
 							"folderbox()|"+get_lang("Edit folders")+"|editfolders.gif",
Index: trunk/expressoMail1_2/js/TreeShow.js
===================================================================
--- trunk/expressoMail1_2/js/TreeShow.js	(revision 63)
+++ trunk/expressoMail1_2/js/TreeShow.js	(revision 69)
@@ -26,4 +26,5 @@
 			}
 			ttree.FOLDER = ttreeBox.name_folder;
+			tree_folders.getNodeById(get_current_folder())._select();
 		}
 		cExecute ("$this.imap_functions.get_folders_list", handler_update_folders);		
@@ -108,4 +109,8 @@
 						return false;
 					}
+					if(ttree.FOLDER == get_current_folder()){
+						alert(get_lang("It's not possible")+" renomear essa pasta, pois está sendo utilizada!");
+						return false;
+					}
 					var button1 = prompt("Digite um novo nome para a caixa : ", "");
 					if(trim(button1) == "" || trim(button1) == null){
@@ -259,5 +264,9 @@
 		var aux = param.split(cyrus_delimiter);
 		var aux1 = aux.pop();
-		
+
+		if(ttree.FOLDER == get_current_folder()){
+			alert(get_lang("It's not possible")+" renomear essa pasta, pois está sendo utilizada!");
+			return false;
+		}
 		if(confirm("Deseja excluir a pasta '" + aux1+"' ?")){
 			var handler_return = function(data)
Index: trunk/expressoMail1_2/index.php
===================================================================
--- trunk/expressoMail1_2/index.php	(revision 65)
+++ trunk/expressoMail1_2/index.php	(revision 69)
@@ -4,5 +4,5 @@
 		'nonavbar' => False,
 		'currentapp' => 'expressoMail1_2',
-		'update_version'	=> '1.2102',
+		'update_version'	=> '1.2103',
 		'enable_nextmatchs_class' => True
 	);
@@ -14,6 +14,5 @@
 	echo '<script type="text/javascript" src="../phpgwapi/js/wz_dragdrop/wz_dragdrop.js?'.$update_version.'"></script>
 		<script type="text/javascript" src="../phpgwapi/js/dJSWin/dJSWin.js?'.$update_version.'"></script>';
-	
-	
+		
 	// Get Data from ldap_manager and emailadmin.
 	$ldap_manager = CreateObject('contactcenter.bo_ldap_manager');
@@ -60,4 +59,13 @@
 	$template->pfp('out','list');
 	$GLOBALS['phpgw']->common->phpgw_footer();
+    
+	_debug_array($_GLOBALS['phpgw_info']['server']);
+    $c = CreateObject('phpgwapi.config','expressoMail1_2');
+    $c->read_repository();
+    $current_config = $c->config_data;
+    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham'] = $current_config['expressoMail_command_for_ham'];
+    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
+    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];
+    echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
 
 	$obj = createobject("expressoMail1_2.functions");
Index: trunk/expressoMail1_2/templates/default/config.tpl
===================================================================
--- trunk/expressoMail1_2/templates/default/config.tpl	(revision 69)
+++ trunk/expressoMail1_2/templates/default/config.tpl	(revision 69)
@@ -0,0 +1,50 @@
+<!-- BEGIN header -->
+<form method="POST" action="{action_url}">
+<table border="0" align="center">
+   <tr bgcolor="{th_bg}">
+    <td colspan="2"><font color="{th_text}">&nbsp;<b>{title}</b></font></td>
+   </tr>
+<!-- END header -->
+<!-- BEGIN body -->
+   <tr bgcolor="{row_on}">
+    <td colspan="2">&nbsp;</td>
+   </tr>
+   <tr bgcolor="{row_off}">
+    <td colspan="2"><b>{lang_ExpressoMail_settings}</b></td>
+   </tr>
+   <tr bgcolor="{row_on}">
+    <td>{lang_Do_you_want_to_use_the_spam_filter?}</td>
+    <td>
+     <select name="newsettings[expressoMail_use_spam_filter]">
+      <option value=""{selected_expressoMail_use_spam_filter_False}>{lang_No}</option>
+      <option value="True"{selected_expressoMail_use_spam_filter_True}>{lang_Yes}</option>
+     </select>
+    </td>
+   </tr>
+   <tr bgcolor="{row_off}">
+    <td>{lang_Command_for_spam}</td>
+    <td>
+	<input type="text" name="newsettings[expressoMail_command_for_spam]" value="{value_expressoMail_command_for_spam}" size="60" /> 
+    </td>
+   <tr bgcolor="{row_on}">
+    <td>{lang_Command_for_unmark_spam}</td>
+    <td>
+	<input size="60" name="newsettings[expressoMail_command_for_ham]" value="{value_expressoMail_command_for_ham}"> 
+    </td>
+   </tr>
+<!-- END body -->
+<!-- BEGIN footer -->
+  <tr bgcolor="{th_bg}">
+    <td colspan="2">
+&nbsp;
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" align="center">
+      <input type="submit" name="submit" value="{lang_submit}">
+      <input type="submit" name="cancel" value="{lang_cancel}">
+    </td>
+  </tr>
+</table>
+</form>
+<!-- END footer -->
