Well with this fix a sender can remove certain messages from the outbox:
Update your database (you have to add one field):
[code:1]ALTER TABLE `jos_uddeim` ADD `totrashoutbox` INT( 1 ) DEFAULT '0' NOT NULL ;
[/code:1]
In
function showOutbox($myself, $item_id)
change
[code:1]$sql="SELECT count(id) FROM #__uddeim WHERE ((systemmessage IS NULL) OR (systemmessage='')) AND fromid=".$my->id;
[/code:1]
to
[code:1]$sql="SELECT count(id) FROM #__uddeim WHERE totrashoutbox<1 AND ((systemmessage IS NULL) OR (systemmessage='')) AND fromid=".$my->id;
[/code:1]
Change
[code:1]if($config_realnames) {
$sql="SELECT a.*, b.name AS toname FROM #__uddeim AS a, #__users AS b WHERE a.fromid=".$my->id." AND a.toid=b.id AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) ORDER BY toread ASC, datum DESC LIMIT ".$limitstart.", ".$limit;
} else {
$sql="SELECT a.*, b.username AS toname FROM #__uddeim AS a, #__users AS b WHERE a.fromid=".$my->id." AND a.toid=b.id AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) ORDER BY toread ASC, datum DESC LIMIT ".$limitstart.", ".$limit;
}
[/code:1]
to
[code:1]if($config_realnames) {
$sql="SELECT a.*, b.name AS toname FROM #__uddeim AS a, #__users AS b WHERE a.totrashoutbox<1 AND a.fromid=".$my->id." AND a.toid=b.id AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) ORDER BY toread ASC, datum DESC LIMIT ".$limitstart.", ".$limit;
} else {
$sql="SELECT a.*, b.username AS toname FROM #__uddeim AS a, #__users AS b WHERE a.totrashoutbox<1 AND a.fromid=".$my->id." AND a.toid=b.id AND ((a.systemmessage IS NULL) OR (a.systemmessage='')) ORDER BY toread ASC, datum DESC LIMIT ".$limitstart.", ".$limit;
}
[/code:1]
Change following block:
[code:1] $datumcell=uddeDate($themessage->datum);
if($themessage->toread==0) {
$deletecell="<a href=index.php?option=com_uddeim&task=recall&messageid=".$themessage->id.">"._UDDEIM_RECALL."</a>";
$deletecell.="<br>";
} else {
$deletecell="";
}
$sbsdeletecell="<a href=index.php?option=com_uddeim&task=deletefromoutbox&returnlimit=".$limit."&returnlimitstart=".$limitstart."&messageid=".$themessage->id.">"._UDDEIM_DELETELINK."</a>";
echo "\n\t<tr class='sectiontableentry".$i."'>";
echo "\n\t\t<td valign='middle'>".$readcell."</td>";
echo "\n\t\t<td>".$tocell."</td>";
echo "\n\t\t<td>".$messagecell."</td>";
echo "\n\t\t<td>".$datumcell."</td>";
echo "\n\t\t<td class='pathway'>".$deletecell.$sbsdeletecell."</td>";
echo "</tr>";
[/code:1]
Add following function:
[code:1]function deleteMessageOutbox($myself, $messageid, $returntask, $returnlimit, $returnlimitstart, $item_id, $ret) {
## Delete sets outbox trash flag to true (it does not erase the message from the database,
## this is only done by PRUNING the messages. So messages deleted from the inbox will
## be moved to the trash can of the respective user
global $database, $my, $config_allowarchive;
$deletetime=uddetime();
$sql="UPDATE #__uddeim SET totrashoutbox=1 WHERE fromid=".$my->id." AND id=".$messageid;
$database->setQuery($sql);
if (!$database->query()) {
die("SQL error when attempting to trash a message" . $database->stderr(true));
}
if($ret=='archive' && $config_allowarchive) {
$redirecturl="index.php?option=com_uddeim&task=archive&Itemid=".$item_id."&limit=".$returnlimit."&limitstart=".$returnlimitstart;
mosRedirect($redirecturl);
} elseif($ret=='top') {
$redirecturl="index.php?option=com_uddeim&task=inbox&Itemid=".$item_id;
mosRedirect($redirecturl);
} else {
$redirecturl="index.php?option=com_uddeim&task=inbox&Itemid=".$item_id."&limit=".$returnlimit."&limitstart=".$returnlimitstart;
mosRedirect($redirecturl);
}
}
[/code:1]
There is still a small problem:
When the receiver deletes the message and it is purged after e.g. 48hours it is also purged from the senders outbox.
To fix this the purge-function has to check both flags for deleting a message and the showtrash-function must be modified only to display items which purge time is not exceeded. Since these modifications need some more lines of code I keep this for the author. I have tried to reach him but his email address seems to be outdated.
Post edited by: slabbi, at: 2006/08/27 15:37