"msg" => array("type" => "mediumtext", "not null" => "1"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+ "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
$hostname = $a->get_hostname();
if(strpos($hostname,':'))
$hostname = substr($hostname,0,strpos($hostname,':'));
-
+
$sender_email = $a->config['sender_email'];
if (empty($sender_email)) {
$sender_email = t('noreply') . '@' . $hostname;
// e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>');
+ if (isset($params['item']['id']))
+ $item_id = $params['item']['id'];
+ else
+ $item_id = 0;
+
+ if (isset($params['parent']))
+ $parent_id = $params['parent'];
+ else
+ $parent_id = 0;
+
if($params['type'] == NOTIFY_MAIL) {
$subject = sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename);
if($params['type'] == NOTIFY_COMMENT) {
// logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
- $parent_id = $params['parent'];
+ //$parent_id = $params['parent'];
$p = q("SELECT `ignored` FROM `thread` WHERE `iid` = %d AND `uid` = %d LIMIT 1",
intval($parent_id),
$datarray['date'] = datetime_convert();
$datarray['uid'] = $params['uid'];
$datarray['link'] = $itemlink;
+ $datarray['iid'] = $item_id;
$datarray['parent'] = $parent_id;
$datarray['type'] = $params['type'];
$datarray['verb'] = $params['verb'];
// create notification entry in DB
- $r = q("insert into notify (hash,name,url,photo,date,uid,link,parent,type,verb,otype)
- values('%s','%s','%s','%s','%s',%d,'%s',%d,%d,'%s','%s')",
+ $r = q("insert into notify (hash,name,url,photo,date,uid,link,iid,parent,type,verb,otype)
+ values('%s','%s','%s','%s','%s',%d,'%s',%d,%d,%d,'%s','%s')",
dbesc($datarray['hash']),
dbesc($datarray['name']),
dbesc($datarray['url']),
dbesc($datarray['date']),
intval($datarray['uid']),
dbesc($datarray['link']),
+ intval($datarray['iid']),
intval($datarray['parent']),
intval($datarray['type']),
dbesc($datarray['verb']),
$firehose = intval(get_pconfig(local_user(),'system','notify_full'));
- $t = q("select count(*) as total from notify where uid = %d and seen = 0",
+ $t = q("select count(*) as `total` from `notify` where `uid` = %d and `seen` = 0 AND `msg` != '' GROUP BY `parent`",
intval(local_user())
);
if($t && intval($t[0]['total']) > 49) {
- $z = q("select * from notify where uid = %d
- and seen = 0 order by date desc limit 0, 50",
+ $z = q("select * from notify where uid = %d AND `msg` != ''
+ and seen = 0 GROUP BY `parent` order by date desc limit 0, 50",
intval(local_user())
);
$sysnotify = $t[0]['total'];
}
else {
- $z1 = q("select * from notify where uid = %d
- and seen = 0 order by date desc limit 0, 50",
+ $z1 = q("select * from notify where uid = %d AND `msg` != ''
+ and seen = 0 GROUP BY `parent` order by date desc limit 0, 50",
intval(local_user())
);
- $z2 = q("select * from notify where uid = %d
- and seen = 1 order by date desc limit 0, %d",
+ $z2 = q("select * from notify where uid = %d AND `msg` != ''
+ and seen = 1 GROUP BY `parent` order by date desc limit 0, %d",
intval(local_user()),
intval(50 - intval($t[0]['total']))
);