public static function fnUpdateTweetAjax($status, $user, $room, $tomail, $bstatus, $parent) {
		$text = 'hello world;';
		include('WikiTweet.config.php');
		$show = ($tomail==2) ? 2 : 1;
		global $wgDBprefix, $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, $wgLanguageCode, $IP, $wgServer ;
		$db = mysql_connect($wgDBserver, $wgDBuser, $wgDBpassword);
		mysql_select_db($wgDBname,$db);

		$dbr =& wfGetDB( DB_SLAVE );
		$dbr->insert('wikitweet',array(
			'`id`'      => ''      ,
			'`text`'    => $status ,
			'`user`'    => $user   ,
			'`room`'    => $room   ,
			'`show`'    => $show   ,
			'`status`'  => $bstatus,
			'`parent`'  => $parent,
			'`lastupdatedate`' => time()
		));

		if( $parent != 0 )
		{
			// update last update date parent tweet
			$dbr->update( 'wikitweet', array('`lastupdatedate`' => time()), array('id' => $parent) ) ;
		}
		
		$dest=array('concerned'=>array(),'subscribers'=>array()); // initialisation de la liste des récepteurs
		$user_email = $wgWikiTweet['wikimail']; // initialisation du sender
		if($tomail==1 or $tomail==2 or  !$wgWikiTweet['tweetandemail']){ // si l'option tomail est à 1 ou 2 > mails directs, mentions, privés
			$res = $dbr->select('user','user_email',"user_name = '$user' ");

			if ($dbr->numRows($res) > 0){
				$row = $dbr->fetchObject($res);
				$user_email = $row->user_email;
				if ($user_email!=''){
					$status_array = split("@",$status);
					$i = -1;
					foreach($status_array as $values){
						$i += 1;
						if ($i>0){
							$values_array = split(" ",$values);
							$username = $values_array[0];
							$res2 = $dbr->select('user','user_email',"user_name = '$username' ");
							if ($dbr->numRows($res2) > 0){
								$row2 = $dbr->fetchObject($res2);
								$useremail = $row2->user_email;
								if ($useremail!='')
									array_push($dest['concerned'],$useremail);
							}
						}
					}
				}
			}
		}
		if( $tomail!=2)
		{
			// pas d'envoi de mails groupés pour les tweets privés
			// à ce stade, $dest contient les utilisateurs qui sont spécifiques au tweets, et non pas abonnés.
			$roomssons = array();
			$sql_subscriptions = '';
			// récupération des abonnés pour envoi de mail (abonnés user ou abonnés room + inherit rooms)
			foreach(WikiTweetFunctions::_getParentsRoom($room,$wgWikiTweet['inherit']) as $roomparent)
			{
				$sql_subscriptions .= " OR (wt.link = '$roomparent' AND wt.type='room')";
			}
			$sql1 = "SELECT DISTINCT {$wgDBprefix}user.user_email FROM {$wgDBprefix}user,{$wgDBprefix}wikitweet_subscription wt WHERE wt.user={$wgDBprefix}user.user_name AND ((wt.link = '$room' AND wt.type='room') or (wt.link='$user' AND wt.type='user'){$sql_subscriptions}) ;";

			$res1 = $dbr->query( $sql1, __METHOD__ );
			while( $row1 = $dbr->fetchObject( $res1 ) )
			{
				$useremail = $row1->user_email;
				array_push($dest['subscribers'],$useremail);
				$text .= $useremail.'---';
			}
		}
		$lenlist = array('concerned'=>0,'subscribers'=>0);
		foreach($dest as $desttype=>$destarray)
		{
			foreach($dest[$desttype] as $destmail){
				$lenlist[$desttype] += strlen($destmail);
				$text .= "--g:$desttype:$destmail--";
			}
		}
		$bstatus_string = ($bstatus > 1) ? ' ['.wfMsg('wikitweet-status'.$bstatus).']' : '';
		
		foreach($dest as $desttype=>$destarray)
		{
			if($lenlist[$desttype]>0){
				$room_title = (isset($wgWikiTweet['titles'][$room])) ? $room.' - '.$wgWikiTweet['titles'][$room] : $room;
				$concernsstring = ($desttype == 'concerned') ? "[".wfMsg('wikitweet-concerns')."]" : "";
				$sender = ($desttype == 'concerned') ? $wgWikiTweet['wikimail-concerns'] : $wgWikiTweet['wikimails'][$bstatus];

				$answering = '';
				if( $parent != 0 )
				{
					// en réponse au wikitweet
					$res = $dbr->select( 
						'wikitweet' , 
						'*' , 
						"`show`=1 AND `id`='$parent'",
						__METHOD__ ,
						array("ORDER BY" =>" `date` ASC", "LIMIT" => $rows)
					);
					$row = $dbr->fetchObject( $res );
					$answering = wfMsg('wikitweet-inresponseto')." \n\n".wfMsg('wikitweet-from')." @{$row->user} ({$row->date}) : {$row->text}\n";

					$res = $dbr->select( 
						'wikitweet' , 
						'*' , 
						"`show`=1 AND `parent`='$parent'",
						__METHOD__ ,
						array("ORDER BY" =>" `date` ASC", "LIMIT" => $rows)
					);
					while( $row = $dbr->fetchObject( $res ) )
					{
						$answering .= "\n\t|----\n\t| ".wfMsg('wikitweet-from')." @{$row->user} ({$row->date}) : {$row->text}";
					}
					$answering .= "\n\t|----";
				}

				WikiTweetFunctions::send( $dest[$desttype], $sender , "[WikiTweet]$bstatus_string $concernsstring  ".date('d/m H:i')." @$user (".wfMsg('wikitweet-in')." $room_title)", wfMsg('wikitweet-from')." @$user :\n----\n".$status."\n----\n\n$answering(".wfMsg('wikitweet-in')." \"$room_title\")\n\n".wfMsg('wikitweet-directlink')." $wgServer/mediawiki/index.php/{$wgWikiTweet['roomlink']}$room");
				$text .= wfMsg('wikitweet-mailsent');
			}
		}
		mysql_close(); 
		return $text;
	}