Index: /trunk/jabberit_messenger/inc/controller.xml
===================================================================
--- /trunk/jabberit_messenger/inc/controller.xml	(revision 1775)
+++ /trunk/jabberit_messenger/inc/controller.xml	(revision 1799)
@@ -35,8 +35,6 @@
 			<item ref="contacts_im" alias="verifyAddNewContact" class="contacts_im" method="verifyAddNewContact" prefix="class." suffix=".inc.php"/>
 			<item ref="db_im" alias="editHostJabber" class="db_im" method="editHostJabber" prefix="class." suffix=".inc.php"/>
-			<item ref="db_im" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/>
 			<item ref="db_im" alias="setAttributesLdap" class="db_im" method="setAttributesLdap" prefix="class." suffix=".inc.php"/>
 			<item ref="db_im" alias="setHostJabber" class="db_im" method="setHostJabber" prefix="class." suffix=".inc.php"/>
-			<item ref="db_im" alias="setPreferences" class="db_im" method="setPreferences" prefix="class." suffix=".inc.php"/>
 			<item ref="db_im" alias="setOuGroupsLocked" class="db_im" method="setOuGroupsLocked" prefix="class." suffix=".inc.php"/>
 			<item ref="db_im" alias="setOrganization" class="db_im" method="setOrganization" prefix="class." suffix=".inc.php"/>
@@ -49,4 +47,6 @@
 			<item ref="fileDefine" alias="ldapInternal" class="fileDefine" method="ldapInternal" prefix="class." suffix=".inc.php"/>			
 			<item ref="ldap_im" alias="getGroupsLdap" class="ldap_im" method="getGroupsLdap" prefix="class." suffix=".inc.php"/>
+			<item ref="preferences" alias="getPreferences" class="db_im" method="getPreferences" prefix="class." suffix=".inc.php"/>
+			<item ref="preferences" alias="setPreferences" class="preferencesJMessenger" method="setPreferences" prefix="" suffix=".php"/>
 		</php>
 		<xml></xml>
Index: /trunk/jabberit_messenger/inc/login.php
===================================================================
--- /trunk/jabberit_messenger/inc/login.php	(revision 1504)
+++ /trunk/jabberit_messenger/inc/login.php	(revision 1799)
@@ -13,5 +13,4 @@
 	define('PHPGW_API_INC','../../phpgwapi/inc');
 	require_once(PHPGW_API_INC . '/class.Template.inc.php');
-	require_once('class.db_im.inc.php');
 
 	if(isset($_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']))
@@ -48,10 +47,4 @@
 		// FirstName
 		$CnName = explode(" ",$_SESSION['phpgw_info']['jabberit_messenger']['fullname']);
-		
-		// Preferences
-		$obj = new db_im();
-		$preferences = $obj->getPreferences();
-		$preferences = substr($preferences,(strpos($preferences,";") + 1), strlen($preferences));
-		$preferences = explode(":", $preferences);
 		
 		if(is_array($organization))
Index: /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 1761)
+++ /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 1799)
@@ -1,3 +1,4 @@
 <?php
+
   /***************************************************************************\
   *  Expresso - Expresso Messenger                                            *
@@ -20,6 +21,6 @@
 
 		// User Lang 
-		$_SESSION['phpgw_info']['jabberit_messenger']['applet_lang']	= $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']; 
-		
+		$_SESSION['phpgw_info']['jabberit_messenger']['applet_lang']	= $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+
 		//Members Group
 		$_SESSION['phpgw_info']['jabberit_messenger']['membership']		= $GLOBALS['phpgw']->accounts->membership();
Index: /trunk/jabberit_messenger/inc/class.db_im.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.db_im.inc.php	(revision 1756)
+++ /trunk/jabberit_messenger/inc/class.db_im.inc.php	(revision 1799)
@@ -212,6 +212,13 @@
 				$result[] = $this->db->row();
 	
-			if(count($result) > 0)
-				return unserialize($result[0]['preference_value']);
+			if( count($result) > 0 )
+			{
+				$_return = unserialize($result[0]['preference_value']);
+				
+				if( is_array($_return) )
+					return $_return['preferences'];
+				else
+					return $_return;
+			}
 		}
 
@@ -219,33 +226,4 @@
 	}
 
-	public final function setPreferences($pParam)
-	{
-		$preferences = $pParam['preferences1'];
-		
-		if(isset($pParam['preferences2']))
-			$preferences .= ";". $pParam['preferences2'];
-		
-		if(isset($pParam['preferences3']))
-			$preferences .= ";". $pParam['preferences3'];
-		
-		$user_id  = $this->user_id;
-		
-		$query = "insert into phpgw_preferences values('".$user_id."','jabberit_messenger','".serialize($preferences)."')";
-				
-		if($this->db->query($query))
-		{ 
-			return "true";
-		}
-		else
-		{
-			$query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='jabberit_messenger' and preference_owner='".$user_id."'";
-
-			if($this->db->query($query))
-				return "true";
-			else
-				return "false";			
-		}		
-	}
-	
 	public final function setApplications($pApplications)
 	{
