Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[en] Bug fix: when max_msg was set to 0 the first posted message in a…
… PV was lost. [1h30]

[fr] Bug fix : lorsque max_msg valait 0 le premier message posté dans un message privé était perdu. [1h30]


git-svn-id: https://phpfreechat.svn.sourceforge.net/svnroot/phpfreechat/trunk@839 2772adf2-ac07-0410-9d30-e29d8120292e
  • Loading branch information
kerphi committed Oct 22, 2006
1 parent bca7397 commit da8f9c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/commands/connect.class.php
Expand Up @@ -21,6 +21,7 @@ function run(&$xml_reponse, $p)
// i.e. be ready to re-get all last posted messages
if ($getoldmsg)
{
// reset the channel identifiers
require_once(dirname(__FILE__)."/join.class.php");
$channels = array();
if (count($u->channels) == 0)
Expand All @@ -40,6 +41,21 @@ function run(&$xml_reponse, $p)
$oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$chanid;
$_SESSION[$oldmsg_sid] = true;
}
// reset the private messages identifiers
if (count($u->privmsg) > 0)
{
foreach($u->privmsg as $recipientid2 => $pv)
{
$recipient2 = $pv['recipient'];
// reset the fromid flag
$from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$recipientid2;
$from_id = $ct->getLastId($recipient2)-$c->max_msg;
$_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id;
// reset the oldmsg flag
$oldmsg_sid = "pfc_oldmsg_".$c->getId()."_".$clientid."_".$recipientid2;
$_SESSION[$oldmsg_sid] = true;
}
}
}

// check if the user is alone on the server, and give it the admin status if yes
Expand Down
2 changes: 1 addition & 1 deletion src/commands/privmsg.class.php
Expand Up @@ -78,7 +78,7 @@ function run(&$xml_reponse, $p)
// reset the message id indicator
// i.e. be ready to re-get all last posted messages
$from_id_sid = "pfc_from_id_".$c->getId()."_".$clientid."_".$pvrecipientid;
$from_id = $container->getLastId($pvrecipient)-$c->max_msg;
$from_id = $container->getLastId($pvrecipient)-$c->max_msg-1;
$_SESSION[$from_id_sid] = ($from_id<0) ? 0 : $from_id;

// register the user (and his metadata) in this pv
Expand Down

0 comments on commit da8f9c2

Please sign in to comment.