Index: /trunk/instant_messenger/inc/class.Ujabber.inc.php
===================================================================
--- /trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 73)
+++ /trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 76)
@@ -358,4 +358,30 @@
       }
    }
+
+   /*
+    * Composing / Paused Message
+    */
+
+   function composingMessage($pComposing)
+   {
+
+		$xml  = "<message xmlns='jabber:client' to='".$pComposing['to']."' id='".time()."' type='chat'>";
+		$xml .= "<x xmlns='jabber:x:event'>";
+		$xml .= "<composing/>";
+		$xml .= "</x>";
+		$xml .= "<composing xmlns='http://jabber.org/protocol/chatstates'/>";
+		$xml .= "</message>";
+   	$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] .= $xml;
+   }
+   
+   function pausedMessage($pComposing)
+   {
+		$xml  = "<message xmlns='jabber:client' to='".$pComposing['to']."' id='".time()."' type='chat'>";
+		$xml .= "<x xmlns='jabber:x:event'/>";
+		$xml .= "<paused xmlns='http://jabber.org/protocol/chatstates'/>";
+		$xml .= "</message>";
+
+		$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] .= $xml;
+   }
    
    /*
Index: /trunk/instant_messenger/js/im_preferences.js
===================================================================
--- /trunk/instant_messenger/js/im_preferences.js	(revision 70)
+++ /trunk/instant_messenger/js/im_preferences.js	(revision 76)
@@ -341,9 +341,8 @@
 			nickname = (func.trim(nickname) != "" ) ? nickname : _this.jid ;
 			message  = (func.trim(message) != "" ) ? message : "Sua Mensagem";
+			IM.custom_message = message;
 			
 			var span_nick = document.getElementById('span_nickname');
-				span_nick.innerHTML = ( nickname ) ? "<b>&nbsp;" + decodeURI(nickname.substring(0,15)) + "</b>" : "<b>&nbsp;" + IM.get_lang('Nickname') + "</b>";
-			var span_mess = document.getElementById('span_message');
-				span_mess.innerHTML = ( message ) ? "<b>&nbsp;" + decodeURI(message.substring(0,20)) + "</b>" : "<b>&nbsp;" + IM.get_lang('Status') + "</b>";
+				span_nick.innerHTML = ( nickname ) ? "<b>" + decodeURI(nickname.substring(0,15)) + "</b>" : "<b>" + IM.get_lang('Nickname') + "</b>";
 		}
 		XMLTools.request('$this.Ujabber.getJid','GET',handler_getId);
@@ -408,10 +407,7 @@
 			{	
 				var nn = ( func.trim(document.getElementById(Nvcard[i]).value) != "") ? document.getElementById(Nvcard[i]).value : this.jid; 
-				document.getElementById('span_nickname').innerHTML = "<b>&nbsp;" + nn.substring(0,15) + "</b>";
-			}
-			if( Nvcard[i] === 'DESC' )
-			{
-				document.getElementById('span_message').innerHTML = "<b>&nbsp;" + document.getElementById(Nvcard[i]).value.substring(0,20) + "...</b>";
-			}
+				document.getElementById('span_nickname').innerHTML = "<b>" + nn.substring(0,15) + "</b>";
+			}
+
 			value = document.getElementById(Nvcard[i]).value;
 			value = (func.trim(value) != "") ? value : "";
Index: /trunk/instant_messenger/js/im_functions.js
===================================================================
--- /trunk/instant_messenger/js/im_functions.js	(revision 75)
+++ /trunk/instant_messenger/js/im_functions.js	(revision 76)
@@ -6,4 +6,7 @@
 	   this.userPrefe   = false;
 	   this.count_Vcard = 0;
+	   this._listen     = "";
+	   this.custom_message = "";
+	   this.timeout_composing = "";
 	}
 
@@ -20,4 +23,6 @@
 			if( data )
 			{
+				if(data == 'available' || data == 'xa')
+					awayFlag = true;
 				statusFlag = data;
 				setTimeout('IM.ImgStatus("'+data+'")',4000);
@@ -68,7 +73,7 @@
 	      }catch(e){}
 
-	      setTimeout('IM.listen()', 3000);
+	      _this._listen = setTimeout('IM.listen()', 3000);
 	   };
-	   this._listen = false;
+
 	   XMLTools.__RETURN_MODE__ = 'XML';
 	   XMLTools.request('$this.Ujabber.listen', 'GET', handler);
@@ -454,4 +459,8 @@
 	   }
 	};
+    
+    /*
+     * Composing / GetComposing / Paused Message
+     */
 
 	IM.prototype.getComposing = function(data)
@@ -476,4 +485,31 @@
 			}
 		}
+	};
+	
+	IM.prototype.composingMessage = function(pId)
+	{
+		if( IM.timeout_composing )
+		{	
+			clearTimeout(IM.timeout_composing);
+			IM.timeout_composing = eval('setTimeout("IM.pausedMessage(\'' + pId + '\')",2000)');
+		}
+		else
+		{
+			IM.timeout_composing = eval('setTimeout("IM.pausedMessage(\'' + pId + '\')",2000)');
+			var handler_composingMessage = function(data)
+			{
+			};
+			XMLTools.request('$this.Ujabber.composingMessage', 'POST', handler_composingMessage,"to="+pId);
+		}
+	};
+	
+	IM.prototype.pausedMessage = function(pId)
+	{
+		clearTimeout(IM.timeout_composing);
+		IM.timeout_composing = "";
+		var handler_pausedMessage = function(data)
+		{
+		};
+		XMLTools.request('$this.Ujabber.pausedMessage','POST',handler_pausedMessage,"to="+pId);
 	};
 
@@ -789,7 +825,7 @@
 		    eval('var option' + (parseInt(i)+1) + '_image = _img[' + i + '];');
 		 }
-
+		
 		 option1_link.onclick = function(){statusFlag = 'available'; IM.setStatus('available');};
-		 option2_link.onclick = function(){statusFlag = 'xa'; IM.setStatus('xa');};
+		 option2_link.onclick = function(){statusFlag = 'xa'; awayFlag = false; IM.setStatus('xa');};
 		 option3_link.onclick = function(){statusFlag = 'dnd'; IM.setStatus('dnd');};
 		 option4_link.onclick = function(){statusFlag = 'unavailable'; IM.setStatus('unavailable');};
@@ -843,5 +879,5 @@
 			if ( pStatus == 'custom' )
 			{
-				pStatus = prompt('Personalize seu Status : ');
+				pStatus = prompt('Personalize seu Status : ', this.custom_message);
 				pStatus = 'show=' + statusFlag + '&status=' + pStatus;
 			}
@@ -875,16 +911,18 @@
    IM.prototype.setAway = function()
    {
-      if ( statusFlag != 'available' || this._listen > 0 )
-         return false;
-
-      if ( awayFlag )
+      if(statusFlag != 'dnd' && statusFlag != 'unavailable')
       {
-	     this.setStatus('available');
-         awayFlag = false;
-      }
-      else
-      {
-         this.setStatus('xa');
-         awayFlag = true;
+		  if ( awayFlag )
+	      {
+		     this.setStatus('available');
+		     statusFlag = 'available';
+	         awayFlag = false;
+	      }
+	      else
+	      {
+	         this.setStatus('xa');
+	   	     statusFlag = 'xa';
+	       	 awayFlag = true;
+	      }		
       }
    };
Index: /trunk/instant_messenger/js/im_var_globals.js
===================================================================
--- /trunk/instant_messenger/js/im_var_globals.js	(revision 70)
+++ /trunk/instant_messenger/js/im_var_globals.js	(revision 76)
@@ -3,5 +3,5 @@
 * @DATE: 2006/10/23 11:37:30
 * @LAST CHANGE: Qui 14 Dez 2006 14:28:12 BRST::
-*/
+**/
 
 var focusFlag = true;
@@ -20,14 +20,16 @@
 function awayTimer()
 {
-	if ( awayFlag )
+	if( awayFlag )
 		IM.setAway();
 	
 	if(window.IM_Preferences)
 	{
-		if ( _awayTimer )
+		if( _awayTimer )
 			clearTimeout(_awayTimer);
 		_awayTimer = setTimeout("IM.setAway()", parseInt(IM_Preferences.im_timer_xa) * 60000 );
 	}
 }
+
+awayTimer();
 
 function windowBlur() 
Index: /trunk/instant_messenger/js/im_win.js
===================================================================
--- /trunk/instant_messenger/js/im_win.js	(revision 75)
+++ /trunk/instant_messenger/js/im_win.js	(revision 76)
@@ -77,19 +77,20 @@
 			func.confEl(main_menu_head_picture, 'style', 'float: left; height: 65px; margin: 2px; width: 49px;');
 
+			var main_menu_head_name_lable = func.newEl('span');
+			func.confEl(main_menu_head_name_lable,'style','margin: 3px;');
+			main_menu_head_name_lable.innerHTML = "Nickname ";
+
+			var br1 = func.newEl('br');
+						
 			var main_menu_head_name = func.newEl('span');
 			func.confEl(main_menu_head_name, 'id', 'span_nickname');
-			var main_menu_head_name_txt = document.createTextNode(" your nickname");
+			func.confEl(main_menu_head_name, 'style', 'margin-left: 5px;');
+			var main_menu_head_name_txt = document.createTextNode("your nickname");
 			func.insEl(main_menu_head_name_txt, main_menu_head_name);
 
-			var br1 = func.newEl('br');
-
-			var main_menu_head_message = func.newEl('span');
-			func.confEl(main_menu_head_message, 'id', 'span_message');
-			var main_menu_head_message_txt = document.createTextNode(' your message');
-			func.insEl(main_menu_head_message_txt, main_menu_head_message);
-
 			var br2 = func.newEl('br');
-
-			func.insEl(main_menu_head_picture, main_menu_head_name, br1, main_menu_head_message, br2, main_menu_head);
+			var br3 = func.newEl('br');
+
+			func.insEl(main_menu_head_picture, main_menu_head_name_lable, br1, main_menu_head_name, br2, br3, main_menu_head);
 
 			var main_menu_head_div = func.newEl("div");
@@ -984,8 +985,10 @@
    "getText" : function(e)
    {
+
       if ( !focusFlag ) windowFocus();
       evt = e.keyCode;
       pId = ( e.srcElement ) ? e.srcElement.id : e.target.getElementsByTagName('body').item(0).id;
       pId = pId.replace('_at_', '@').replace(/_dot_/g, '.')
+	  IM.composingMessage(pId);	
       switch ( evt )
       {
