Make UddelIM more like Facebook Message System

10 years 6 months ago #235634 by Josh Lewis
Replied by Josh Lewis on topic Make UddelIM more like Facebook Message System
Had to install it to see that it is indeed a plugin. ;) The fact that it doesn't come in the normal installation made it less obvious to me.

Please Log in to join the conversation.

10 years 1 month ago #242158 by morvy
Stephan please, how is handled "message read" when I open it ? I'm playing with postbox plugin to fit needs of my users and I wanted to mark all messages as read when user opens a conversation..

Please Log in to join the conversation.

10 years 1 month ago #242168 by slabbi
"Msg read" is set when a user has opened a message, though the recipient can reset it by clicking on the envelope.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in to join the conversation.

10 years 1 month ago #242169 by morvy
Yes I know how it works in default, I want to achieve, that when user opens "thread" all incoming messages from sender will become read

Please Log in to join the conversation.

10 years 1 month ago #242171 by slabbi
The thread should be marked "unread" when at least one unread message is in the thread.

The code in postbox plugin is quite complex:
$sql = "SELECT count(id) AS cnt, MIN(toread) AS toread, MAX(flagged) AS flagged, MAX(datum) AS datum, id, displayname FROM (
			(SELECT a.toid AS id, 1 AS toread, 0 AS flagged, a.datum AS datum, b.".($config->realnames ? "name" : "username")." AS displayname FROM #__uddeim AS a LEFT JOIN #__users AS b ON a.toid=b.id WHERE a.fromid=".(int)$myself." AND a.totrashoutbox=0 ) 
			UNION 
			(SELECT a.fromid AS id, toread, flagged, a.datum AS datum, b.".($config->realnames ? "name" : "username")." AS displayname FROM #__uddeim AS a LEFT JOIN #__users AS b ON a.fromid=b.id WHERE a.toid=".(int)$myself." AND a.totrash=0 AND a.archived=0 AND a.delayed=0 )
			) AS comb_table".$filter." GROUP BY id".$sort." LIMIT ".(int)$limitstart.", ".(int)$limit;

"MIN(toread) AS toread" is the magic part. It takes all "toread" flags "0=unread, 1=read" and calculates the minimum. When min=0 then there is at least one unread message.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in to join the conversation.

Moderators: beatnantslabbikrileon
Time to create page: 0.224 seconds

Facebook Twitter LinkedIn