Skip to Content Skip to Menu

Make UddelIM more like Facebook Message System

  • Josh Lewis
  • Josh Lewis
  • OFFLINE
  • Posts: 112
  • Thanks: 7
  • Karma: 0
  • Add-ons
11 years 4 weeks 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 or Create an account to join the conversation.

  • morvy
  • morvy
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 0
10 years 8 months 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 or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
10 years 8 months 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 or Create an account to join the conversation.

  • morvy
  • morvy
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 0
10 years 8 months 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 or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
10 years 8 months 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:
Code:
$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 or Create an account to join the conversation.

Moderators: beatnantslabbikrileon
Powered by Kunena Forum