Hi, don't worry with 1.0 code, check 1.1:
[code:1] $sql = "SELECT a.*, ufrom.".($config->pubrealnames ? "name" : "username"«»)." AS fromname,
uto.".($config->pubrealnames ? "name" : "username"«»)." AS toname
FROM (#__uddeim AS a LEFT JOIN #__users AS ufrom ON a.fromid = ufrom.id)
LEFT JOIN #__users AS uto ON a.toid = uto.id
WHERE (totrashdate >= ".$timeframe." AND a.totrash=1 AND a.toid =".(int)$myself."«»)
OR (totrashdateoutbox >= ".$timeframe." AND a.totrashoutbox=1 AND a.fromid=".(int)$myself." AND a.toid<>a.fromid AND ((systemmessage IS NULL) OR (systemmessage='')))
ORDER BY IF(totrashdate,totrashdate,totrashdateoutbox) DESC LIMIT ".(int)$limitstart.", ".(int)$limit;[/code:1]
It's little bit more complex. For 1.2 I have already added "fromid" but the above code needs some optimizations though