Index: /trunk/prototype/services/iCal.php
===================================================================
--- /trunk/prototype/services/iCal.php	(revision 6807)
+++ /trunk/prototype/services/iCal.php	(revision 6861)
@@ -572,5 +572,5 @@
 				$interation['schedulable://' . $schedulable['id']] = false;
 			    break;
-
+				
 			case 'ADD':
 			    break;
@@ -720,5 +720,10 @@
 
 			case 'REPLY':
-			    $interation = ICAL_ACTION_REPLY;
+				if ($schedulable = self::_getSchedulable($uid)) {
+					while ($property = $component->getProperty('attendee', FALSE, TRUE))
+					    if ($attendee = self::_getParticipantByMail(str_replace('MAILTO:', '', $property['value']), $schedulable['participants'], true))
+							$interation = (constant('STATUS_' . strtoupper($property['params']['PARTSTAT'])) == $attendee['status']) ?  ICAL_ACTION_NONE : ICAL_ACTION_REPLY;
+			    }else
+			    	$interation = ICAL_NOT_FOUND;
 			    break;
 
@@ -810,9 +815,9 @@
     
     
-    private static function _getParticipantByMail($mail, &$participants) {
+    private static function _getParticipantByMail($mail, &$participants, $isFull) {
 	if ($participants && $participants != '')
 	    foreach ($participants as $i => $v)
 		if ((is_array($v) && isset($v['user'])) && ($v['user']['mail'] == $mail || (isset($v['user']['mailAlternateAddress']) && in_array($mail, $v['user']['mailAlternateAddress']))))
-		    return $v['id'];
+		      return !!$isFull ? $v : $v['id'];
 	return false;
     }
Index: /trunk/prototype/modules/calendar/constants.php
===================================================================
--- /trunk/prototype/modules/calendar/constants.php	(revision 6295)
+++ /trunk/prototype/modules/calendar/constants.php	(revision 6861)
@@ -33,4 +33,5 @@
 define('ICAL_ACTION_IMPORT_FROM_PERMISSION', 10);
 define('ICAL_ACTION_NONE_FROM_PERMISSION', 11);
+define('ICAL_NOT_FOUND', 12);
 
 define('ATTENDEE_ACL_ORGANIZATION', 'o');
Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 6851)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 6861)
@@ -3190,7 +3190,11 @@
         }
 		attachments.id = "attachments_" + ID;
+		var parserImport = false;
 		for (var i=0; i<info_msg.attachments.length; i++)
 		{
+			var import_url = '$this.db_functions.import_vcard&msg_folder='+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding;
 			var link_attachment = document.createElement("a");
+			link_attachment.setAttribute("class", "type_images");
+			link_attachment.style.display = "block";
 			link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i));
 			link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")";
@@ -3205,11 +3209,13 @@
 				link_import_attachment.setAttribute("onclick","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"'); return false;");
 				link_import_attachment.title = get_lang("Import to calendar");
+				link_import_attachment.style.display = "inline";
 				link_import_attachment.align = "top";
 				link_import_attachment.style.marginLeft = "5px";
 				link_import_attachment.style.cursor = "pointer";
 				link_attachment.appendChild(link_import_attachment);
-			}
-
-                        if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1))
+				parserImport = true;
+			}
+
+            if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1))
 			{
 				//Link para importar calendário
@@ -3223,14 +3229,51 @@
 				link_open_msg.style.cursor = "pointer";
 				link_attachment.appendChild(link_open_msg);
-		}
-		
-            link_attachment.innerHTML += '<br/>';
+			}
+		
+            //link_attachment.innerHTML += '<br/>';
             attachments.appendChild(link_attachment);
             }
 		tr6.appendChild(td6);
-            tr6.appendChild(attachments);
+        tr6.appendChild(attachments);
 		tbody_message_others_options.appendChild(tr6);
 	}
 
+	if (parserImport){
+		$.ajax({
+			url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&readable=true&cirus_delimiter='+cyrus_delimiter+'&analize=true&uidAccount='+decodeOwner(),
+			async: true,
+			success: function(data){
+				data = connector.unserialize(data);
+
+				if(typeof(data) == "object"){
+				    var calendarPermission = data.calendar;
+				    data = data.action;
+				}
+					
+				switch(parseInt(data)){
+				case 5:
+					$('.type_images').append('<img class="loader" src="templates/default/images/ajax-loader.gif" align="top" style="margin-left: 5px; cursor: pointer; display: inline">');
+					$.ajax({
+						url: "controller.php?action="+import_url+'&from_ajax=true&selected=true',
+						success: function(msg){		
+							$('.type_images').append('<img src="../prototype/modules/mail/img/flagDone.png" align="top" style="margin: 3px 0 0 5px; cursor: pointer; display: inline">').parent().find('.loader').remove();
+							write_msg( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento foi Atualizado com sucesso" : "Ocorreu um erro ao atualizar evento" );
+						}
+					});
+					return;
+					break;		
+				case 4:
+					$('.type_images').append('<img src="../prototype/modules/mail/img/flagDone.png" align="top" style="margin: 3px 0 0 5px; cursor: pointer; ">');
+					write_msg("Seu evento encontra-se atualizado.");
+					return;
+					break;
+				case 12:
+					write_msg('Este evento não existe mais.');
+					return;
+					break;			
+				}
+			}
+		});
+	}
 	//k!!
 	
@@ -4301,5 +4344,5 @@
 		show_hide(content.find(".cc-tr"), $(this));
 		change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC'));
-	});
+	})
 	
 	//BOTAO ENVIAR
